Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] m32r: bootloader support for OPSPUT platform

This patch supports "m32r-g00ff" bootloader for an OPSPUT platform.

Applying this patch, it is possible to do ATA-boot from an IDE drive or
HTTP-boot from network by m32r-g00ff.

* arch/m32r/boot/compressed/m32r_sio.c: Fix hangup on OPSPUT at boot.

* arch/m32r/kernel/io_opsput.c: IDE support for OPSPUT.
* arch/m32r/kernel/setup_opsput.c: ditto.
* include/asm-m32r/ide.h: ditto.

Signed-off-by: Kazuhiro Inaoka <inaoka@linux-m32r.org>
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
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
d93f7de8 6b8bd3f4

+84 -14
+6 -1
arch/m32r/boot/compressed/m32r_sio.c
··· 2 2 * arch/m32r/boot/compressed/m32r_sio.c 3 3 * 4 4 * 2003-02-12: Takeo Takahashi 5 + * 2006-11-30: OPSPUT support by Kazuhiro Inaoka 5 6 * 6 7 */ 7 8 ··· 17 16 return 0; 18 17 } 19 18 20 - #if defined(CONFIG_PLAT_M32700UT_Alpha) || defined(CONFIG_PLAT_M32700UT) 19 + #if defined(CONFIG_PLAT_M32700UT_Alpha) || defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_OPSPUT) 21 20 #include <asm/m32r.h> 22 21 #include <asm/io.h> 23 22 ··· 32 31 #define BOOT_SIO0TXB (volatile unsigned short *)(0x02c00000 + 0x2000c) 33 32 #else 34 33 #undef PLD_BASE 34 + #if defined(CONFIG_PLAT_OPSPUT) 35 + #define PLD_BASE 0x1cc00000 36 + #else 35 37 #define PLD_BASE 0xa4c00000 38 + #endif 36 39 #define BOOT_SIO0STS PLD_ESIO0STS 37 40 #define BOOT_SIO0TXB PLD_ESIO0TXB 38 41 #endif
+69 -2
arch/m32r/kernel/io_opsput.c
··· 30 30 extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int); 31 31 #endif /* CONFIG_PCMCIA && CONFIG_M32R_CFC */ 32 32 33 - #define PORT2ADDR(port) _port2addr(port) 34 - #define PORT2ADDR_USB(port) _port2addr_usb(port) 33 + #define PORT2ADDR(port) _port2addr(port) 34 + #define PORT2ADDR_USB(port) _port2addr_usb(port) 35 35 36 36 static inline void *_port2addr(unsigned long port) 37 37 { 38 38 return (void *)(port | NONCACHE_OFFSET); 39 39 } 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 40 60 41 61 /* 42 62 * OPSPUT-LAN is located in the extended bus space ··· 117 97 { 118 98 if (port >= LAN_IOSTART && port < LAN_IOEND) 119 99 return _ne_inb(PORT2ADDR_NE(port)); 100 + 101 + #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 102 + else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 103 + return *(volatile unsigned char *)__port2addr_ata(port); 104 + } 105 + #endif 120 106 #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) 121 107 else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { 122 108 unsigned char b; ··· 138 112 { 139 113 if (port >= LAN_IOSTART && port < LAN_IOEND) 140 114 return _ne_inw(PORT2ADDR_NE(port)); 115 + #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 116 + else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 117 + return *(volatile unsigned short *)__port2addr_ata(port); 118 + } 119 + #endif 141 120 #if defined(CONFIG_USB) 142 121 else if(port >= 0x340 && port < 0x3a0) 143 122 return *(volatile unsigned short *)PORT2ADDR_USB(port); ··· 195 164 if (port >= LAN_IOSTART && port < LAN_IOEND) 196 165 _ne_outb(b, PORT2ADDR_NE(port)); 197 166 else 167 + #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 168 + if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 169 + *(volatile unsigned char *)__port2addr_ata(port) = b; 170 + } else 171 + #endif 198 172 #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) 199 173 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { 200 174 pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0); ··· 213 177 if (port >= LAN_IOSTART && port < LAN_IOEND) 214 178 _ne_outw(w, PORT2ADDR_NE(port)); 215 179 else 180 + #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 181 + if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 182 + *(volatile unsigned short *)__port2addr_ata(port) = w; 183 + } else 184 + #endif 216 185 #if defined(CONFIG_USB) 217 186 if(port >= 0x340 && port < 0x3a0) 218 187 *(volatile unsigned short *)PORT2ADDR_USB(port) = w; ··· 263 222 { 264 223 if (port >= LAN_IOSTART && port < LAN_IOEND) 265 224 _ne_insb(PORT2ADDR_NE(port), addr, count); 225 + #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 226 + else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 227 + unsigned char *buf = addr; 228 + unsigned char *portp = __port2addr_ata(port); 229 + while (count--) 230 + *buf++ = *(volatile unsigned char *)portp; 231 + } 232 + #endif 266 233 #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) 267 234 else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { 268 235 pcc_ioread_byte(0, port, (void *)addr, sizeof(unsigned char), ··· 303 254 pcc_ioread_word(9, port, (void *)addr, sizeof(unsigned short), 304 255 count, 1); 305 256 #endif 257 + #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 258 + } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 259 + portp = __port2addr_ata(port); 260 + while (count--) 261 + *buf++ = *(volatile unsigned short *)portp; 262 + #endif 306 263 } else { 307 264 portp = PORT2ADDR(port); 308 265 while (count--) ··· 335 280 portp = PORT2ADDR_NE(port); 336 281 while (count--) 337 282 _ne_outb(*buf++, portp); 283 + #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 284 + } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 285 + portp = __port2addr_ata(port); 286 + while (count--) 287 + *(volatile unsigned char *)portp = *buf++; 288 + #endif 338 289 #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) 339 290 } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { 340 291 pcc_iowrite_byte(0, port, (void *)addr, sizeof(unsigned char), ··· 366 305 portp = PORT2ADDR_NE(port); 367 306 while (count--) 368 307 *(volatile unsigned short *)portp = *buf++; 308 + #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 309 + } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 310 + portp = __port2addr_ata(port); 311 + while (count--) 312 + *(volatile unsigned short *)portp = *buf++; 313 + #endif 369 314 #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) 370 315 } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { 371 316 pcc_iowrite_word(9, port, (void *)addr, sizeof(unsigned short),
+7 -10
arch/m32r/kernel/setup_opsput.c
··· 218 218 219 219 static struct hw_interrupt_type opsput_lanpld_irq_type = 220 220 { 221 - "OPSPUT-PLD-LAN-IRQ", 222 - startup_opsput_lanpld_irq, 223 - shutdown_opsput_lanpld_irq, 224 - enable_opsput_lanpld_irq, 225 - disable_opsput_lanpld_irq, 226 - mask_and_ack_opsput_lanpld, 227 - end_opsput_lanpld_irq 221 + .typename = "OPSPUT-PLD-LAN-IRQ", 222 + .startup = startup_opsput_lanpld_irq, 223 + .shutdown = shutdown_opsput_lanpld_irq, 224 + .enable = enable_opsput_lanpld_irq, 225 + .disable = disable_opsput_lanpld_irq, 226 + .ack = mask_and_ack_opsput_lanpld, 227 + .end = end_opsput_lanpld_irq 228 228 }; 229 229 230 230 /* ··· 374 374 disable_opsput_pld_irq(PLD_IRQ_SIO0_SND); 375 375 #endif /* CONFIG_SERIAL_M32R_PLDSIO */ 376 376 377 - #if defined(CONFIG_M32R_CFC) 378 377 /* INT#1: CFC IREQ on PLD */ 379 378 irq_desc[PLD_IRQ_CFIREQ].status = IRQ_DISABLED; 380 379 irq_desc[PLD_IRQ_CFIREQ].chip = &opsput_pld_irq_type; ··· 397 398 irq_desc[PLD_IRQ_CFC_EJECT].depth = 1; /* disable nested irq */ 398 399 pld_icu_data[irq2pldirq(PLD_IRQ_CFC_EJECT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* 'H' edge sense */ 399 400 disable_opsput_pld_irq(PLD_IRQ_CFC_EJECT); 400 - #endif /* CONFIG_M32R_CFC */ 401 - 402 401 403 402 /* 404 403 * INT0# is used for LAN, DIO
+2 -1
include/asm-m32r/ide.h
··· 32 32 static __inline__ int ide_default_irq(unsigned long base) 33 33 { 34 34 switch (base) { 35 - #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_MAPPI2) 35 + #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_MAPPI2) \ 36 + || defined(CONFIG_PLAT_OPSPUT) 36 37 case 0x1f0: return PLD_IRQ_CFIREQ; 37 38 default: 38 39 return 0;