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>
23 #include <linux/slab.h>
25 #include <asm/mach/arch.h>
26 #include <asm/mach/map.h>
27 #include <asm/mach/irq.h>
29 #include <mach/hardware.h>
31 #include <mach/irqs.h>
34 #include <plat/regs-serial.h>
38 #include <plat/devs.h>
40 #include <plat/regs-spi.h>
44 /* Serial port registrations */
46 static struct resource s3c2410_uart0_resource
[] = {
48 .start
= S3C2410_PA_UART0
,
49 .end
= S3C2410_PA_UART0
+ 0x3fff,
50 .flags
= IORESOURCE_MEM
,
53 .start
= IRQ_S3CUART_RX0
,
54 .end
= IRQ_S3CUART_ERR0
,
55 .flags
= IORESOURCE_IRQ
,
59 static struct resource s3c2410_uart1_resource
[] = {
61 .start
= S3C2410_PA_UART1
,
62 .end
= S3C2410_PA_UART1
+ 0x3fff,
63 .flags
= IORESOURCE_MEM
,
66 .start
= IRQ_S3CUART_RX1
,
67 .end
= IRQ_S3CUART_ERR1
,
68 .flags
= IORESOURCE_IRQ
,
72 static struct resource s3c2410_uart2_resource
[] = {
74 .start
= S3C2410_PA_UART2
,
75 .end
= S3C2410_PA_UART2
+ 0x3fff,
76 .flags
= IORESOURCE_MEM
,
79 .start
= IRQ_S3CUART_RX2
,
80 .end
= IRQ_S3CUART_ERR2
,
81 .flags
= IORESOURCE_IRQ
,
85 static struct resource s3c2410_uart3_resource
[] = {
87 .start
= S3C2443_PA_UART3
,
88 .end
= S3C2443_PA_UART3
+ 0x3fff,
89 .flags
= IORESOURCE_MEM
,
92 .start
= IRQ_S3CUART_RX3
,
93 .end
= IRQ_S3CUART_ERR3
,
94 .flags
= IORESOURCE_IRQ
,
98 struct s3c24xx_uart_resources s3c2410_uart_resources
[] __initdata
= {
100 .resources
= s3c2410_uart0_resource
,
101 .nr_resources
= ARRAY_SIZE(s3c2410_uart0_resource
),
104 .resources
= s3c2410_uart1_resource
,
105 .nr_resources
= ARRAY_SIZE(s3c2410_uart1_resource
),
108 .resources
= s3c2410_uart2_resource
,
109 .nr_resources
= ARRAY_SIZE(s3c2410_uart2_resource
),
112 .resources
= s3c2410_uart3_resource
,
113 .nr_resources
= ARRAY_SIZE(s3c2410_uart3_resource
),
119 static struct resource s3c_lcd_resource
[] = {
121 .start
= S3C24XX_PA_LCD
,
122 .end
= S3C24XX_PA_LCD
+ S3C24XX_SZ_LCD
- 1,
123 .flags
= IORESOURCE_MEM
,
128 .flags
= IORESOURCE_IRQ
,
133 static u64 s3c_device_lcd_dmamask
= 0xffffffffUL
;
135 struct platform_device s3c_device_lcd
= {
136 .name
= "s3c2410-lcd",
138 .num_resources
= ARRAY_SIZE(s3c_lcd_resource
),
139 .resource
= s3c_lcd_resource
,
141 .dma_mask
= &s3c_device_lcd_dmamask
,
142 .coherent_dma_mask
= 0xffffffffUL
146 EXPORT_SYMBOL(s3c_device_lcd
);
148 void __init
s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info
*pd
)
150 struct s3c2410fb_mach_info
*npd
;
152 npd
= kmalloc(sizeof(*npd
), GFP_KERNEL
);
154 memcpy(npd
, pd
, sizeof(*npd
));
155 s3c_device_lcd
.dev
.platform_data
= npd
;
157 printk(KERN_ERR
"no memory for LCD platform data\n");
163 static struct resource s3c_ts_resource
[] = {
165 .start
= S3C24XX_PA_ADC
,
166 .end
= S3C24XX_PA_ADC
+ S3C24XX_SZ_ADC
- 1,
167 .flags
= IORESOURCE_MEM
,
172 .flags
= IORESOURCE_IRQ
,
177 struct platform_device s3c_device_ts
= {
178 .name
= "s3c2410-ts",
180 .dev
.parent
= &s3c_device_adc
.dev
,
181 .num_resources
= ARRAY_SIZE(s3c_ts_resource
),
182 .resource
= s3c_ts_resource
,
184 EXPORT_SYMBOL(s3c_device_ts
);
186 static struct s3c2410_ts_mach_info s3c2410ts_info
;
188 void __init
s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info
*hard_s3c2410ts_info
)
190 memcpy(&s3c2410ts_info
, hard_s3c2410ts_info
, sizeof(struct s3c2410_ts_mach_info
));
191 s3c_device_ts
.dev
.platform_data
= &s3c2410ts_info
;
193 EXPORT_SYMBOL(s3c24xx_ts_set_platdata
);
195 /* USB Device (Gadget)*/
197 static struct resource s3c_usbgadget_resource
[] = {
199 .start
= S3C24XX_PA_USBDEV
,
200 .end
= S3C24XX_PA_USBDEV
+ S3C24XX_SZ_USBDEV
- 1,
201 .flags
= IORESOURCE_MEM
,
206 .flags
= IORESOURCE_IRQ
,
211 struct platform_device s3c_device_usbgadget
= {
212 .name
= "s3c2410-usbgadget",
214 .num_resources
= ARRAY_SIZE(s3c_usbgadget_resource
),
215 .resource
= s3c_usbgadget_resource
,
218 EXPORT_SYMBOL(s3c_device_usbgadget
);
220 void __init
s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info
*pd
)
222 struct s3c2410_udc_mach_info
*npd
;
224 npd
= kmalloc(sizeof(*npd
), GFP_KERNEL
);
226 memcpy(npd
, pd
, sizeof(*npd
));
227 s3c_device_usbgadget
.dev
.platform_data
= npd
;
229 printk(KERN_ERR
"no memory for udc platform data\n");
236 static struct resource s3c_wdt_resource
[] = {
238 .start
= S3C24XX_PA_WATCHDOG
,
239 .end
= S3C24XX_PA_WATCHDOG
+ S3C24XX_SZ_WATCHDOG
- 1,
240 .flags
= IORESOURCE_MEM
,
245 .flags
= IORESOURCE_IRQ
,
250 struct platform_device s3c_device_wdt
= {
251 .name
= "s3c2410-wdt",
253 .num_resources
= ARRAY_SIZE(s3c_wdt_resource
),
254 .resource
= s3c_wdt_resource
,
257 EXPORT_SYMBOL(s3c_device_wdt
);
261 static struct resource s3c_iis_resource
[] = {
263 .start
= S3C24XX_PA_IIS
,
264 .end
= S3C24XX_PA_IIS
+ S3C24XX_SZ_IIS
-1,
265 .flags
= IORESOURCE_MEM
,
269 static u64 s3c_device_iis_dmamask
= 0xffffffffUL
;
271 struct platform_device s3c_device_iis
= {
272 .name
= "s3c2410-iis",
274 .num_resources
= ARRAY_SIZE(s3c_iis_resource
),
275 .resource
= s3c_iis_resource
,
277 .dma_mask
= &s3c_device_iis_dmamask
,
278 .coherent_dma_mask
= 0xffffffffUL
282 EXPORT_SYMBOL(s3c_device_iis
);
286 static struct resource s3c_rtc_resource
[] = {
288 .start
= S3C24XX_PA_RTC
,
289 .end
= S3C24XX_PA_RTC
+ 0xff,
290 .flags
= IORESOURCE_MEM
,
295 .flags
= IORESOURCE_IRQ
,
300 .flags
= IORESOURCE_IRQ
304 struct platform_device s3c_device_rtc
= {
305 .name
= "s3c2410-rtc",
307 .num_resources
= ARRAY_SIZE(s3c_rtc_resource
),
308 .resource
= s3c_rtc_resource
,
311 EXPORT_SYMBOL(s3c_device_rtc
);
315 static struct resource s3c_adc_resource
[] = {
317 .start
= S3C24XX_PA_ADC
,
318 .end
= S3C24XX_PA_ADC
+ S3C24XX_SZ_ADC
- 1,
319 .flags
= IORESOURCE_MEM
,
324 .flags
= IORESOURCE_IRQ
,
329 .flags
= IORESOURCE_IRQ
,
334 struct platform_device s3c_device_adc
= {
335 .name
= "s3c24xx-adc",
337 .num_resources
= ARRAY_SIZE(s3c_adc_resource
),
338 .resource
= s3c_adc_resource
,
343 struct platform_device s3c_device_hwmon
= {
346 .dev
.parent
= &s3c_device_adc
.dev
,
351 static struct resource s3c_sdi_resource
[] = {
353 .start
= S3C24XX_PA_SDI
,
354 .end
= S3C24XX_PA_SDI
+ S3C24XX_SZ_SDI
- 1,
355 .flags
= IORESOURCE_MEM
,
360 .flags
= IORESOURCE_IRQ
,
365 struct platform_device s3c_device_sdi
= {
366 .name
= "s3c2410-sdi",
368 .num_resources
= ARRAY_SIZE(s3c_sdi_resource
),
369 .resource
= s3c_sdi_resource
,
372 EXPORT_SYMBOL(s3c_device_sdi
);
374 void s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata
*pdata
)
376 struct s3c24xx_mci_pdata
*npd
;
378 npd
= kmemdup(pdata
, sizeof(struct s3c24xx_mci_pdata
), GFP_KERNEL
);
380 printk(KERN_ERR
"%s: no memory to copy pdata", __func__
);
382 s3c_device_sdi
.dev
.platform_data
= npd
;
388 static struct resource s3c_spi0_resource
[] = {
390 .start
= S3C24XX_PA_SPI
,
391 .end
= S3C24XX_PA_SPI
+ 0x1f,
392 .flags
= IORESOURCE_MEM
,
397 .flags
= IORESOURCE_IRQ
,
402 static u64 s3c_device_spi0_dmamask
= 0xffffffffUL
;
404 struct platform_device s3c_device_spi0
= {
405 .name
= "s3c2410-spi",
407 .num_resources
= ARRAY_SIZE(s3c_spi0_resource
),
408 .resource
= s3c_spi0_resource
,
410 .dma_mask
= &s3c_device_spi0_dmamask
,
411 .coherent_dma_mask
= 0xffffffffUL
415 EXPORT_SYMBOL(s3c_device_spi0
);
419 static struct resource s3c_spi1_resource
[] = {
421 .start
= S3C24XX_PA_SPI
+ S3C2410_SPI1
,
422 .end
= S3C24XX_PA_SPI
+ S3C2410_SPI1
+ 0x1f,
423 .flags
= IORESOURCE_MEM
,
428 .flags
= IORESOURCE_IRQ
,
433 static u64 s3c_device_spi1_dmamask
= 0xffffffffUL
;
435 struct platform_device s3c_device_spi1
= {
436 .name
= "s3c2410-spi",
438 .num_resources
= ARRAY_SIZE(s3c_spi1_resource
),
439 .resource
= s3c_spi1_resource
,
441 .dma_mask
= &s3c_device_spi1_dmamask
,
442 .coherent_dma_mask
= 0xffffffffUL
446 EXPORT_SYMBOL(s3c_device_spi1
);
448 #ifdef CONFIG_CPU_S3C2440
450 /* Camif Controller */
452 static struct resource s3c_camif_resource
[] = {
454 .start
= S3C2440_PA_CAMIF
,
455 .end
= S3C2440_PA_CAMIF
+ S3C2440_SZ_CAMIF
- 1,
456 .flags
= IORESOURCE_MEM
,
461 .flags
= IORESOURCE_IRQ
,
466 static u64 s3c_device_camif_dmamask
= 0xffffffffUL
;
468 struct platform_device s3c_device_camif
= {
469 .name
= "s3c2440-camif",
471 .num_resources
= ARRAY_SIZE(s3c_camif_resource
),
472 .resource
= s3c_camif_resource
,
474 .dma_mask
= &s3c_device_camif_dmamask
,
475 .coherent_dma_mask
= 0xffffffffUL
479 EXPORT_SYMBOL(s3c_device_camif
);
483 static struct resource s3c_ac97_resource
[] = {
485 .start
= S3C2440_PA_AC97
,
486 .end
= S3C2440_PA_AC97
+ S3C2440_SZ_AC97
-1,
487 .flags
= IORESOURCE_MEM
,
490 .start
= IRQ_S3C244x_AC97
,
491 .end
= IRQ_S3C244x_AC97
,
492 .flags
= IORESOURCE_IRQ
,
496 .start
= DMACH_PCM_OUT
,
497 .end
= DMACH_PCM_OUT
,
498 .flags
= IORESOURCE_DMA
,
502 .start
= DMACH_PCM_IN
,
504 .flags
= IORESOURCE_DMA
,
508 .start
= DMACH_MIC_IN
,
510 .flags
= IORESOURCE_DMA
,
514 static u64 s3c_device_ac97_dmamask
= 0xffffffffUL
;
516 struct platform_device s3c_device_ac97
= {
519 .num_resources
= ARRAY_SIZE(s3c_ac97_resource
),
520 .resource
= s3c_ac97_resource
,
522 .dma_mask
= &s3c_device_ac97_dmamask
,
523 .coherent_dma_mask
= 0xffffffffUL
527 EXPORT_SYMBOL(s3c_device_ac97
);
529 #endif // CONFIG_CPU_S32440