aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m32r
diff options
context:
space:
mode:
authorHirokazu Takata <takata@linux-m32r.org>2005-11-28 16:44:00 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-28 17:42:24 -0500
commitad09d583106fadfdf751926107cfe35fba6bdbd4 (patch)
tree35df7418b229ed8b8eb42609924a383660705359 /arch/m32r
parent0332db5aff3eec73eead6d991782b0dee1376dc0 (diff)
[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>
Diffstat (limited to 'arch/m32r')
-rw-r--r--arch/m32r/kernel/io_mappi3.c54
-rw-r--r--arch/m32r/kernel/setup_mappi3.c20
2 files changed, 48 insertions, 26 deletions
diff --git a/arch/m32r/kernel/io_mappi3.c b/arch/m32r/kernel/io_mappi3.c
index 6716ffea769a..f80321a58764 100644
--- a/arch/m32r/kernel/io_mappi3.c
+++ b/arch/m32r/kernel/io_mappi3.c
@@ -36,12 +36,13 @@ static inline void *_port2addr(unsigned long port)
36 return (void *)(port + NONCACHE_OFFSET); 36 return (void *)(port + NONCACHE_OFFSET);
37} 37}
38 38
39#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 39#if defined(CONFIG_IDE)
40static inline void *__port2addr_ata(unsigned long port) 40static inline void *__port2addr_ata(unsigned long port)
41{ 41{
42 static int dummy_reg; 42 static int dummy_reg;
43 43
44 switch (port) { 44 switch (port) {
45 /* IDE0 CF */
45 case 0x1f0: return (void *)0xb4002000; 46 case 0x1f0: return (void *)0xb4002000;
46 case 0x1f1: return (void *)0xb4012800; 47 case 0x1f1: return (void *)0xb4012800;
47 case 0x1f2: return (void *)0xb4012002; 48 case 0x1f2: return (void *)0xb4012002;
@@ -51,6 +52,17 @@ static inline void *__port2addr_ata(unsigned long port)
51 case 0x1f6: return (void *)0xb4012006; 52 case 0x1f6: return (void *)0xb4012006;
52 case 0x1f7: return (void *)0xb4012806; 53 case 0x1f7: return (void *)0xb4012806;
53 case 0x3f6: return (void *)0xb401200e; 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 default: return (void *)&dummy_reg; 66 default: return (void *)&dummy_reg;
55 } 67 }
56} 68}
@@ -108,8 +120,9 @@ unsigned char _inb(unsigned long port)
108{ 120{
109 if (port >= LAN_IOSTART && port < LAN_IOEND) 121 if (port >= LAN_IOSTART && port < LAN_IOEND)
110 return _ne_inb(PORT2ADDR_NE(port)); 122 return _ne_inb(PORT2ADDR_NE(port));
111#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 123#if defined(CONFIG_IDE)
112 else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 124 else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) ||
125 ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){
113 return *(volatile unsigned char *)__port2addr_ata(port); 126 return *(volatile unsigned char *)__port2addr_ata(port);
114 } 127 }
115#endif 128#endif
@@ -127,8 +140,9 @@ unsigned short _inw(unsigned long port)
127{ 140{
128 if (port >= LAN_IOSTART && port < LAN_IOEND) 141 if (port >= LAN_IOSTART && port < LAN_IOEND)
129 return _ne_inw(PORT2ADDR_NE(port)); 142 return _ne_inw(PORT2ADDR_NE(port));
130#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 143#if defined(CONFIG_IDE)
131 else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 144 else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) ||
145 ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){
132 return *(volatile unsigned short *)__port2addr_ata(port); 146 return *(volatile unsigned short *)__port2addr_ata(port);
133 } 147 }
134#endif 148#endif
@@ -185,8 +199,9 @@ void _outb(unsigned char b, unsigned long port)
185 if (port >= LAN_IOSTART && port < LAN_IOEND) 199 if (port >= LAN_IOSTART && port < LAN_IOEND)
186 _ne_outb(b, PORT2ADDR_NE(port)); 200 _ne_outb(b, PORT2ADDR_NE(port));
187 else 201 else
188#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 202#if defined(CONFIG_IDE)
189 if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 203 if ( ((port >= 0x170 && port <=0x177) || port == 0x376) ||
204 ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){
190 *(volatile unsigned char *)__port2addr_ata(port) = b; 205 *(volatile unsigned char *)__port2addr_ata(port) = b;
191 } else 206 } else
192#endif 207#endif
@@ -203,8 +218,9 @@ void _outw(unsigned short w, unsigned long port)
203 if (port >= LAN_IOSTART && port < LAN_IOEND) 218 if (port >= LAN_IOSTART && port < LAN_IOEND)
204 _ne_outw(w, PORT2ADDR_NE(port)); 219 _ne_outw(w, PORT2ADDR_NE(port));
205 else 220 else
206#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 221#if defined(CONFIG_IDE)
207 if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 222 if ( ((port >= 0x170 && port <=0x177) || port == 0x376) ||
223 ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){
208 *(volatile unsigned short *)__port2addr_ata(port) = w; 224 *(volatile unsigned short *)__port2addr_ata(port) = w;
209 } else 225 } else
210#endif 226#endif
@@ -253,8 +269,9 @@ void _insb(unsigned int port, void * addr, unsigned long count)
253{ 269{
254 if (port >= LAN_IOSTART && port < LAN_IOEND) 270 if (port >= LAN_IOSTART && port < LAN_IOEND)
255 _ne_insb(PORT2ADDR_NE(port), addr, count); 271 _ne_insb(PORT2ADDR_NE(port), addr, count);
256#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 272#if defined(CONFIG_IDE)
257 else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 273 else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) ||
274 ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){
258 unsigned char *buf = addr; 275 unsigned char *buf = addr;
259 unsigned char *portp = __port2addr_ata(port); 276 unsigned char *portp = __port2addr_ata(port);
260 while (count--) 277 while (count--)
@@ -289,8 +306,9 @@ void _insw(unsigned int port, void * addr, unsigned long count)
289 pcc_ioread_word(9, port, (void *)addr, sizeof(unsigned short), 306 pcc_ioread_word(9, port, (void *)addr, sizeof(unsigned short),
290 count, 1); 307 count, 1);
291#endif 308#endif
292#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 309#if defined(CONFIG_IDE)
293 } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 310 } else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) ||
311 ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){
294 portp = __port2addr_ata(port); 312 portp = __port2addr_ata(port);
295 while (count--) 313 while (count--)
296 *buf++ = *(volatile unsigned short *)portp; 314 *buf++ = *(volatile unsigned short *)portp;
@@ -321,8 +339,9 @@ void _outsb(unsigned int port, const void * addr, unsigned long count)
321 portp = PORT2ADDR_NE(port); 339 portp = PORT2ADDR_NE(port);
322 while (count--) 340 while (count--)
323 _ne_outb(*buf++, portp); 341 _ne_outb(*buf++, portp);
324#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 342#if defined(CONFIG_IDE)
325 } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 343 } else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) ||
344 ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){
326 portp = __port2addr_ata(port); 345 portp = __port2addr_ata(port);
327 while (count--) 346 while (count--)
328 *(volatile unsigned char *)portp = *buf++; 347 *(volatile unsigned char *)portp = *buf++;
@@ -348,8 +367,9 @@ void _outsw(unsigned int port, const void * addr, unsigned long count)
348 portp = PORT2ADDR_NE(port); 367 portp = PORT2ADDR_NE(port);
349 while (count--) 368 while (count--)
350 *(volatile unsigned short *)portp = *buf++; 369 *(volatile unsigned short *)portp = *buf++;
351#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 370#if defined(CONFIG_IDE)
352 } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { 371 } else if ( ((port >= 0x170 && port <=0x177) || port == 0x376) ||
372 ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) ){
353 portp = __port2addr_ata(port); 373 portp = __port2addr_ata(port);
354 while (count--) 374 while (count--)
355 *(volatile unsigned short *)portp = *buf++; 375 *(volatile unsigned short *)portp = *buf++;
diff --git a/arch/m32r/kernel/setup_mappi3.c b/arch/m32r/kernel/setup_mappi3.c
index 9c79341a7b45..f6ecdf7f555c 100644
--- a/arch/m32r/kernel/setup_mappi3.c
+++ b/arch/m32r/kernel/setup_mappi3.c
@@ -151,7 +151,7 @@ void __init init_IRQ(void)
151 disable_mappi3_irq(M32R_IRQ_INT1); 151 disable_mappi3_irq(M32R_IRQ_INT1);
152#endif /* CONFIG_USB */ 152#endif /* CONFIG_USB */
153 153
154 /* ICUCR40: CFC IREQ */ 154 /* CFC IREQ */
155 irq_desc[PLD_IRQ_CFIREQ].status = IRQ_DISABLED; 155 irq_desc[PLD_IRQ_CFIREQ].status = IRQ_DISABLED;
156 irq_desc[PLD_IRQ_CFIREQ].handler = &mappi3_irq_type; 156 irq_desc[PLD_IRQ_CFIREQ].handler = &mappi3_irq_type;
157 irq_desc[PLD_IRQ_CFIREQ].action = 0; 157 irq_desc[PLD_IRQ_CFIREQ].action = 0;
@@ -160,7 +160,7 @@ void __init init_IRQ(void)
160 disable_mappi3_irq(PLD_IRQ_CFIREQ); 160 disable_mappi3_irq(PLD_IRQ_CFIREQ);
161 161
162#if defined(CONFIG_M32R_CFC) 162#if defined(CONFIG_M32R_CFC)
163 /* ICUCR41: CFC Insert */ 163 /* ICUCR41: CFC Insert & eject */
164 irq_desc[PLD_IRQ_CFC_INSERT].status = IRQ_DISABLED; 164 irq_desc[PLD_IRQ_CFC_INSERT].status = IRQ_DISABLED;
165 irq_desc[PLD_IRQ_CFC_INSERT].handler = &mappi3_irq_type; 165 irq_desc[PLD_IRQ_CFC_INSERT].handler = &mappi3_irq_type;
166 irq_desc[PLD_IRQ_CFC_INSERT].action = 0; 166 irq_desc[PLD_IRQ_CFC_INSERT].action = 0;
@@ -168,14 +168,16 @@ void __init init_IRQ(void)
168 icu_data[PLD_IRQ_CFC_INSERT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00; 168 icu_data[PLD_IRQ_CFC_INSERT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00;
169 disable_mappi3_irq(PLD_IRQ_CFC_INSERT); 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#endif /* CONFIG_M32R_CFC */ 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#if defined(CONFIG_SMC91X) 183#if defined(CONFIG_SMC91X)