Commit ad09d583106fadfdf751926107cfe35fba6bdbd4
Committed by
Linus Torvalds
1 parent
0332db5aff
Exists in
master
and in
7 other branches
[PATCH] m32r: M3A-2170(Mappi-III) IDE support
This patch is for supporting IDE interface for M3A-2170(Mappi-III) board. Signed-off-by: Mamoru Sakugawa <sakugawa@linux-m32r.org> Signed-off-by: Hirokazu Takata <takata@linux-m32r.org> Cc: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 5 changed files with 59 additions and 33 deletions Side-by-side Diff
arch/m32r/kernel/io_mappi3.c
... | ... | @@ -36,12 +36,13 @@ |
36 | 36 | return (void *)(port + NONCACHE_OFFSET); |
37 | 37 | } |
38 | 38 | |
39 | -#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | |
39 | +#if defined(CONFIG_IDE) | |
40 | 40 | static inline void *__port2addr_ata(unsigned long port) |
41 | 41 | { |
42 | 42 | static int dummy_reg; |
43 | 43 | |
44 | 44 | switch (port) { |
45 | + /* IDE0 CF */ | |
45 | 46 | case 0x1f0: return (void *)0xb4002000; |
46 | 47 | case 0x1f1: return (void *)0xb4012800; |
47 | 48 | case 0x1f2: return (void *)0xb4012002; |
... | ... | @@ -51,6 +52,17 @@ |
51 | 52 | case 0x1f6: return (void *)0xb4012006; |
52 | 53 | case 0x1f7: return (void *)0xb4012806; |
53 | 54 | case 0x3f6: return (void *)0xb401200e; |
55 | + /* IDE1 IDE */ | |
56 | + case 0x170: return (void *)0xb4810000; /* Data 16bit */ | |
57 | + case 0x171: return (void *)0xb4810002; /* Features / Error */ | |
58 | + case 0x172: return (void *)0xb4810004; /* Sector count */ | |
59 | + case 0x173: return (void *)0xb4810006; /* Sector number */ | |
60 | + case 0x174: return (void *)0xb4810008; /* Cylinder low */ | |
61 | + case 0x175: return (void *)0xb481000a; /* Cylinder high */ | |
62 | + case 0x176: return (void *)0xb481000c; /* Device head */ | |
63 | + case 0x177: return (void *)0xb481000e; /* Command */ | |
64 | + case 0x376: return (void *)0xb480800c; /* Device control / Alt status */ | |
65 | + | |
54 | 66 | default: return (void *)&dummy_reg; |
55 | 67 | } |
56 | 68 | } |
... | ... | @@ -108,8 +120,9 @@ |
108 | 120 | { |
109 | 121 | if (port >= LAN_IOSTART && port < LAN_IOEND) |
110 | 122 | return _ne_inb(PORT2ADDR_NE(port)); |
111 | -#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | |
112 | - else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | |
123 | +#if defined(CONFIG_IDE) | |
124 | + else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) || | |
125 | + ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){ | |
113 | 126 | return *(volatile unsigned char *)__port2addr_ata(port); |
114 | 127 | } |
115 | 128 | #endif |
... | ... | @@ -127,8 +140,9 @@ |
127 | 140 | { |
128 | 141 | if (port >= LAN_IOSTART && port < LAN_IOEND) |
129 | 142 | return _ne_inw(PORT2ADDR_NE(port)); |
130 | -#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | |
131 | - else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | |
143 | +#if defined(CONFIG_IDE) | |
144 | + else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) || | |
145 | + ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){ | |
132 | 146 | return *(volatile unsigned short *)__port2addr_ata(port); |
133 | 147 | } |
134 | 148 | #endif |
... | ... | @@ -185,8 +199,9 @@ |
185 | 199 | if (port >= LAN_IOSTART && port < LAN_IOEND) |
186 | 200 | _ne_outb(b, PORT2ADDR_NE(port)); |
187 | 201 | else |
188 | -#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | |
189 | - if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | |
202 | +#if defined(CONFIG_IDE) | |
203 | + if ( ((port >= 0x170 && port <=0x177) || port == 0x376) || | |
204 | + ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){ | |
190 | 205 | *(volatile unsigned char *)__port2addr_ata(port) = b; |
191 | 206 | } else |
192 | 207 | #endif |
... | ... | @@ -203,8 +218,9 @@ |
203 | 218 | if (port >= LAN_IOSTART && port < LAN_IOEND) |
204 | 219 | _ne_outw(w, PORT2ADDR_NE(port)); |
205 | 220 | else |
206 | -#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | |
207 | - if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | |
221 | +#if defined(CONFIG_IDE) | |
222 | + if ( ((port >= 0x170 && port <=0x177) || port == 0x376) || | |
223 | + ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){ | |
208 | 224 | *(volatile unsigned short *)__port2addr_ata(port) = w; |
209 | 225 | } else |
210 | 226 | #endif |
... | ... | @@ -253,8 +269,9 @@ |
253 | 269 | { |
254 | 270 | if (port >= LAN_IOSTART && port < LAN_IOEND) |
255 | 271 | _ne_insb(PORT2ADDR_NE(port), addr, count); |
256 | -#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | |
257 | - else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | |
272 | +#if defined(CONFIG_IDE) | |
273 | + else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) || | |
274 | + ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){ | |
258 | 275 | unsigned char *buf = addr; |
259 | 276 | unsigned char *portp = __port2addr_ata(port); |
260 | 277 | while (count--) |
... | ... | @@ -289,8 +306,9 @@ |
289 | 306 | pcc_ioread_word(9, port, (void *)addr, sizeof(unsigned short), |
290 | 307 | count, 1); |
291 | 308 | #endif |
292 | -#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | |
293 | - } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | |
309 | +#if defined(CONFIG_IDE) | |
310 | + } else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) || | |
311 | + ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){ | |
294 | 312 | portp = __port2addr_ata(port); |
295 | 313 | while (count--) |
296 | 314 | *buf++ = *(volatile unsigned short *)portp; |
... | ... | @@ -321,8 +339,9 @@ |
321 | 339 | portp = PORT2ADDR_NE(port); |
322 | 340 | while (count--) |
323 | 341 | _ne_outb(*buf++, portp); |
324 | -#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | |
325 | - } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | |
342 | +#if defined(CONFIG_IDE) | |
343 | + } else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) || | |
344 | + ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){ | |
326 | 345 | portp = __port2addr_ata(port); |
327 | 346 | while (count--) |
328 | 347 | *(volatile unsigned char *)portp = *buf++; |
... | ... | @@ -348,8 +367,9 @@ |
348 | 367 | portp = PORT2ADDR_NE(port); |
349 | 368 | while (count--) |
350 | 369 | *(volatile unsigned short *)portp = *buf++; |
351 | -#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | |
352 | - } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | |
370 | +#if defined(CONFIG_IDE) | |
371 | + } else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) || | |
372 | + ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){ | |
353 | 373 | portp = __port2addr_ata(port); |
354 | 374 | while (count--) |
355 | 375 | *(volatile unsigned short *)portp = *buf++; |
arch/m32r/kernel/setup_mappi3.c
... | ... | @@ -151,7 +151,7 @@ |
151 | 151 | disable_mappi3_irq(M32R_IRQ_INT1); |
152 | 152 | #endif /* CONFIG_USB */ |
153 | 153 | |
154 | - /* ICUCR40: CFC IREQ */ | |
154 | + /* CFC IREQ */ | |
155 | 155 | irq_desc[PLD_IRQ_CFIREQ].status = IRQ_DISABLED; |
156 | 156 | irq_desc[PLD_IRQ_CFIREQ].handler = &mappi3_irq_type; |
157 | 157 | irq_desc[PLD_IRQ_CFIREQ].action = 0; |
... | ... | @@ -160,7 +160,7 @@ |
160 | 160 | disable_mappi3_irq(PLD_IRQ_CFIREQ); |
161 | 161 | |
162 | 162 | #if defined(CONFIG_M32R_CFC) |
163 | - /* ICUCR41: CFC Insert */ | |
163 | + /* ICUCR41: CFC Insert & eject */ | |
164 | 164 | irq_desc[PLD_IRQ_CFC_INSERT].status = IRQ_DISABLED; |
165 | 165 | irq_desc[PLD_IRQ_CFC_INSERT].handler = &mappi3_irq_type; |
166 | 166 | irq_desc[PLD_IRQ_CFC_INSERT].action = 0; |
167 | 167 | |
... | ... | @@ -168,14 +168,16 @@ |
168 | 168 | icu_data[PLD_IRQ_CFC_INSERT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00; |
169 | 169 | disable_mappi3_irq(PLD_IRQ_CFC_INSERT); |
170 | 170 | |
171 | - /* ICUCR42: CFC Eject */ | |
172 | - irq_desc[PLD_IRQ_CFC_EJECT].status = IRQ_DISABLED; | |
173 | - irq_desc[PLD_IRQ_CFC_EJECT].handler = &mappi3_irq_type; | |
174 | - irq_desc[PLD_IRQ_CFC_EJECT].action = 0; | |
175 | - irq_desc[PLD_IRQ_CFC_EJECT].depth = 1; /* disable nested irq */ | |
176 | - icu_data[PLD_IRQ_CFC_EJECT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; | |
177 | - disable_mappi3_irq(PLD_IRQ_CFC_EJECT); | |
178 | 171 | #endif /* CONFIG_M32R_CFC */ |
172 | + | |
173 | + /* IDE IREQ */ | |
174 | + irq_desc[PLD_IRQ_IDEIREQ].status = IRQ_DISABLED; | |
175 | + irq_desc[PLD_IRQ_IDEIREQ].handler = &mappi3_irq_type; | |
176 | + irq_desc[PLD_IRQ_IDEIREQ].action = 0; | |
177 | + irq_desc[PLD_IRQ_IDEIREQ].depth = 1; /* disable nested irq */ | |
178 | + icu_data[PLD_IRQ_IDEIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; | |
179 | + disable_mappi3_irq(PLD_IRQ_IDEIREQ); | |
180 | + | |
179 | 181 | } |
180 | 182 | |
181 | 183 | #if defined(CONFIG_SMC91X) |
drivers/pcmcia/m32r_cfc.c
... | ... | @@ -355,9 +355,10 @@ |
355 | 355 | #ifndef CONFIG_PLAT_USRV |
356 | 356 | /* insert interrupt */ |
357 | 357 | request_irq(irq, pcc_interrupt, 0, "m32r_cfc", pcc_interrupt); |
358 | +#ifndef CONFIG_PLAT_MAPPI3 | |
358 | 359 | /* eject interrupt */ |
359 | 360 | request_irq(irq+1, pcc_interrupt, 0, "m32r_cfc", pcc_interrupt); |
360 | - | |
361 | +#endif | |
361 | 362 | debug(3, "m32r_cfc: enable CFMSK, RDYSEL\n"); |
362 | 363 | pcc_set(pcc_sockets, (unsigned int)PLD_CFIMASK, 0x01); |
363 | 364 | #endif /* CONFIG_PLAT_USRV */ |
include/asm-m32r/ide.h
... | ... | @@ -25,18 +25,21 @@ |
25 | 25 | # endif |
26 | 26 | #endif |
27 | 27 | |
28 | -#if defined(CONFIG_PLAT_M32700UT) | |
29 | -#include <asm/irq.h> | |
30 | -#include <asm/m32700ut/m32700ut_pld.h> | |
31 | -#endif | |
28 | +#include <asm/m32r.h> | |
32 | 29 | |
30 | + | |
33 | 31 | #define IDE_ARCH_OBSOLETE_DEFAULTS |
34 | 32 | |
35 | 33 | static __inline__ int ide_default_irq(unsigned long base) |
36 | 34 | { |
37 | 35 | switch (base) { |
38 | -#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_MAPPI2) || defined(CONFIG_PLAT_MAPPI3) | |
36 | +#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_MAPPI2) | |
39 | 37 | case 0x1f0: return PLD_IRQ_CFIREQ; |
38 | + default: | |
39 | + return 0; | |
40 | +#elif defined(CONFIG_PLAT_MAPPI3) | |
41 | + case 0x1f0: return PLD_IRQ_CFIREQ; | |
42 | + case 0x170: return PLD_IRQ_IDEIREQ; | |
40 | 43 | default: |
41 | 44 | return 0; |
42 | 45 | #else |
include/asm-m32r/mappi3/mappi3_pld.h
... | ... | @@ -59,7 +59,7 @@ |
59 | 59 | #define M32R_IRQ_I2C (28) /* I2C-BUS */ |
60 | 60 | #define PLD_IRQ_CFIREQ (6) /* INT5 CFC Card Interrupt */ |
61 | 61 | #define PLD_IRQ_CFC_INSERT (7) /* INT6 CFC Card Insert */ |
62 | -#define PLD_IRQ_CFC_EJECT (8) /* INT7 CFC Card Eject */ | |
62 | +#define PLD_IRQ_IDEIREQ (8) /* INT7 IDE Interrupt */ | |
63 | 63 | #define PLD_IRQ_MMCCARD (43) /* MMC Card Insert */ |
64 | 64 | #define PLD_IRQ_MMCIRQ (44) /* MMC Transfer Done */ |
65 | 65 |