Linux-2.6.12-rc2
[linux-2.6/next.git] / arch / sh / boards / ec3104 / io.c
bloba70928c44753c8cb9d1df1cf50847b2e94adf5d3
1 /*
2 * linux/arch/sh/kernel/io_ec3104.c
3 * EC3104 companion chip support
5 * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
7 */
8 /* EC3104 note:
9 * This code was written without any documentation about the EC3104 chip. While
10 * I hope I got most of the basic functionality right, the register names I use
11 * are most likely completely different from those in the chip documentation.
13 * If you have any further information about the EC3104, please tell me
14 * (prumpf@tux.org).
17 #include <linux/kernel.h>
18 #include <linux/types.h>
19 #include <asm/io.h>
20 #include <asm/page.h>
21 #include <asm/ec3104/ec3104.h>
24 * EC3104 has a real ISA bus which we redirect low port accesses to (the
25 * actual device on mine is a ESS 1868, and I don't want to hack the driver
26 * more than strictly necessary). I am not going to duplicate the
27 * hard coding of PC addresses (for the 16550s aso) here though; it's just
28 * too ugly.
31 #define low_port(port) ((port) < 0x10000)
33 static inline unsigned long port2addr(unsigned long port)
35 switch(port >> 16) {
36 case 0:
37 return EC3104_ISA_BASE + port * 2;
39 /* XXX hack. it's unclear what to do about the serial ports */
40 case 1:
41 return EC3104_BASE + (port&0xffff) * 4;
43 default:
44 /* XXX PCMCIA */
45 return 0;
49 unsigned char ec3104_inb(unsigned long port)
51 u8 ret;
53 ret = *(volatile u8 *)port2addr(port);
55 return ret;
58 unsigned short ec3104_inw(unsigned long port)
60 BUG();
63 unsigned long ec3104_inl(unsigned long port)
65 BUG();
68 void ec3104_outb(unsigned char data, unsigned long port)
70 *(volatile u8 *)port2addr(port) = data;
73 void ec3104_outw(unsigned short data, unsigned long port)
75 BUG();
78 void ec3104_outl(unsigned long data, unsigned long port)
80 BUG();