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>
25 #include <linux/dma-mapping.h>
26 #include <linux/export.h>
28 #include <asm/mach/arch.h>
29 #include <asm/mach/map.h>
30 #include <asm/mach/irq.h>
32 #include <mach/hardware.h>
34 #include <mach/irqs.h>
37 #include <plat/regs-serial.h>
41 #include <plat/devs.h>
43 #include <plat/regs-spi.h>
46 /* Serial port registrations */
48 static struct resource s3c2410_uart0_resource
[] = {
50 .start
= S3C2410_PA_UART0
,
51 .end
= S3C2410_PA_UART0
+ 0x3fff,
52 .flags
= IORESOURCE_MEM
,
55 .start
= IRQ_S3CUART_RX0
,
56 .end
= IRQ_S3CUART_ERR0
,
57 .flags
= IORESOURCE_IRQ
,
61 static struct resource s3c2410_uart1_resource
[] = {
63 .start
= S3C2410_PA_UART1
,
64 .end
= S3C2410_PA_UART1
+ 0x3fff,
65 .flags
= IORESOURCE_MEM
,
68 .start
= IRQ_S3CUART_RX1
,
69 .end
= IRQ_S3CUART_ERR1
,
70 .flags
= IORESOURCE_IRQ
,
74 static struct resource s3c2410_uart2_resource
[] = {
76 .start
= S3C2410_PA_UART2
,
77 .end
= S3C2410_PA_UART2
+ 0x3fff,
78 .flags
= IORESOURCE_MEM
,
81 .start
= IRQ_S3CUART_RX2
,
82 .end
= IRQ_S3CUART_ERR2
,
83 .flags
= IORESOURCE_IRQ
,
87 static struct resource s3c2410_uart3_resource
[] = {
89 .start
= S3C2443_PA_UART3
,
90 .end
= S3C2443_PA_UART3
+ 0x3fff,
91 .flags
= IORESOURCE_MEM
,
94 .start
= IRQ_S3CUART_RX3
,
95 .end
= IRQ_S3CUART_ERR3
,
96 .flags
= IORESOURCE_IRQ
,
100 struct s3c24xx_uart_resources s3c2410_uart_resources
[] __initdata
= {
102 .resources
= s3c2410_uart0_resource
,
103 .nr_resources
= ARRAY_SIZE(s3c2410_uart0_resource
),
106 .resources
= s3c2410_uart1_resource
,
107 .nr_resources
= ARRAY_SIZE(s3c2410_uart1_resource
),
110 .resources
= s3c2410_uart2_resource
,
111 .nr_resources
= ARRAY_SIZE(s3c2410_uart2_resource
),
114 .resources
= s3c2410_uart3_resource
,
115 .nr_resources
= ARRAY_SIZE(s3c2410_uart3_resource
),
121 static struct resource s3c_lcd_resource
[] = {
123 .start
= S3C24XX_PA_LCD
,
124 .end
= S3C24XX_PA_LCD
+ S3C24XX_SZ_LCD
- 1,
125 .flags
= IORESOURCE_MEM
,
130 .flags
= IORESOURCE_IRQ
,
135 static u64 s3c_device_lcd_dmamask
= 0xffffffffUL
;
137 struct platform_device s3c_device_lcd
= {
138 .name
= "s3c2410-lcd",
140 .num_resources
= ARRAY_SIZE(s3c_lcd_resource
),
141 .resource
= s3c_lcd_resource
,
143 .dma_mask
= &s3c_device_lcd_dmamask
,
144 .coherent_dma_mask
= 0xffffffffUL
148 EXPORT_SYMBOL(s3c_device_lcd
);
150 void __init
s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info
*pd
)
152 struct s3c2410fb_mach_info
*npd
;
154 npd
= s3c_set_platdata(pd
, sizeof(*npd
), &s3c_device_lcd
);
156 npd
->displays
= kmemdup(pd
->displays
,
157 sizeof(struct s3c2410fb_display
) * npd
->num_displays
,
160 printk(KERN_ERR
"no memory for LCD display data\n");
162 printk(KERN_ERR
"no memory for LCD platform data\n");
168 static struct resource s3c_ts_resource
[] = {
170 .start
= S3C24XX_PA_ADC
,
171 .end
= S3C24XX_PA_ADC
+ S3C24XX_SZ_ADC
- 1,
172 .flags
= IORESOURCE_MEM
,
177 .flags
= IORESOURCE_IRQ
,
182 struct platform_device s3c_device_ts
= {
183 .name
= "s3c2410-ts",
185 .dev
.parent
= &s3c_device_adc
.dev
,
186 .num_resources
= ARRAY_SIZE(s3c_ts_resource
),
187 .resource
= s3c_ts_resource
,
189 EXPORT_SYMBOL(s3c_device_ts
);
191 void __init
s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info
*hard_s3c2410ts_info
)
193 s3c_set_platdata(hard_s3c2410ts_info
,
194 sizeof(struct s3c2410_ts_mach_info
), &s3c_device_ts
);
197 /* USB Device (Gadget)*/
199 static struct resource s3c_usbgadget_resource
[] = {
201 .start
= S3C24XX_PA_USBDEV
,
202 .end
= S3C24XX_PA_USBDEV
+ S3C24XX_SZ_USBDEV
- 1,
203 .flags
= IORESOURCE_MEM
,
208 .flags
= IORESOURCE_IRQ
,
213 struct platform_device s3c_device_usbgadget
= {
214 .name
= "s3c2410-usbgadget",
216 .num_resources
= ARRAY_SIZE(s3c_usbgadget_resource
),
217 .resource
= s3c_usbgadget_resource
,
220 EXPORT_SYMBOL(s3c_device_usbgadget
);
222 void __init
s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info
*pd
)
224 s3c_set_platdata(pd
, sizeof(*pd
), &s3c_device_usbgadget
);
227 /* USB High Speed 2.0 Device (Gadget) */
228 static struct resource s3c_hsudc_resource
[] = {
230 .start
= S3C2416_PA_HSUDC
,
231 .end
= S3C2416_PA_HSUDC
+ S3C2416_SZ_HSUDC
- 1,
232 .flags
= IORESOURCE_MEM
,
237 .flags
= IORESOURCE_IRQ
,
241 static u64 s3c_hsudc_dmamask
= DMA_BIT_MASK(32);
243 struct platform_device s3c_device_usb_hsudc
= {
246 .num_resources
= ARRAY_SIZE(s3c_hsudc_resource
),
247 .resource
= s3c_hsudc_resource
,
249 .dma_mask
= &s3c_hsudc_dmamask
,
250 .coherent_dma_mask
= DMA_BIT_MASK(32),
254 void __init
s3c24xx_hsudc_set_platdata(struct s3c24xx_hsudc_platdata
*pd
)
256 s3c_set_platdata(pd
, sizeof(*pd
), &s3c_device_usb_hsudc
);
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
= "s3c24xx-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 static struct resource s3c_sdi_resource
[] = {
345 .start
= S3C24XX_PA_SDI
,
346 .end
= S3C24XX_PA_SDI
+ S3C24XX_SZ_SDI
- 1,
347 .flags
= IORESOURCE_MEM
,
352 .flags
= IORESOURCE_IRQ
,
357 struct platform_device s3c_device_sdi
= {
358 .name
= "s3c2410-sdi",
360 .num_resources
= ARRAY_SIZE(s3c_sdi_resource
),
361 .resource
= s3c_sdi_resource
,
364 EXPORT_SYMBOL(s3c_device_sdi
);
366 void __init
s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata
*pdata
)
368 s3c_set_platdata(pdata
, sizeof(struct s3c24xx_mci_pdata
),
375 static struct resource s3c_spi0_resource
[] = {
377 .start
= S3C24XX_PA_SPI
,
378 .end
= S3C24XX_PA_SPI
+ 0x1f,
379 .flags
= IORESOURCE_MEM
,
384 .flags
= IORESOURCE_IRQ
,
389 static u64 s3c_device_spi0_dmamask
= 0xffffffffUL
;
391 struct platform_device s3c_device_spi0
= {
392 .name
= "s3c2410-spi",
394 .num_resources
= ARRAY_SIZE(s3c_spi0_resource
),
395 .resource
= s3c_spi0_resource
,
397 .dma_mask
= &s3c_device_spi0_dmamask
,
398 .coherent_dma_mask
= 0xffffffffUL
402 EXPORT_SYMBOL(s3c_device_spi0
);
406 static struct resource s3c_spi1_resource
[] = {
408 .start
= S3C24XX_PA_SPI
+ S3C2410_SPI1
,
409 .end
= S3C24XX_PA_SPI
+ S3C2410_SPI1
+ 0x1f,
410 .flags
= IORESOURCE_MEM
,
415 .flags
= IORESOURCE_IRQ
,
420 static u64 s3c_device_spi1_dmamask
= 0xffffffffUL
;
422 struct platform_device s3c_device_spi1
= {
423 .name
= "s3c2410-spi",
425 .num_resources
= ARRAY_SIZE(s3c_spi1_resource
),
426 .resource
= s3c_spi1_resource
,
428 .dma_mask
= &s3c_device_spi1_dmamask
,
429 .coherent_dma_mask
= 0xffffffffUL
433 EXPORT_SYMBOL(s3c_device_spi1
);
435 #ifdef CONFIG_CPU_S3C2440
437 /* Camif Controller */
439 static struct resource s3c_camif_resource
[] = {
441 .start
= S3C2440_PA_CAMIF
,
442 .end
= S3C2440_PA_CAMIF
+ S3C2440_SZ_CAMIF
- 1,
443 .flags
= IORESOURCE_MEM
,
448 .flags
= IORESOURCE_IRQ
,
453 static u64 s3c_device_camif_dmamask
= 0xffffffffUL
;
455 struct platform_device s3c_device_camif
= {
456 .name
= "s3c2440-camif",
458 .num_resources
= ARRAY_SIZE(s3c_camif_resource
),
459 .resource
= s3c_camif_resource
,
461 .dma_mask
= &s3c_device_camif_dmamask
,
462 .coherent_dma_mask
= 0xffffffffUL
466 EXPORT_SYMBOL(s3c_device_camif
);
470 static struct resource s3c_ac97_resource
[] = {
472 .start
= S3C2440_PA_AC97
,
473 .end
= S3C2440_PA_AC97
+ S3C2440_SZ_AC97
-1,
474 .flags
= IORESOURCE_MEM
,
477 .start
= IRQ_S3C244x_AC97
,
478 .end
= IRQ_S3C244x_AC97
,
479 .flags
= IORESOURCE_IRQ
,
483 .start
= DMACH_PCM_OUT
,
484 .end
= DMACH_PCM_OUT
,
485 .flags
= IORESOURCE_DMA
,
489 .start
= DMACH_PCM_IN
,
491 .flags
= IORESOURCE_DMA
,
495 .start
= DMACH_MIC_IN
,
497 .flags
= IORESOURCE_DMA
,
501 static u64 s3c_device_audio_dmamask
= 0xffffffffUL
;
503 struct platform_device s3c_device_ac97
= {
504 .name
= "samsung-ac97",
506 .num_resources
= ARRAY_SIZE(s3c_ac97_resource
),
507 .resource
= s3c_ac97_resource
,
509 .dma_mask
= &s3c_device_audio_dmamask
,
510 .coherent_dma_mask
= 0xffffffffUL
514 EXPORT_SYMBOL(s3c_device_ac97
);
518 struct platform_device s3c2412_device_iis
= {
519 .name
= "s3c2412-iis",
522 .dma_mask
= &s3c_device_audio_dmamask
,
523 .coherent_dma_mask
= 0xffffffffUL
527 EXPORT_SYMBOL(s3c2412_device_iis
);
529 #endif // CONFIG_CPU_S32440