diff options
Diffstat (limited to 'arch/m32r/kernel/io_opsput.c')
-rw-r--r-- | arch/m32r/kernel/io_opsput.c | 71 |
1 files changed, 69 insertions, 2 deletions
diff --git a/arch/m32r/kernel/io_opsput.c b/arch/m32r/kernel/io_opsput.c index da6c5f5c1f82..3cbb1f717e50 100644 --- a/arch/m32r/kernel/io_opsput.c +++ b/arch/m32r/kernel/io_opsput.c | |||
@@ -30,14 +30,34 @@ extern void pcc_iowrite_byte(int, unsigned long, void *, size_t, size_t, int); | |||
30 | extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int); | 30 | extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int); |
31 | #endif /* CONFIG_PCMCIA && CONFIG_M32R_CFC */ | 31 | #endif /* CONFIG_PCMCIA && CONFIG_M32R_CFC */ |
32 | 32 | ||
33 | #define PORT2ADDR(port) _port2addr(port) | 33 | #define PORT2ADDR(port) _port2addr(port) |
34 | #define PORT2ADDR_USB(port) _port2addr_usb(port) | 34 | #define PORT2ADDR_USB(port) _port2addr_usb(port) |
35 | 35 | ||
36 | static inline void *_port2addr(unsigned long port) | 36 | static inline void *_port2addr(unsigned long port) |
37 | { | 37 | { |
38 | return (void *)(port | NONCACHE_OFFSET); | 38 | return (void *)(port | NONCACHE_OFFSET); |
39 | } | 39 | } |
40 | 40 | ||
41 | #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | ||
42 | static inline void *__port2addr_ata(unsigned long port) | ||
43 | { | ||
44 | static int dummy_reg; | ||
45 | |||
46 | switch (port) { | ||
47 | case 0x1f0: return (void *)(0x0c002000 | NONCACHE_OFFSET); | ||
48 | case 0x1f1: return (void *)(0x0c012800 | NONCACHE_OFFSET); | ||
49 | case 0x1f2: return (void *)(0x0c012002 | NONCACHE_OFFSET); | ||
50 | case 0x1f3: return (void *)(0x0c012802 | NONCACHE_OFFSET); | ||
51 | case 0x1f4: return (void *)(0x0c012004 | NONCACHE_OFFSET); | ||
52 | case 0x1f5: return (void *)(0x0c012804 | NONCACHE_OFFSET); | ||
53 | case 0x1f6: return (void *)(0x0c012006 | NONCACHE_OFFSET); | ||
54 | case 0x1f7: return (void *)(0x0c012806 | NONCACHE_OFFSET); | ||
55 | case 0x3f6: return (void *)(0x0c01200e | NONCACHE_OFFSET); | ||
56 | default: return (void *)&dummy_reg; | ||
57 | } | ||
58 | } | ||
59 | #endif | ||
60 | |||
41 | /* | 61 | /* |
42 | * OPSPUT-LAN is located in the extended bus space | 62 | * OPSPUT-LAN is located in the extended bus space |
43 | * from 0x10000000 to 0x13ffffff on physical address. | 63 | * from 0x10000000 to 0x13ffffff on physical address. |
@@ -97,6 +117,12 @@ unsigned char _inb(unsigned long port) | |||
97 | { | 117 | { |
98 | if (port >= LAN_IOSTART && port < LAN_IOEND) | 118 | if (port >= LAN_IOSTART && port < LAN_IOEND) |
99 | return _ne_inb(PORT2ADDR_NE(port)); | 119 | return _ne_inb(PORT2ADDR_NE(port)); |
120 | |||
121 | #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | ||
122 | else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | ||
123 | return *(volatile unsigned char *)__port2addr_ata(port); | ||
124 | } | ||
125 | #endif | ||
100 | #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) | 126 | #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) |
101 | else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { | 127 | else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { |
102 | unsigned char b; | 128 | unsigned char b; |
@@ -112,6 +138,11 @@ unsigned short _inw(unsigned long port) | |||
112 | { | 138 | { |
113 | if (port >= LAN_IOSTART && port < LAN_IOEND) | 139 | if (port >= LAN_IOSTART && port < LAN_IOEND) |
114 | return _ne_inw(PORT2ADDR_NE(port)); | 140 | return _ne_inw(PORT2ADDR_NE(port)); |
141 | #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | ||
142 | else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | ||
143 | return *(volatile unsigned short *)__port2addr_ata(port); | ||
144 | } | ||
145 | #endif | ||
115 | #if defined(CONFIG_USB) | 146 | #if defined(CONFIG_USB) |
116 | else if(port >= 0x340 && port < 0x3a0) | 147 | else if(port >= 0x340 && port < 0x3a0) |
117 | return *(volatile unsigned short *)PORT2ADDR_USB(port); | 148 | return *(volatile unsigned short *)PORT2ADDR_USB(port); |
@@ -164,6 +195,11 @@ void _outb(unsigned char b, unsigned long port) | |||
164 | if (port >= LAN_IOSTART && port < LAN_IOEND) | 195 | if (port >= LAN_IOSTART && port < LAN_IOEND) |
165 | _ne_outb(b, PORT2ADDR_NE(port)); | 196 | _ne_outb(b, PORT2ADDR_NE(port)); |
166 | else | 197 | else |
198 | #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | ||
199 | if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | ||
200 | *(volatile unsigned char *)__port2addr_ata(port) = b; | ||
201 | } else | ||
202 | #endif | ||
167 | #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) | 203 | #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) |
168 | if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { | 204 | if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { |
169 | pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0); | 205 | pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0); |
@@ -177,6 +213,11 @@ void _outw(unsigned short w, unsigned long port) | |||
177 | if (port >= LAN_IOSTART && port < LAN_IOEND) | 213 | if (port >= LAN_IOSTART && port < LAN_IOEND) |
178 | _ne_outw(w, PORT2ADDR_NE(port)); | 214 | _ne_outw(w, PORT2ADDR_NE(port)); |
179 | else | 215 | else |
216 | #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | ||
217 | if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | ||
218 | *(volatile unsigned short *)__port2addr_ata(port) = w; | ||
219 | } else | ||
220 | #endif | ||
180 | #if defined(CONFIG_USB) | 221 | #if defined(CONFIG_USB) |
181 | if(port >= 0x340 && port < 0x3a0) | 222 | if(port >= 0x340 && port < 0x3a0) |
182 | *(volatile unsigned short *)PORT2ADDR_USB(port) = w; | 223 | *(volatile unsigned short *)PORT2ADDR_USB(port) = w; |
@@ -222,6 +263,14 @@ void _insb(unsigned int port, void *addr, unsigned long count) | |||
222 | { | 263 | { |
223 | if (port >= LAN_IOSTART && port < LAN_IOEND) | 264 | if (port >= LAN_IOSTART && port < LAN_IOEND) |
224 | _ne_insb(PORT2ADDR_NE(port), addr, count); | 265 | _ne_insb(PORT2ADDR_NE(port), addr, count); |
266 | #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | ||
267 | else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | ||
268 | unsigned char *buf = addr; | ||
269 | unsigned char *portp = __port2addr_ata(port); | ||
270 | while (count--) | ||
271 | *buf++ = *(volatile unsigned char *)portp; | ||
272 | } | ||
273 | #endif | ||
225 | #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) | 274 | #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) |
226 | else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { | 275 | else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { |
227 | pcc_ioread_byte(0, port, (void *)addr, sizeof(unsigned char), | 276 | pcc_ioread_byte(0, port, (void *)addr, sizeof(unsigned char), |
@@ -254,6 +303,12 @@ void _insw(unsigned int port, void *addr, unsigned long count) | |||
254 | pcc_ioread_word(9, port, (void *)addr, sizeof(unsigned short), | 303 | pcc_ioread_word(9, port, (void *)addr, sizeof(unsigned short), |
255 | count, 1); | 304 | count, 1); |
256 | #endif | 305 | #endif |
306 | #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | ||
307 | } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | ||
308 | portp = __port2addr_ata(port); | ||
309 | while (count--) | ||
310 | *buf++ = *(volatile unsigned short *)portp; | ||
311 | #endif | ||
257 | } else { | 312 | } else { |
258 | portp = PORT2ADDR(port); | 313 | portp = PORT2ADDR(port); |
259 | while (count--) | 314 | while (count--) |
@@ -280,6 +335,12 @@ void _outsb(unsigned int port, const void *addr, unsigned long count) | |||
280 | portp = PORT2ADDR_NE(port); | 335 | portp = PORT2ADDR_NE(port); |
281 | while (count--) | 336 | while (count--) |
282 | _ne_outb(*buf++, portp); | 337 | _ne_outb(*buf++, portp); |
338 | #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | ||
339 | } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | ||
340 | portp = __port2addr_ata(port); | ||
341 | while (count--) | ||
342 | *(volatile unsigned char *)portp = *buf++; | ||
343 | #endif | ||
283 | #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) | 344 | #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) |
284 | } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { | 345 | } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { |
285 | pcc_iowrite_byte(0, port, (void *)addr, sizeof(unsigned char), | 346 | pcc_iowrite_byte(0, port, (void *)addr, sizeof(unsigned char), |
@@ -305,6 +366,12 @@ void _outsw(unsigned int port, const void *addr, unsigned long count) | |||
305 | portp = PORT2ADDR_NE(port); | 366 | portp = PORT2ADDR_NE(port); |
306 | while (count--) | 367 | while (count--) |
307 | *(volatile unsigned short *)portp = *buf++; | 368 | *(volatile unsigned short *)portp = *buf++; |
369 | #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | ||
370 | } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | ||
371 | portp = __port2addr_ata(port); | ||
372 | while (count--) | ||
373 | *(volatile unsigned short *)portp = *buf++; | ||
374 | #endif | ||
308 | #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) | 375 | #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) |
309 | } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { | 376 | } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { |
310 | pcc_iowrite_word(9, port, (void *)addr, sizeof(unsigned short), | 377 | pcc_iowrite_word(9, port, (void *)addr, sizeof(unsigned short), |