1 /* linux/arch/arm/plat-s3c24xx/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/serial_core.h>
21 #include <linux/platform_device.h>
24 #include <asm/mach/arch.h>
25 #include <asm/mach/map.h>
26 #include <asm/mach/irq.h>
28 #include <mach/hardware.h>
31 #include <plat/regs-serial.h>
34 #include <plat/devs.h>
36 #include <plat/regs-spi.h>
38 /* Serial port registrations */
40 static struct resource s3c2410_uart0_resource[] = {
42 .start = S3C2410_PA_UART0,
43 .end = S3C2410_PA_UART0 + 0x3fff,
44 .flags = IORESOURCE_MEM,
47 .start = IRQ_S3CUART_RX0,
48 .end = IRQ_S3CUART_ERR0,
49 .flags = IORESOURCE_IRQ,
53 static struct resource s3c2410_uart1_resource[] = {
55 .start = S3C2410_PA_UART1,
56 .end = S3C2410_PA_UART1 + 0x3fff,
57 .flags = IORESOURCE_MEM,
60 .start = IRQ_S3CUART_RX1,
61 .end = IRQ_S3CUART_ERR1,
62 .flags = IORESOURCE_IRQ,
66 static struct resource s3c2410_uart2_resource[] = {
68 .start = S3C2410_PA_UART2,
69 .end = S3C2410_PA_UART2 + 0x3fff,
70 .flags = IORESOURCE_MEM,
73 .start = IRQ_S3CUART_RX2,
74 .end = IRQ_S3CUART_ERR2,
75 .flags = IORESOURCE_IRQ,
79 static struct resource s3c2410_uart3_resource[] = {
81 .start = S3C2443_PA_UART3,
82 .end = S3C2443_PA_UART3 + 0x3fff,
83 .flags = IORESOURCE_MEM,
86 .start = IRQ_S3CUART_RX3,
87 .end = IRQ_S3CUART_ERR3,
88 .flags = IORESOURCE_IRQ,
92 struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
94 .resources = s3c2410_uart0_resource,
95 .nr_resources = ARRAY_SIZE(s3c2410_uart0_resource),
98 .resources = s3c2410_uart1_resource,
99 .nr_resources = ARRAY_SIZE(s3c2410_uart1_resource),
102 .resources = s3c2410_uart2_resource,
103 .nr_resources = ARRAY_SIZE(s3c2410_uart2_resource),
106 .resources = s3c2410_uart3_resource,
107 .nr_resources = ARRAY_SIZE(s3c2410_uart3_resource),
113 static struct platform_device s3c24xx_uart_device0 = {
117 static struct platform_device s3c24xx_uart_device1 = {
121 static struct platform_device s3c24xx_uart_device2 = {
125 static struct platform_device s3c24xx_uart_device3 = {
129 struct platform_device *s3c24xx_uart_src[4] = {
130 &s3c24xx_uart_device0,
131 &s3c24xx_uart_device1,
132 &s3c24xx_uart_device2,
133 &s3c24xx_uart_device3,
136 struct platform_device *s3c24xx_uart_devs[4] = {
139 /* USB Host Controller */
141 static struct resource s3c_usb_resource[] = {
143 .start = S3C24XX_PA_USBHOST,
144 .end = S3C24XX_PA_USBHOST + S3C24XX_SZ_USBHOST - 1,
145 .flags = IORESOURCE_MEM,
150 .flags = IORESOURCE_IRQ,
154 static u64 s3c_device_usb_dmamask = 0xffffffffUL;
156 struct platform_device s3c_device_usb = {
157 .name = "s3c2410-ohci",
159 .num_resources = ARRAY_SIZE(s3c_usb_resource),
160 .resource = s3c_usb_resource,
162 .dma_mask = &s3c_device_usb_dmamask,
163 .coherent_dma_mask = 0xffffffffUL
167 EXPORT_SYMBOL(s3c_device_usb);
171 static struct resource s3c_lcd_resource[] = {
173 .start = S3C24XX_PA_LCD,
174 .end = S3C24XX_PA_LCD + S3C24XX_SZ_LCD - 1,
175 .flags = IORESOURCE_MEM,
180 .flags = IORESOURCE_IRQ,
185 static u64 s3c_device_lcd_dmamask = 0xffffffffUL;
187 struct platform_device s3c_device_lcd = {
188 .name = "s3c2410-lcd",
190 .num_resources = ARRAY_SIZE(s3c_lcd_resource),
191 .resource = s3c_lcd_resource,
193 .dma_mask = &s3c_device_lcd_dmamask,
194 .coherent_dma_mask = 0xffffffffUL
198 EXPORT_SYMBOL(s3c_device_lcd);
200 void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
202 struct s3c2410fb_mach_info *npd;
204 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
206 memcpy(npd, pd, sizeof(*npd));
207 s3c_device_lcd.dev.platform_data = npd;
209 printk(KERN_ERR "no memory for LCD platform data\n");
213 /* NAND Controller */
215 static struct resource s3c_nand_resource[] = {
217 .start = S3C24XX_PA_NAND,
218 .end = S3C24XX_PA_NAND + S3C24XX_SZ_NAND - 1,
219 .flags = IORESOURCE_MEM,
223 struct platform_device s3c_device_nand = {
224 .name = "s3c2410-nand",
226 .num_resources = ARRAY_SIZE(s3c_nand_resource),
227 .resource = s3c_nand_resource,
230 EXPORT_SYMBOL(s3c_device_nand);
232 /* USB Device (Gadget)*/
234 static struct resource s3c_usbgadget_resource[] = {
236 .start = S3C24XX_PA_USBDEV,
237 .end = S3C24XX_PA_USBDEV + S3C24XX_SZ_USBDEV - 1,
238 .flags = IORESOURCE_MEM,
243 .flags = IORESOURCE_IRQ,
248 struct platform_device s3c_device_usbgadget = {
249 .name = "s3c2410-usbgadget",
251 .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
252 .resource = s3c_usbgadget_resource,
255 EXPORT_SYMBOL(s3c_device_usbgadget);
257 void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)
259 struct s3c2410_udc_mach_info *npd;
261 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
263 memcpy(npd, pd, sizeof(*npd));
264 s3c_device_usbgadget.dev.platform_data = npd;
266 printk(KERN_ERR "no memory for udc platform data\n");
273 static struct resource s3c_wdt_resource[] = {
275 .start = S3C24XX_PA_WATCHDOG,
276 .end = S3C24XX_PA_WATCHDOG + S3C24XX_SZ_WATCHDOG - 1,
277 .flags = IORESOURCE_MEM,
282 .flags = IORESOURCE_IRQ,
287 struct platform_device s3c_device_wdt = {
288 .name = "s3c2410-wdt",
290 .num_resources = ARRAY_SIZE(s3c_wdt_resource),
291 .resource = s3c_wdt_resource,
294 EXPORT_SYMBOL(s3c_device_wdt);
298 static struct resource s3c_iis_resource[] = {
300 .start = S3C24XX_PA_IIS,
301 .end = S3C24XX_PA_IIS + S3C24XX_SZ_IIS -1,
302 .flags = IORESOURCE_MEM,
306 static u64 s3c_device_iis_dmamask = 0xffffffffUL;
308 struct platform_device s3c_device_iis = {
309 .name = "s3c2410-iis",
311 .num_resources = ARRAY_SIZE(s3c_iis_resource),
312 .resource = s3c_iis_resource,
314 .dma_mask = &s3c_device_iis_dmamask,
315 .coherent_dma_mask = 0xffffffffUL
319 EXPORT_SYMBOL(s3c_device_iis);
323 static struct resource s3c_rtc_resource[] = {
325 .start = S3C24XX_PA_RTC,
326 .end = S3C24XX_PA_RTC + 0xff,
327 .flags = IORESOURCE_MEM,
332 .flags = IORESOURCE_IRQ,
337 .flags = IORESOURCE_IRQ
341 struct platform_device s3c_device_rtc = {
342 .name = "s3c2410-rtc",
344 .num_resources = ARRAY_SIZE(s3c_rtc_resource),
345 .resource = s3c_rtc_resource,
348 EXPORT_SYMBOL(s3c_device_rtc);
352 static struct resource s3c_adc_resource[] = {
354 .start = S3C24XX_PA_ADC,
355 .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
356 .flags = IORESOURCE_MEM,
361 .flags = IORESOURCE_IRQ,
366 .flags = IORESOURCE_IRQ,
371 struct platform_device s3c_device_adc = {
372 .name = "s3c24xx-adc",
374 .num_resources = ARRAY_SIZE(s3c_adc_resource),
375 .resource = s3c_adc_resource,
380 struct platform_device s3c_device_hwmon = {
381 .name = "s3c24xx-hwmon",
383 .dev.parent = &s3c_device_adc.dev,
388 static struct resource s3c_sdi_resource[] = {
390 .start = S3C24XX_PA_SDI,
391 .end = S3C24XX_PA_SDI + S3C24XX_SZ_SDI - 1,
392 .flags = IORESOURCE_MEM,
397 .flags = IORESOURCE_IRQ,
402 struct platform_device s3c_device_sdi = {
403 .name = "s3c2410-sdi",
405 .num_resources = ARRAY_SIZE(s3c_sdi_resource),
406 .resource = s3c_sdi_resource,
409 EXPORT_SYMBOL(s3c_device_sdi);
413 static struct resource s3c_spi0_resource[] = {
415 .start = S3C24XX_PA_SPI,
416 .end = S3C24XX_PA_SPI + 0x1f,
417 .flags = IORESOURCE_MEM,
422 .flags = IORESOURCE_IRQ,
427 static u64 s3c_device_spi0_dmamask = 0xffffffffUL;
429 struct platform_device s3c_device_spi0 = {
430 .name = "s3c2410-spi",
432 .num_resources = ARRAY_SIZE(s3c_spi0_resource),
433 .resource = s3c_spi0_resource,
435 .dma_mask = &s3c_device_spi0_dmamask,
436 .coherent_dma_mask = 0xffffffffUL
440 EXPORT_SYMBOL(s3c_device_spi0);
444 static struct resource s3c_spi1_resource[] = {
446 .start = S3C24XX_PA_SPI + S3C2410_SPI1,
447 .end = S3C24XX_PA_SPI + S3C2410_SPI1 + 0x1f,
448 .flags = IORESOURCE_MEM,
453 .flags = IORESOURCE_IRQ,
458 static u64 s3c_device_spi1_dmamask = 0xffffffffUL;
460 struct platform_device s3c_device_spi1 = {
461 .name = "s3c2410-spi",
463 .num_resources = ARRAY_SIZE(s3c_spi1_resource),
464 .resource = s3c_spi1_resource,
466 .dma_mask = &s3c_device_spi1_dmamask,
467 .coherent_dma_mask = 0xffffffffUL
471 EXPORT_SYMBOL(s3c_device_spi1);
473 #ifdef CONFIG_CPU_S3C2440
475 /* Camif Controller */
477 static struct resource s3c_camif_resource[] = {
479 .start = S3C2440_PA_CAMIF,
480 .end = S3C2440_PA_CAMIF + S3C2440_SZ_CAMIF - 1,
481 .flags = IORESOURCE_MEM,
486 .flags = IORESOURCE_IRQ,
491 static u64 s3c_device_camif_dmamask = 0xffffffffUL;
493 struct platform_device s3c_device_camif = {
494 .name = "s3c2440-camif",
496 .num_resources = ARRAY_SIZE(s3c_camif_resource),
497 .resource = s3c_camif_resource,
499 .dma_mask = &s3c_device_camif_dmamask,
500 .coherent_dma_mask = 0xffffffffUL
504 EXPORT_SYMBOL(s3c_device_camif);
506 #endif // CONFIG_CPU_S32440