aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/se/7206/io.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2007-09-12 23:59:32 -0400
committerPaul Mundt <lethal@linux-sh.org>2007-09-20 22:57:54 -0400
commitdfcb76089ada89a5520ad8544440799e75f01227 (patch)
treed9d12536cd6bef6ebda9eb2717f4c7a0a43a4b73 /arch/sh/boards/se/7206/io.c
parentded5431ff311d963888ac951131a04fe7633aa79 (diff)
sh: se7206: Make the I/O port routines less stupid.
The port routines were logically inverted, and the MRSHPC range had no upper bound, causing 8 and 16-bit port I/O to get mangled. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards/se/7206/io.c')
-rw-r--r--arch/sh/boards/se/7206/io.c29
1 files changed, 4 insertions, 25 deletions
diff --git a/arch/sh/boards/se/7206/io.c b/arch/sh/boards/se/7206/io.c
index b557273e0cbe..eb30dc2df96f 100644
--- a/arch/sh/boards/se/7206/io.c
+++ b/arch/sh/boards/se/7206/io.c
@@ -26,22 +26,22 @@ static inline void delay(void)
26static inline volatile __u16 * 26static inline volatile __u16 *
27port2adr(unsigned int port) 27port2adr(unsigned int port)
28{ 28{
29 if (port >= 0x2000) 29 if (port >= 0x2000 && port < 0x2020)
30 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000)); 30 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
31 else if (port >= 0x300 || port < 0x310) 31 else if (port >= 0x300 && port < 0x310)
32 return (volatile __u16 *) (PA_SMSC + (port - 0x300)); 32 return (volatile __u16 *) (PA_SMSC + (port - 0x300));
33} 33}
34 34
35unsigned char se7206_inb(unsigned long port) 35unsigned char se7206_inb(unsigned long port)
36{ 36{
37 return (*port2adr(port))&0xff; 37 return (*port2adr(port)) & 0xff;
38} 38}
39 39
40unsigned char se7206_inb_p(unsigned long port) 40unsigned char se7206_inb_p(unsigned long port)
41{ 41{
42 unsigned long v; 42 unsigned long v;
43 43
44 v = (*port2adr(port))&0xff; 44 v = (*port2adr(port)) & 0xff;
45 delay(); 45 delay();
46 return v; 46 return v;
47} 47}
@@ -51,12 +51,6 @@ unsigned short se7206_inw(unsigned long port)
51 return *port2adr(port);; 51 return *port2adr(port);;
52} 52}
53 53
54unsigned int se7206_inl(unsigned long port)
55{
56 maybebadio(port);
57 return 0;
58}
59
60void se7206_outb(unsigned char value, unsigned long port) 54void se7206_outb(unsigned char value, unsigned long port)
61{ 55{
62 *(port2adr(port)) = value; 56 *(port2adr(port)) = value;
@@ -73,11 +67,6 @@ void se7206_outw(unsigned short value, unsigned long port)
73 *port2adr(port) = value; 67 *port2adr(port) = value;
74} 68}
75 69
76void se7206_outl(unsigned int value, unsigned long port)
77{
78 maybebadio(port);
79}
80
81void se7206_insb(unsigned long port, void *addr, unsigned long count) 70void se7206_insb(unsigned long port, void *addr, unsigned long count)
82{ 71{
83 volatile __u16 *p = port2adr(port); 72 volatile __u16 *p = port2adr(port);
@@ -95,11 +84,6 @@ void se7206_insw(unsigned long port, void *addr, unsigned long count)
95 *ap++ = *p; 84 *ap++ = *p;
96} 85}
97 86
98void se7206_insl(unsigned long port, void *addr, unsigned long count)
99{
100 maybebadio(port);
101}
102
103void se7206_outsb(unsigned long port, const void *addr, unsigned long count) 87void se7206_outsb(unsigned long port, const void *addr, unsigned long count)
104{ 88{
105 volatile __u16 *p = port2adr(port); 89 volatile __u16 *p = port2adr(port);
@@ -116,8 +100,3 @@ void se7206_outsw(unsigned long port, const void *addr, unsigned long count)
116 while (count--) 100 while (count--)
117 *p = *ap++; 101 *p = *ap++;
118} 102}
119
120void se7206_outsl(unsigned long port, const void *addr, unsigned long count)
121{
122 maybebadio(port);
123}