patch-2.4.0-test6 linux/arch/sh/kernel/io_hd64461.c

Next file: linux/arch/sh/kernel/io_se.c
Previous file: linux/arch/sh/kernel/io_generic.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test5/linux/arch/sh/kernel/io_hd64461.c linux/arch/sh/kernel/io_hd64461.c
@@ -10,15 +10,36 @@
 
 static __inline__ unsigned long PORT2ADDR(unsigned long port)
 {
+	/* 16550A: HD64461 internal */
+	if (0x3f8<=port && port<=0x3ff)
+		return CONFIG_HD64461_IOBASE + 0x8000 + ((port-0x3f8)<<1);
+	if (0x2f8<=port && port<=0x2ff)
+		return CONFIG_HD64461_IOBASE + 0x7000 + ((port-0x2f8)<<1);
+
+#ifdef CONFIG_HD64461_ENABLER
+	/* NE2000: HD64461 PCMCIA channel 0 (I/O) */
+	if (0x300<=port && port<=0x31f)
+		return 0xba000000 + port;
+
+	/* ide0: HD64461 PCMCIA channel 1 (memory) */
+	/* On HP690, CF in slot 1 is configured as a memory card
+	   device.  See CF+ and CompactFlash Specification for the
+	   detail of CF's memory mapped addressing. */
+	if (0x1f0<=port && port<=0x1f7)	return 0xb5000000 + port;
+	if (port == 0x3f6) return 0xb50001fe;
+#endif
+
+	/* ??? */
+	if (port < 0x10000) return 0xa0000000 + port;
+
 	/* HD64461 internal devices (0xb0000000) */
-	if (port < 0x10000) return CONFIG_HD64461_IOBASE + port;
+	if (port < 0x20000) return CONFIG_HD64461_IOBASE + port - 0x10000;
 
 	/* PCMCIA channel 0, I/O (0xba000000) */
-	if (port < 0x20000) return 0xba000000 + port - 0x10000;
+	if (port < 0x30000) return 0xba000000 + port - 0x20000;
 
-	/* PCMCIA channel 1, memory (0xb5000000)
-	   SH7709 cannot support I/O card attached to Area 5 */
-	if (port < 0x30000) return 0xb5000000 + port - 0x20000;
+	/* PCMCIA channel 1, memory (0xb5000000) */
+	if (port < 0x40000) return 0xb5000000 + port - 0x30000;
 
 	/* Whole physical address space (0xa0000000) */
 	return 0xa0000000 + (port & 0x1fffffff);
@@ -29,80 +50,80 @@
 	ctrl_inw(0xa0000000);
 }
 
-unsigned long inb(unsigned int port)
+unsigned long hd64461_inb(unsigned int port)
 {
 	return *(volatile unsigned char*)PORT2ADDR(port);
 }
 
-unsigned long inb_p(unsigned int port)
+unsigned long hd64461_inb_p(unsigned int port)
 {
 	unsigned long v = *(volatile unsigned char*)PORT2ADDR(port);
 	delay();
 	return v;
 }
 
-unsigned long inw(unsigned int port)
+unsigned long hd64461_inw(unsigned int port)
 {
 	return *(volatile unsigned short*)PORT2ADDR(port);
 }
 
-unsigned long inl(unsigned int port)
+unsigned long hd64461_inl(unsigned int port)
 {
 	return *(volatile unsigned long*)PORT2ADDR(port);
 }
 
-void insb(unsigned int port, void *buffer, unsigned long count)
+void hd64461_insb(unsigned int port, void *buffer, unsigned long count)
 {
 	unsigned char *buf=buffer;
 	while(count--) *buf++=inb(port);
 }
 
-void insw(unsigned int port, void *buffer, unsigned long count)
+void hd64461_insw(unsigned int port, void *buffer, unsigned long count)
 {
 	unsigned short *buf=buffer;
 	while(count--) *buf++=inw(port);
 }
 
-void insl(unsigned int port, void *buffer, unsigned long count)
+void hd64461_insl(unsigned int port, void *buffer, unsigned long count)
 {
 	unsigned long *buf=buffer;
 	while(count--) *buf++=inl(port);
 }
 
-void outb(unsigned long b, unsigned int port)
+void hd64461_outb(unsigned long b, unsigned int port)
 {
 	*(volatile unsigned char*)PORT2ADDR(port) = b;
 }
 
-void outb_p(unsigned long b, unsigned int port)
+void hd64461_outb_p(unsigned long b, unsigned int port)
 {
 	*(volatile unsigned char*)PORT2ADDR(port) = b;
 	delay();
 }
 
-void outw(unsigned long b, unsigned int port)
+void hd64461_outw(unsigned long b, unsigned int port)
 {
 	*(volatile unsigned short*)PORT2ADDR(port) = b;
 }
 
-void outl(unsigned long b, unsigned int port)
+void hd64461_outl(unsigned long b, unsigned int port)
 {
         *(volatile unsigned long*)PORT2ADDR(port) = b;
 }
 
-void outsb(unsigned int port, const void *buffer, unsigned long count)
+void hd64461_outsb(unsigned int port, const void *buffer, unsigned long count)
 {
 	const unsigned char *buf=buffer;
 	while(count--) outb(*buf++, port);
 }
 
-void outsw(unsigned int port, const void *buffer, unsigned long count)
+void hd64461_outsw(unsigned int port, const void *buffer, unsigned long count)
 {
 	const unsigned short *buf=buffer;
 	while(count--) outw(*buf++, port);
 }
 
-void outsl(unsigned int port, const void *buffer, unsigned long count)
+void hd64461_outsl(unsigned int port, const void *buffer, unsigned long count)
 {
 	const unsigned long *buf=buffer;
 	while(count--) outl(*buf++, port);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)