blob: faccde2092d2f353617e61893218c50a263ab22c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* linux/arch/arm/mach-s3c2410/devs.c
2 *
3 * Copyright (c) 2004 Simtec Electronics
Ben Dooks916a0022006-09-06 19:03:21 +01004 * Ben Dooks <ben@simtec.co.uk>
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 *
Ben Dooks916a0022006-09-06 19:03:21 +01006 * Base S3C24XX platform device definitions
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 *
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 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070012*/
13
14#include <linux/kernel.h>
15#include <linux/types.h>
16#include <linux/interrupt.h>
17#include <linux/list.h>
18#include <linux/timer.h>
19#include <linux/init.h>
Ben Dooksb6d1f542006-12-17 23:22:26 +010020#include <linux/serial_core.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010021#include <linux/platform_device.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070022
23#include <asm/mach/arch.h>
24#include <asm/mach/map.h>
25#include <asm/mach/irq.h>
Arnaud Patardf92273c2005-09-09 13:10:10 -070026#include <asm/arch/fb.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070027#include <asm/hardware.h>
28#include <asm/io.h>
29#include <asm/irq.h>
30
31#include <asm/arch/regs-serial.h>
32
33#include "devs.h"
Ben Dooks66a9b492006-06-18 23:04:05 +010034#include "cpu.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070035
36/* Serial port registrations */
37
Ben Dooks66a9b492006-06-18 23:04:05 +010038static struct resource s3c2410_uart0_resource[] = {
39 [0] = {
40 .start = S3C2410_PA_UART0,
41 .end = S3C2410_PA_UART0 + 0x3fff,
42 .flags = IORESOURCE_MEM,
43 },
44 [1] = {
45 .start = IRQ_S3CUART_RX0,
46 .end = IRQ_S3CUART_ERR0,
47 .flags = IORESOURCE_IRQ,
48 }
49};
50
51static struct resource s3c2410_uart1_resource[] = {
52 [0] = {
53 .start = S3C2410_PA_UART1,
54 .end = S3C2410_PA_UART1 + 0x3fff,
55 .flags = IORESOURCE_MEM,
56 },
57 [1] = {
58 .start = IRQ_S3CUART_RX1,
59 .end = IRQ_S3CUART_ERR1,
60 .flags = IORESOURCE_IRQ,
61 }
62};
63
64static struct resource s3c2410_uart2_resource[] = {
65 [0] = {
66 .start = S3C2410_PA_UART2,
67 .end = S3C2410_PA_UART2 + 0x3fff,
68 .flags = IORESOURCE_MEM,
69 },
70 [1] = {
71 .start = IRQ_S3CUART_RX2,
72 .end = IRQ_S3CUART_ERR2,
73 .flags = IORESOURCE_IRQ,
74 }
75};
76
77struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
78 [0] = {
79 .resources = s3c2410_uart0_resource,
80 .nr_resources = ARRAY_SIZE(s3c2410_uart0_resource),
81 },
82 [1] = {
83 .resources = s3c2410_uart1_resource,
84 .nr_resources = ARRAY_SIZE(s3c2410_uart1_resource),
85 },
86 [2] = {
87 .resources = s3c2410_uart2_resource,
88 .nr_resources = ARRAY_SIZE(s3c2410_uart2_resource),
89 },
90};
91
92/* yart devices */
93
94static struct platform_device s3c24xx_uart_device0 = {
95 .id = 0,
96};
97
98static struct platform_device s3c24xx_uart_device1 = {
99 .id = 1,
100};
101
102static struct platform_device s3c24xx_uart_device2 = {
103 .id = 2,
104};
105
106struct platform_device *s3c24xx_uart_src[3] = {
107 &s3c24xx_uart_device0,
108 &s3c24xx_uart_device1,
109 &s3c24xx_uart_device2,
110};
111
112struct platform_device *s3c24xx_uart_devs[3] = {
113};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114
115/* USB Host Controller */
116
117static struct resource s3c_usb_resource[] = {
118 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000119 .start = S3C24XX_PA_USBHOST,
120 .end = S3C24XX_PA_USBHOST + S3C24XX_SZ_USBHOST - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121 .flags = IORESOURCE_MEM,
122 },
123 [1] = {
124 .start = IRQ_USBH,
125 .end = IRQ_USBH,
126 .flags = IORESOURCE_IRQ,
127 }
128};
129
130static u64 s3c_device_usb_dmamask = 0xffffffffUL;
131
132struct platform_device s3c_device_usb = {
133 .name = "s3c2410-ohci",
134 .id = -1,
135 .num_resources = ARRAY_SIZE(s3c_usb_resource),
136 .resource = s3c_usb_resource,
137 .dev = {
138 .dma_mask = &s3c_device_usb_dmamask,
139 .coherent_dma_mask = 0xffffffffUL
140 }
141};
142
143EXPORT_SYMBOL(s3c_device_usb);
144
145/* LCD Controller */
146
147static struct resource s3c_lcd_resource[] = {
148 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000149 .start = S3C24XX_PA_LCD,
150 .end = S3C24XX_PA_LCD + S3C24XX_SZ_LCD - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151 .flags = IORESOURCE_MEM,
152 },
153 [1] = {
154 .start = IRQ_LCD,
155 .end = IRQ_LCD,
156 .flags = IORESOURCE_IRQ,
157 }
158
159};
160
161static u64 s3c_device_lcd_dmamask = 0xffffffffUL;
162
163struct platform_device s3c_device_lcd = {
164 .name = "s3c2410-lcd",
165 .id = -1,
166 .num_resources = ARRAY_SIZE(s3c_lcd_resource),
167 .resource = s3c_lcd_resource,
168 .dev = {
Ben Dooks6904b242005-06-29 11:09:15 +0100169 .dma_mask = &s3c_device_lcd_dmamask,
170 .coherent_dma_mask = 0xffffffffUL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171 }
172};
173
174EXPORT_SYMBOL(s3c_device_lcd);
175
Ben Dooks893b0302005-10-28 15:31:45 +0100176void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
Arnaud Patardf92273c2005-09-09 13:10:10 -0700177{
Ben Dooks893b0302005-10-28 15:31:45 +0100178 struct s3c2410fb_mach_info *npd;
179
180 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
181 if (npd) {
182 memcpy(npd, pd, sizeof(*npd));
183 s3c_device_lcd.dev.platform_data = npd;
184 } else {
185 printk(KERN_ERR "no memory for LCD platform data\n");
186 }
Arnaud Patardf92273c2005-09-09 13:10:10 -0700187}
Arnaud Patardf92273c2005-09-09 13:10:10 -0700188
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189/* NAND Controller */
190
191static struct resource s3c_nand_resource[] = {
192 [0] = {
193 .start = S3C2410_PA_NAND,
Ben Dooksa0e0adb2005-10-28 15:26:42 +0100194 .end = S3C2410_PA_NAND + S3C24XX_SZ_NAND - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700195 .flags = IORESOURCE_MEM,
196 }
197};
198
199struct platform_device s3c_device_nand = {
200 .name = "s3c2410-nand",
201 .id = -1,
202 .num_resources = ARRAY_SIZE(s3c_nand_resource),
203 .resource = s3c_nand_resource,
204};
205
206EXPORT_SYMBOL(s3c_device_nand);
207
208/* USB Device (Gadget)*/
209
210static struct resource s3c_usbgadget_resource[] = {
211 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000212 .start = S3C24XX_PA_USBDEV,
213 .end = S3C24XX_PA_USBDEV + S3C24XX_SZ_USBDEV - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214 .flags = IORESOURCE_MEM,
215 },
216 [1] = {
217 .start = IRQ_USBD,
218 .end = IRQ_USBD,
219 .flags = IORESOURCE_IRQ,
220 }
221
222};
223
224struct platform_device s3c_device_usbgadget = {
225 .name = "s3c2410-usbgadget",
226 .id = -1,
227 .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
228 .resource = s3c_usbgadget_resource,
229};
230
231EXPORT_SYMBOL(s3c_device_usbgadget);
232
233/* Watchdog */
234
235static struct resource s3c_wdt_resource[] = {
236 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000237 .start = S3C24XX_PA_WATCHDOG,
238 .end = S3C24XX_PA_WATCHDOG + S3C24XX_SZ_WATCHDOG - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239 .flags = IORESOURCE_MEM,
240 },
241 [1] = {
242 .start = IRQ_WDT,
243 .end = IRQ_WDT,
244 .flags = IORESOURCE_IRQ,
245 }
246
247};
248
249struct platform_device s3c_device_wdt = {
250 .name = "s3c2410-wdt",
251 .id = -1,
252 .num_resources = ARRAY_SIZE(s3c_wdt_resource),
253 .resource = s3c_wdt_resource,
254};
255
256EXPORT_SYMBOL(s3c_device_wdt);
257
258/* I2C */
259
260static struct resource s3c_i2c_resource[] = {
261 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000262 .start = S3C24XX_PA_IIC,
263 .end = S3C24XX_PA_IIC + S3C24XX_SZ_IIC - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264 .flags = IORESOURCE_MEM,
265 },
266 [1] = {
267 .start = IRQ_IIC,
268 .end = IRQ_IIC,
269 .flags = IORESOURCE_IRQ,
270 }
271
272};
273
274struct platform_device s3c_device_i2c = {
275 .name = "s3c2410-i2c",
276 .id = -1,
277 .num_resources = ARRAY_SIZE(s3c_i2c_resource),
278 .resource = s3c_i2c_resource,
279};
280
281EXPORT_SYMBOL(s3c_device_i2c);
282
283/* IIS */
284
285static struct resource s3c_iis_resource[] = {
286 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000287 .start = S3C24XX_PA_IIS,
288 .end = S3C24XX_PA_IIS + S3C24XX_SZ_IIS -1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700289 .flags = IORESOURCE_MEM,
290 }
291};
292
293static u64 s3c_device_iis_dmamask = 0xffffffffUL;
294
295struct platform_device s3c_device_iis = {
296 .name = "s3c2410-iis",
297 .id = -1,
298 .num_resources = ARRAY_SIZE(s3c_iis_resource),
299 .resource = s3c_iis_resource,
300 .dev = {
301 .dma_mask = &s3c_device_iis_dmamask,
302 .coherent_dma_mask = 0xffffffffUL
303 }
304};
305
306EXPORT_SYMBOL(s3c_device_iis);
307
308/* RTC */
309
310static struct resource s3c_rtc_resource[] = {
311 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000312 .start = S3C24XX_PA_RTC,
313 .end = S3C24XX_PA_RTC + 0xff,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700314 .flags = IORESOURCE_MEM,
315 },
316 [1] = {
317 .start = IRQ_RTC,
318 .end = IRQ_RTC,
319 .flags = IORESOURCE_IRQ,
320 },
321 [2] = {
322 .start = IRQ_TICK,
323 .end = IRQ_TICK,
324 .flags = IORESOURCE_IRQ
325 }
326};
327
328struct platform_device s3c_device_rtc = {
329 .name = "s3c2410-rtc",
330 .id = -1,
331 .num_resources = ARRAY_SIZE(s3c_rtc_resource),
332 .resource = s3c_rtc_resource,
333};
334
335EXPORT_SYMBOL(s3c_device_rtc);
336
337/* ADC */
338
339static struct resource s3c_adc_resource[] = {
340 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000341 .start = S3C24XX_PA_ADC,
342 .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700343 .flags = IORESOURCE_MEM,
344 },
345 [1] = {
346 .start = IRQ_TC,
Ben Dooks083d06e2006-02-08 22:03:31 +0000347 .end = IRQ_TC,
348 .flags = IORESOURCE_IRQ,
349 },
350 [2] = {
351 .start = IRQ_ADC,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700352 .end = IRQ_ADC,
353 .flags = IORESOURCE_IRQ,
354 }
355
356};
357
358struct platform_device s3c_device_adc = {
359 .name = "s3c2410-adc",
360 .id = -1,
361 .num_resources = ARRAY_SIZE(s3c_adc_resource),
362 .resource = s3c_adc_resource,
363};
364
365/* SDI */
366
367static struct resource s3c_sdi_resource[] = {
368 [0] = {
369 .start = S3C2410_PA_SDI,
Ben Dooksa0e0adb2005-10-28 15:26:42 +0100370 .end = S3C2410_PA_SDI + S3C24XX_SZ_SDI - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700371 .flags = IORESOURCE_MEM,
372 },
373 [1] = {
374 .start = IRQ_SDI,
375 .end = IRQ_SDI,
376 .flags = IORESOURCE_IRQ,
377 }
378
379};
380
381struct platform_device s3c_device_sdi = {
382 .name = "s3c2410-sdi",
383 .id = -1,
384 .num_resources = ARRAY_SIZE(s3c_sdi_resource),
385 .resource = s3c_sdi_resource,
386};
387
388EXPORT_SYMBOL(s3c_device_sdi);
389
390/* SPI (0) */
391
392static struct resource s3c_spi0_resource[] = {
393 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000394 .start = S3C24XX_PA_SPI,
395 .end = S3C24XX_PA_SPI + 0x1f,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700396 .flags = IORESOURCE_MEM,
397 },
398 [1] = {
399 .start = IRQ_SPI0,
400 .end = IRQ_SPI0,
401 .flags = IORESOURCE_IRQ,
402 }
403
404};
405
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000406static u64 s3c_device_spi0_dmamask = 0xffffffffUL;
407
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408struct platform_device s3c_device_spi0 = {
409 .name = "s3c2410-spi",
410 .id = 0,
411 .num_resources = ARRAY_SIZE(s3c_spi0_resource),
412 .resource = s3c_spi0_resource,
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000413 .dev = {
414 .dma_mask = &s3c_device_spi0_dmamask,
415 .coherent_dma_mask = 0xffffffffUL
416 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700417};
418
419EXPORT_SYMBOL(s3c_device_spi0);
420
421/* SPI (1) */
422
423static struct resource s3c_spi1_resource[] = {
424 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000425 .start = S3C24XX_PA_SPI + 0x20,
426 .end = S3C24XX_PA_SPI + 0x20 + 0x1f,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700427 .flags = IORESOURCE_MEM,
428 },
429 [1] = {
430 .start = IRQ_SPI1,
431 .end = IRQ_SPI1,
432 .flags = IORESOURCE_IRQ,
433 }
434
435};
436
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000437static u64 s3c_device_spi1_dmamask = 0xffffffffUL;
438
Linus Torvalds1da177e2005-04-16 15:20:36 -0700439struct platform_device s3c_device_spi1 = {
440 .name = "s3c2410-spi",
441 .id = 1,
442 .num_resources = ARRAY_SIZE(s3c_spi1_resource),
443 .resource = s3c_spi1_resource,
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000444 .dev = {
445 .dma_mask = &s3c_device_spi1_dmamask,
446 .coherent_dma_mask = 0xffffffffUL
447 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700448};
449
450EXPORT_SYMBOL(s3c_device_spi1);
451
452/* pwm timer blocks */
453
454static struct resource s3c_timer0_resource[] = {
455 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000456 .start = S3C24XX_PA_TIMER + 0x0C,
457 .end = S3C24XX_PA_TIMER + 0x0C + 0xB,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700458 .flags = IORESOURCE_MEM,
459 },
460 [1] = {
461 .start = IRQ_TIMER0,
462 .end = IRQ_TIMER0,
463 .flags = IORESOURCE_IRQ,
464 }
465
466};
467
468struct platform_device s3c_device_timer0 = {
469 .name = "s3c2410-timer",
470 .id = 0,
471 .num_resources = ARRAY_SIZE(s3c_timer0_resource),
472 .resource = s3c_timer0_resource,
473};
474
475EXPORT_SYMBOL(s3c_device_timer0);
476
477/* timer 1 */
478
479static struct resource s3c_timer1_resource[] = {
480 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000481 .start = S3C24XX_PA_TIMER + 0x18,
482 .end = S3C24XX_PA_TIMER + 0x23,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700483 .flags = IORESOURCE_MEM,
484 },
485 [1] = {
486 .start = IRQ_TIMER1,
487 .end = IRQ_TIMER1,
488 .flags = IORESOURCE_IRQ,
489 }
490
491};
492
493struct platform_device s3c_device_timer1 = {
494 .name = "s3c2410-timer",
495 .id = 1,
496 .num_resources = ARRAY_SIZE(s3c_timer1_resource),
497 .resource = s3c_timer1_resource,
498};
499
500EXPORT_SYMBOL(s3c_device_timer1);
501
502/* timer 2 */
503
504static struct resource s3c_timer2_resource[] = {
505 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000506 .start = S3C24XX_PA_TIMER + 0x24,
507 .end = S3C24XX_PA_TIMER + 0x2F,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700508 .flags = IORESOURCE_MEM,
509 },
510 [1] = {
511 .start = IRQ_TIMER2,
512 .end = IRQ_TIMER2,
513 .flags = IORESOURCE_IRQ,
514 }
515
516};
517
518struct platform_device s3c_device_timer2 = {
519 .name = "s3c2410-timer",
520 .id = 2,
521 .num_resources = ARRAY_SIZE(s3c_timer2_resource),
522 .resource = s3c_timer2_resource,
523};
524
525EXPORT_SYMBOL(s3c_device_timer2);
526
527/* timer 3 */
528
529static struct resource s3c_timer3_resource[] = {
530 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000531 .start = S3C24XX_PA_TIMER + 0x30,
532 .end = S3C24XX_PA_TIMER + 0x3B,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700533 .flags = IORESOURCE_MEM,
534 },
535 [1] = {
536 .start = IRQ_TIMER3,
537 .end = IRQ_TIMER3,
538 .flags = IORESOURCE_IRQ,
539 }
540
541};
542
543struct platform_device s3c_device_timer3 = {
544 .name = "s3c2410-timer",
545 .id = 3,
546 .num_resources = ARRAY_SIZE(s3c_timer3_resource),
547 .resource = s3c_timer3_resource,
548};
549
550EXPORT_SYMBOL(s3c_device_timer3);
551
552#ifdef CONFIG_CPU_S3C2440
553
554/* Camif Controller */
555
556static struct resource s3c_camif_resource[] = {
557 [0] = {
558 .start = S3C2440_PA_CAMIF,
Ben Dooksa0e0adb2005-10-28 15:26:42 +0100559 .end = S3C2440_PA_CAMIF + S3C2440_SZ_CAMIF - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700560 .flags = IORESOURCE_MEM,
561 },
562 [1] = {
563 .start = IRQ_CAM,
564 .end = IRQ_CAM,
565 .flags = IORESOURCE_IRQ,
566 }
567
568};
569
570static u64 s3c_device_camif_dmamask = 0xffffffffUL;
571
572struct platform_device s3c_device_camif = {
573 .name = "s3c2440-camif",
574 .id = -1,
575 .num_resources = ARRAY_SIZE(s3c_camif_resource),
576 .resource = s3c_camif_resource,
577 .dev = {
578 .dma_mask = &s3c_device_camif_dmamask,
579 .coherent_dma_mask = 0xffffffffUL
580 }
581};
582
583EXPORT_SYMBOL(s3c_device_camif);
584
585#endif // CONFIG_CPU_S32440