[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>

authored by

Hirokazu Takata and committed by
Linus Torvalds
ad09d583 0332db5a

+59 -33
+37 -17
arch/m32r/kernel/io_mappi3.c
··· 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; ··· 52 51 case 0x1f6: return (void *)0xb4012006; 53 52 case 0x1f7: return (void *)0xb4012806; 54 53 case 0x3f6: return (void *)0xb401200e; 54 + /* IDE1 IDE */ 55 + case 0x170: return (void *)0xb4810000; /* Data 16bit */ 56 + case 0x171: return (void *)0xb4810002; /* Features / Error */ 57 + case 0x172: return (void *)0xb4810004; /* Sector count */ 58 + case 0x173: return (void *)0xb4810006; /* Sector number */ 59 + case 0x174: return (void *)0xb4810008; /* Cylinder low */ 60 + case 0x175: return (void *)0xb481000a; /* Cylinder high */ 61 + case 0x176: return (void *)0xb481000c; /* Device head */ 62 + case 0x177: return (void *)0xb481000e; /* Command */ 63 + case 0x376: return (void *)0xb480800c; /* Device control / Alt status */ 64 + 55 65 default: return (void *)&dummy_reg; 56 66 } 57 67 } ··· 120 108 { 121 109 if (port >= LAN_IOSTART && port < LAN_IOEND) 122 110 return _ne_inb(PORT2ADDR_NE(port)); 123 - #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 124 - else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 111 + #if defined(CONFIG_IDE) 112 + else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) || 113 + ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){ 125 114 return *(volatile unsigned char *)__port2addr_ata(port); 126 115 } 127 116 #endif ··· 140 127 { 141 128 if (port >= LAN_IOSTART && port < LAN_IOEND) 142 129 return _ne_inw(PORT2ADDR_NE(port)); 143 - #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 144 - else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 130 + #if defined(CONFIG_IDE) 131 + else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) || 132 + ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){ 145 133 return *(volatile unsigned short *)__port2addr_ata(port); 146 134 } 147 135 #endif ··· 199 185 if (port >= LAN_IOSTART && port < LAN_IOEND) 200 186 _ne_outb(b, PORT2ADDR_NE(port)); 201 187 else 202 - #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 203 - if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 188 + #if defined(CONFIG_IDE) 189 + if ( ((port >= 0x170 && port <=0x177) || port == 0x376) || 190 + ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){ 204 191 *(volatile unsigned char *)__port2addr_ata(port) = b; 205 192 } else 206 193 #endif ··· 218 203 if (port >= LAN_IOSTART && port < LAN_IOEND) 219 204 _ne_outw(w, PORT2ADDR_NE(port)); 220 205 else 221 - #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 222 - if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 206 + #if defined(CONFIG_IDE) 207 + if ( ((port >= 0x170 && port <=0x177) || port == 0x376) || 208 + ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){ 223 209 *(volatile unsigned short *)__port2addr_ata(port) = w; 224 210 } else 225 211 #endif ··· 269 253 { 270 254 if (port >= LAN_IOSTART && port < LAN_IOEND) 271 255 _ne_insb(PORT2ADDR_NE(port), addr, count); 272 - #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 273 - else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 256 + #if defined(CONFIG_IDE) 257 + else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) || 258 + ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){ 274 259 unsigned char *buf = addr; 275 260 unsigned char *portp = __port2addr_ata(port); 276 261 while (count--) ··· 306 289 pcc_ioread_word(9, port, (void *)addr, sizeof(unsigned short), 307 290 count, 1); 308 291 #endif 309 - #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 310 - } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 292 + #if defined(CONFIG_IDE) 293 + } else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) || 294 + ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){ 311 295 portp = __port2addr_ata(port); 312 296 while (count--) 313 297 *buf++ = *(volatile unsigned short *)portp; ··· 339 321 portp = PORT2ADDR_NE(port); 340 322 while (count--) 341 323 _ne_outb(*buf++, portp); 342 - #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 343 - } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 324 + #if defined(CONFIG_IDE) 325 + } else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) || 326 + ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){ 344 327 portp = __port2addr_ata(port); 345 328 while (count--) 346 329 *(volatile unsigned char *)portp = *buf++; ··· 367 348 portp = PORT2ADDR_NE(port); 368 349 while (count--) 369 350 *(volatile unsigned short *)portp = *buf++; 370 - #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 371 - } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 351 + #if defined(CONFIG_IDE) 352 + } else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) || 353 + ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){ 372 354 portp = __port2addr_ata(port); 373 355 while (count--) 374 356 *(volatile unsigned short *)portp = *buf++;
+11 -9
arch/m32r/kernel/setup_mappi3.c
··· 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 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; ··· 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)
+2 -1
drivers/pcmcia/m32r_cfc.c
··· 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 */
+8 -5
include/asm-m32r/ide.h
··· 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> 29 + 32 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
+1 -1
include/asm-m32r/mappi3/mappi3_pld.h
··· 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