Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* linux/arch/arm/mach-s3c2410/devs.c |
2 | * | |
3 | * Copyright (c) 2004 Simtec Electronics | |
4 | * Ben Dooks <ben@simtec.co.uk> | |
5 | * | |
6 | * Base S3C2410 platform device definitions | |
7 | * | |
8 | * This program is free software; you can redistribute it and/or modify | |
9 | * it under the terms of the GNU General Public License version 2 as | |
10 | * published by the Free Software Foundation. | |
11 | * | |
12 | * Modifications: | |
13 | * 10-Mar-2005 LCVR Changed S3C2410_{VA,SZ} to S3C24XX_{VA,SZ} | |
14 | * 10-Feb-2005 BJD Added camera from guillaume.gourat@nexvision.tv | |
15 | * 29-Aug-2004 BJD Added timers 0 through 3 | |
16 | * 29-Aug-2004 BJD Changed index of devices we only have one of to -1 | |
17 | * 21-Aug-2004 BJD Added IRQ_TICK to RTC resources | |
18 | * 18-Aug-2004 BJD Created initial version | |
19 | */ | |
20 | ||
21 | #include <linux/kernel.h> | |
22 | #include <linux/types.h> | |
23 | #include <linux/interrupt.h> | |
24 | #include <linux/list.h> | |
25 | #include <linux/timer.h> | |
26 | #include <linux/init.h> | |
27 | #include <linux/device.h> | |
28 | ||
29 | #include <asm/mach/arch.h> | |
30 | #include <asm/mach/map.h> | |
31 | #include <asm/mach/irq.h> | |
f92273c1 | 32 | #include <asm/arch/fb.h> |
1da177e4 LT |
33 | #include <asm/hardware.h> |
34 | #include <asm/io.h> | |
35 | #include <asm/irq.h> | |
36 | ||
37 | #include <asm/arch/regs-serial.h> | |
38 | ||
39 | #include "devs.h" | |
40 | ||
41 | /* Serial port registrations */ | |
42 | ||
43 | struct platform_device *s3c24xx_uart_devs[3]; | |
44 | ||
45 | /* USB Host Controller */ | |
46 | ||
47 | static struct resource s3c_usb_resource[] = { | |
48 | [0] = { | |
49 | .start = S3C2410_PA_USBHOST, | |
50 | .end = S3C2410_PA_USBHOST + S3C24XX_SZ_USBHOST, | |
51 | .flags = IORESOURCE_MEM, | |
52 | }, | |
53 | [1] = { | |
54 | .start = IRQ_USBH, | |
55 | .end = IRQ_USBH, | |
56 | .flags = IORESOURCE_IRQ, | |
57 | } | |
58 | }; | |
59 | ||
60 | static u64 s3c_device_usb_dmamask = 0xffffffffUL; | |
61 | ||
62 | struct platform_device s3c_device_usb = { | |
63 | .name = "s3c2410-ohci", | |
64 | .id = -1, | |
65 | .num_resources = ARRAY_SIZE(s3c_usb_resource), | |
66 | .resource = s3c_usb_resource, | |
67 | .dev = { | |
68 | .dma_mask = &s3c_device_usb_dmamask, | |
69 | .coherent_dma_mask = 0xffffffffUL | |
70 | } | |
71 | }; | |
72 | ||
73 | EXPORT_SYMBOL(s3c_device_usb); | |
74 | ||
75 | /* LCD Controller */ | |
76 | ||
77 | static struct resource s3c_lcd_resource[] = { | |
78 | [0] = { | |
79 | .start = S3C2410_PA_LCD, | |
80 | .end = S3C2410_PA_LCD + S3C24XX_SZ_LCD, | |
81 | .flags = IORESOURCE_MEM, | |
82 | }, | |
83 | [1] = { | |
84 | .start = IRQ_LCD, | |
85 | .end = IRQ_LCD, | |
86 | .flags = IORESOURCE_IRQ, | |
87 | } | |
88 | ||
89 | }; | |
90 | ||
91 | static u64 s3c_device_lcd_dmamask = 0xffffffffUL; | |
92 | ||
93 | struct platform_device s3c_device_lcd = { | |
94 | .name = "s3c2410-lcd", | |
95 | .id = -1, | |
96 | .num_resources = ARRAY_SIZE(s3c_lcd_resource), | |
97 | .resource = s3c_lcd_resource, | |
98 | .dev = { | |
6904b246 BD |
99 | .dma_mask = &s3c_device_lcd_dmamask, |
100 | .coherent_dma_mask = 0xffffffffUL | |
1da177e4 LT |
101 | } |
102 | }; | |
103 | ||
104 | EXPORT_SYMBOL(s3c_device_lcd); | |
105 | ||
f92273c1 AP |
106 | static struct s3c2410fb_mach_info s3c2410fb_info; |
107 | ||
108 | void __init set_s3c2410fb_info(struct s3c2410fb_mach_info *hard_s3c2410fb_info) | |
109 | { | |
110 | memcpy(&s3c2410fb_info,hard_s3c2410fb_info,sizeof(struct s3c2410fb_mach_info)); | |
111 | s3c_device_lcd.dev.platform_data = &s3c2410fb_info; | |
112 | } | |
113 | EXPORT_SYMBOL(set_s3c2410fb_info); | |
114 | ||
1da177e4 LT |
115 | /* NAND Controller */ |
116 | ||
117 | static struct resource s3c_nand_resource[] = { | |
118 | [0] = { | |
119 | .start = S3C2410_PA_NAND, | |
120 | .end = S3C2410_PA_NAND + S3C24XX_SZ_NAND, | |
121 | .flags = IORESOURCE_MEM, | |
122 | } | |
123 | }; | |
124 | ||
125 | struct platform_device s3c_device_nand = { | |
126 | .name = "s3c2410-nand", | |
127 | .id = -1, | |
128 | .num_resources = ARRAY_SIZE(s3c_nand_resource), | |
129 | .resource = s3c_nand_resource, | |
130 | }; | |
131 | ||
132 | EXPORT_SYMBOL(s3c_device_nand); | |
133 | ||
134 | /* USB Device (Gadget)*/ | |
135 | ||
136 | static struct resource s3c_usbgadget_resource[] = { | |
137 | [0] = { | |
138 | .start = S3C2410_PA_USBDEV, | |
139 | .end = S3C2410_PA_USBDEV + S3C24XX_SZ_USBDEV, | |
140 | .flags = IORESOURCE_MEM, | |
141 | }, | |
142 | [1] = { | |
143 | .start = IRQ_USBD, | |
144 | .end = IRQ_USBD, | |
145 | .flags = IORESOURCE_IRQ, | |
146 | } | |
147 | ||
148 | }; | |
149 | ||
150 | struct platform_device s3c_device_usbgadget = { | |
151 | .name = "s3c2410-usbgadget", | |
152 | .id = -1, | |
153 | .num_resources = ARRAY_SIZE(s3c_usbgadget_resource), | |
154 | .resource = s3c_usbgadget_resource, | |
155 | }; | |
156 | ||
157 | EXPORT_SYMBOL(s3c_device_usbgadget); | |
158 | ||
159 | /* Watchdog */ | |
160 | ||
161 | static struct resource s3c_wdt_resource[] = { | |
162 | [0] = { | |
163 | .start = S3C2410_PA_WATCHDOG, | |
164 | .end = S3C2410_PA_WATCHDOG + S3C24XX_SZ_WATCHDOG, | |
165 | .flags = IORESOURCE_MEM, | |
166 | }, | |
167 | [1] = { | |
168 | .start = IRQ_WDT, | |
169 | .end = IRQ_WDT, | |
170 | .flags = IORESOURCE_IRQ, | |
171 | } | |
172 | ||
173 | }; | |
174 | ||
175 | struct platform_device s3c_device_wdt = { | |
176 | .name = "s3c2410-wdt", | |
177 | .id = -1, | |
178 | .num_resources = ARRAY_SIZE(s3c_wdt_resource), | |
179 | .resource = s3c_wdt_resource, | |
180 | }; | |
181 | ||
182 | EXPORT_SYMBOL(s3c_device_wdt); | |
183 | ||
184 | /* I2C */ | |
185 | ||
186 | static struct resource s3c_i2c_resource[] = { | |
187 | [0] = { | |
188 | .start = S3C2410_PA_IIC, | |
189 | .end = S3C2410_PA_IIC + S3C24XX_SZ_IIC, | |
190 | .flags = IORESOURCE_MEM, | |
191 | }, | |
192 | [1] = { | |
193 | .start = IRQ_IIC, | |
194 | .end = IRQ_IIC, | |
195 | .flags = IORESOURCE_IRQ, | |
196 | } | |
197 | ||
198 | }; | |
199 | ||
200 | struct platform_device s3c_device_i2c = { | |
201 | .name = "s3c2410-i2c", | |
202 | .id = -1, | |
203 | .num_resources = ARRAY_SIZE(s3c_i2c_resource), | |
204 | .resource = s3c_i2c_resource, | |
205 | }; | |
206 | ||
207 | EXPORT_SYMBOL(s3c_device_i2c); | |
208 | ||
209 | /* IIS */ | |
210 | ||
211 | static struct resource s3c_iis_resource[] = { | |
212 | [0] = { | |
213 | .start = S3C2410_PA_IIS, | |
214 | .end = S3C2410_PA_IIS + S3C24XX_SZ_IIS, | |
215 | .flags = IORESOURCE_MEM, | |
216 | } | |
217 | }; | |
218 | ||
219 | static u64 s3c_device_iis_dmamask = 0xffffffffUL; | |
220 | ||
221 | struct platform_device s3c_device_iis = { | |
222 | .name = "s3c2410-iis", | |
223 | .id = -1, | |
224 | .num_resources = ARRAY_SIZE(s3c_iis_resource), | |
225 | .resource = s3c_iis_resource, | |
226 | .dev = { | |
227 | .dma_mask = &s3c_device_iis_dmamask, | |
228 | .coherent_dma_mask = 0xffffffffUL | |
229 | } | |
230 | }; | |
231 | ||
232 | EXPORT_SYMBOL(s3c_device_iis); | |
233 | ||
234 | /* RTC */ | |
235 | ||
236 | static struct resource s3c_rtc_resource[] = { | |
237 | [0] = { | |
238 | .start = S3C2410_PA_RTC, | |
239 | .end = S3C2410_PA_RTC + 0xff, | |
240 | .flags = IORESOURCE_MEM, | |
241 | }, | |
242 | [1] = { | |
243 | .start = IRQ_RTC, | |
244 | .end = IRQ_RTC, | |
245 | .flags = IORESOURCE_IRQ, | |
246 | }, | |
247 | [2] = { | |
248 | .start = IRQ_TICK, | |
249 | .end = IRQ_TICK, | |
250 | .flags = IORESOURCE_IRQ | |
251 | } | |
252 | }; | |
253 | ||
254 | struct platform_device s3c_device_rtc = { | |
255 | .name = "s3c2410-rtc", | |
256 | .id = -1, | |
257 | .num_resources = ARRAY_SIZE(s3c_rtc_resource), | |
258 | .resource = s3c_rtc_resource, | |
259 | }; | |
260 | ||
261 | EXPORT_SYMBOL(s3c_device_rtc); | |
262 | ||
263 | /* ADC */ | |
264 | ||
265 | static struct resource s3c_adc_resource[] = { | |
266 | [0] = { | |
267 | .start = S3C2410_PA_ADC, | |
268 | .end = S3C2410_PA_ADC + S3C24XX_SZ_ADC, | |
269 | .flags = IORESOURCE_MEM, | |
270 | }, | |
271 | [1] = { | |
272 | .start = IRQ_TC, | |
273 | .end = IRQ_ADC, | |
274 | .flags = IORESOURCE_IRQ, | |
275 | } | |
276 | ||
277 | }; | |
278 | ||
279 | struct platform_device s3c_device_adc = { | |
280 | .name = "s3c2410-adc", | |
281 | .id = -1, | |
282 | .num_resources = ARRAY_SIZE(s3c_adc_resource), | |
283 | .resource = s3c_adc_resource, | |
284 | }; | |
285 | ||
286 | /* SDI */ | |
287 | ||
288 | static struct resource s3c_sdi_resource[] = { | |
289 | [0] = { | |
290 | .start = S3C2410_PA_SDI, | |
291 | .end = S3C2410_PA_SDI + S3C24XX_SZ_SDI, | |
292 | .flags = IORESOURCE_MEM, | |
293 | }, | |
294 | [1] = { | |
295 | .start = IRQ_SDI, | |
296 | .end = IRQ_SDI, | |
297 | .flags = IORESOURCE_IRQ, | |
298 | } | |
299 | ||
300 | }; | |
301 | ||
302 | struct platform_device s3c_device_sdi = { | |
303 | .name = "s3c2410-sdi", | |
304 | .id = -1, | |
305 | .num_resources = ARRAY_SIZE(s3c_sdi_resource), | |
306 | .resource = s3c_sdi_resource, | |
307 | }; | |
308 | ||
309 | EXPORT_SYMBOL(s3c_device_sdi); | |
310 | ||
311 | /* SPI (0) */ | |
312 | ||
313 | static struct resource s3c_spi0_resource[] = { | |
314 | [0] = { | |
315 | .start = S3C2410_PA_SPI, | |
316 | .end = S3C2410_PA_SPI + 0x1f, | |
317 | .flags = IORESOURCE_MEM, | |
318 | }, | |
319 | [1] = { | |
320 | .start = IRQ_SPI0, | |
321 | .end = IRQ_SPI0, | |
322 | .flags = IORESOURCE_IRQ, | |
323 | } | |
324 | ||
325 | }; | |
326 | ||
327 | struct platform_device s3c_device_spi0 = { | |
328 | .name = "s3c2410-spi", | |
329 | .id = 0, | |
330 | .num_resources = ARRAY_SIZE(s3c_spi0_resource), | |
331 | .resource = s3c_spi0_resource, | |
332 | }; | |
333 | ||
334 | EXPORT_SYMBOL(s3c_device_spi0); | |
335 | ||
336 | /* SPI (1) */ | |
337 | ||
338 | static struct resource s3c_spi1_resource[] = { | |
339 | [0] = { | |
340 | .start = S3C2410_PA_SPI + 0x20, | |
341 | .end = S3C2410_PA_SPI + 0x20 + 0x1f, | |
342 | .flags = IORESOURCE_MEM, | |
343 | }, | |
344 | [1] = { | |
345 | .start = IRQ_SPI1, | |
346 | .end = IRQ_SPI1, | |
347 | .flags = IORESOURCE_IRQ, | |
348 | } | |
349 | ||
350 | }; | |
351 | ||
352 | struct platform_device s3c_device_spi1 = { | |
353 | .name = "s3c2410-spi", | |
354 | .id = 1, | |
355 | .num_resources = ARRAY_SIZE(s3c_spi1_resource), | |
356 | .resource = s3c_spi1_resource, | |
357 | }; | |
358 | ||
359 | EXPORT_SYMBOL(s3c_device_spi1); | |
360 | ||
361 | /* pwm timer blocks */ | |
362 | ||
363 | static struct resource s3c_timer0_resource[] = { | |
364 | [0] = { | |
365 | .start = S3C2410_PA_TIMER + 0x0C, | |
366 | .end = S3C2410_PA_TIMER + 0x0C + 0xB, | |
367 | .flags = IORESOURCE_MEM, | |
368 | }, | |
369 | [1] = { | |
370 | .start = IRQ_TIMER0, | |
371 | .end = IRQ_TIMER0, | |
372 | .flags = IORESOURCE_IRQ, | |
373 | } | |
374 | ||
375 | }; | |
376 | ||
377 | struct platform_device s3c_device_timer0 = { | |
378 | .name = "s3c2410-timer", | |
379 | .id = 0, | |
380 | .num_resources = ARRAY_SIZE(s3c_timer0_resource), | |
381 | .resource = s3c_timer0_resource, | |
382 | }; | |
383 | ||
384 | EXPORT_SYMBOL(s3c_device_timer0); | |
385 | ||
386 | /* timer 1 */ | |
387 | ||
388 | static struct resource s3c_timer1_resource[] = { | |
389 | [0] = { | |
390 | .start = S3C2410_PA_TIMER + 0x18, | |
391 | .end = S3C2410_PA_TIMER + 0x23, | |
392 | .flags = IORESOURCE_MEM, | |
393 | }, | |
394 | [1] = { | |
395 | .start = IRQ_TIMER1, | |
396 | .end = IRQ_TIMER1, | |
397 | .flags = IORESOURCE_IRQ, | |
398 | } | |
399 | ||
400 | }; | |
401 | ||
402 | struct platform_device s3c_device_timer1 = { | |
403 | .name = "s3c2410-timer", | |
404 | .id = 1, | |
405 | .num_resources = ARRAY_SIZE(s3c_timer1_resource), | |
406 | .resource = s3c_timer1_resource, | |
407 | }; | |
408 | ||
409 | EXPORT_SYMBOL(s3c_device_timer1); | |
410 | ||
411 | /* timer 2 */ | |
412 | ||
413 | static struct resource s3c_timer2_resource[] = { | |
414 | [0] = { | |
415 | .start = S3C2410_PA_TIMER + 0x24, | |
416 | .end = S3C2410_PA_TIMER + 0x2F, | |
417 | .flags = IORESOURCE_MEM, | |
418 | }, | |
419 | [1] = { | |
420 | .start = IRQ_TIMER2, | |
421 | .end = IRQ_TIMER2, | |
422 | .flags = IORESOURCE_IRQ, | |
423 | } | |
424 | ||
425 | }; | |
426 | ||
427 | struct platform_device s3c_device_timer2 = { | |
428 | .name = "s3c2410-timer", | |
429 | .id = 2, | |
430 | .num_resources = ARRAY_SIZE(s3c_timer2_resource), | |
431 | .resource = s3c_timer2_resource, | |
432 | }; | |
433 | ||
434 | EXPORT_SYMBOL(s3c_device_timer2); | |
435 | ||
436 | /* timer 3 */ | |
437 | ||
438 | static struct resource s3c_timer3_resource[] = { | |
439 | [0] = { | |
440 | .start = S3C2410_PA_TIMER + 0x30, | |
441 | .end = S3C2410_PA_TIMER + 0x3B, | |
442 | .flags = IORESOURCE_MEM, | |
443 | }, | |
444 | [1] = { | |
445 | .start = IRQ_TIMER3, | |
446 | .end = IRQ_TIMER3, | |
447 | .flags = IORESOURCE_IRQ, | |
448 | } | |
449 | ||
450 | }; | |
451 | ||
452 | struct platform_device s3c_device_timer3 = { | |
453 | .name = "s3c2410-timer", | |
454 | .id = 3, | |
455 | .num_resources = ARRAY_SIZE(s3c_timer3_resource), | |
456 | .resource = s3c_timer3_resource, | |
457 | }; | |
458 | ||
459 | EXPORT_SYMBOL(s3c_device_timer3); | |
460 | ||
461 | #ifdef CONFIG_CPU_S3C2440 | |
462 | ||
463 | /* Camif Controller */ | |
464 | ||
465 | static struct resource s3c_camif_resource[] = { | |
466 | [0] = { | |
467 | .start = S3C2440_PA_CAMIF, | |
468 | .end = S3C2440_PA_CAMIF + S3C2440_SZ_CAMIF, | |
469 | .flags = IORESOURCE_MEM, | |
470 | }, | |
471 | [1] = { | |
472 | .start = IRQ_CAM, | |
473 | .end = IRQ_CAM, | |
474 | .flags = IORESOURCE_IRQ, | |
475 | } | |
476 | ||
477 | }; | |
478 | ||
479 | static u64 s3c_device_camif_dmamask = 0xffffffffUL; | |
480 | ||
481 | struct platform_device s3c_device_camif = { | |
482 | .name = "s3c2440-camif", | |
483 | .id = -1, | |
484 | .num_resources = ARRAY_SIZE(s3c_camif_resource), | |
485 | .resource = s3c_camif_resource, | |
486 | .dev = { | |
487 | .dma_mask = &s3c_device_camif_dmamask, | |
488 | .coherent_dma_mask = 0xffffffffUL | |
489 | } | |
490 | }; | |
491 | ||
492 | EXPORT_SYMBOL(s3c_device_camif); | |
493 | ||
494 | #endif // CONFIG_CPU_S32440 |