blob: cae35ff76f339b8be674b5f10262cbcc301bed44 [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>
Russell Kingd052d1b2005-10-29 19:07:23 +010020#include <linux/platform_device.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
22#include <asm/mach/arch.h>
23#include <asm/mach/map.h>
24#include <asm/mach/irq.h>
Arnaud Patardf92273c2005-09-09 13:10:10 -070025#include <asm/arch/fb.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070026#include <asm/hardware.h>
27#include <asm/io.h>
28#include <asm/irq.h>
29
30#include <asm/arch/regs-serial.h>
31
32#include "devs.h"
Ben Dooks66a9b492006-06-18 23:04:05 +010033#include "cpu.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070034
35/* Serial port registrations */
36
Ben Dooks66a9b492006-06-18 23:04:05 +010037static struct resource s3c2410_uart0_resource[] = {
38 [0] = {
39 .start = S3C2410_PA_UART0,
40 .end = S3C2410_PA_UART0 + 0x3fff,
41 .flags = IORESOURCE_MEM,
42 },
43 [1] = {
44 .start = IRQ_S3CUART_RX0,
45 .end = IRQ_S3CUART_ERR0,
46 .flags = IORESOURCE_IRQ,
47 }
48};
49
50static struct resource s3c2410_uart1_resource[] = {
51 [0] = {
52 .start = S3C2410_PA_UART1,
53 .end = S3C2410_PA_UART1 + 0x3fff,
54 .flags = IORESOURCE_MEM,
55 },
56 [1] = {
57 .start = IRQ_S3CUART_RX1,
58 .end = IRQ_S3CUART_ERR1,
59 .flags = IORESOURCE_IRQ,
60 }
61};
62
63static struct resource s3c2410_uart2_resource[] = {
64 [0] = {
65 .start = S3C2410_PA_UART2,
66 .end = S3C2410_PA_UART2 + 0x3fff,
67 .flags = IORESOURCE_MEM,
68 },
69 [1] = {
70 .start = IRQ_S3CUART_RX2,
71 .end = IRQ_S3CUART_ERR2,
72 .flags = IORESOURCE_IRQ,
73 }
74};
75
76struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
77 [0] = {
78 .resources = s3c2410_uart0_resource,
79 .nr_resources = ARRAY_SIZE(s3c2410_uart0_resource),
80 },
81 [1] = {
82 .resources = s3c2410_uart1_resource,
83 .nr_resources = ARRAY_SIZE(s3c2410_uart1_resource),
84 },
85 [2] = {
86 .resources = s3c2410_uart2_resource,
87 .nr_resources = ARRAY_SIZE(s3c2410_uart2_resource),
88 },
89};
90
91/* yart devices */
92
93static struct platform_device s3c24xx_uart_device0 = {
94 .id = 0,
95};
96
97static struct platform_device s3c24xx_uart_device1 = {
98 .id = 1,
99};
100
101static struct platform_device s3c24xx_uart_device2 = {
102 .id = 2,
103};
104
105struct platform_device *s3c24xx_uart_src[3] = {
106 &s3c24xx_uart_device0,
107 &s3c24xx_uart_device1,
108 &s3c24xx_uart_device2,
109};
110
111struct platform_device *s3c24xx_uart_devs[3] = {
112};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113
114/* USB Host Controller */
115
116static struct resource s3c_usb_resource[] = {
117 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000118 .start = S3C24XX_PA_USBHOST,
119 .end = S3C24XX_PA_USBHOST + S3C24XX_SZ_USBHOST - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120 .flags = IORESOURCE_MEM,
121 },
122 [1] = {
123 .start = IRQ_USBH,
124 .end = IRQ_USBH,
125 .flags = IORESOURCE_IRQ,
126 }
127};
128
129static u64 s3c_device_usb_dmamask = 0xffffffffUL;
130
131struct platform_device s3c_device_usb = {
132 .name = "s3c2410-ohci",
133 .id = -1,
134 .num_resources = ARRAY_SIZE(s3c_usb_resource),
135 .resource = s3c_usb_resource,
136 .dev = {
137 .dma_mask = &s3c_device_usb_dmamask,
138 .coherent_dma_mask = 0xffffffffUL
139 }
140};
141
142EXPORT_SYMBOL(s3c_device_usb);
143
144/* LCD Controller */
145
146static struct resource s3c_lcd_resource[] = {
147 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000148 .start = S3C24XX_PA_LCD,
149 .end = S3C24XX_PA_LCD + S3C24XX_SZ_LCD - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150 .flags = IORESOURCE_MEM,
151 },
152 [1] = {
153 .start = IRQ_LCD,
154 .end = IRQ_LCD,
155 .flags = IORESOURCE_IRQ,
156 }
157
158};
159
160static u64 s3c_device_lcd_dmamask = 0xffffffffUL;
161
162struct platform_device s3c_device_lcd = {
163 .name = "s3c2410-lcd",
164 .id = -1,
165 .num_resources = ARRAY_SIZE(s3c_lcd_resource),
166 .resource = s3c_lcd_resource,
167 .dev = {
Ben Dooks6904b242005-06-29 11:09:15 +0100168 .dma_mask = &s3c_device_lcd_dmamask,
169 .coherent_dma_mask = 0xffffffffUL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170 }
171};
172
173EXPORT_SYMBOL(s3c_device_lcd);
174
Ben Dooks893b0302005-10-28 15:31:45 +0100175void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
Arnaud Patardf92273c2005-09-09 13:10:10 -0700176{
Ben Dooks893b0302005-10-28 15:31:45 +0100177 struct s3c2410fb_mach_info *npd;
178
179 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
180 if (npd) {
181 memcpy(npd, pd, sizeof(*npd));
182 s3c_device_lcd.dev.platform_data = npd;
183 } else {
184 printk(KERN_ERR "no memory for LCD platform data\n");
185 }
Arnaud Patardf92273c2005-09-09 13:10:10 -0700186}
Arnaud Patardf92273c2005-09-09 13:10:10 -0700187
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188/* NAND Controller */
189
190static struct resource s3c_nand_resource[] = {
191 [0] = {
192 .start = S3C2410_PA_NAND,
Ben Dooksa0e0adb2005-10-28 15:26:42 +0100193 .end = S3C2410_PA_NAND + S3C24XX_SZ_NAND - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700194 .flags = IORESOURCE_MEM,
195 }
196};
197
198struct platform_device s3c_device_nand = {
199 .name = "s3c2410-nand",
200 .id = -1,
201 .num_resources = ARRAY_SIZE(s3c_nand_resource),
202 .resource = s3c_nand_resource,
203};
204
205EXPORT_SYMBOL(s3c_device_nand);
206
207/* USB Device (Gadget)*/
208
209static struct resource s3c_usbgadget_resource[] = {
210 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000211 .start = S3C24XX_PA_USBDEV,
212 .end = S3C24XX_PA_USBDEV + S3C24XX_SZ_USBDEV - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213 .flags = IORESOURCE_MEM,
214 },
215 [1] = {
216 .start = IRQ_USBD,
217 .end = IRQ_USBD,
218 .flags = IORESOURCE_IRQ,
219 }
220
221};
222
223struct platform_device s3c_device_usbgadget = {
224 .name = "s3c2410-usbgadget",
225 .id = -1,
226 .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
227 .resource = s3c_usbgadget_resource,
228};
229
230EXPORT_SYMBOL(s3c_device_usbgadget);
231
232/* Watchdog */
233
234static struct resource s3c_wdt_resource[] = {
235 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000236 .start = S3C24XX_PA_WATCHDOG,
237 .end = S3C24XX_PA_WATCHDOG + S3C24XX_SZ_WATCHDOG - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238 .flags = IORESOURCE_MEM,
239 },
240 [1] = {
241 .start = IRQ_WDT,
242 .end = IRQ_WDT,
243 .flags = IORESOURCE_IRQ,
244 }
245
246};
247
248struct platform_device s3c_device_wdt = {
249 .name = "s3c2410-wdt",
250 .id = -1,
251 .num_resources = ARRAY_SIZE(s3c_wdt_resource),
252 .resource = s3c_wdt_resource,
253};
254
255EXPORT_SYMBOL(s3c_device_wdt);
256
257/* I2C */
258
259static struct resource s3c_i2c_resource[] = {
260 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000261 .start = S3C24XX_PA_IIC,
262 .end = S3C24XX_PA_IIC + S3C24XX_SZ_IIC - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700263 .flags = IORESOURCE_MEM,
264 },
265 [1] = {
266 .start = IRQ_IIC,
267 .end = IRQ_IIC,
268 .flags = IORESOURCE_IRQ,
269 }
270
271};
272
273struct platform_device s3c_device_i2c = {
274 .name = "s3c2410-i2c",
275 .id = -1,
276 .num_resources = ARRAY_SIZE(s3c_i2c_resource),
277 .resource = s3c_i2c_resource,
278};
279
280EXPORT_SYMBOL(s3c_device_i2c);
281
282/* IIS */
283
284static struct resource s3c_iis_resource[] = {
285 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000286 .start = S3C24XX_PA_IIS,
287 .end = S3C24XX_PA_IIS + S3C24XX_SZ_IIS -1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700288 .flags = IORESOURCE_MEM,
289 }
290};
291
292static u64 s3c_device_iis_dmamask = 0xffffffffUL;
293
294struct platform_device s3c_device_iis = {
295 .name = "s3c2410-iis",
296 .id = -1,
297 .num_resources = ARRAY_SIZE(s3c_iis_resource),
298 .resource = s3c_iis_resource,
299 .dev = {
300 .dma_mask = &s3c_device_iis_dmamask,
301 .coherent_dma_mask = 0xffffffffUL
302 }
303};
304
305EXPORT_SYMBOL(s3c_device_iis);
306
307/* RTC */
308
309static struct resource s3c_rtc_resource[] = {
310 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000311 .start = S3C24XX_PA_RTC,
312 .end = S3C24XX_PA_RTC + 0xff,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700313 .flags = IORESOURCE_MEM,
314 },
315 [1] = {
316 .start = IRQ_RTC,
317 .end = IRQ_RTC,
318 .flags = IORESOURCE_IRQ,
319 },
320 [2] = {
321 .start = IRQ_TICK,
322 .end = IRQ_TICK,
323 .flags = IORESOURCE_IRQ
324 }
325};
326
327struct platform_device s3c_device_rtc = {
328 .name = "s3c2410-rtc",
329 .id = -1,
330 .num_resources = ARRAY_SIZE(s3c_rtc_resource),
331 .resource = s3c_rtc_resource,
332};
333
334EXPORT_SYMBOL(s3c_device_rtc);
335
336/* ADC */
337
338static struct resource s3c_adc_resource[] = {
339 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000340 .start = S3C24XX_PA_ADC,
341 .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700342 .flags = IORESOURCE_MEM,
343 },
344 [1] = {
345 .start = IRQ_TC,
Ben Dooks083d06e2006-02-08 22:03:31 +0000346 .end = IRQ_TC,
347 .flags = IORESOURCE_IRQ,
348 },
349 [2] = {
350 .start = IRQ_ADC,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351 .end = IRQ_ADC,
352 .flags = IORESOURCE_IRQ,
353 }
354
355};
356
357struct platform_device s3c_device_adc = {
358 .name = "s3c2410-adc",
359 .id = -1,
360 .num_resources = ARRAY_SIZE(s3c_adc_resource),
361 .resource = s3c_adc_resource,
362};
363
364/* SDI */
365
366static struct resource s3c_sdi_resource[] = {
367 [0] = {
368 .start = S3C2410_PA_SDI,
Ben Dooksa0e0adb2005-10-28 15:26:42 +0100369 .end = S3C2410_PA_SDI + S3C24XX_SZ_SDI - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700370 .flags = IORESOURCE_MEM,
371 },
372 [1] = {
373 .start = IRQ_SDI,
374 .end = IRQ_SDI,
375 .flags = IORESOURCE_IRQ,
376 }
377
378};
379
380struct platform_device s3c_device_sdi = {
381 .name = "s3c2410-sdi",
382 .id = -1,
383 .num_resources = ARRAY_SIZE(s3c_sdi_resource),
384 .resource = s3c_sdi_resource,
385};
386
387EXPORT_SYMBOL(s3c_device_sdi);
388
389/* SPI (0) */
390
391static struct resource s3c_spi0_resource[] = {
392 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000393 .start = S3C24XX_PA_SPI,
394 .end = S3C24XX_PA_SPI + 0x1f,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700395 .flags = IORESOURCE_MEM,
396 },
397 [1] = {
398 .start = IRQ_SPI0,
399 .end = IRQ_SPI0,
400 .flags = IORESOURCE_IRQ,
401 }
402
403};
404
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000405static u64 s3c_device_spi0_dmamask = 0xffffffffUL;
406
Linus Torvalds1da177e2005-04-16 15:20:36 -0700407struct platform_device s3c_device_spi0 = {
408 .name = "s3c2410-spi",
409 .id = 0,
410 .num_resources = ARRAY_SIZE(s3c_spi0_resource),
411 .resource = s3c_spi0_resource,
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000412 .dev = {
413 .dma_mask = &s3c_device_spi0_dmamask,
414 .coherent_dma_mask = 0xffffffffUL
415 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700416};
417
418EXPORT_SYMBOL(s3c_device_spi0);
419
420/* SPI (1) */
421
422static struct resource s3c_spi1_resource[] = {
423 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000424 .start = S3C24XX_PA_SPI + 0x20,
425 .end = S3C24XX_PA_SPI + 0x20 + 0x1f,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700426 .flags = IORESOURCE_MEM,
427 },
428 [1] = {
429 .start = IRQ_SPI1,
430 .end = IRQ_SPI1,
431 .flags = IORESOURCE_IRQ,
432 }
433
434};
435
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000436static u64 s3c_device_spi1_dmamask = 0xffffffffUL;
437
Linus Torvalds1da177e2005-04-16 15:20:36 -0700438struct platform_device s3c_device_spi1 = {
439 .name = "s3c2410-spi",
440 .id = 1,
441 .num_resources = ARRAY_SIZE(s3c_spi1_resource),
442 .resource = s3c_spi1_resource,
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000443 .dev = {
444 .dma_mask = &s3c_device_spi1_dmamask,
445 .coherent_dma_mask = 0xffffffffUL
446 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700447};
448
449EXPORT_SYMBOL(s3c_device_spi1);
450
451/* pwm timer blocks */
452
453static struct resource s3c_timer0_resource[] = {
454 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000455 .start = S3C24XX_PA_TIMER + 0x0C,
456 .end = S3C24XX_PA_TIMER + 0x0C + 0xB,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700457 .flags = IORESOURCE_MEM,
458 },
459 [1] = {
460 .start = IRQ_TIMER0,
461 .end = IRQ_TIMER0,
462 .flags = IORESOURCE_IRQ,
463 }
464
465};
466
467struct platform_device s3c_device_timer0 = {
468 .name = "s3c2410-timer",
469 .id = 0,
470 .num_resources = ARRAY_SIZE(s3c_timer0_resource),
471 .resource = s3c_timer0_resource,
472};
473
474EXPORT_SYMBOL(s3c_device_timer0);
475
476/* timer 1 */
477
478static struct resource s3c_timer1_resource[] = {
479 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000480 .start = S3C24XX_PA_TIMER + 0x18,
481 .end = S3C24XX_PA_TIMER + 0x23,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700482 .flags = IORESOURCE_MEM,
483 },
484 [1] = {
485 .start = IRQ_TIMER1,
486 .end = IRQ_TIMER1,
487 .flags = IORESOURCE_IRQ,
488 }
489
490};
491
492struct platform_device s3c_device_timer1 = {
493 .name = "s3c2410-timer",
494 .id = 1,
495 .num_resources = ARRAY_SIZE(s3c_timer1_resource),
496 .resource = s3c_timer1_resource,
497};
498
499EXPORT_SYMBOL(s3c_device_timer1);
500
501/* timer 2 */
502
503static struct resource s3c_timer2_resource[] = {
504 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000505 .start = S3C24XX_PA_TIMER + 0x24,
506 .end = S3C24XX_PA_TIMER + 0x2F,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700507 .flags = IORESOURCE_MEM,
508 },
509 [1] = {
510 .start = IRQ_TIMER2,
511 .end = IRQ_TIMER2,
512 .flags = IORESOURCE_IRQ,
513 }
514
515};
516
517struct platform_device s3c_device_timer2 = {
518 .name = "s3c2410-timer",
519 .id = 2,
520 .num_resources = ARRAY_SIZE(s3c_timer2_resource),
521 .resource = s3c_timer2_resource,
522};
523
524EXPORT_SYMBOL(s3c_device_timer2);
525
526/* timer 3 */
527
528static struct resource s3c_timer3_resource[] = {
529 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000530 .start = S3C24XX_PA_TIMER + 0x30,
531 .end = S3C24XX_PA_TIMER + 0x3B,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700532 .flags = IORESOURCE_MEM,
533 },
534 [1] = {
535 .start = IRQ_TIMER3,
536 .end = IRQ_TIMER3,
537 .flags = IORESOURCE_IRQ,
538 }
539
540};
541
542struct platform_device s3c_device_timer3 = {
543 .name = "s3c2410-timer",
544 .id = 3,
545 .num_resources = ARRAY_SIZE(s3c_timer3_resource),
546 .resource = s3c_timer3_resource,
547};
548
549EXPORT_SYMBOL(s3c_device_timer3);
550
551#ifdef CONFIG_CPU_S3C2440
552
553/* Camif Controller */
554
555static struct resource s3c_camif_resource[] = {
556 [0] = {
557 .start = S3C2440_PA_CAMIF,
Ben Dooksa0e0adb2005-10-28 15:26:42 +0100558 .end = S3C2440_PA_CAMIF + S3C2440_SZ_CAMIF - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700559 .flags = IORESOURCE_MEM,
560 },
561 [1] = {
562 .start = IRQ_CAM,
563 .end = IRQ_CAM,
564 .flags = IORESOURCE_IRQ,
565 }
566
567};
568
569static u64 s3c_device_camif_dmamask = 0xffffffffUL;
570
571struct platform_device s3c_device_camif = {
572 .name = "s3c2440-camif",
573 .id = -1,
574 .num_resources = ARRAY_SIZE(s3c_camif_resource),
575 .resource = s3c_camif_resource,
576 .dev = {
577 .dma_mask = &s3c_device_camif_dmamask,
578 .coherent_dma_mask = 0xffffffffUL
579 }
580};
581
582EXPORT_SYMBOL(s3c_device_camif);
583
584#endif // CONFIG_CPU_S32440