diff options
author | Hirokazu Takata <takata@linux-m32r.org> | 2007-08-01 08:09:31 -0400 |
---|---|---|
committer | Hirokazu Takata <takata@linux-m32r.org> | 2007-09-02 22:30:18 -0400 |
commit | 3264f976d3188bea80819793c13a3220b8a4867c (patch) | |
tree | e451b9179430ddbbe1102050ebf391433248c1e1 /arch/m32r/platforms/mappi2 | |
parent | e6a7ba7efddbb393b726453eae8601ef02b9a610 (diff) |
m32r: Rearrange platform-dependent codes
Rearrange platform-dependent codes from arch/m32r/kernel/*.c
to arch/m32r/platforms/{platform}/.
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
Diffstat (limited to 'arch/m32r/platforms/mappi2')
-rw-r--r-- | arch/m32r/platforms/mappi2/Makefile | 1 | ||||
-rw-r--r-- | arch/m32r/platforms/mappi2/io.c | 383 | ||||
-rw-r--r-- | arch/m32r/platforms/mappi2/setup.c | 201 |
3 files changed, 585 insertions, 0 deletions
diff --git a/arch/m32r/platforms/mappi2/Makefile b/arch/m32r/platforms/mappi2/Makefile new file mode 100644 index 000000000000..0de59084f21c --- /dev/null +++ b/arch/m32r/platforms/mappi2/Makefile | |||
@@ -0,0 +1 @@ | |||
obj-y := setup.o io.o | |||
diff --git a/arch/m32r/platforms/mappi2/io.c b/arch/m32r/platforms/mappi2/io.c new file mode 100644 index 000000000000..da58960b3f8a --- /dev/null +++ b/arch/m32r/platforms/mappi2/io.c | |||
@@ -0,0 +1,383 @@ | |||
1 | /* | ||
2 | * linux/arch/m32r/platforms/mappi2/io.c | ||
3 | * | ||
4 | * Typical I/O routines for Mappi2 board. | ||
5 | * | ||
6 | * Copyright (c) 2001-2005 Hiroyuki Kondo, Hirokazu Takata, | ||
7 | * Hitoshi Yamamoto, Mamoru Sakugawa | ||
8 | */ | ||
9 | |||
10 | #include <asm/m32r.h> | ||
11 | #include <asm/page.h> | ||
12 | #include <asm/io.h> | ||
13 | #include <asm/byteorder.h> | ||
14 | |||
15 | #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) | ||
16 | #include <linux/types.h> | ||
17 | |||
18 | #define M32R_PCC_IOMAP_SIZE 0x1000 | ||
19 | |||
20 | #define M32R_PCC_IOSTART0 0x1000 | ||
21 | #define M32R_PCC_IOEND0 (M32R_PCC_IOSTART0 + M32R_PCC_IOMAP_SIZE - 1) | ||
22 | |||
23 | extern void pcc_ioread_byte(int, unsigned long, void *, size_t, size_t, int); | ||
24 | extern void pcc_ioread_word(int, unsigned long, void *, size_t, size_t, int); | ||
25 | extern void pcc_iowrite_byte(int, unsigned long, void *, size_t, size_t, int); | ||
26 | extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int); | ||
27 | #endif /* CONFIG_PCMCIA && CONFIG_M32R_CFC */ | ||
28 | |||
29 | #define PORT2ADDR(port) _port2addr(port) | ||
30 | #define PORT2ADDR_NE(port) _port2addr_ne(port) | ||
31 | #define PORT2ADDR_USB(port) _port2addr_usb(port) | ||
32 | |||
33 | static inline void *_port2addr(unsigned long port) | ||
34 | { | ||
35 | return (void *)(port | NONCACHE_OFFSET); | ||
36 | } | ||
37 | |||
38 | #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | ||
39 | static inline void *__port2addr_ata(unsigned long port) | ||
40 | { | ||
41 | static int dummy_reg; | ||
42 | |||
43 | switch (port) { | ||
44 | case 0x1f0: return (void *)(0x0c002000 | NONCACHE_OFFSET); | ||
45 | case 0x1f1: return (void *)(0x0c012800 | NONCACHE_OFFSET); | ||
46 | case 0x1f2: return (void *)(0x0c012002 | NONCACHE_OFFSET); | ||
47 | case 0x1f3: return (void *)(0x0c012802 | NONCACHE_OFFSET); | ||
48 | case 0x1f4: return (void *)(0x0c012004 | NONCACHE_OFFSET); | ||
49 | case 0x1f5: return (void *)(0x0c012804 | NONCACHE_OFFSET); | ||
50 | case 0x1f6: return (void *)(0x0c012006 | NONCACHE_OFFSET); | ||
51 | case 0x1f7: return (void *)(0x0c012806 | NONCACHE_OFFSET); | ||
52 | case 0x3f6: return (void *)(0x0c01200e | NONCACHE_OFFSET); | ||
53 | default: return (void *)&dummy_reg; | ||
54 | } | ||
55 | } | ||
56 | #endif | ||
57 | |||
58 | #define LAN_IOSTART (0x300 | NONCACHE_OFFSET) | ||
59 | #define LAN_IOEND (0x320 | NONCACHE_OFFSET) | ||
60 | #ifdef CONFIG_CHIP_OPSP | ||
61 | static inline void *_port2addr_ne(unsigned long port) | ||
62 | { | ||
63 | return (void *)(port + 0x10000000); | ||
64 | } | ||
65 | #else | ||
66 | static inline void *_port2addr_ne(unsigned long port) | ||
67 | { | ||
68 | return (void *)(port + 0x04000000); | ||
69 | } | ||
70 | #endif | ||
71 | static inline void *_port2addr_usb(unsigned long port) | ||
72 | { | ||
73 | return (void *)(port + NONCACHE_OFFSET + 0x14000000); | ||
74 | } | ||
75 | static inline void delay(void) | ||
76 | { | ||
77 | __asm__ __volatile__ ("push r0; \n\t pop r0;" : : :"memory"); | ||
78 | } | ||
79 | |||
80 | /* | ||
81 | * NIC I/O function | ||
82 | */ | ||
83 | |||
84 | static inline unsigned char _ne_inb(void *portp) | ||
85 | { | ||
86 | return (unsigned char) *(volatile unsigned char *)portp; | ||
87 | } | ||
88 | |||
89 | static inline unsigned short _ne_inw(void *portp) | ||
90 | { | ||
91 | return (unsigned short)le16_to_cpu(*(volatile unsigned short *)portp); | ||
92 | } | ||
93 | |||
94 | static inline void _ne_insb(void *portp, void * addr, unsigned long count) | ||
95 | { | ||
96 | unsigned char *buf = addr; | ||
97 | |||
98 | while (count--) | ||
99 | *buf++ = *(volatile unsigned char *)portp; | ||
100 | } | ||
101 | |||
102 | static inline void _ne_outb(unsigned char b, void *portp) | ||
103 | { | ||
104 | *(volatile unsigned char *)portp = (unsigned char)b; | ||
105 | } | ||
106 | |||
107 | static inline void _ne_outw(unsigned short w, void *portp) | ||
108 | { | ||
109 | *(volatile unsigned short *)portp = cpu_to_le16(w); | ||
110 | } | ||
111 | |||
112 | unsigned char _inb(unsigned long port) | ||
113 | { | ||
114 | if (port >= LAN_IOSTART && port < LAN_IOEND) | ||
115 | return _ne_inb(PORT2ADDR_NE(port)); | ||
116 | #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | ||
117 | else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | ||
118 | return *(volatile unsigned char *)__port2addr_ata(port); | ||
119 | } | ||
120 | #endif | ||
121 | #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) | ||
122 | else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { | ||
123 | unsigned char b; | ||
124 | pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0); | ||
125 | return b; | ||
126 | } else | ||
127 | #endif | ||
128 | |||
129 | return *(volatile unsigned char *)PORT2ADDR(port); | ||
130 | } | ||
131 | |||
132 | unsigned short _inw(unsigned long port) | ||
133 | { | ||
134 | if (port >= LAN_IOSTART && port < LAN_IOEND) | ||
135 | return _ne_inw(PORT2ADDR_NE(port)); | ||
136 | #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | ||
137 | else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | ||
138 | return *(volatile unsigned short *)__port2addr_ata(port); | ||
139 | } | ||
140 | #endif | ||
141 | #if defined(CONFIG_USB) | ||
142 | else if (port >= 0x340 && port < 0x3a0) | ||
143 | return *(volatile unsigned short *)PORT2ADDR_USB(port); | ||
144 | #endif | ||
145 | |||
146 | #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) | ||
147 | else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { | ||
148 | unsigned short w; | ||
149 | pcc_ioread_word(0, port, &w, sizeof(w), 1, 0); | ||
150 | return w; | ||
151 | } else | ||
152 | #endif | ||
153 | return *(volatile unsigned short *)PORT2ADDR(port); | ||
154 | } | ||
155 | |||
156 | unsigned long _inl(unsigned long port) | ||
157 | { | ||
158 | #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) | ||
159 | if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { | ||
160 | unsigned long l; | ||
161 | pcc_ioread_word(0, port, &l, sizeof(l), 1, 0); | ||
162 | return l; | ||
163 | } else | ||
164 | #endif | ||
165 | return *(volatile unsigned long *)PORT2ADDR(port); | ||
166 | } | ||
167 | |||
168 | unsigned char _inb_p(unsigned long port) | ||
169 | { | ||
170 | unsigned char v = _inb(port); | ||
171 | delay(); | ||
172 | return (v); | ||
173 | } | ||
174 | |||
175 | unsigned short _inw_p(unsigned long port) | ||
176 | { | ||
177 | unsigned short v = _inw(port); | ||
178 | delay(); | ||
179 | return (v); | ||
180 | } | ||
181 | |||
182 | unsigned long _inl_p(unsigned long port) | ||
183 | { | ||
184 | unsigned long v = _inl(port); | ||
185 | delay(); | ||
186 | return (v); | ||
187 | } | ||
188 | |||
189 | void _outb(unsigned char b, unsigned long port) | ||
190 | { | ||
191 | if (port >= LAN_IOSTART && port < LAN_IOEND) | ||
192 | _ne_outb(b, PORT2ADDR_NE(port)); | ||
193 | else | ||
194 | #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | ||
195 | if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | ||
196 | *(volatile unsigned char *)__port2addr_ata(port) = b; | ||
197 | } else | ||
198 | #endif | ||
199 | #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) | ||
200 | if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { | ||
201 | pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0); | ||
202 | } else | ||
203 | #endif | ||
204 | *(volatile unsigned char *)PORT2ADDR(port) = b; | ||
205 | } | ||
206 | |||
207 | void _outw(unsigned short w, unsigned long port) | ||
208 | { | ||
209 | if (port >= LAN_IOSTART && port < LAN_IOEND) | ||
210 | _ne_outw(w, PORT2ADDR_NE(port)); | ||
211 | else | ||
212 | #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | ||
213 | if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | ||
214 | *(volatile unsigned short *)__port2addr_ata(port) = w; | ||
215 | } else | ||
216 | #endif | ||
217 | #if defined(CONFIG_USB) | ||
218 | if (port >= 0x340 && port < 0x3a0) | ||
219 | *(volatile unsigned short *)PORT2ADDR_USB(port) = w; | ||
220 | else | ||
221 | #endif | ||
222 | #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) | ||
223 | if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { | ||
224 | pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0); | ||
225 | } else | ||
226 | #endif | ||
227 | *(volatile unsigned short *)PORT2ADDR(port) = w; | ||
228 | } | ||
229 | |||
230 | void _outl(unsigned long l, unsigned long port) | ||
231 | { | ||
232 | #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) | ||
233 | if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { | ||
234 | pcc_iowrite_word(0, port, &l, sizeof(l), 1, 0); | ||
235 | } else | ||
236 | #endif | ||
237 | *(volatile unsigned long *)PORT2ADDR(port) = l; | ||
238 | } | ||
239 | |||
240 | void _outb_p(unsigned char b, unsigned long port) | ||
241 | { | ||
242 | _outb(b, port); | ||
243 | delay(); | ||
244 | } | ||
245 | |||
246 | void _outw_p(unsigned short w, unsigned long port) | ||
247 | { | ||
248 | _outw(w, port); | ||
249 | delay(); | ||
250 | } | ||
251 | |||
252 | void _outl_p(unsigned long l, unsigned long port) | ||
253 | { | ||
254 | _outl(l, port); | ||
255 | delay(); | ||
256 | } | ||
257 | |||
258 | void _insb(unsigned int port, void * addr, unsigned long count) | ||
259 | { | ||
260 | if (port >= LAN_IOSTART && port < LAN_IOEND) | ||
261 | _ne_insb(PORT2ADDR_NE(port), addr, count); | ||
262 | #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | ||
263 | else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | ||
264 | unsigned char *buf = addr; | ||
265 | unsigned char *portp = __port2addr_ata(port); | ||
266 | while (count--) | ||
267 | *buf++ = *(volatile unsigned char *)portp; | ||
268 | } | ||
269 | #endif | ||
270 | #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) | ||
271 | else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { | ||
272 | pcc_ioread_byte(0, port, (void *)addr, sizeof(unsigned char), | ||
273 | count, 1); | ||
274 | } | ||
275 | #endif | ||
276 | else { | ||
277 | unsigned char *buf = addr; | ||
278 | unsigned char *portp = PORT2ADDR(port); | ||
279 | while (count--) | ||
280 | *buf++ = *(volatile unsigned char *)portp; | ||
281 | } | ||
282 | } | ||
283 | |||
284 | void _insw(unsigned int port, void * addr, unsigned long count) | ||
285 | { | ||
286 | unsigned short *buf = addr; | ||
287 | unsigned short *portp; | ||
288 | |||
289 | if (port >= LAN_IOSTART && port < LAN_IOEND) { | ||
290 | portp = PORT2ADDR_NE(port); | ||
291 | while (count--) | ||
292 | *buf++ = *(volatile unsigned short *)portp; | ||
293 | #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) | ||
294 | } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { | ||
295 | pcc_ioread_word(9, port, (void *)addr, sizeof(unsigned short), | ||
296 | count, 1); | ||
297 | #endif | ||
298 | #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | ||
299 | } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | ||
300 | portp = __port2addr_ata(port); | ||
301 | while (count--) | ||
302 | *buf++ = *(volatile unsigned short *)portp; | ||
303 | #endif | ||
304 | } else { | ||
305 | portp = PORT2ADDR(port); | ||
306 | while (count--) | ||
307 | *buf++ = *(volatile unsigned short *)portp; | ||
308 | } | ||
309 | } | ||
310 | |||
311 | void _insl(unsigned int port, void * addr, unsigned long count) | ||
312 | { | ||
313 | unsigned long *buf = addr; | ||
314 | unsigned long *portp; | ||
315 | |||
316 | portp = PORT2ADDR(port); | ||
317 | while (count--) | ||
318 | *buf++ = *(volatile unsigned long *)portp; | ||
319 | } | ||
320 | |||
321 | void _outsb(unsigned int port, const void * addr, unsigned long count) | ||
322 | { | ||
323 | const unsigned char *buf = addr; | ||
324 | unsigned char *portp; | ||
325 | |||
326 | if (port >= LAN_IOSTART && port < LAN_IOEND) { | ||
327 | portp = PORT2ADDR_NE(port); | ||
328 | while (count--) | ||
329 | _ne_outb(*buf++, portp); | ||
330 | #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | ||
331 | } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | ||
332 | portp = __port2addr_ata(port); | ||
333 | while (count--) | ||
334 | *(volatile unsigned char *)portp = *buf++; | ||
335 | #endif | ||
336 | #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) | ||
337 | } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { | ||
338 | pcc_iowrite_byte(0, port, (void *)addr, sizeof(unsigned char), | ||
339 | count, 1); | ||
340 | #endif | ||
341 | } else { | ||
342 | portp = PORT2ADDR(port); | ||
343 | while (count--) | ||
344 | *(volatile unsigned char *)portp = *buf++; | ||
345 | } | ||
346 | } | ||
347 | |||
348 | void _outsw(unsigned int port, const void * addr, unsigned long count) | ||
349 | { | ||
350 | const unsigned short *buf = addr; | ||
351 | unsigned short *portp; | ||
352 | |||
353 | if (port >= LAN_IOSTART && port < LAN_IOEND) { | ||
354 | portp = PORT2ADDR_NE(port); | ||
355 | while (count--) | ||
356 | *(volatile unsigned short *)portp = *buf++; | ||
357 | #if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) | ||
358 | } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { | ||
359 | portp = __port2addr_ata(port); | ||
360 | while (count--) | ||
361 | *(volatile unsigned short *)portp = *buf++; | ||
362 | #endif | ||
363 | #if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) | ||
364 | } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { | ||
365 | pcc_iowrite_word(9, port, (void *)addr, sizeof(unsigned short), | ||
366 | count, 1); | ||
367 | #endif | ||
368 | } else { | ||
369 | portp = PORT2ADDR(port); | ||
370 | while (count--) | ||
371 | *(volatile unsigned short *)portp = *buf++; | ||
372 | } | ||
373 | } | ||
374 | |||
375 | void _outsl(unsigned int port, const void * addr, unsigned long count) | ||
376 | { | ||
377 | const unsigned long *buf = addr; | ||
378 | unsigned char *portp; | ||
379 | |||
380 | portp = PORT2ADDR(port); | ||
381 | while (count--) | ||
382 | *(volatile unsigned long *)portp = *buf++; | ||
383 | } | ||
diff --git a/arch/m32r/platforms/mappi2/setup.c b/arch/m32r/platforms/mappi2/setup.c new file mode 100644 index 000000000000..d87969c6356e --- /dev/null +++ b/arch/m32r/platforms/mappi2/setup.c | |||
@@ -0,0 +1,201 @@ | |||
1 | /* | ||
2 | * linux/arch/m32r/platforms/mappi2/setup.c | ||
3 | * | ||
4 | * Setup routines for Renesas MAPPI-II(M3A-ZA36) Board | ||
5 | * | ||
6 | * Copyright (c) 2001-2005 Hiroyuki Kondo, Hirokazu Takata, | ||
7 | * Hitoshi Yamamoto, Mamoru Sakugawa | ||
8 | */ | ||
9 | |||
10 | #include <linux/irq.h> | ||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/platform_device.h> | ||
14 | |||
15 | #include <asm/system.h> | ||
16 | #include <asm/m32r.h> | ||
17 | #include <asm/io.h> | ||
18 | |||
19 | #define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long))) | ||
20 | |||
21 | icu_data_t icu_data[NR_IRQS]; | ||
22 | |||
23 | static void disable_mappi2_irq(unsigned int irq) | ||
24 | { | ||
25 | unsigned long port, data; | ||
26 | |||
27 | if ((irq == 0) ||(irq >= NR_IRQS)) { | ||
28 | printk("bad irq 0x%08x\n", irq); | ||
29 | return; | ||
30 | } | ||
31 | port = irq2port(irq); | ||
32 | data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7; | ||
33 | outl(data, port); | ||
34 | } | ||
35 | |||
36 | static void enable_mappi2_irq(unsigned int irq) | ||
37 | { | ||
38 | unsigned long port, data; | ||
39 | |||
40 | if ((irq == 0) ||(irq >= NR_IRQS)) { | ||
41 | printk("bad irq 0x%08x\n", irq); | ||
42 | return; | ||
43 | } | ||
44 | port = irq2port(irq); | ||
45 | data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6; | ||
46 | outl(data, port); | ||
47 | } | ||
48 | |||
49 | static void mask_and_ack_mappi2(unsigned int irq) | ||
50 | { | ||
51 | disable_mappi2_irq(irq); | ||
52 | } | ||
53 | |||
54 | static void end_mappi2_irq(unsigned int irq) | ||
55 | { | ||
56 | enable_mappi2_irq(irq); | ||
57 | } | ||
58 | |||
59 | static unsigned int startup_mappi2_irq(unsigned int irq) | ||
60 | { | ||
61 | enable_mappi2_irq(irq); | ||
62 | return (0); | ||
63 | } | ||
64 | |||
65 | static void shutdown_mappi2_irq(unsigned int irq) | ||
66 | { | ||
67 | unsigned long port; | ||
68 | |||
69 | port = irq2port(irq); | ||
70 | outl(M32R_ICUCR_ILEVEL7, port); | ||
71 | } | ||
72 | |||
73 | static struct hw_interrupt_type mappi2_irq_type = | ||
74 | { | ||
75 | .typename = "MAPPI2-IRQ", | ||
76 | .startup = startup_mappi2_irq, | ||
77 | .shutdown = shutdown_mappi2_irq, | ||
78 | .enable = enable_mappi2_irq, | ||
79 | .disable = disable_mappi2_irq, | ||
80 | .ack = mask_and_ack_mappi2, | ||
81 | .end = end_mappi2_irq | ||
82 | }; | ||
83 | |||
84 | void __init init_IRQ(void) | ||
85 | { | ||
86 | #if defined(CONFIG_SMC91X) | ||
87 | /* INT0 : LAN controller (SMC91111) */ | ||
88 | irq_desc[M32R_IRQ_INT0].status = IRQ_DISABLED; | ||
89 | irq_desc[M32R_IRQ_INT0].chip = &mappi2_irq_type; | ||
90 | irq_desc[M32R_IRQ_INT0].action = 0; | ||
91 | irq_desc[M32R_IRQ_INT0].depth = 1; | ||
92 | icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; | ||
93 | disable_mappi2_irq(M32R_IRQ_INT0); | ||
94 | #endif /* CONFIG_SMC91X */ | ||
95 | |||
96 | /* MFT2 : system timer */ | ||
97 | irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED; | ||
98 | irq_desc[M32R_IRQ_MFT2].chip = &mappi2_irq_type; | ||
99 | irq_desc[M32R_IRQ_MFT2].action = 0; | ||
100 | irq_desc[M32R_IRQ_MFT2].depth = 1; | ||
101 | icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; | ||
102 | disable_mappi2_irq(M32R_IRQ_MFT2); | ||
103 | |||
104 | #ifdef CONFIG_SERIAL_M32R_SIO | ||
105 | /* SIO0_R : uart receive data */ | ||
106 | irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED; | ||
107 | irq_desc[M32R_IRQ_SIO0_R].chip = &mappi2_irq_type; | ||
108 | irq_desc[M32R_IRQ_SIO0_R].action = 0; | ||
109 | irq_desc[M32R_IRQ_SIO0_R].depth = 1; | ||
110 | icu_data[M32R_IRQ_SIO0_R].icucr = 0; | ||
111 | disable_mappi2_irq(M32R_IRQ_SIO0_R); | ||
112 | |||
113 | /* SIO0_S : uart send data */ | ||
114 | irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED; | ||
115 | irq_desc[M32R_IRQ_SIO0_S].chip = &mappi2_irq_type; | ||
116 | irq_desc[M32R_IRQ_SIO0_S].action = 0; | ||
117 | irq_desc[M32R_IRQ_SIO0_S].depth = 1; | ||
118 | icu_data[M32R_IRQ_SIO0_S].icucr = 0; | ||
119 | disable_mappi2_irq(M32R_IRQ_SIO0_S); | ||
120 | /* SIO1_R : uart receive data */ | ||
121 | irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED; | ||
122 | irq_desc[M32R_IRQ_SIO1_R].chip = &mappi2_irq_type; | ||
123 | irq_desc[M32R_IRQ_SIO1_R].action = 0; | ||
124 | irq_desc[M32R_IRQ_SIO1_R].depth = 1; | ||
125 | icu_data[M32R_IRQ_SIO1_R].icucr = 0; | ||
126 | disable_mappi2_irq(M32R_IRQ_SIO1_R); | ||
127 | |||
128 | /* SIO1_S : uart send data */ | ||
129 | irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED; | ||
130 | irq_desc[M32R_IRQ_SIO1_S].chip = &mappi2_irq_type; | ||
131 | irq_desc[M32R_IRQ_SIO1_S].action = 0; | ||
132 | irq_desc[M32R_IRQ_SIO1_S].depth = 1; | ||
133 | icu_data[M32R_IRQ_SIO1_S].icucr = 0; | ||
134 | disable_mappi2_irq(M32R_IRQ_SIO1_S); | ||
135 | #endif /* CONFIG_M32R_USE_DBG_CONSOLE */ | ||
136 | |||
137 | #if defined(CONFIG_USB) | ||
138 | /* INT1 : USB Host controller interrupt */ | ||
139 | irq_desc[M32R_IRQ_INT1].status = IRQ_DISABLED; | ||
140 | irq_desc[M32R_IRQ_INT1].chip = &mappi2_irq_type; | ||
141 | irq_desc[M32R_IRQ_INT1].action = 0; | ||
142 | irq_desc[M32R_IRQ_INT1].depth = 1; | ||
143 | icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_ISMOD01; | ||
144 | disable_mappi2_irq(M32R_IRQ_INT1); | ||
145 | #endif /* CONFIG_USB */ | ||
146 | |||
147 | /* ICUCR40: CFC IREQ */ | ||
148 | irq_desc[PLD_IRQ_CFIREQ].status = IRQ_DISABLED; | ||
149 | irq_desc[PLD_IRQ_CFIREQ].chip = &mappi2_irq_type; | ||
150 | irq_desc[PLD_IRQ_CFIREQ].action = 0; | ||
151 | irq_desc[PLD_IRQ_CFIREQ].depth = 1; /* disable nested irq */ | ||
152 | icu_data[PLD_IRQ_CFIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01; | ||
153 | disable_mappi2_irq(PLD_IRQ_CFIREQ); | ||
154 | |||
155 | #if defined(CONFIG_M32R_CFC) | ||
156 | /* ICUCR41: CFC Insert */ | ||
157 | irq_desc[PLD_IRQ_CFC_INSERT].status = IRQ_DISABLED; | ||
158 | irq_desc[PLD_IRQ_CFC_INSERT].chip = &mappi2_irq_type; | ||
159 | irq_desc[PLD_IRQ_CFC_INSERT].action = 0; | ||
160 | irq_desc[PLD_IRQ_CFC_INSERT].depth = 1; /* disable nested irq */ | ||
161 | icu_data[PLD_IRQ_CFC_INSERT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00; | ||
162 | disable_mappi2_irq(PLD_IRQ_CFC_INSERT); | ||
163 | |||
164 | /* ICUCR42: CFC Eject */ | ||
165 | irq_desc[PLD_IRQ_CFC_EJECT].status = IRQ_DISABLED; | ||
166 | irq_desc[PLD_IRQ_CFC_EJECT].chip = &mappi2_irq_type; | ||
167 | irq_desc[PLD_IRQ_CFC_EJECT].action = 0; | ||
168 | irq_desc[PLD_IRQ_CFC_EJECT].depth = 1; /* disable nested irq */ | ||
169 | icu_data[PLD_IRQ_CFC_EJECT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; | ||
170 | disable_mappi2_irq(PLD_IRQ_CFC_EJECT); | ||
171 | #endif /* CONFIG_MAPPI2_CFC */ | ||
172 | } | ||
173 | |||
174 | #define LAN_IOSTART 0x300 | ||
175 | #define LAN_IOEND 0x320 | ||
176 | static struct resource smc91x_resources[] = { | ||
177 | [0] = { | ||
178 | .start = (LAN_IOSTART), | ||
179 | .end = (LAN_IOEND), | ||
180 | .flags = IORESOURCE_MEM, | ||
181 | }, | ||
182 | [1] = { | ||
183 | .start = M32R_IRQ_INT0, | ||
184 | .end = M32R_IRQ_INT0, | ||
185 | .flags = IORESOURCE_IRQ, | ||
186 | } | ||
187 | }; | ||
188 | |||
189 | static struct platform_device smc91x_device = { | ||
190 | .name = "smc91x", | ||
191 | .id = 0, | ||
192 | .num_resources = ARRAY_SIZE(smc91x_resources), | ||
193 | .resource = smc91x_resources, | ||
194 | }; | ||
195 | |||
196 | static int __init platform_init(void) | ||
197 | { | ||
198 | platform_device_register(&smc91x_device); | ||
199 | return 0; | ||
200 | } | ||
201 | arch_initcall(platform_init); | ||