1 /* linux/arch/arm/mach-s3c2410/devs.c
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
6 * Base S3C24XX platform device definitions
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.
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>
20 #include <linux/platform_device.h>
22 #include <asm/mach/arch.h>
23 #include <asm/mach/map.h>
24 #include <asm/mach/irq.h>
25 #include <asm/arch/fb.h>
26 #include <asm/hardware.h>
30 #include <asm/arch/regs-serial.h>
35 /* Serial port registrations */
37 static struct resource s3c2410_uart0_resource[] = {
39 .start = S3C2410_PA_UART0,
40 .end = S3C2410_PA_UART0 + 0x3fff,
41 .flags = IORESOURCE_MEM,
44 .start = IRQ_S3CUART_RX0,
45 .end = IRQ_S3CUART_ERR0,
46 .flags = IORESOURCE_IRQ,
50 static struct resource s3c2410_uart1_resource[] = {
52 .start = S3C2410_PA_UART1,
53 .end = S3C2410_PA_UART1 + 0x3fff,
54 .flags = IORESOURCE_MEM,
57 .start = IRQ_S3CUART_RX1,
58 .end = IRQ_S3CUART_ERR1,
59 .flags = IORESOURCE_IRQ,
63 static struct resource s3c2410_uart2_resource[] = {
65 .start = S3C2410_PA_UART2,
66 .end = S3C2410_PA_UART2 + 0x3fff,
67 .flags = IORESOURCE_MEM,
70 .start = IRQ_S3CUART_RX2,
71 .end = IRQ_S3CUART_ERR2,
72 .flags = IORESOURCE_IRQ,
76 struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
78 .resources = s3c2410_uart0_resource,
79 .nr_resources = ARRAY_SIZE(s3c2410_uart0_resource),
82 .resources = s3c2410_uart1_resource,
83 .nr_resources = ARRAY_SIZE(s3c2410_uart1_resource),
86 .resources = s3c2410_uart2_resource,
87 .nr_resources = ARRAY_SIZE(s3c2410_uart2_resource),
93 static struct platform_device s3c24xx_uart_device0 = {
97 static struct platform_device s3c24xx_uart_device1 = {
101 static struct platform_device s3c24xx_uart_device2 = {
105 struct platform_device *s3c24xx_uart_src[3] = {
106 &s3c24xx_uart_device0,
107 &s3c24xx_uart_device1,
108 &s3c24xx_uart_device2,
111 struct platform_device *s3c24xx_uart_devs[3] = {
114 /* USB Host Controller */
116 static struct resource s3c_usb_resource[] = {
118 .start = S3C24XX_PA_USBHOST,
119 .end = S3C24XX_PA_USBHOST + S3C24XX_SZ_USBHOST - 1,
120 .flags = IORESOURCE_MEM,
125 .flags = IORESOURCE_IRQ,
129 static u64 s3c_device_usb_dmamask = 0xffffffffUL;
131 struct platform_device s3c_device_usb = {
132 .name = "s3c2410-ohci",
134 .num_resources = ARRAY_SIZE(s3c_usb_resource),
135 .resource = s3c_usb_resource,
137 .dma_mask = &s3c_device_usb_dmamask,
138 .coherent_dma_mask = 0xffffffffUL
142 EXPORT_SYMBOL(s3c_device_usb);
146 static struct resource s3c_lcd_resource[] = {
148 .start = S3C24XX_PA_LCD,
149 .end = S3C24XX_PA_LCD + S3C24XX_SZ_LCD - 1,
150 .flags = IORESOURCE_MEM,
155 .flags = IORESOURCE_IRQ,
160 static u64 s3c_device_lcd_dmamask = 0xffffffffUL;
162 struct platform_device s3c_device_lcd = {
163 .name = "s3c2410-lcd",
165 .num_resources = ARRAY_SIZE(s3c_lcd_resource),
166 .resource = s3c_lcd_resource,
168 .dma_mask = &s3c_device_lcd_dmamask,
169 .coherent_dma_mask = 0xffffffffUL
173 EXPORT_SYMBOL(s3c_device_lcd);
175 void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
177 struct s3c2410fb_mach_info *npd;
179 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
181 memcpy(npd, pd, sizeof(*npd));
182 s3c_device_lcd.dev.platform_data = npd;
184 printk(KERN_ERR "no memory for LCD platform data\n");
188 /* NAND Controller */
190 static struct resource s3c_nand_resource[] = {
192 .start = S3C2410_PA_NAND,
193 .end = S3C2410_PA_NAND + S3C24XX_SZ_NAND - 1,
194 .flags = IORESOURCE_MEM,
198 struct platform_device s3c_device_nand = {
199 .name = "s3c2410-nand",
201 .num_resources = ARRAY_SIZE(s3c_nand_resource),
202 .resource = s3c_nand_resource,
205 EXPORT_SYMBOL(s3c_device_nand);
207 /* USB Device (Gadget)*/
209 static struct resource s3c_usbgadget_resource[] = {
211 .start = S3C24XX_PA_USBDEV,
212 .end = S3C24XX_PA_USBDEV + S3C24XX_SZ_USBDEV - 1,
213 .flags = IORESOURCE_MEM,
218 .flags = IORESOURCE_IRQ,
223 struct platform_device s3c_device_usbgadget = {
224 .name = "s3c2410-usbgadget",
226 .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
227 .resource = s3c_usbgadget_resource,
230 EXPORT_SYMBOL(s3c_device_usbgadget);
234 static struct resource s3c_wdt_resource[] = {
236 .start = S3C24XX_PA_WATCHDOG,
237 .end = S3C24XX_PA_WATCHDOG + S3C24XX_SZ_WATCHDOG - 1,
238 .flags = IORESOURCE_MEM,
243 .flags = IORESOURCE_IRQ,
248 struct platform_device s3c_device_wdt = {
249 .name = "s3c2410-wdt",
251 .num_resources = ARRAY_SIZE(s3c_wdt_resource),
252 .resource = s3c_wdt_resource,
255 EXPORT_SYMBOL(s3c_device_wdt);
259 static struct resource s3c_i2c_resource[] = {
261 .start = S3C24XX_PA_IIC,
262 .end = S3C24XX_PA_IIC + S3C24XX_SZ_IIC - 1,
263 .flags = IORESOURCE_MEM,
268 .flags = IORESOURCE_IRQ,
273 struct platform_device s3c_device_i2c = {
274 .name = "s3c2410-i2c",
276 .num_resources = ARRAY_SIZE(s3c_i2c_resource),
277 .resource = s3c_i2c_resource,
280 EXPORT_SYMBOL(s3c_device_i2c);
284 static struct resource s3c_iis_resource[] = {
286 .start = S3C24XX_PA_IIS,
287 .end = S3C24XX_PA_IIS + S3C24XX_SZ_IIS -1,
288 .flags = IORESOURCE_MEM,
292 static u64 s3c_device_iis_dmamask = 0xffffffffUL;
294 struct platform_device s3c_device_iis = {
295 .name = "s3c2410-iis",
297 .num_resources = ARRAY_SIZE(s3c_iis_resource),
298 .resource = s3c_iis_resource,
300 .dma_mask = &s3c_device_iis_dmamask,
301 .coherent_dma_mask = 0xffffffffUL
305 EXPORT_SYMBOL(s3c_device_iis);
309 static struct resource s3c_rtc_resource[] = {
311 .start = S3C24XX_PA_RTC,
312 .end = S3C24XX_PA_RTC + 0xff,
313 .flags = IORESOURCE_MEM,
318 .flags = IORESOURCE_IRQ,
323 .flags = IORESOURCE_IRQ
327 struct platform_device s3c_device_rtc = {
328 .name = "s3c2410-rtc",
330 .num_resources = ARRAY_SIZE(s3c_rtc_resource),
331 .resource = s3c_rtc_resource,
334 EXPORT_SYMBOL(s3c_device_rtc);
338 static struct resource s3c_adc_resource[] = {
340 .start = S3C24XX_PA_ADC,
341 .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
342 .flags = IORESOURCE_MEM,
347 .flags = IORESOURCE_IRQ,
352 .flags = IORESOURCE_IRQ,
357 struct platform_device s3c_device_adc = {
358 .name = "s3c2410-adc",
360 .num_resources = ARRAY_SIZE(s3c_adc_resource),
361 .resource = s3c_adc_resource,
366 static struct resource s3c_sdi_resource[] = {
368 .start = S3C2410_PA_SDI,
369 .end = S3C2410_PA_SDI + S3C24XX_SZ_SDI - 1,
370 .flags = IORESOURCE_MEM,
375 .flags = IORESOURCE_IRQ,
380 struct platform_device s3c_device_sdi = {
381 .name = "s3c2410-sdi",
383 .num_resources = ARRAY_SIZE(s3c_sdi_resource),
384 .resource = s3c_sdi_resource,
387 EXPORT_SYMBOL(s3c_device_sdi);
391 static struct resource s3c_spi0_resource[] = {
393 .start = S3C24XX_PA_SPI,
394 .end = S3C24XX_PA_SPI + 0x1f,
395 .flags = IORESOURCE_MEM,
400 .flags = IORESOURCE_IRQ,
405 static u64 s3c_device_spi0_dmamask = 0xffffffffUL;
407 struct platform_device s3c_device_spi0 = {
408 .name = "s3c2410-spi",
410 .num_resources = ARRAY_SIZE(s3c_spi0_resource),
411 .resource = s3c_spi0_resource,
413 .dma_mask = &s3c_device_spi0_dmamask,
414 .coherent_dma_mask = 0xffffffffUL
418 EXPORT_SYMBOL(s3c_device_spi0);
422 static struct resource s3c_spi1_resource[] = {
424 .start = S3C24XX_PA_SPI + 0x20,
425 .end = S3C24XX_PA_SPI + 0x20 + 0x1f,
426 .flags = IORESOURCE_MEM,
431 .flags = IORESOURCE_IRQ,
436 static u64 s3c_device_spi1_dmamask = 0xffffffffUL;
438 struct platform_device s3c_device_spi1 = {
439 .name = "s3c2410-spi",
441 .num_resources = ARRAY_SIZE(s3c_spi1_resource),
442 .resource = s3c_spi1_resource,
444 .dma_mask = &s3c_device_spi1_dmamask,
445 .coherent_dma_mask = 0xffffffffUL
449 EXPORT_SYMBOL(s3c_device_spi1);
451 /* pwm timer blocks */
453 static struct resource s3c_timer0_resource[] = {
455 .start = S3C24XX_PA_TIMER + 0x0C,
456 .end = S3C24XX_PA_TIMER + 0x0C + 0xB,
457 .flags = IORESOURCE_MEM,
462 .flags = IORESOURCE_IRQ,
467 struct platform_device s3c_device_timer0 = {
468 .name = "s3c2410-timer",
470 .num_resources = ARRAY_SIZE(s3c_timer0_resource),
471 .resource = s3c_timer0_resource,
474 EXPORT_SYMBOL(s3c_device_timer0);
478 static struct resource s3c_timer1_resource[] = {
480 .start = S3C24XX_PA_TIMER + 0x18,
481 .end = S3C24XX_PA_TIMER + 0x23,
482 .flags = IORESOURCE_MEM,
487 .flags = IORESOURCE_IRQ,
492 struct platform_device s3c_device_timer1 = {
493 .name = "s3c2410-timer",
495 .num_resources = ARRAY_SIZE(s3c_timer1_resource),
496 .resource = s3c_timer1_resource,
499 EXPORT_SYMBOL(s3c_device_timer1);
503 static struct resource s3c_timer2_resource[] = {
505 .start = S3C24XX_PA_TIMER + 0x24,
506 .end = S3C24XX_PA_TIMER + 0x2F,
507 .flags = IORESOURCE_MEM,
512 .flags = IORESOURCE_IRQ,
517 struct platform_device s3c_device_timer2 = {
518 .name = "s3c2410-timer",
520 .num_resources = ARRAY_SIZE(s3c_timer2_resource),
521 .resource = s3c_timer2_resource,
524 EXPORT_SYMBOL(s3c_device_timer2);
528 static struct resource s3c_timer3_resource[] = {
530 .start = S3C24XX_PA_TIMER + 0x30,
531 .end = S3C24XX_PA_TIMER + 0x3B,
532 .flags = IORESOURCE_MEM,
537 .flags = IORESOURCE_IRQ,
542 struct platform_device s3c_device_timer3 = {
543 .name = "s3c2410-timer",
545 .num_resources = ARRAY_SIZE(s3c_timer3_resource),
546 .resource = s3c_timer3_resource,
549 EXPORT_SYMBOL(s3c_device_timer3);
551 #ifdef CONFIG_CPU_S3C2440
553 /* Camif Controller */
555 static struct resource s3c_camif_resource[] = {
557 .start = S3C2440_PA_CAMIF,
558 .end = S3C2440_PA_CAMIF + S3C2440_SZ_CAMIF - 1,
559 .flags = IORESOURCE_MEM,
564 .flags = IORESOURCE_IRQ,
569 static u64 s3c_device_camif_dmamask = 0xffffffffUL;
571 struct platform_device s3c_device_camif = {
572 .name = "s3c2440-camif",
574 .num_resources = ARRAY_SIZE(s3c_camif_resource),
575 .resource = s3c_camif_resource,
577 .dma_mask = &s3c_device_camif_dmamask,
578 .coherent_dma_mask = 0xffffffffUL
582 EXPORT_SYMBOL(s3c_device_camif);
584 #endif // CONFIG_CPU_S32440