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 <asm/mach/arch.h>
24 #include <asm/mach/map.h>
25 #include <asm/mach/irq.h>
26 #include <asm/arch/fb.h>
27 #include <asm/hardware.h>
31 #include <asm/arch/regs-serial.h>
33 #include <asm/plat-s3c24xx/devs.h>
34 #include <asm/plat-s3c24xx/cpu.h>
36 /* Serial port registrations */
38 static struct resource s3c2410_uart0_resource
[] = {
40 .start
= S3C2410_PA_UART0
,
41 .end
= S3C2410_PA_UART0
+ 0x3fff,
42 .flags
= IORESOURCE_MEM
,
45 .start
= IRQ_S3CUART_RX0
,
46 .end
= IRQ_S3CUART_ERR0
,
47 .flags
= IORESOURCE_IRQ
,
51 static struct resource s3c2410_uart1_resource
[] = {
53 .start
= S3C2410_PA_UART1
,
54 .end
= S3C2410_PA_UART1
+ 0x3fff,
55 .flags
= IORESOURCE_MEM
,
58 .start
= IRQ_S3CUART_RX1
,
59 .end
= IRQ_S3CUART_ERR1
,
60 .flags
= IORESOURCE_IRQ
,
64 static struct resource s3c2410_uart2_resource
[] = {
66 .start
= S3C2410_PA_UART2
,
67 .end
= S3C2410_PA_UART2
+ 0x3fff,
68 .flags
= IORESOURCE_MEM
,
71 .start
= IRQ_S3CUART_RX2
,
72 .end
= IRQ_S3CUART_ERR2
,
73 .flags
= IORESOURCE_IRQ
,
77 struct s3c24xx_uart_resources s3c2410_uart_resources
[] __initdata
= {
79 .resources
= s3c2410_uart0_resource
,
80 .nr_resources
= ARRAY_SIZE(s3c2410_uart0_resource
),
83 .resources
= s3c2410_uart1_resource
,
84 .nr_resources
= ARRAY_SIZE(s3c2410_uart1_resource
),
87 .resources
= s3c2410_uart2_resource
,
88 .nr_resources
= ARRAY_SIZE(s3c2410_uart2_resource
),
94 static struct platform_device s3c24xx_uart_device0
= {
98 static struct platform_device s3c24xx_uart_device1
= {
102 static struct platform_device s3c24xx_uart_device2
= {
106 struct platform_device
*s3c24xx_uart_src
[3] = {
107 &s3c24xx_uart_device0
,
108 &s3c24xx_uart_device1
,
109 &s3c24xx_uart_device2
,
112 struct platform_device
*s3c24xx_uart_devs
[3] = {
115 /* USB Host Controller */
117 static struct resource s3c_usb_resource
[] = {
119 .start
= S3C24XX_PA_USBHOST
,
120 .end
= S3C24XX_PA_USBHOST
+ S3C24XX_SZ_USBHOST
- 1,
121 .flags
= IORESOURCE_MEM
,
126 .flags
= IORESOURCE_IRQ
,
130 static u64 s3c_device_usb_dmamask
= 0xffffffffUL
;
132 struct platform_device s3c_device_usb
= {
133 .name
= "s3c2410-ohci",
135 .num_resources
= ARRAY_SIZE(s3c_usb_resource
),
136 .resource
= s3c_usb_resource
,
138 .dma_mask
= &s3c_device_usb_dmamask
,
139 .coherent_dma_mask
= 0xffffffffUL
143 EXPORT_SYMBOL(s3c_device_usb
);
147 static struct resource s3c_lcd_resource
[] = {
149 .start
= S3C24XX_PA_LCD
,
150 .end
= S3C24XX_PA_LCD
+ S3C24XX_SZ_LCD
- 1,
151 .flags
= IORESOURCE_MEM
,
156 .flags
= IORESOURCE_IRQ
,
161 static u64 s3c_device_lcd_dmamask
= 0xffffffffUL
;
163 struct platform_device s3c_device_lcd
= {
164 .name
= "s3c2410-lcd",
166 .num_resources
= ARRAY_SIZE(s3c_lcd_resource
),
167 .resource
= s3c_lcd_resource
,
169 .dma_mask
= &s3c_device_lcd_dmamask
,
170 .coherent_dma_mask
= 0xffffffffUL
174 EXPORT_SYMBOL(s3c_device_lcd
);
176 void __init
s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info
*pd
)
178 struct s3c2410fb_mach_info
*npd
;
180 npd
= kmalloc(sizeof(*npd
), GFP_KERNEL
);
182 memcpy(npd
, pd
, sizeof(*npd
));
183 s3c_device_lcd
.dev
.platform_data
= npd
;
185 printk(KERN_ERR
"no memory for LCD platform data\n");
189 /* NAND Controller */
191 static struct resource s3c_nand_resource
[] = {
193 .start
= S3C2410_PA_NAND
,
194 .end
= S3C2410_PA_NAND
+ S3C24XX_SZ_NAND
- 1,
195 .flags
= IORESOURCE_MEM
,
199 struct platform_device s3c_device_nand
= {
200 .name
= "s3c2410-nand",
202 .num_resources
= ARRAY_SIZE(s3c_nand_resource
),
203 .resource
= s3c_nand_resource
,
206 EXPORT_SYMBOL(s3c_device_nand
);
208 /* USB Device (Gadget)*/
210 static struct resource s3c_usbgadget_resource
[] = {
212 .start
= S3C24XX_PA_USBDEV
,
213 .end
= S3C24XX_PA_USBDEV
+ S3C24XX_SZ_USBDEV
- 1,
214 .flags
= IORESOURCE_MEM
,
219 .flags
= IORESOURCE_IRQ
,
224 struct platform_device s3c_device_usbgadget
= {
225 .name
= "s3c2410-usbgadget",
227 .num_resources
= ARRAY_SIZE(s3c_usbgadget_resource
),
228 .resource
= s3c_usbgadget_resource
,
231 EXPORT_SYMBOL(s3c_device_usbgadget
);
235 static struct resource s3c_wdt_resource
[] = {
237 .start
= S3C24XX_PA_WATCHDOG
,
238 .end
= S3C24XX_PA_WATCHDOG
+ S3C24XX_SZ_WATCHDOG
- 1,
239 .flags
= IORESOURCE_MEM
,
244 .flags
= IORESOURCE_IRQ
,
249 struct platform_device s3c_device_wdt
= {
250 .name
= "s3c2410-wdt",
252 .num_resources
= ARRAY_SIZE(s3c_wdt_resource
),
253 .resource
= s3c_wdt_resource
,
256 EXPORT_SYMBOL(s3c_device_wdt
);
260 static struct resource s3c_i2c_resource
[] = {
262 .start
= S3C24XX_PA_IIC
,
263 .end
= S3C24XX_PA_IIC
+ S3C24XX_SZ_IIC
- 1,
264 .flags
= IORESOURCE_MEM
,
269 .flags
= IORESOURCE_IRQ
,
274 struct platform_device s3c_device_i2c
= {
275 .name
= "s3c2410-i2c",
277 .num_resources
= ARRAY_SIZE(s3c_i2c_resource
),
278 .resource
= s3c_i2c_resource
,
281 EXPORT_SYMBOL(s3c_device_i2c
);
285 static struct resource s3c_iis_resource
[] = {
287 .start
= S3C24XX_PA_IIS
,
288 .end
= S3C24XX_PA_IIS
+ S3C24XX_SZ_IIS
-1,
289 .flags
= IORESOURCE_MEM
,
293 static u64 s3c_device_iis_dmamask
= 0xffffffffUL
;
295 struct platform_device s3c_device_iis
= {
296 .name
= "s3c2410-iis",
298 .num_resources
= ARRAY_SIZE(s3c_iis_resource
),
299 .resource
= s3c_iis_resource
,
301 .dma_mask
= &s3c_device_iis_dmamask
,
302 .coherent_dma_mask
= 0xffffffffUL
306 EXPORT_SYMBOL(s3c_device_iis
);
310 static struct resource s3c_rtc_resource
[] = {
312 .start
= S3C24XX_PA_RTC
,
313 .end
= S3C24XX_PA_RTC
+ 0xff,
314 .flags
= IORESOURCE_MEM
,
319 .flags
= IORESOURCE_IRQ
,
324 .flags
= IORESOURCE_IRQ
328 struct platform_device s3c_device_rtc
= {
329 .name
= "s3c2410-rtc",
331 .num_resources
= ARRAY_SIZE(s3c_rtc_resource
),
332 .resource
= s3c_rtc_resource
,
335 EXPORT_SYMBOL(s3c_device_rtc
);
339 static struct resource s3c_adc_resource
[] = {
341 .start
= S3C24XX_PA_ADC
,
342 .end
= S3C24XX_PA_ADC
+ S3C24XX_SZ_ADC
- 1,
343 .flags
= IORESOURCE_MEM
,
348 .flags
= IORESOURCE_IRQ
,
353 .flags
= IORESOURCE_IRQ
,
358 struct platform_device s3c_device_adc
= {
359 .name
= "s3c2410-adc",
361 .num_resources
= ARRAY_SIZE(s3c_adc_resource
),
362 .resource
= s3c_adc_resource
,
367 static struct resource s3c_sdi_resource
[] = {
369 .start
= S3C2410_PA_SDI
,
370 .end
= S3C2410_PA_SDI
+ S3C24XX_SZ_SDI
- 1,
371 .flags
= IORESOURCE_MEM
,
376 .flags
= IORESOURCE_IRQ
,
381 struct platform_device s3c_device_sdi
= {
382 .name
= "s3c2410-sdi",
384 .num_resources
= ARRAY_SIZE(s3c_sdi_resource
),
385 .resource
= s3c_sdi_resource
,
388 EXPORT_SYMBOL(s3c_device_sdi
);
392 static struct resource s3c_spi0_resource
[] = {
394 .start
= S3C24XX_PA_SPI
,
395 .end
= S3C24XX_PA_SPI
+ 0x1f,
396 .flags
= IORESOURCE_MEM
,
401 .flags
= IORESOURCE_IRQ
,
406 static u64 s3c_device_spi0_dmamask
= 0xffffffffUL
;
408 struct platform_device s3c_device_spi0
= {
409 .name
= "s3c2410-spi",
411 .num_resources
= ARRAY_SIZE(s3c_spi0_resource
),
412 .resource
= s3c_spi0_resource
,
414 .dma_mask
= &s3c_device_spi0_dmamask
,
415 .coherent_dma_mask
= 0xffffffffUL
419 EXPORT_SYMBOL(s3c_device_spi0
);
423 static struct resource s3c_spi1_resource
[] = {
425 .start
= S3C24XX_PA_SPI
+ 0x20,
426 .end
= S3C24XX_PA_SPI
+ 0x20 + 0x1f,
427 .flags
= IORESOURCE_MEM
,
432 .flags
= IORESOURCE_IRQ
,
437 static u64 s3c_device_spi1_dmamask
= 0xffffffffUL
;
439 struct platform_device s3c_device_spi1
= {
440 .name
= "s3c2410-spi",
442 .num_resources
= ARRAY_SIZE(s3c_spi1_resource
),
443 .resource
= s3c_spi1_resource
,
445 .dma_mask
= &s3c_device_spi1_dmamask
,
446 .coherent_dma_mask
= 0xffffffffUL
450 EXPORT_SYMBOL(s3c_device_spi1
);
452 /* pwm timer blocks */
454 static struct resource s3c_timer0_resource
[] = {
456 .start
= S3C24XX_PA_TIMER
+ 0x0C,
457 .end
= S3C24XX_PA_TIMER
+ 0x0C + 0xB,
458 .flags
= IORESOURCE_MEM
,
463 .flags
= IORESOURCE_IRQ
,
468 struct platform_device s3c_device_timer0
= {
469 .name
= "s3c2410-timer",
471 .num_resources
= ARRAY_SIZE(s3c_timer0_resource
),
472 .resource
= s3c_timer0_resource
,
475 EXPORT_SYMBOL(s3c_device_timer0
);
479 static struct resource s3c_timer1_resource
[] = {
481 .start
= S3C24XX_PA_TIMER
+ 0x18,
482 .end
= S3C24XX_PA_TIMER
+ 0x23,
483 .flags
= IORESOURCE_MEM
,
488 .flags
= IORESOURCE_IRQ
,
493 struct platform_device s3c_device_timer1
= {
494 .name
= "s3c2410-timer",
496 .num_resources
= ARRAY_SIZE(s3c_timer1_resource
),
497 .resource
= s3c_timer1_resource
,
500 EXPORT_SYMBOL(s3c_device_timer1
);
504 static struct resource s3c_timer2_resource
[] = {
506 .start
= S3C24XX_PA_TIMER
+ 0x24,
507 .end
= S3C24XX_PA_TIMER
+ 0x2F,
508 .flags
= IORESOURCE_MEM
,
513 .flags
= IORESOURCE_IRQ
,
518 struct platform_device s3c_device_timer2
= {
519 .name
= "s3c2410-timer",
521 .num_resources
= ARRAY_SIZE(s3c_timer2_resource
),
522 .resource
= s3c_timer2_resource
,
525 EXPORT_SYMBOL(s3c_device_timer2
);
529 static struct resource s3c_timer3_resource
[] = {
531 .start
= S3C24XX_PA_TIMER
+ 0x30,
532 .end
= S3C24XX_PA_TIMER
+ 0x3B,
533 .flags
= IORESOURCE_MEM
,
538 .flags
= IORESOURCE_IRQ
,
543 struct platform_device s3c_device_timer3
= {
544 .name
= "s3c2410-timer",
546 .num_resources
= ARRAY_SIZE(s3c_timer3_resource
),
547 .resource
= s3c_timer3_resource
,
550 EXPORT_SYMBOL(s3c_device_timer3
);
552 #ifdef CONFIG_CPU_S3C2440
554 /* Camif Controller */
556 static struct resource s3c_camif_resource
[] = {
558 .start
= S3C2440_PA_CAMIF
,
559 .end
= S3C2440_PA_CAMIF
+ S3C2440_SZ_CAMIF
- 1,
560 .flags
= IORESOURCE_MEM
,
565 .flags
= IORESOURCE_IRQ
,
570 static u64 s3c_device_camif_dmamask
= 0xffffffffUL
;
572 struct platform_device s3c_device_camif
= {
573 .name
= "s3c2440-camif",
575 .num_resources
= ARRAY_SIZE(s3c_camif_resource
),
576 .resource
= s3c_camif_resource
,
578 .dma_mask
= &s3c_device_camif_dmamask
,
579 .coherent_dma_mask
= 0xffffffffUL
583 EXPORT_SYMBOL(s3c_device_camif
);
585 #endif // CONFIG_CPU_S32440