| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
 | 2 |  * linux/arch/sh/kernel/io_ec3104.c | 
 | 3 |  *  EC3104 companion chip support | 
 | 4 |  * | 
 | 5 |  * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org> | 
 | 6 |  * | 
 | 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. | 
 | 12 |  * | 
 | 13 |  * If you have any further information about the EC3104, please tell me | 
 | 14 |  * (prumpf@tux.org). | 
 | 15 |  */ | 
 | 16 |  | 
 | 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> | 
 | 22 |  | 
 | 23 | /* | 
 | 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. | 
 | 29 |  */ | 
 | 30 |  | 
 | 31 | #define low_port(port) ((port) < 0x10000) | 
 | 32 |  | 
 | 33 | static inline unsigned long port2addr(unsigned long port) | 
 | 34 | { | 
 | 35 | 	switch(port >> 16) { | 
 | 36 | 	case 0: | 
 | 37 | 		return EC3104_ISA_BASE + port * 2; | 
 | 38 |  | 
 | 39 | 		/* XXX hack. it's unclear what to do about the serial ports */ | 
 | 40 | 	case 1: | 
 | 41 | 		return EC3104_BASE + (port&0xffff) * 4; | 
 | 42 |  | 
 | 43 | 	default: | 
 | 44 | 		/* XXX PCMCIA */ | 
 | 45 | 		return 0; | 
 | 46 | 	} | 
 | 47 | } | 
 | 48 |  | 
 | 49 | unsigned char ec3104_inb(unsigned long port) | 
 | 50 | { | 
 | 51 | 	u8 ret; | 
 | 52 |  | 
 | 53 | 	ret = *(volatile u8 *)port2addr(port); | 
 | 54 |  | 
 | 55 | 	return ret; | 
 | 56 | } | 
 | 57 |  | 
 | 58 | unsigned short ec3104_inw(unsigned long port) | 
 | 59 | { | 
 | 60 | 	BUG(); | 
 | 61 | } | 
 | 62 |  | 
 | 63 | unsigned long ec3104_inl(unsigned long port) | 
 | 64 | { | 
 | 65 | 	BUG(); | 
 | 66 | } | 
 | 67 |  | 
 | 68 | void ec3104_outb(unsigned char data, unsigned long port) | 
 | 69 | { | 
 | 70 | 	*(volatile u8 *)port2addr(port) = data; | 
 | 71 | } | 
 | 72 |  | 
 | 73 | void ec3104_outw(unsigned short data, unsigned long port) | 
 | 74 | { | 
 | 75 | 	BUG(); | 
 | 76 | } | 
 | 77 |  | 
 | 78 | void ec3104_outl(unsigned long data, unsigned long port) | 
 | 79 | { | 
 | 80 | 	BUG(); | 
 | 81 | } |