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>
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 /* NAND Controller */
187 static struct resource s3c_nand_resource
[] = {
189 .start
= S3C24XX_PA_NAND
,
190 .end
= S3C24XX_PA_NAND
+ S3C24XX_SZ_NAND
- 1,
191 .flags
= IORESOURCE_MEM
,
195 struct platform_device s3c_device_nand
= {
196 .name
= "s3c2410-nand",
198 .num_resources
= ARRAY_SIZE(s3c_nand_resource
),
199 .resource
= s3c_nand_resource
,
202 EXPORT_SYMBOL(s3c_device_nand
);
205 struct platform_device s3c_device_ts
= {
206 .name
= "s3c2410-ts",
210 EXPORT_SYMBOL(s3c_device_ts
);
212 static struct s3c2410_ts_mach_info s3c2410ts_info
;
214 void set_s3c2410ts_info(struct s3c2410_ts_mach_info
*hard_s3c2410ts_info
)
216 memcpy(&s3c2410ts_info
,hard_s3c2410ts_info
,sizeof(struct s3c2410_ts_mach_info
));
217 s3c_device_ts
.dev
.platform_data
= &s3c2410ts_info
;
219 EXPORT_SYMBOL(set_s3c2410ts_info
);
221 /* USB Device (Gadget)*/
223 static struct resource s3c_usbgadget_resource
[] = {
225 .start
= S3C24XX_PA_USBDEV
,
226 .end
= S3C24XX_PA_USBDEV
+ S3C24XX_SZ_USBDEV
- 1,
227 .flags
= IORESOURCE_MEM
,
232 .flags
= IORESOURCE_IRQ
,
237 struct platform_device s3c_device_usbgadget
= {
238 .name
= "s3c2410-usbgadget",
240 .num_resources
= ARRAY_SIZE(s3c_usbgadget_resource
),
241 .resource
= s3c_usbgadget_resource
,
244 EXPORT_SYMBOL(s3c_device_usbgadget
);
246 void __init
s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info
*pd
)
248 struct s3c2410_udc_mach_info
*npd
;
250 npd
= kmalloc(sizeof(*npd
), GFP_KERNEL
);
252 memcpy(npd
, pd
, sizeof(*npd
));
253 s3c_device_usbgadget
.dev
.platform_data
= npd
;
255 printk(KERN_ERR
"no memory for udc platform data\n");
262 static struct resource s3c_wdt_resource
[] = {
264 .start
= S3C24XX_PA_WATCHDOG
,
265 .end
= S3C24XX_PA_WATCHDOG
+ S3C24XX_SZ_WATCHDOG
- 1,
266 .flags
= IORESOURCE_MEM
,
271 .flags
= IORESOURCE_IRQ
,
276 struct platform_device s3c_device_wdt
= {
277 .name
= "s3c2410-wdt",
279 .num_resources
= ARRAY_SIZE(s3c_wdt_resource
),
280 .resource
= s3c_wdt_resource
,
283 EXPORT_SYMBOL(s3c_device_wdt
);
287 static struct resource s3c_iis_resource
[] = {
289 .start
= S3C24XX_PA_IIS
,
290 .end
= S3C24XX_PA_IIS
+ S3C24XX_SZ_IIS
-1,
291 .flags
= IORESOURCE_MEM
,
295 static u64 s3c_device_iis_dmamask
= 0xffffffffUL
;
297 struct platform_device s3c_device_iis
= {
298 .name
= "s3c2410-iis",
300 .num_resources
= ARRAY_SIZE(s3c_iis_resource
),
301 .resource
= s3c_iis_resource
,
303 .dma_mask
= &s3c_device_iis_dmamask
,
304 .coherent_dma_mask
= 0xffffffffUL
308 EXPORT_SYMBOL(s3c_device_iis
);
312 static struct resource s3c_rtc_resource
[] = {
314 .start
= S3C24XX_PA_RTC
,
315 .end
= S3C24XX_PA_RTC
+ 0xff,
316 .flags
= IORESOURCE_MEM
,
321 .flags
= IORESOURCE_IRQ
,
326 .flags
= IORESOURCE_IRQ
330 struct platform_device s3c_device_rtc
= {
331 .name
= "s3c2410-rtc",
333 .num_resources
= ARRAY_SIZE(s3c_rtc_resource
),
334 .resource
= s3c_rtc_resource
,
337 EXPORT_SYMBOL(s3c_device_rtc
);
341 static struct resource s3c_adc_resource
[] = {
343 .start
= S3C24XX_PA_ADC
,
344 .end
= S3C24XX_PA_ADC
+ S3C24XX_SZ_ADC
- 1,
345 .flags
= IORESOURCE_MEM
,
350 .flags
= IORESOURCE_IRQ
,
355 .flags
= IORESOURCE_IRQ
,
360 struct platform_device s3c_device_adc
= {
361 .name
= "s3c24xx-adc",
363 .num_resources
= ARRAY_SIZE(s3c_adc_resource
),
364 .resource
= s3c_adc_resource
,
369 struct platform_device s3c_device_hwmon
= {
370 .name
= "s3c24xx-hwmon",
372 .dev
.parent
= &s3c_device_adc
.dev
,
377 static struct resource s3c_sdi_resource
[] = {
379 .start
= S3C24XX_PA_SDI
,
380 .end
= S3C24XX_PA_SDI
+ S3C24XX_SZ_SDI
- 1,
381 .flags
= IORESOURCE_MEM
,
386 .flags
= IORESOURCE_IRQ
,
391 struct platform_device s3c_device_sdi
= {
392 .name
= "s3c2410-sdi",
394 .num_resources
= ARRAY_SIZE(s3c_sdi_resource
),
395 .resource
= s3c_sdi_resource
,
398 EXPORT_SYMBOL(s3c_device_sdi
);
402 static struct resource s3c_spi0_resource
[] = {
404 .start
= S3C24XX_PA_SPI
,
405 .end
= S3C24XX_PA_SPI
+ 0x1f,
406 .flags
= IORESOURCE_MEM
,
411 .flags
= IORESOURCE_IRQ
,
416 static u64 s3c_device_spi0_dmamask
= 0xffffffffUL
;
418 struct platform_device s3c_device_spi0
= {
419 .name
= "s3c2410-spi",
421 .num_resources
= ARRAY_SIZE(s3c_spi0_resource
),
422 .resource
= s3c_spi0_resource
,
424 .dma_mask
= &s3c_device_spi0_dmamask
,
425 .coherent_dma_mask
= 0xffffffffUL
429 EXPORT_SYMBOL(s3c_device_spi0
);
433 static struct resource s3c_spi1_resource
[] = {
435 .start
= S3C24XX_PA_SPI
+ S3C2410_SPI1
,
436 .end
= S3C24XX_PA_SPI
+ S3C2410_SPI1
+ 0x1f,
437 .flags
= IORESOURCE_MEM
,
442 .flags
= IORESOURCE_IRQ
,
447 static u64 s3c_device_spi1_dmamask
= 0xffffffffUL
;
449 struct platform_device s3c_device_spi1
= {
450 .name
= "s3c2410-spi",
452 .num_resources
= ARRAY_SIZE(s3c_spi1_resource
),
453 .resource
= s3c_spi1_resource
,
455 .dma_mask
= &s3c_device_spi1_dmamask
,
456 .coherent_dma_mask
= 0xffffffffUL
460 EXPORT_SYMBOL(s3c_device_spi1
);
462 #ifdef CONFIG_CPU_S3C2440
464 /* Camif Controller */
466 static struct resource s3c_camif_resource
[] = {
468 .start
= S3C2440_PA_CAMIF
,
469 .end
= S3C2440_PA_CAMIF
+ S3C2440_SZ_CAMIF
- 1,
470 .flags
= IORESOURCE_MEM
,
475 .flags
= IORESOURCE_IRQ
,
480 static u64 s3c_device_camif_dmamask
= 0xffffffffUL
;
482 struct platform_device s3c_device_camif
= {
483 .name
= "s3c2440-camif",
485 .num_resources
= ARRAY_SIZE(s3c_camif_resource
),
486 .resource
= s3c_camif_resource
,
488 .dma_mask
= &s3c_device_camif_dmamask
,
489 .coherent_dma_mask
= 0xffffffffUL
493 EXPORT_SYMBOL(s3c_device_camif
);
495 #endif // CONFIG_CPU_S32440