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>
30 #include <mach/irqs.h>
33 #include <plat/regs-serial.h>
36 #include <plat/devs.h>
38 #include <plat/regs-spi.h>
42 /* Serial port registrations */
44 static struct resource s3c2410_uart0_resource
[] = {
46 .start
= S3C2410_PA_UART0
,
47 .end
= S3C2410_PA_UART0
+ 0x3fff,
48 .flags
= IORESOURCE_MEM
,
51 .start
= IRQ_S3CUART_RX0
,
52 .end
= IRQ_S3CUART_ERR0
,
53 .flags
= IORESOURCE_IRQ
,
57 static struct resource s3c2410_uart1_resource
[] = {
59 .start
= S3C2410_PA_UART1
,
60 .end
= S3C2410_PA_UART1
+ 0x3fff,
61 .flags
= IORESOURCE_MEM
,
64 .start
= IRQ_S3CUART_RX1
,
65 .end
= IRQ_S3CUART_ERR1
,
66 .flags
= IORESOURCE_IRQ
,
70 static struct resource s3c2410_uart2_resource
[] = {
72 .start
= S3C2410_PA_UART2
,
73 .end
= S3C2410_PA_UART2
+ 0x3fff,
74 .flags
= IORESOURCE_MEM
,
77 .start
= IRQ_S3CUART_RX2
,
78 .end
= IRQ_S3CUART_ERR2
,
79 .flags
= IORESOURCE_IRQ
,
83 static struct resource s3c2410_uart3_resource
[] = {
85 .start
= S3C2443_PA_UART3
,
86 .end
= S3C2443_PA_UART3
+ 0x3fff,
87 .flags
= IORESOURCE_MEM
,
90 .start
= IRQ_S3CUART_RX3
,
91 .end
= IRQ_S3CUART_ERR3
,
92 .flags
= IORESOURCE_IRQ
,
96 struct s3c24xx_uart_resources s3c2410_uart_resources
[] __initdata
= {
98 .resources
= s3c2410_uart0_resource
,
99 .nr_resources
= ARRAY_SIZE(s3c2410_uart0_resource
),
102 .resources
= s3c2410_uart1_resource
,
103 .nr_resources
= ARRAY_SIZE(s3c2410_uart1_resource
),
106 .resources
= s3c2410_uart2_resource
,
107 .nr_resources
= ARRAY_SIZE(s3c2410_uart2_resource
),
110 .resources
= s3c2410_uart3_resource
,
111 .nr_resources
= ARRAY_SIZE(s3c2410_uart3_resource
),
117 static struct platform_device s3c24xx_uart_device0
= {
121 static struct platform_device s3c24xx_uart_device1
= {
125 static struct platform_device s3c24xx_uart_device2
= {
129 static struct platform_device s3c24xx_uart_device3
= {
133 struct platform_device
*s3c24xx_uart_src
[4] = {
134 &s3c24xx_uart_device0
,
135 &s3c24xx_uart_device1
,
136 &s3c24xx_uart_device2
,
137 &s3c24xx_uart_device3
,
140 struct platform_device
*s3c24xx_uart_devs
[4] = {
145 static struct resource s3c_lcd_resource
[] = {
147 .start
= S3C24XX_PA_LCD
,
148 .end
= S3C24XX_PA_LCD
+ S3C24XX_SZ_LCD
- 1,
149 .flags
= IORESOURCE_MEM
,
154 .flags
= IORESOURCE_IRQ
,
159 static u64 s3c_device_lcd_dmamask
= 0xffffffffUL
;
161 struct platform_device s3c_device_lcd
= {
162 .name
= "s3c2410-lcd",
164 .num_resources
= ARRAY_SIZE(s3c_lcd_resource
),
165 .resource
= s3c_lcd_resource
,
167 .dma_mask
= &s3c_device_lcd_dmamask
,
168 .coherent_dma_mask
= 0xffffffffUL
172 EXPORT_SYMBOL(s3c_device_lcd
);
174 void __init
s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info
*pd
)
176 struct s3c2410fb_mach_info
*npd
;
178 npd
= kmalloc(sizeof(*npd
), GFP_KERNEL
);
180 memcpy(npd
, pd
, sizeof(*npd
));
181 s3c_device_lcd
.dev
.platform_data
= npd
;
183 printk(KERN_ERR
"no memory for LCD platform data\n");
188 struct platform_device s3c_device_ts
= {
189 .name
= "s3c2410-ts",
192 EXPORT_SYMBOL(s3c_device_ts
);
194 static struct s3c2410_ts_mach_info s3c2410ts_info
;
196 void __init
s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info
*hard_s3c2410ts_info
)
198 memcpy(&s3c2410ts_info
, hard_s3c2410ts_info
, sizeof(struct s3c2410_ts_mach_info
));
199 s3c_device_ts
.dev
.platform_data
= &s3c2410ts_info
;
201 EXPORT_SYMBOL(s3c24xx_ts_set_platdata
);
203 /* USB Device (Gadget)*/
205 static struct resource s3c_usbgadget_resource
[] = {
207 .start
= S3C24XX_PA_USBDEV
,
208 .end
= S3C24XX_PA_USBDEV
+ S3C24XX_SZ_USBDEV
- 1,
209 .flags
= IORESOURCE_MEM
,
214 .flags
= IORESOURCE_IRQ
,
219 struct platform_device s3c_device_usbgadget
= {
220 .name
= "s3c2410-usbgadget",
222 .num_resources
= ARRAY_SIZE(s3c_usbgadget_resource
),
223 .resource
= s3c_usbgadget_resource
,
226 EXPORT_SYMBOL(s3c_device_usbgadget
);
228 void __init
s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info
*pd
)
230 struct s3c2410_udc_mach_info
*npd
;
232 npd
= kmalloc(sizeof(*npd
), GFP_KERNEL
);
234 memcpy(npd
, pd
, sizeof(*npd
));
235 s3c_device_usbgadget
.dev
.platform_data
= npd
;
237 printk(KERN_ERR
"no memory for udc platform data\n");
244 static struct resource s3c_wdt_resource
[] = {
246 .start
= S3C24XX_PA_WATCHDOG
,
247 .end
= S3C24XX_PA_WATCHDOG
+ S3C24XX_SZ_WATCHDOG
- 1,
248 .flags
= IORESOURCE_MEM
,
253 .flags
= IORESOURCE_IRQ
,
258 struct platform_device s3c_device_wdt
= {
259 .name
= "s3c2410-wdt",
261 .num_resources
= ARRAY_SIZE(s3c_wdt_resource
),
262 .resource
= s3c_wdt_resource
,
265 EXPORT_SYMBOL(s3c_device_wdt
);
269 static struct resource s3c_iis_resource
[] = {
271 .start
= S3C24XX_PA_IIS
,
272 .end
= S3C24XX_PA_IIS
+ S3C24XX_SZ_IIS
-1,
273 .flags
= IORESOURCE_MEM
,
277 static u64 s3c_device_iis_dmamask
= 0xffffffffUL
;
279 struct platform_device s3c_device_iis
= {
280 .name
= "s3c2410-iis",
282 .num_resources
= ARRAY_SIZE(s3c_iis_resource
),
283 .resource
= s3c_iis_resource
,
285 .dma_mask
= &s3c_device_iis_dmamask
,
286 .coherent_dma_mask
= 0xffffffffUL
290 EXPORT_SYMBOL(s3c_device_iis
);
294 static struct resource s3c_rtc_resource
[] = {
296 .start
= S3C24XX_PA_RTC
,
297 .end
= S3C24XX_PA_RTC
+ 0xff,
298 .flags
= IORESOURCE_MEM
,
303 .flags
= IORESOURCE_IRQ
,
308 .flags
= IORESOURCE_IRQ
312 struct platform_device s3c_device_rtc
= {
313 .name
= "s3c2410-rtc",
315 .num_resources
= ARRAY_SIZE(s3c_rtc_resource
),
316 .resource
= s3c_rtc_resource
,
319 EXPORT_SYMBOL(s3c_device_rtc
);
323 static struct resource s3c_adc_resource
[] = {
325 .start
= S3C24XX_PA_ADC
,
326 .end
= S3C24XX_PA_ADC
+ S3C24XX_SZ_ADC
- 1,
327 .flags
= IORESOURCE_MEM
,
332 .flags
= IORESOURCE_IRQ
,
337 .flags
= IORESOURCE_IRQ
,
342 struct platform_device s3c_device_adc
= {
343 .name
= "s3c24xx-adc",
345 .num_resources
= ARRAY_SIZE(s3c_adc_resource
),
346 .resource
= s3c_adc_resource
,
351 struct platform_device s3c_device_hwmon
= {
354 .dev
.parent
= &s3c_device_adc
.dev
,
359 static struct resource s3c_sdi_resource
[] = {
361 .start
= S3C24XX_PA_SDI
,
362 .end
= S3C24XX_PA_SDI
+ S3C24XX_SZ_SDI
- 1,
363 .flags
= IORESOURCE_MEM
,
368 .flags
= IORESOURCE_IRQ
,
373 struct platform_device s3c_device_sdi
= {
374 .name
= "s3c2410-sdi",
376 .num_resources
= ARRAY_SIZE(s3c_sdi_resource
),
377 .resource
= s3c_sdi_resource
,
380 EXPORT_SYMBOL(s3c_device_sdi
);
384 static struct resource s3c_spi0_resource
[] = {
386 .start
= S3C24XX_PA_SPI
,
387 .end
= S3C24XX_PA_SPI
+ 0x1f,
388 .flags
= IORESOURCE_MEM
,
393 .flags
= IORESOURCE_IRQ
,
398 static u64 s3c_device_spi0_dmamask
= 0xffffffffUL
;
400 struct platform_device s3c_device_spi0
= {
401 .name
= "s3c2410-spi",
403 .num_resources
= ARRAY_SIZE(s3c_spi0_resource
),
404 .resource
= s3c_spi0_resource
,
406 .dma_mask
= &s3c_device_spi0_dmamask
,
407 .coherent_dma_mask
= 0xffffffffUL
411 EXPORT_SYMBOL(s3c_device_spi0
);
415 static struct resource s3c_spi1_resource
[] = {
417 .start
= S3C24XX_PA_SPI
+ S3C2410_SPI1
,
418 .end
= S3C24XX_PA_SPI
+ S3C2410_SPI1
+ 0x1f,
419 .flags
= IORESOURCE_MEM
,
424 .flags
= IORESOURCE_IRQ
,
429 static u64 s3c_device_spi1_dmamask
= 0xffffffffUL
;
431 struct platform_device s3c_device_spi1
= {
432 .name
= "s3c2410-spi",
434 .num_resources
= ARRAY_SIZE(s3c_spi1_resource
),
435 .resource
= s3c_spi1_resource
,
437 .dma_mask
= &s3c_device_spi1_dmamask
,
438 .coherent_dma_mask
= 0xffffffffUL
442 EXPORT_SYMBOL(s3c_device_spi1
);
444 #ifdef CONFIG_CPU_S3C2440
446 /* Camif Controller */
448 static struct resource s3c_camif_resource
[] = {
450 .start
= S3C2440_PA_CAMIF
,
451 .end
= S3C2440_PA_CAMIF
+ S3C2440_SZ_CAMIF
- 1,
452 .flags
= IORESOURCE_MEM
,
457 .flags
= IORESOURCE_IRQ
,
462 static u64 s3c_device_camif_dmamask
= 0xffffffffUL
;
464 struct platform_device s3c_device_camif
= {
465 .name
= "s3c2440-camif",
467 .num_resources
= ARRAY_SIZE(s3c_camif_resource
),
468 .resource
= s3c_camif_resource
,
470 .dma_mask
= &s3c_device_camif_dmamask
,
471 .coherent_dma_mask
= 0xffffffffUL
475 EXPORT_SYMBOL(s3c_device_camif
);
479 static struct resource s3c_ac97_resource
[] = {
481 .start
= S3C2440_PA_AC97
,
482 .end
= S3C2440_PA_AC97
+ S3C2440_SZ_AC97
-1,
483 .flags
= IORESOURCE_MEM
,
486 .start
= IRQ_S3C244x_AC97
,
487 .end
= IRQ_S3C244x_AC97
,
488 .flags
= IORESOURCE_IRQ
,
492 .start
= DMACH_PCM_OUT
,
493 .end
= DMACH_PCM_OUT
,
494 .flags
= IORESOURCE_DMA
,
498 .start
= DMACH_PCM_IN
,
500 .flags
= IORESOURCE_DMA
,
504 .start
= DMACH_MIC_IN
,
506 .flags
= IORESOURCE_DMA
,
510 static u64 s3c_device_ac97_dmamask
= 0xffffffffUL
;
512 struct platform_device s3c_device_ac97
= {
515 .num_resources
= ARRAY_SIZE(s3c_ac97_resource
),
516 .resource
= s3c_ac97_resource
,
518 .dma_mask
= &s3c_device_ac97_dmamask
,
519 .coherent_dma_mask
= 0xffffffffUL
523 EXPORT_SYMBOL(s3c_device_ac97
);
525 #endif // CONFIG_CPU_S32440