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>
32 #include <asm/arch/udc.h>
34 #include <asm/plat-s3c24xx/devs.h>
35 #include <asm/plat-s3c24xx/cpu.h>
37 /* Serial port registrations */
39 static struct resource s3c2410_uart0_resource
[] = {
41 .start
= S3C2410_PA_UART0
,
42 .end
= S3C2410_PA_UART0
+ 0x3fff,
43 .flags
= IORESOURCE_MEM
,
46 .start
= IRQ_S3CUART_RX0
,
47 .end
= IRQ_S3CUART_ERR0
,
48 .flags
= IORESOURCE_IRQ
,
52 static struct resource s3c2410_uart1_resource
[] = {
54 .start
= S3C2410_PA_UART1
,
55 .end
= S3C2410_PA_UART1
+ 0x3fff,
56 .flags
= IORESOURCE_MEM
,
59 .start
= IRQ_S3CUART_RX1
,
60 .end
= IRQ_S3CUART_ERR1
,
61 .flags
= IORESOURCE_IRQ
,
65 static struct resource s3c2410_uart2_resource
[] = {
67 .start
= S3C2410_PA_UART2
,
68 .end
= S3C2410_PA_UART2
+ 0x3fff,
69 .flags
= IORESOURCE_MEM
,
72 .start
= IRQ_S3CUART_RX2
,
73 .end
= IRQ_S3CUART_ERR2
,
74 .flags
= IORESOURCE_IRQ
,
78 struct s3c24xx_uart_resources s3c2410_uart_resources
[] __initdata
= {
80 .resources
= s3c2410_uart0_resource
,
81 .nr_resources
= ARRAY_SIZE(s3c2410_uart0_resource
),
84 .resources
= s3c2410_uart1_resource
,
85 .nr_resources
= ARRAY_SIZE(s3c2410_uart1_resource
),
88 .resources
= s3c2410_uart2_resource
,
89 .nr_resources
= ARRAY_SIZE(s3c2410_uart2_resource
),
95 static struct platform_device s3c24xx_uart_device0
= {
99 static struct platform_device s3c24xx_uart_device1
= {
103 static struct platform_device s3c24xx_uart_device2
= {
107 struct platform_device
*s3c24xx_uart_src
[3] = {
108 &s3c24xx_uart_device0
,
109 &s3c24xx_uart_device1
,
110 &s3c24xx_uart_device2
,
113 struct platform_device
*s3c24xx_uart_devs
[3] = {
116 /* USB Host Controller */
118 static struct resource s3c_usb_resource
[] = {
120 .start
= S3C24XX_PA_USBHOST
,
121 .end
= S3C24XX_PA_USBHOST
+ S3C24XX_SZ_USBHOST
- 1,
122 .flags
= IORESOURCE_MEM
,
127 .flags
= IORESOURCE_IRQ
,
131 static u64 s3c_device_usb_dmamask
= 0xffffffffUL
;
133 struct platform_device s3c_device_usb
= {
134 .name
= "s3c2410-ohci",
136 .num_resources
= ARRAY_SIZE(s3c_usb_resource
),
137 .resource
= s3c_usb_resource
,
139 .dma_mask
= &s3c_device_usb_dmamask
,
140 .coherent_dma_mask
= 0xffffffffUL
144 EXPORT_SYMBOL(s3c_device_usb
);
148 static struct resource s3c_lcd_resource
[] = {
150 .start
= S3C24XX_PA_LCD
,
151 .end
= S3C24XX_PA_LCD
+ S3C24XX_SZ_LCD
- 1,
152 .flags
= IORESOURCE_MEM
,
157 .flags
= IORESOURCE_IRQ
,
162 static u64 s3c_device_lcd_dmamask
= 0xffffffffUL
;
164 struct platform_device s3c_device_lcd
= {
165 .name
= "s3c2410-lcd",
167 .num_resources
= ARRAY_SIZE(s3c_lcd_resource
),
168 .resource
= s3c_lcd_resource
,
170 .dma_mask
= &s3c_device_lcd_dmamask
,
171 .coherent_dma_mask
= 0xffffffffUL
175 EXPORT_SYMBOL(s3c_device_lcd
);
177 void __init
s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info
*pd
)
179 struct s3c2410fb_mach_info
*npd
;
181 npd
= kmalloc(sizeof(*npd
), GFP_KERNEL
);
183 memcpy(npd
, pd
, sizeof(*npd
));
184 s3c_device_lcd
.dev
.platform_data
= npd
;
186 printk(KERN_ERR
"no memory for LCD platform data\n");
190 /* NAND Controller */
192 static struct resource s3c_nand_resource
[] = {
194 .start
= S3C2410_PA_NAND
,
195 .end
= S3C2410_PA_NAND
+ S3C24XX_SZ_NAND
- 1,
196 .flags
= IORESOURCE_MEM
,
200 struct platform_device s3c_device_nand
= {
201 .name
= "s3c2410-nand",
203 .num_resources
= ARRAY_SIZE(s3c_nand_resource
),
204 .resource
= s3c_nand_resource
,
207 EXPORT_SYMBOL(s3c_device_nand
);
209 /* USB Device (Gadget)*/
211 static struct resource s3c_usbgadget_resource
[] = {
213 .start
= S3C24XX_PA_USBDEV
,
214 .end
= S3C24XX_PA_USBDEV
+ S3C24XX_SZ_USBDEV
- 1,
215 .flags
= IORESOURCE_MEM
,
220 .flags
= IORESOURCE_IRQ
,
225 struct platform_device s3c_device_usbgadget
= {
226 .name
= "s3c2410-usbgadget",
228 .num_resources
= ARRAY_SIZE(s3c_usbgadget_resource
),
229 .resource
= s3c_usbgadget_resource
,
232 EXPORT_SYMBOL(s3c_device_usbgadget
);
234 void __init
s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info
*pd
)
236 struct s3c2410_udc_mach_info
*npd
;
238 npd
= kmalloc(sizeof(*npd
), GFP_KERNEL
);
240 memcpy(npd
, pd
, sizeof(*npd
));
241 s3c_device_usbgadget
.dev
.platform_data
= npd
;
243 printk(KERN_ERR
"no memory for udc platform data\n");
250 static struct resource s3c_wdt_resource
[] = {
252 .start
= S3C24XX_PA_WATCHDOG
,
253 .end
= S3C24XX_PA_WATCHDOG
+ S3C24XX_SZ_WATCHDOG
- 1,
254 .flags
= IORESOURCE_MEM
,
259 .flags
= IORESOURCE_IRQ
,
264 struct platform_device s3c_device_wdt
= {
265 .name
= "s3c2410-wdt",
267 .num_resources
= ARRAY_SIZE(s3c_wdt_resource
),
268 .resource
= s3c_wdt_resource
,
271 EXPORT_SYMBOL(s3c_device_wdt
);
275 static struct resource s3c_i2c_resource
[] = {
277 .start
= S3C24XX_PA_IIC
,
278 .end
= S3C24XX_PA_IIC
+ S3C24XX_SZ_IIC
- 1,
279 .flags
= IORESOURCE_MEM
,
284 .flags
= IORESOURCE_IRQ
,
289 struct platform_device s3c_device_i2c
= {
290 .name
= "s3c2410-i2c",
292 .num_resources
= ARRAY_SIZE(s3c_i2c_resource
),
293 .resource
= s3c_i2c_resource
,
296 EXPORT_SYMBOL(s3c_device_i2c
);
300 static struct resource s3c_iis_resource
[] = {
302 .start
= S3C24XX_PA_IIS
,
303 .end
= S3C24XX_PA_IIS
+ S3C24XX_SZ_IIS
-1,
304 .flags
= IORESOURCE_MEM
,
308 static u64 s3c_device_iis_dmamask
= 0xffffffffUL
;
310 struct platform_device s3c_device_iis
= {
311 .name
= "s3c2410-iis",
313 .num_resources
= ARRAY_SIZE(s3c_iis_resource
),
314 .resource
= s3c_iis_resource
,
316 .dma_mask
= &s3c_device_iis_dmamask
,
317 .coherent_dma_mask
= 0xffffffffUL
321 EXPORT_SYMBOL(s3c_device_iis
);
325 static struct resource s3c_rtc_resource
[] = {
327 .start
= S3C24XX_PA_RTC
,
328 .end
= S3C24XX_PA_RTC
+ 0xff,
329 .flags
= IORESOURCE_MEM
,
334 .flags
= IORESOURCE_IRQ
,
339 .flags
= IORESOURCE_IRQ
343 struct platform_device s3c_device_rtc
= {
344 .name
= "s3c2410-rtc",
346 .num_resources
= ARRAY_SIZE(s3c_rtc_resource
),
347 .resource
= s3c_rtc_resource
,
350 EXPORT_SYMBOL(s3c_device_rtc
);
354 static struct resource s3c_adc_resource
[] = {
356 .start
= S3C24XX_PA_ADC
,
357 .end
= S3C24XX_PA_ADC
+ S3C24XX_SZ_ADC
- 1,
358 .flags
= IORESOURCE_MEM
,
363 .flags
= IORESOURCE_IRQ
,
368 .flags
= IORESOURCE_IRQ
,
373 struct platform_device s3c_device_adc
= {
374 .name
= "s3c2410-adc",
376 .num_resources
= ARRAY_SIZE(s3c_adc_resource
),
377 .resource
= s3c_adc_resource
,
382 static struct resource s3c_sdi_resource
[] = {
384 .start
= S3C2410_PA_SDI
,
385 .end
= S3C2410_PA_SDI
+ S3C24XX_SZ_SDI
- 1,
386 .flags
= IORESOURCE_MEM
,
391 .flags
= IORESOURCE_IRQ
,
396 struct platform_device s3c_device_sdi
= {
397 .name
= "s3c2410-sdi",
399 .num_resources
= ARRAY_SIZE(s3c_sdi_resource
),
400 .resource
= s3c_sdi_resource
,
403 EXPORT_SYMBOL(s3c_device_sdi
);
407 static struct resource s3c_spi0_resource
[] = {
409 .start
= S3C24XX_PA_SPI
,
410 .end
= S3C24XX_PA_SPI
+ 0x1f,
411 .flags
= IORESOURCE_MEM
,
416 .flags
= IORESOURCE_IRQ
,
421 static u64 s3c_device_spi0_dmamask
= 0xffffffffUL
;
423 struct platform_device s3c_device_spi0
= {
424 .name
= "s3c2410-spi",
426 .num_resources
= ARRAY_SIZE(s3c_spi0_resource
),
427 .resource
= s3c_spi0_resource
,
429 .dma_mask
= &s3c_device_spi0_dmamask
,
430 .coherent_dma_mask
= 0xffffffffUL
434 EXPORT_SYMBOL(s3c_device_spi0
);
438 static struct resource s3c_spi1_resource
[] = {
440 .start
= S3C24XX_PA_SPI
+ 0x20,
441 .end
= S3C24XX_PA_SPI
+ 0x20 + 0x1f,
442 .flags
= IORESOURCE_MEM
,
447 .flags
= IORESOURCE_IRQ
,
452 static u64 s3c_device_spi1_dmamask
= 0xffffffffUL
;
454 struct platform_device s3c_device_spi1
= {
455 .name
= "s3c2410-spi",
457 .num_resources
= ARRAY_SIZE(s3c_spi1_resource
),
458 .resource
= s3c_spi1_resource
,
460 .dma_mask
= &s3c_device_spi1_dmamask
,
461 .coherent_dma_mask
= 0xffffffffUL
465 EXPORT_SYMBOL(s3c_device_spi1
);
467 /* pwm timer blocks */
469 static struct resource s3c_timer0_resource
[] = {
471 .start
= S3C24XX_PA_TIMER
+ 0x0C,
472 .end
= S3C24XX_PA_TIMER
+ 0x0C + 0xB,
473 .flags
= IORESOURCE_MEM
,
478 .flags
= IORESOURCE_IRQ
,
483 struct platform_device s3c_device_timer0
= {
484 .name
= "s3c2410-timer",
486 .num_resources
= ARRAY_SIZE(s3c_timer0_resource
),
487 .resource
= s3c_timer0_resource
,
490 EXPORT_SYMBOL(s3c_device_timer0
);
494 static struct resource s3c_timer1_resource
[] = {
496 .start
= S3C24XX_PA_TIMER
+ 0x18,
497 .end
= S3C24XX_PA_TIMER
+ 0x23,
498 .flags
= IORESOURCE_MEM
,
503 .flags
= IORESOURCE_IRQ
,
508 struct platform_device s3c_device_timer1
= {
509 .name
= "s3c2410-timer",
511 .num_resources
= ARRAY_SIZE(s3c_timer1_resource
),
512 .resource
= s3c_timer1_resource
,
515 EXPORT_SYMBOL(s3c_device_timer1
);
519 static struct resource s3c_timer2_resource
[] = {
521 .start
= S3C24XX_PA_TIMER
+ 0x24,
522 .end
= S3C24XX_PA_TIMER
+ 0x2F,
523 .flags
= IORESOURCE_MEM
,
528 .flags
= IORESOURCE_IRQ
,
533 struct platform_device s3c_device_timer2
= {
534 .name
= "s3c2410-timer",
536 .num_resources
= ARRAY_SIZE(s3c_timer2_resource
),
537 .resource
= s3c_timer2_resource
,
540 EXPORT_SYMBOL(s3c_device_timer2
);
544 static struct resource s3c_timer3_resource
[] = {
546 .start
= S3C24XX_PA_TIMER
+ 0x30,
547 .end
= S3C24XX_PA_TIMER
+ 0x3B,
548 .flags
= IORESOURCE_MEM
,
553 .flags
= IORESOURCE_IRQ
,
558 struct platform_device s3c_device_timer3
= {
559 .name
= "s3c2410-timer",
561 .num_resources
= ARRAY_SIZE(s3c_timer3_resource
),
562 .resource
= s3c_timer3_resource
,
565 EXPORT_SYMBOL(s3c_device_timer3
);
567 #ifdef CONFIG_CPU_S3C2440
569 /* Camif Controller */
571 static struct resource s3c_camif_resource
[] = {
573 .start
= S3C2440_PA_CAMIF
,
574 .end
= S3C2440_PA_CAMIF
+ S3C2440_SZ_CAMIF
- 1,
575 .flags
= IORESOURCE_MEM
,
580 .flags
= IORESOURCE_IRQ
,
585 static u64 s3c_device_camif_dmamask
= 0xffffffffUL
;
587 struct platform_device s3c_device_camif
= {
588 .name
= "s3c2440-camif",
590 .num_resources
= ARRAY_SIZE(s3c_camif_resource
),
591 .resource
= s3c_camif_resource
,
593 .dma_mask
= &s3c_device_camif_dmamask
,
594 .coherent_dma_mask
= 0xffffffffUL
598 EXPORT_SYMBOL(s3c_device_camif
);
600 #endif // CONFIG_CPU_S32440