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] = {
141 static struct resource s3c_lcd_resource
[] = {
143 .start
= S3C24XX_PA_LCD
,
144 .end
= S3C24XX_PA_LCD
+ S3C24XX_SZ_LCD
- 1,
145 .flags
= IORESOURCE_MEM
,
150 .flags
= IORESOURCE_IRQ
,
155 static u64 s3c_device_lcd_dmamask
= 0xffffffffUL
;
157 struct platform_device s3c_device_lcd
= {
158 .name
= "s3c2410-lcd",
160 .num_resources
= ARRAY_SIZE(s3c_lcd_resource
),
161 .resource
= s3c_lcd_resource
,
163 .dma_mask
= &s3c_device_lcd_dmamask
,
164 .coherent_dma_mask
= 0xffffffffUL
168 EXPORT_SYMBOL(s3c_device_lcd
);
170 void __init
s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info
*pd
)
172 struct s3c2410fb_mach_info
*npd
;
174 npd
= kmalloc(sizeof(*npd
), GFP_KERNEL
);
176 memcpy(npd
, pd
, sizeof(*npd
));
177 s3c_device_lcd
.dev
.platform_data
= npd
;
179 printk(KERN_ERR
"no memory for LCD platform data\n");
183 /* NAND Controller */
185 static struct resource s3c_nand_resource
[] = {
187 .start
= S3C24XX_PA_NAND
,
188 .end
= S3C24XX_PA_NAND
+ S3C24XX_SZ_NAND
- 1,
189 .flags
= IORESOURCE_MEM
,
193 struct platform_device s3c_device_nand
= {
194 .name
= "s3c2410-nand",
196 .num_resources
= ARRAY_SIZE(s3c_nand_resource
),
197 .resource
= s3c_nand_resource
,
200 EXPORT_SYMBOL(s3c_device_nand
);
202 /* USB Device (Gadget)*/
204 static struct resource s3c_usbgadget_resource
[] = {
206 .start
= S3C24XX_PA_USBDEV
,
207 .end
= S3C24XX_PA_USBDEV
+ S3C24XX_SZ_USBDEV
- 1,
208 .flags
= IORESOURCE_MEM
,
213 .flags
= IORESOURCE_IRQ
,
218 struct platform_device s3c_device_usbgadget
= {
219 .name
= "s3c2410-usbgadget",
221 .num_resources
= ARRAY_SIZE(s3c_usbgadget_resource
),
222 .resource
= s3c_usbgadget_resource
,
225 EXPORT_SYMBOL(s3c_device_usbgadget
);
227 void __init
s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info
*pd
)
229 struct s3c2410_udc_mach_info
*npd
;
231 npd
= kmalloc(sizeof(*npd
), GFP_KERNEL
);
233 memcpy(npd
, pd
, sizeof(*npd
));
234 s3c_device_usbgadget
.dev
.platform_data
= npd
;
236 printk(KERN_ERR
"no memory for udc platform data\n");
243 static struct resource s3c_wdt_resource
[] = {
245 .start
= S3C24XX_PA_WATCHDOG
,
246 .end
= S3C24XX_PA_WATCHDOG
+ S3C24XX_SZ_WATCHDOG
- 1,
247 .flags
= IORESOURCE_MEM
,
252 .flags
= IORESOURCE_IRQ
,
257 struct platform_device s3c_device_wdt
= {
258 .name
= "s3c2410-wdt",
260 .num_resources
= ARRAY_SIZE(s3c_wdt_resource
),
261 .resource
= s3c_wdt_resource
,
264 EXPORT_SYMBOL(s3c_device_wdt
);
268 static struct resource s3c_iis_resource
[] = {
270 .start
= S3C24XX_PA_IIS
,
271 .end
= S3C24XX_PA_IIS
+ S3C24XX_SZ_IIS
-1,
272 .flags
= IORESOURCE_MEM
,
276 static u64 s3c_device_iis_dmamask
= 0xffffffffUL
;
278 struct platform_device s3c_device_iis
= {
279 .name
= "s3c2410-iis",
281 .num_resources
= ARRAY_SIZE(s3c_iis_resource
),
282 .resource
= s3c_iis_resource
,
284 .dma_mask
= &s3c_device_iis_dmamask
,
285 .coherent_dma_mask
= 0xffffffffUL
289 EXPORT_SYMBOL(s3c_device_iis
);
293 static struct resource s3c_rtc_resource
[] = {
295 .start
= S3C24XX_PA_RTC
,
296 .end
= S3C24XX_PA_RTC
+ 0xff,
297 .flags
= IORESOURCE_MEM
,
302 .flags
= IORESOURCE_IRQ
,
307 .flags
= IORESOURCE_IRQ
311 struct platform_device s3c_device_rtc
= {
312 .name
= "s3c2410-rtc",
314 .num_resources
= ARRAY_SIZE(s3c_rtc_resource
),
315 .resource
= s3c_rtc_resource
,
318 EXPORT_SYMBOL(s3c_device_rtc
);
322 static struct resource s3c_adc_resource
[] = {
324 .start
= S3C24XX_PA_ADC
,
325 .end
= S3C24XX_PA_ADC
+ S3C24XX_SZ_ADC
- 1,
326 .flags
= IORESOURCE_MEM
,
331 .flags
= IORESOURCE_IRQ
,
336 .flags
= IORESOURCE_IRQ
,
341 struct platform_device s3c_device_adc
= {
342 .name
= "s3c24xx-adc",
344 .num_resources
= ARRAY_SIZE(s3c_adc_resource
),
345 .resource
= s3c_adc_resource
,
350 struct platform_device s3c_device_hwmon
= {
351 .name
= "s3c24xx-hwmon",
353 .dev
.parent
= &s3c_device_adc
.dev
,
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