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 struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
81 .resources = s3c2410_uart0_resource,
82 .nr_resources = ARRAY_SIZE(s3c2410_uart0_resource),
85 .resources = s3c2410_uart1_resource,
86 .nr_resources = ARRAY_SIZE(s3c2410_uart1_resource),
89 .resources = s3c2410_uart2_resource,
90 .nr_resources = ARRAY_SIZE(s3c2410_uart2_resource),
96 static struct platform_device s3c24xx_uart_device0 = {
100 static struct platform_device s3c24xx_uart_device1 = {
104 static struct platform_device s3c24xx_uart_device2 = {
108 struct platform_device *s3c24xx_uart_src[3] = {
109 &s3c24xx_uart_device0,
110 &s3c24xx_uart_device1,
111 &s3c24xx_uart_device2,
114 struct platform_device *s3c24xx_uart_devs[3] = {
117 /* USB Host Controller */
119 static struct resource s3c_usb_resource[] = {
121 .start = S3C24XX_PA_USBHOST,
122 .end = S3C24XX_PA_USBHOST + S3C24XX_SZ_USBHOST - 1,
123 .flags = IORESOURCE_MEM,
128 .flags = IORESOURCE_IRQ,
132 static u64 s3c_device_usb_dmamask = 0xffffffffUL;
134 struct platform_device s3c_device_usb = {
135 .name = "s3c2410-ohci",
137 .num_resources = ARRAY_SIZE(s3c_usb_resource),
138 .resource = s3c_usb_resource,
140 .dma_mask = &s3c_device_usb_dmamask,
141 .coherent_dma_mask = 0xffffffffUL
145 EXPORT_SYMBOL(s3c_device_usb);
149 static struct resource s3c_lcd_resource[] = {
151 .start = S3C24XX_PA_LCD,
152 .end = S3C24XX_PA_LCD + S3C24XX_SZ_LCD - 1,
153 .flags = IORESOURCE_MEM,
158 .flags = IORESOURCE_IRQ,
163 static u64 s3c_device_lcd_dmamask = 0xffffffffUL;
165 struct platform_device s3c_device_lcd = {
166 .name = "s3c2410-lcd",
168 .num_resources = ARRAY_SIZE(s3c_lcd_resource),
169 .resource = s3c_lcd_resource,
171 .dma_mask = &s3c_device_lcd_dmamask,
172 .coherent_dma_mask = 0xffffffffUL
176 EXPORT_SYMBOL(s3c_device_lcd);
178 void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
180 struct s3c2410fb_mach_info *npd;
182 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
184 memcpy(npd, pd, sizeof(*npd));
185 s3c_device_lcd.dev.platform_data = npd;
187 printk(KERN_ERR "no memory for LCD platform data\n");
191 /* NAND Controller */
193 static struct resource s3c_nand_resource[] = {
195 .start = S3C24XX_PA_NAND,
196 .end = S3C24XX_PA_NAND + S3C24XX_SZ_NAND - 1,
197 .flags = IORESOURCE_MEM,
201 struct platform_device s3c_device_nand = {
202 .name = "s3c2410-nand",
204 .num_resources = ARRAY_SIZE(s3c_nand_resource),
205 .resource = s3c_nand_resource,
208 EXPORT_SYMBOL(s3c_device_nand);
210 /* USB Device (Gadget)*/
212 static struct resource s3c_usbgadget_resource[] = {
214 .start = S3C24XX_PA_USBDEV,
215 .end = S3C24XX_PA_USBDEV + S3C24XX_SZ_USBDEV - 1,
216 .flags = IORESOURCE_MEM,
221 .flags = IORESOURCE_IRQ,
226 struct platform_device s3c_device_usbgadget = {
227 .name = "s3c2410-usbgadget",
229 .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
230 .resource = s3c_usbgadget_resource,
233 EXPORT_SYMBOL(s3c_device_usbgadget);
235 void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)
237 struct s3c2410_udc_mach_info *npd;
239 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
241 memcpy(npd, pd, sizeof(*npd));
242 s3c_device_usbgadget.dev.platform_data = npd;
244 printk(KERN_ERR "no memory for udc platform data\n");
251 static struct resource s3c_wdt_resource[] = {
253 .start = S3C24XX_PA_WATCHDOG,
254 .end = S3C24XX_PA_WATCHDOG + S3C24XX_SZ_WATCHDOG - 1,
255 .flags = IORESOURCE_MEM,
260 .flags = IORESOURCE_IRQ,
265 struct platform_device s3c_device_wdt = {
266 .name = "s3c2410-wdt",
268 .num_resources = ARRAY_SIZE(s3c_wdt_resource),
269 .resource = s3c_wdt_resource,
272 EXPORT_SYMBOL(s3c_device_wdt);
276 static struct resource s3c_iis_resource[] = {
278 .start = S3C24XX_PA_IIS,
279 .end = S3C24XX_PA_IIS + S3C24XX_SZ_IIS -1,
280 .flags = IORESOURCE_MEM,
284 static u64 s3c_device_iis_dmamask = 0xffffffffUL;
286 struct platform_device s3c_device_iis = {
287 .name = "s3c2410-iis",
289 .num_resources = ARRAY_SIZE(s3c_iis_resource),
290 .resource = s3c_iis_resource,
292 .dma_mask = &s3c_device_iis_dmamask,
293 .coherent_dma_mask = 0xffffffffUL
297 EXPORT_SYMBOL(s3c_device_iis);
301 static struct resource s3c_rtc_resource[] = {
303 .start = S3C24XX_PA_RTC,
304 .end = S3C24XX_PA_RTC + 0xff,
305 .flags = IORESOURCE_MEM,
310 .flags = IORESOURCE_IRQ,
315 .flags = IORESOURCE_IRQ
319 struct platform_device s3c_device_rtc = {
320 .name = "s3c2410-rtc",
322 .num_resources = ARRAY_SIZE(s3c_rtc_resource),
323 .resource = s3c_rtc_resource,
326 EXPORT_SYMBOL(s3c_device_rtc);
330 static struct resource s3c_adc_resource[] = {
332 .start = S3C24XX_PA_ADC,
333 .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
334 .flags = IORESOURCE_MEM,
339 .flags = IORESOURCE_IRQ,
344 .flags = IORESOURCE_IRQ,
349 struct platform_device s3c_device_adc = {
350 .name = "s3c2410-adc",
352 .num_resources = ARRAY_SIZE(s3c_adc_resource),
353 .resource = s3c_adc_resource,
358 static struct resource s3c_sdi_resource[] = {
360 .start = S3C24XX_PA_SDI,
361 .end = S3C24XX_PA_SDI + S3C24XX_SZ_SDI - 1,
362 .flags = IORESOURCE_MEM,
367 .flags = IORESOURCE_IRQ,
372 struct platform_device s3c_device_sdi = {
373 .name = "s3c2410-sdi",
375 .num_resources = ARRAY_SIZE(s3c_sdi_resource),
376 .resource = s3c_sdi_resource,
379 EXPORT_SYMBOL(s3c_device_sdi);
383 static struct resource s3c_spi0_resource[] = {
385 .start = S3C24XX_PA_SPI,
386 .end = S3C24XX_PA_SPI + 0x1f,
387 .flags = IORESOURCE_MEM,
392 .flags = IORESOURCE_IRQ,
397 static u64 s3c_device_spi0_dmamask = 0xffffffffUL;
399 struct platform_device s3c_device_spi0 = {
400 .name = "s3c2410-spi",
402 .num_resources = ARRAY_SIZE(s3c_spi0_resource),
403 .resource = s3c_spi0_resource,
405 .dma_mask = &s3c_device_spi0_dmamask,
406 .coherent_dma_mask = 0xffffffffUL
410 EXPORT_SYMBOL(s3c_device_spi0);
414 static struct resource s3c_spi1_resource[] = {
416 .start = S3C24XX_PA_SPI + S3C2410_SPI1,
417 .end = S3C24XX_PA_SPI + S3C2410_SPI1 + 0x1f,
418 .flags = IORESOURCE_MEM,
423 .flags = IORESOURCE_IRQ,
428 static u64 s3c_device_spi1_dmamask = 0xffffffffUL;
430 struct platform_device s3c_device_spi1 = {
431 .name = "s3c2410-spi",
433 .num_resources = ARRAY_SIZE(s3c_spi1_resource),
434 .resource = s3c_spi1_resource,
436 .dma_mask = &s3c_device_spi1_dmamask,
437 .coherent_dma_mask = 0xffffffffUL
441 EXPORT_SYMBOL(s3c_device_spi1);
443 #ifdef CONFIG_CPU_S3C2440
445 /* Camif Controller */
447 static struct resource s3c_camif_resource[] = {
449 .start = S3C2440_PA_CAMIF,
450 .end = S3C2440_PA_CAMIF + S3C2440_SZ_CAMIF - 1,
451 .flags = IORESOURCE_MEM,
456 .flags = IORESOURCE_IRQ,
461 static u64 s3c_device_camif_dmamask = 0xffffffffUL;
463 struct platform_device s3c_device_camif = {
464 .name = "s3c2440-camif",
466 .num_resources = ARRAY_SIZE(s3c_camif_resource),
467 .resource = s3c_camif_resource,
469 .dma_mask = &s3c_device_camif_dmamask,
470 .coherent_dma_mask = 0xffffffffUL
474 EXPORT_SYMBOL(s3c_device_camif);
476 #endif // CONFIG_CPU_S32440