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>
27 #include <asm/mach/arch.h>
28 #include <asm/mach/map.h>
29 #include <asm/mach/irq.h>
31 #include <mach/hardware.h>
33 #include <mach/irqs.h>
36 #include <plat/regs-serial.h>
40 #include <plat/devs.h>
42 #include <plat/regs-spi.h>
45 /* Serial port registrations */
47 static struct resource s3c2410_uart0_resource
[] = {
49 .start
= S3C2410_PA_UART0
,
50 .end
= S3C2410_PA_UART0
+ 0x3fff,
51 .flags
= IORESOURCE_MEM
,
54 .start
= IRQ_S3CUART_RX0
,
55 .end
= IRQ_S3CUART_ERR0
,
56 .flags
= IORESOURCE_IRQ
,
60 static struct resource s3c2410_uart1_resource
[] = {
62 .start
= S3C2410_PA_UART1
,
63 .end
= S3C2410_PA_UART1
+ 0x3fff,
64 .flags
= IORESOURCE_MEM
,
67 .start
= IRQ_S3CUART_RX1
,
68 .end
= IRQ_S3CUART_ERR1
,
69 .flags
= IORESOURCE_IRQ
,
73 static struct resource s3c2410_uart2_resource
[] = {
75 .start
= S3C2410_PA_UART2
,
76 .end
= S3C2410_PA_UART2
+ 0x3fff,
77 .flags
= IORESOURCE_MEM
,
80 .start
= IRQ_S3CUART_RX2
,
81 .end
= IRQ_S3CUART_ERR2
,
82 .flags
= IORESOURCE_IRQ
,
86 static struct resource s3c2410_uart3_resource
[] = {
88 .start
= S3C2443_PA_UART3
,
89 .end
= S3C2443_PA_UART3
+ 0x3fff,
90 .flags
= IORESOURCE_MEM
,
93 .start
= IRQ_S3CUART_RX3
,
94 .end
= IRQ_S3CUART_ERR3
,
95 .flags
= IORESOURCE_IRQ
,
99 struct s3c24xx_uart_resources s3c2410_uart_resources
[] __initdata
= {
101 .resources
= s3c2410_uart0_resource
,
102 .nr_resources
= ARRAY_SIZE(s3c2410_uart0_resource
),
105 .resources
= s3c2410_uart1_resource
,
106 .nr_resources
= ARRAY_SIZE(s3c2410_uart1_resource
),
109 .resources
= s3c2410_uart2_resource
,
110 .nr_resources
= ARRAY_SIZE(s3c2410_uart2_resource
),
113 .resources
= s3c2410_uart3_resource
,
114 .nr_resources
= ARRAY_SIZE(s3c2410_uart3_resource
),
120 static struct resource s3c_lcd_resource
[] = {
122 .start
= S3C24XX_PA_LCD
,
123 .end
= S3C24XX_PA_LCD
+ S3C24XX_SZ_LCD
- 1,
124 .flags
= IORESOURCE_MEM
,
129 .flags
= IORESOURCE_IRQ
,
134 static u64 s3c_device_lcd_dmamask
= 0xffffffffUL
;
136 struct platform_device s3c_device_lcd
= {
137 .name
= "s3c2410-lcd",
139 .num_resources
= ARRAY_SIZE(s3c_lcd_resource
),
140 .resource
= s3c_lcd_resource
,
142 .dma_mask
= &s3c_device_lcd_dmamask
,
143 .coherent_dma_mask
= 0xffffffffUL
147 EXPORT_SYMBOL(s3c_device_lcd
);
149 void __init
s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info
*pd
)
151 struct s3c2410fb_mach_info
*npd
;
153 npd
= s3c_set_platdata(pd
, sizeof(*npd
), &s3c_device_lcd
);
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 void __init
s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info
*hard_s3c2410ts_info
)
192 s3c_set_platdata(hard_s3c2410ts_info
,
193 sizeof(struct s3c2410_ts_mach_info
), &s3c_device_ts
);
196 /* USB Device (Gadget)*/
198 static struct resource s3c_usbgadget_resource
[] = {
200 .start
= S3C24XX_PA_USBDEV
,
201 .end
= S3C24XX_PA_USBDEV
+ S3C24XX_SZ_USBDEV
- 1,
202 .flags
= IORESOURCE_MEM
,
207 .flags
= IORESOURCE_IRQ
,
212 struct platform_device s3c_device_usbgadget
= {
213 .name
= "s3c2410-usbgadget",
215 .num_resources
= ARRAY_SIZE(s3c_usbgadget_resource
),
216 .resource
= s3c_usbgadget_resource
,
219 EXPORT_SYMBOL(s3c_device_usbgadget
);
221 void __init
s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info
*pd
)
223 s3c_set_platdata(pd
, sizeof(*pd
), &s3c_device_usbgadget
);
226 /* USB High Speed 2.0 Device (Gadget) */
227 static struct resource s3c_hsudc_resource
[] = {
229 .start
= S3C2416_PA_HSUDC
,
230 .end
= S3C2416_PA_HSUDC
+ S3C2416_SZ_HSUDC
- 1,
231 .flags
= IORESOURCE_MEM
,
236 .flags
= IORESOURCE_IRQ
,
240 static u64 s3c_hsudc_dmamask
= DMA_BIT_MASK(32);
242 struct platform_device s3c_device_usb_hsudc
= {
245 .num_resources
= ARRAY_SIZE(s3c_hsudc_resource
),
246 .resource
= s3c_hsudc_resource
,
248 .dma_mask
= &s3c_hsudc_dmamask
,
249 .coherent_dma_mask
= DMA_BIT_MASK(32),
253 void __init
s3c24xx_hsudc_set_platdata(struct s3c24xx_hsudc_platdata
*pd
)
255 s3c_set_platdata(pd
, sizeof(*pd
), &s3c_device_usb_hsudc
);
260 static struct resource s3c_iis_resource
[] = {
262 .start
= S3C24XX_PA_IIS
,
263 .end
= S3C24XX_PA_IIS
+ S3C24XX_SZ_IIS
-1,
264 .flags
= IORESOURCE_MEM
,
268 static u64 s3c_device_iis_dmamask
= 0xffffffffUL
;
270 struct platform_device s3c_device_iis
= {
271 .name
= "s3c24xx-iis",
273 .num_resources
= ARRAY_SIZE(s3c_iis_resource
),
274 .resource
= s3c_iis_resource
,
276 .dma_mask
= &s3c_device_iis_dmamask
,
277 .coherent_dma_mask
= 0xffffffffUL
281 EXPORT_SYMBOL(s3c_device_iis
);
285 static struct resource s3c_rtc_resource
[] = {
287 .start
= S3C24XX_PA_RTC
,
288 .end
= S3C24XX_PA_RTC
+ 0xff,
289 .flags
= IORESOURCE_MEM
,
294 .flags
= IORESOURCE_IRQ
,
299 .flags
= IORESOURCE_IRQ
303 struct platform_device s3c_device_rtc
= {
304 .name
= "s3c2410-rtc",
306 .num_resources
= ARRAY_SIZE(s3c_rtc_resource
),
307 .resource
= s3c_rtc_resource
,
310 EXPORT_SYMBOL(s3c_device_rtc
);
314 static struct resource s3c_adc_resource
[] = {
316 .start
= S3C24XX_PA_ADC
,
317 .end
= S3C24XX_PA_ADC
+ S3C24XX_SZ_ADC
- 1,
318 .flags
= IORESOURCE_MEM
,
323 .flags
= IORESOURCE_IRQ
,
328 .flags
= IORESOURCE_IRQ
,
333 struct platform_device s3c_device_adc
= {
334 .name
= "s3c24xx-adc",
336 .num_resources
= ARRAY_SIZE(s3c_adc_resource
),
337 .resource
= s3c_adc_resource
,
342 static struct resource s3c_sdi_resource
[] = {
344 .start
= S3C24XX_PA_SDI
,
345 .end
= S3C24XX_PA_SDI
+ S3C24XX_SZ_SDI
- 1,
346 .flags
= IORESOURCE_MEM
,
351 .flags
= IORESOURCE_IRQ
,
356 struct platform_device s3c_device_sdi
= {
357 .name
= "s3c2410-sdi",
359 .num_resources
= ARRAY_SIZE(s3c_sdi_resource
),
360 .resource
= s3c_sdi_resource
,
363 EXPORT_SYMBOL(s3c_device_sdi
);
365 void __init
s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata
*pdata
)
367 s3c_set_platdata(pdata
, sizeof(struct s3c24xx_mci_pdata
),
374 static struct resource s3c_spi0_resource
[] = {
376 .start
= S3C24XX_PA_SPI
,
377 .end
= S3C24XX_PA_SPI
+ 0x1f,
378 .flags
= IORESOURCE_MEM
,
383 .flags
= IORESOURCE_IRQ
,
388 static u64 s3c_device_spi0_dmamask
= 0xffffffffUL
;
390 struct platform_device s3c_device_spi0
= {
391 .name
= "s3c2410-spi",
393 .num_resources
= ARRAY_SIZE(s3c_spi0_resource
),
394 .resource
= s3c_spi0_resource
,
396 .dma_mask
= &s3c_device_spi0_dmamask
,
397 .coherent_dma_mask
= 0xffffffffUL
401 EXPORT_SYMBOL(s3c_device_spi0
);
405 static struct resource s3c_spi1_resource
[] = {
407 .start
= S3C24XX_PA_SPI
+ S3C2410_SPI1
,
408 .end
= S3C24XX_PA_SPI
+ S3C2410_SPI1
+ 0x1f,
409 .flags
= IORESOURCE_MEM
,
414 .flags
= IORESOURCE_IRQ
,
419 static u64 s3c_device_spi1_dmamask
= 0xffffffffUL
;
421 struct platform_device s3c_device_spi1
= {
422 .name
= "s3c2410-spi",
424 .num_resources
= ARRAY_SIZE(s3c_spi1_resource
),
425 .resource
= s3c_spi1_resource
,
427 .dma_mask
= &s3c_device_spi1_dmamask
,
428 .coherent_dma_mask
= 0xffffffffUL
432 EXPORT_SYMBOL(s3c_device_spi1
);
434 #ifdef CONFIG_CPU_S3C2440
436 /* Camif Controller */
438 static struct resource s3c_camif_resource
[] = {
440 .start
= S3C2440_PA_CAMIF
,
441 .end
= S3C2440_PA_CAMIF
+ S3C2440_SZ_CAMIF
- 1,
442 .flags
= IORESOURCE_MEM
,
447 .flags
= IORESOURCE_IRQ
,
452 static u64 s3c_device_camif_dmamask
= 0xffffffffUL
;
454 struct platform_device s3c_device_camif
= {
455 .name
= "s3c2440-camif",
457 .num_resources
= ARRAY_SIZE(s3c_camif_resource
),
458 .resource
= s3c_camif_resource
,
460 .dma_mask
= &s3c_device_camif_dmamask
,
461 .coherent_dma_mask
= 0xffffffffUL
465 EXPORT_SYMBOL(s3c_device_camif
);
469 static struct resource s3c_ac97_resource
[] = {
471 .start
= S3C2440_PA_AC97
,
472 .end
= S3C2440_PA_AC97
+ S3C2440_SZ_AC97
-1,
473 .flags
= IORESOURCE_MEM
,
476 .start
= IRQ_S3C244x_AC97
,
477 .end
= IRQ_S3C244x_AC97
,
478 .flags
= IORESOURCE_IRQ
,
482 .start
= DMACH_PCM_OUT
,
483 .end
= DMACH_PCM_OUT
,
484 .flags
= IORESOURCE_DMA
,
488 .start
= DMACH_PCM_IN
,
490 .flags
= IORESOURCE_DMA
,
494 .start
= DMACH_MIC_IN
,
496 .flags
= IORESOURCE_DMA
,
500 static u64 s3c_device_audio_dmamask
= 0xffffffffUL
;
502 struct platform_device s3c_device_ac97
= {
503 .name
= "samsung-ac97",
505 .num_resources
= ARRAY_SIZE(s3c_ac97_resource
),
506 .resource
= s3c_ac97_resource
,
508 .dma_mask
= &s3c_device_audio_dmamask
,
509 .coherent_dma_mask
= 0xffffffffUL
513 EXPORT_SYMBOL(s3c_device_ac97
);
517 struct platform_device s3c2412_device_iis
= {
518 .name
= "s3c2412-iis",
521 .dma_mask
= &s3c_device_audio_dmamask
,
522 .coherent_dma_mask
= 0xffffffffUL
526 EXPORT_SYMBOL(s3c2412_device_iis
);
528 #endif // CONFIG_CPU_S32440