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>
24 #include <linux/string.h>
26 #include <asm/mach/arch.h>
27 #include <asm/mach/map.h>
28 #include <asm/mach/irq.h>
30 #include <mach/hardware.h>
32 #include <mach/irqs.h>
35 #include <plat/regs-serial.h>
39 #include <plat/devs.h>
41 #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
= kmemdup(pd
, sizeof(*npd
), GFP_KERNEL
);
154 s3c_device_lcd
.dev
.platform_data
= npd
;
155 npd
->displays
= kmemdup(pd
->displays
,
156 sizeof(struct s3c2410fb_display
) * npd
->num_displays
,
159 printk(KERN_ERR
"no memory for LCD display data\n");
161 printk(KERN_ERR
"no memory for LCD platform data\n");
167 static struct resource s3c_ts_resource
[] = {
169 .start
= S3C24XX_PA_ADC
,
170 .end
= S3C24XX_PA_ADC
+ S3C24XX_SZ_ADC
- 1,
171 .flags
= IORESOURCE_MEM
,
176 .flags
= IORESOURCE_IRQ
,
181 struct platform_device s3c_device_ts
= {
182 .name
= "s3c2410-ts",
184 .dev
.parent
= &s3c_device_adc
.dev
,
185 .num_resources
= ARRAY_SIZE(s3c_ts_resource
),
186 .resource
= s3c_ts_resource
,
188 EXPORT_SYMBOL(s3c_device_ts
);
190 static struct s3c2410_ts_mach_info s3c2410ts_info
;
192 void __init
s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info
*hard_s3c2410ts_info
)
194 memcpy(&s3c2410ts_info
, hard_s3c2410ts_info
, sizeof(struct s3c2410_ts_mach_info
));
195 s3c_device_ts
.dev
.platform_data
= &s3c2410ts_info
;
197 EXPORT_SYMBOL(s3c24xx_ts_set_platdata
);
199 /* USB Device (Gadget)*/
201 static struct resource s3c_usbgadget_resource
[] = {
203 .start
= S3C24XX_PA_USBDEV
,
204 .end
= S3C24XX_PA_USBDEV
+ S3C24XX_SZ_USBDEV
- 1,
205 .flags
= IORESOURCE_MEM
,
210 .flags
= IORESOURCE_IRQ
,
215 struct platform_device s3c_device_usbgadget
= {
216 .name
= "s3c2410-usbgadget",
218 .num_resources
= ARRAY_SIZE(s3c_usbgadget_resource
),
219 .resource
= s3c_usbgadget_resource
,
222 EXPORT_SYMBOL(s3c_device_usbgadget
);
224 void __init
s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info
*pd
)
226 struct s3c2410_udc_mach_info
*npd
;
228 npd
= kmalloc(sizeof(*npd
), GFP_KERNEL
);
230 memcpy(npd
, pd
, sizeof(*npd
));
231 s3c_device_usbgadget
.dev
.platform_data
= npd
;
233 printk(KERN_ERR
"no memory for udc platform data\n");
239 static struct resource s3c_iis_resource
[] = {
241 .start
= S3C24XX_PA_IIS
,
242 .end
= S3C24XX_PA_IIS
+ S3C24XX_SZ_IIS
-1,
243 .flags
= IORESOURCE_MEM
,
247 static u64 s3c_device_iis_dmamask
= 0xffffffffUL
;
249 struct platform_device s3c_device_iis
= {
250 .name
= "s3c2410-iis",
252 .num_resources
= ARRAY_SIZE(s3c_iis_resource
),
253 .resource
= s3c_iis_resource
,
255 .dma_mask
= &s3c_device_iis_dmamask
,
256 .coherent_dma_mask
= 0xffffffffUL
260 EXPORT_SYMBOL(s3c_device_iis
);
264 static struct resource s3c_rtc_resource
[] = {
266 .start
= S3C24XX_PA_RTC
,
267 .end
= S3C24XX_PA_RTC
+ 0xff,
268 .flags
= IORESOURCE_MEM
,
273 .flags
= IORESOURCE_IRQ
,
278 .flags
= IORESOURCE_IRQ
282 struct platform_device s3c_device_rtc
= {
283 .name
= "s3c2410-rtc",
285 .num_resources
= ARRAY_SIZE(s3c_rtc_resource
),
286 .resource
= s3c_rtc_resource
,
289 EXPORT_SYMBOL(s3c_device_rtc
);
293 static struct resource s3c_adc_resource
[] = {
295 .start
= S3C24XX_PA_ADC
,
296 .end
= S3C24XX_PA_ADC
+ S3C24XX_SZ_ADC
- 1,
297 .flags
= IORESOURCE_MEM
,
302 .flags
= IORESOURCE_IRQ
,
307 .flags
= IORESOURCE_IRQ
,
312 struct platform_device s3c_device_adc
= {
313 .name
= "s3c24xx-adc",
315 .num_resources
= ARRAY_SIZE(s3c_adc_resource
),
316 .resource
= s3c_adc_resource
,
321 static struct resource s3c_sdi_resource
[] = {
323 .start
= S3C24XX_PA_SDI
,
324 .end
= S3C24XX_PA_SDI
+ S3C24XX_SZ_SDI
- 1,
325 .flags
= IORESOURCE_MEM
,
330 .flags
= IORESOURCE_IRQ
,
335 struct platform_device s3c_device_sdi
= {
336 .name
= "s3c2410-sdi",
338 .num_resources
= ARRAY_SIZE(s3c_sdi_resource
),
339 .resource
= s3c_sdi_resource
,
342 EXPORT_SYMBOL(s3c_device_sdi
);
344 void __init
s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata
*pdata
)
346 struct s3c24xx_mci_pdata
*npd
;
348 npd
= kmemdup(pdata
, sizeof(struct s3c24xx_mci_pdata
), GFP_KERNEL
);
350 printk(KERN_ERR
"%s: no memory to copy pdata", __func__
);
352 s3c_device_sdi
.dev
.platform_data
= npd
;
358 static struct resource s3c_spi0_resource
[] = {
360 .start
= S3C24XX_PA_SPI
,
361 .end
= S3C24XX_PA_SPI
+ 0x1f,
362 .flags
= IORESOURCE_MEM
,
367 .flags
= IORESOURCE_IRQ
,
372 static u64 s3c_device_spi0_dmamask
= 0xffffffffUL
;
374 struct platform_device s3c_device_spi0
= {
375 .name
= "s3c2410-spi",
377 .num_resources
= ARRAY_SIZE(s3c_spi0_resource
),
378 .resource
= s3c_spi0_resource
,
380 .dma_mask
= &s3c_device_spi0_dmamask
,
381 .coherent_dma_mask
= 0xffffffffUL
385 EXPORT_SYMBOL(s3c_device_spi0
);
389 static struct resource s3c_spi1_resource
[] = {
391 .start
= S3C24XX_PA_SPI
+ S3C2410_SPI1
,
392 .end
= S3C24XX_PA_SPI
+ S3C2410_SPI1
+ 0x1f,
393 .flags
= IORESOURCE_MEM
,
398 .flags
= IORESOURCE_IRQ
,
403 static u64 s3c_device_spi1_dmamask
= 0xffffffffUL
;
405 struct platform_device s3c_device_spi1
= {
406 .name
= "s3c2410-spi",
408 .num_resources
= ARRAY_SIZE(s3c_spi1_resource
),
409 .resource
= s3c_spi1_resource
,
411 .dma_mask
= &s3c_device_spi1_dmamask
,
412 .coherent_dma_mask
= 0xffffffffUL
416 EXPORT_SYMBOL(s3c_device_spi1
);
418 #ifdef CONFIG_CPU_S3C2440
420 /* Camif Controller */
422 static struct resource s3c_camif_resource
[] = {
424 .start
= S3C2440_PA_CAMIF
,
425 .end
= S3C2440_PA_CAMIF
+ S3C2440_SZ_CAMIF
- 1,
426 .flags
= IORESOURCE_MEM
,
431 .flags
= IORESOURCE_IRQ
,
436 static u64 s3c_device_camif_dmamask
= 0xffffffffUL
;
438 struct platform_device s3c_device_camif
= {
439 .name
= "s3c2440-camif",
441 .num_resources
= ARRAY_SIZE(s3c_camif_resource
),
442 .resource
= s3c_camif_resource
,
444 .dma_mask
= &s3c_device_camif_dmamask
,
445 .coherent_dma_mask
= 0xffffffffUL
449 EXPORT_SYMBOL(s3c_device_camif
);
453 static struct resource s3c_ac97_resource
[] = {
455 .start
= S3C2440_PA_AC97
,
456 .end
= S3C2440_PA_AC97
+ S3C2440_SZ_AC97
-1,
457 .flags
= IORESOURCE_MEM
,
460 .start
= IRQ_S3C244x_AC97
,
461 .end
= IRQ_S3C244x_AC97
,
462 .flags
= IORESOURCE_IRQ
,
466 .start
= DMACH_PCM_OUT
,
467 .end
= DMACH_PCM_OUT
,
468 .flags
= IORESOURCE_DMA
,
472 .start
= DMACH_PCM_IN
,
474 .flags
= IORESOURCE_DMA
,
478 .start
= DMACH_MIC_IN
,
480 .flags
= IORESOURCE_DMA
,
484 static u64 s3c_device_ac97_dmamask
= 0xffffffffUL
;
486 struct platform_device s3c_device_ac97
= {
489 .num_resources
= ARRAY_SIZE(s3c_ac97_resource
),
490 .resource
= s3c_ac97_resource
,
492 .dma_mask
= &s3c_device_ac97_dmamask
,
493 .coherent_dma_mask
= 0xffffffffUL
497 EXPORT_SYMBOL(s3c_device_ac97
);
499 #endif // CONFIG_CPU_S32440