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>
30 #include <mach/irqs.h>
33 #include <plat/regs-serial.h>
36 #include <plat/devs.h>
38 #include <plat/regs-spi.h>
40 /* Serial port registrations */
42 static struct resource s3c2410_uart0_resource
[] = {
44 .start
= S3C2410_PA_UART0
,
45 .end
= S3C2410_PA_UART0
+ 0x3fff,
46 .flags
= IORESOURCE_MEM
,
49 .start
= IRQ_S3CUART_RX0
,
50 .end
= IRQ_S3CUART_ERR0
,
51 .flags
= IORESOURCE_IRQ
,
55 static struct resource s3c2410_uart1_resource
[] = {
57 .start
= S3C2410_PA_UART1
,
58 .end
= S3C2410_PA_UART1
+ 0x3fff,
59 .flags
= IORESOURCE_MEM
,
62 .start
= IRQ_S3CUART_RX1
,
63 .end
= IRQ_S3CUART_ERR1
,
64 .flags
= IORESOURCE_IRQ
,
68 static struct resource s3c2410_uart2_resource
[] = {
70 .start
= S3C2410_PA_UART2
,
71 .end
= S3C2410_PA_UART2
+ 0x3fff,
72 .flags
= IORESOURCE_MEM
,
75 .start
= IRQ_S3CUART_RX2
,
76 .end
= IRQ_S3CUART_ERR2
,
77 .flags
= IORESOURCE_IRQ
,
81 static struct resource s3c2410_uart3_resource
[] = {
83 .start
= S3C2443_PA_UART3
,
84 .end
= S3C2443_PA_UART3
+ 0x3fff,
85 .flags
= IORESOURCE_MEM
,
88 .start
= IRQ_S3CUART_RX3
,
89 .end
= IRQ_S3CUART_ERR3
,
90 .flags
= IORESOURCE_IRQ
,
94 struct s3c24xx_uart_resources s3c2410_uart_resources
[] __initdata
= {
96 .resources
= s3c2410_uart0_resource
,
97 .nr_resources
= ARRAY_SIZE(s3c2410_uart0_resource
),
100 .resources
= s3c2410_uart1_resource
,
101 .nr_resources
= ARRAY_SIZE(s3c2410_uart1_resource
),
104 .resources
= s3c2410_uart2_resource
,
105 .nr_resources
= ARRAY_SIZE(s3c2410_uart2_resource
),
108 .resources
= s3c2410_uart3_resource
,
109 .nr_resources
= ARRAY_SIZE(s3c2410_uart3_resource
),
115 static struct platform_device s3c24xx_uart_device0
= {
119 static struct platform_device s3c24xx_uart_device1
= {
123 static struct platform_device s3c24xx_uart_device2
= {
127 static struct platform_device s3c24xx_uart_device3
= {
131 struct platform_device
*s3c24xx_uart_src
[4] = {
132 &s3c24xx_uart_device0
,
133 &s3c24xx_uart_device1
,
134 &s3c24xx_uart_device2
,
135 &s3c24xx_uart_device3
,
138 struct platform_device
*s3c24xx_uart_devs
[4] = {
143 static struct resource s3c_lcd_resource
[] = {
145 .start
= S3C24XX_PA_LCD
,
146 .end
= S3C24XX_PA_LCD
+ S3C24XX_SZ_LCD
- 1,
147 .flags
= IORESOURCE_MEM
,
152 .flags
= IORESOURCE_IRQ
,
157 static u64 s3c_device_lcd_dmamask
= 0xffffffffUL
;
159 struct platform_device s3c_device_lcd
= {
160 .name
= "s3c2410-lcd",
162 .num_resources
= ARRAY_SIZE(s3c_lcd_resource
),
163 .resource
= s3c_lcd_resource
,
165 .dma_mask
= &s3c_device_lcd_dmamask
,
166 .coherent_dma_mask
= 0xffffffffUL
170 EXPORT_SYMBOL(s3c_device_lcd
);
172 void __init
s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info
*pd
)
174 struct s3c2410fb_mach_info
*npd
;
176 npd
= kmalloc(sizeof(*npd
), GFP_KERNEL
);
178 memcpy(npd
, pd
, sizeof(*npd
));
179 s3c_device_lcd
.dev
.platform_data
= npd
;
181 printk(KERN_ERR
"no memory for LCD platform data\n");
185 /* USB Device (Gadget)*/
187 static struct resource s3c_usbgadget_resource
[] = {
189 .start
= S3C24XX_PA_USBDEV
,
190 .end
= S3C24XX_PA_USBDEV
+ S3C24XX_SZ_USBDEV
- 1,
191 .flags
= IORESOURCE_MEM
,
196 .flags
= IORESOURCE_IRQ
,
201 struct platform_device s3c_device_usbgadget
= {
202 .name
= "s3c2410-usbgadget",
204 .num_resources
= ARRAY_SIZE(s3c_usbgadget_resource
),
205 .resource
= s3c_usbgadget_resource
,
208 EXPORT_SYMBOL(s3c_device_usbgadget
);
210 void __init
s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info
*pd
)
212 struct s3c2410_udc_mach_info
*npd
;
214 npd
= kmalloc(sizeof(*npd
), GFP_KERNEL
);
216 memcpy(npd
, pd
, sizeof(*npd
));
217 s3c_device_usbgadget
.dev
.platform_data
= npd
;
219 printk(KERN_ERR
"no memory for udc platform data\n");
226 static struct resource s3c_wdt_resource
[] = {
228 .start
= S3C24XX_PA_WATCHDOG
,
229 .end
= S3C24XX_PA_WATCHDOG
+ S3C24XX_SZ_WATCHDOG
- 1,
230 .flags
= IORESOURCE_MEM
,
235 .flags
= IORESOURCE_IRQ
,
240 struct platform_device s3c_device_wdt
= {
241 .name
= "s3c2410-wdt",
243 .num_resources
= ARRAY_SIZE(s3c_wdt_resource
),
244 .resource
= s3c_wdt_resource
,
247 EXPORT_SYMBOL(s3c_device_wdt
);
251 static struct resource s3c_iis_resource
[] = {
253 .start
= S3C24XX_PA_IIS
,
254 .end
= S3C24XX_PA_IIS
+ S3C24XX_SZ_IIS
-1,
255 .flags
= IORESOURCE_MEM
,
259 static u64 s3c_device_iis_dmamask
= 0xffffffffUL
;
261 struct platform_device s3c_device_iis
= {
262 .name
= "s3c2410-iis",
264 .num_resources
= ARRAY_SIZE(s3c_iis_resource
),
265 .resource
= s3c_iis_resource
,
267 .dma_mask
= &s3c_device_iis_dmamask
,
268 .coherent_dma_mask
= 0xffffffffUL
272 EXPORT_SYMBOL(s3c_device_iis
);
276 static struct resource s3c_rtc_resource
[] = {
278 .start
= S3C24XX_PA_RTC
,
279 .end
= S3C24XX_PA_RTC
+ 0xff,
280 .flags
= IORESOURCE_MEM
,
285 .flags
= IORESOURCE_IRQ
,
290 .flags
= IORESOURCE_IRQ
294 struct platform_device s3c_device_rtc
= {
295 .name
= "s3c2410-rtc",
297 .num_resources
= ARRAY_SIZE(s3c_rtc_resource
),
298 .resource
= s3c_rtc_resource
,
301 EXPORT_SYMBOL(s3c_device_rtc
);
305 static struct resource s3c_adc_resource
[] = {
307 .start
= S3C24XX_PA_ADC
,
308 .end
= S3C24XX_PA_ADC
+ S3C24XX_SZ_ADC
- 1,
309 .flags
= IORESOURCE_MEM
,
314 .flags
= IORESOURCE_IRQ
,
319 .flags
= IORESOURCE_IRQ
,
324 struct platform_device s3c_device_adc
= {
325 .name
= "s3c24xx-adc",
327 .num_resources
= ARRAY_SIZE(s3c_adc_resource
),
328 .resource
= s3c_adc_resource
,
333 struct platform_device s3c_device_hwmon
= {
336 .dev
.parent
= &s3c_device_adc
.dev
,
341 static struct resource s3c_sdi_resource
[] = {
343 .start
= S3C24XX_PA_SDI
,
344 .end
= S3C24XX_PA_SDI
+ S3C24XX_SZ_SDI
- 1,
345 .flags
= IORESOURCE_MEM
,
350 .flags
= IORESOURCE_IRQ
,
355 struct platform_device s3c_device_sdi
= {
356 .name
= "s3c2410-sdi",
358 .num_resources
= ARRAY_SIZE(s3c_sdi_resource
),
359 .resource
= s3c_sdi_resource
,
362 EXPORT_SYMBOL(s3c_device_sdi
);
366 static struct resource s3c_spi0_resource
[] = {
368 .start
= S3C24XX_PA_SPI
,
369 .end
= S3C24XX_PA_SPI
+ 0x1f,
370 .flags
= IORESOURCE_MEM
,
375 .flags
= IORESOURCE_IRQ
,
380 static u64 s3c_device_spi0_dmamask
= 0xffffffffUL
;
382 struct platform_device s3c_device_spi0
= {
383 .name
= "s3c2410-spi",
385 .num_resources
= ARRAY_SIZE(s3c_spi0_resource
),
386 .resource
= s3c_spi0_resource
,
388 .dma_mask
= &s3c_device_spi0_dmamask
,
389 .coherent_dma_mask
= 0xffffffffUL
393 EXPORT_SYMBOL(s3c_device_spi0
);
397 static struct resource s3c_spi1_resource
[] = {
399 .start
= S3C24XX_PA_SPI
+ S3C2410_SPI1
,
400 .end
= S3C24XX_PA_SPI
+ S3C2410_SPI1
+ 0x1f,
401 .flags
= IORESOURCE_MEM
,
406 .flags
= IORESOURCE_IRQ
,
411 static u64 s3c_device_spi1_dmamask
= 0xffffffffUL
;
413 struct platform_device s3c_device_spi1
= {
414 .name
= "s3c2410-spi",
416 .num_resources
= ARRAY_SIZE(s3c_spi1_resource
),
417 .resource
= s3c_spi1_resource
,
419 .dma_mask
= &s3c_device_spi1_dmamask
,
420 .coherent_dma_mask
= 0xffffffffUL
424 EXPORT_SYMBOL(s3c_device_spi1
);
426 #ifdef CONFIG_CPU_S3C2440
428 /* Camif Controller */
430 static struct resource s3c_camif_resource
[] = {
432 .start
= S3C2440_PA_CAMIF
,
433 .end
= S3C2440_PA_CAMIF
+ S3C2440_SZ_CAMIF
- 1,
434 .flags
= IORESOURCE_MEM
,
439 .flags
= IORESOURCE_IRQ
,
444 static u64 s3c_device_camif_dmamask
= 0xffffffffUL
;
446 struct platform_device s3c_device_camif
= {
447 .name
= "s3c2440-camif",
449 .num_resources
= ARRAY_SIZE(s3c_camif_resource
),
450 .resource
= s3c_camif_resource
,
452 .dma_mask
= &s3c_device_camif_dmamask
,
453 .coherent_dma_mask
= 0xffffffffUL
457 EXPORT_SYMBOL(s3c_device_camif
);
461 static struct resource s3c_ac97_resource
[] = {
463 .start
= S3C2440_PA_AC97
,
464 .end
= S3C2440_PA_AC97
+ S3C2440_SZ_AC97
-1,
465 .flags
= IORESOURCE_MEM
,
468 .start
= IRQ_S3C244x_AC97
,
469 .end
= IRQ_S3C244x_AC97
,
470 .flags
= IORESOURCE_IRQ
,
474 .start
= DMACH_PCM_OUT
,
475 .end
= DMACH_PCM_OUT
,
476 .flags
= IORESOURCE_DMA
,
480 .start
= DMACH_PCM_IN
,
482 .flags
= IORESOURCE_DMA
,
486 .start
= DMACH_MIC_IN
,
488 .flags
= IORESOURCE_DMA
,
492 static u64 s3c_device_ac97_dmamask
= 0xffffffffUL
;
494 struct platform_device s3c_device_ac97
= {
497 .num_resources
= ARRAY_SIZE(s3c_ac97_resource
),
498 .resource
= s3c_ac97_resource
,
500 .dma_mask
= &s3c_device_ac97_dmamask
,
501 .coherent_dma_mask
= 0xffffffffUL
505 EXPORT_SYMBOL(s3c_device_ac97
);
507 #endif // CONFIG_CPU_S32440