1 /* linux/arch/arm/mach-s3c2410/devs.c
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
6 * Base S3C2410 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.
13 * 15-Jan-2006 LCVR Using S3C24XX_PA_##x macro for common S3C24XX devices
14 * 10-Mar-2005 LCVR Changed S3C2410_{VA,SZ} to S3C24XX_{VA,SZ}
15 * 10-Feb-2005 BJD Added camera from guillaume.gourat@nexvision.tv
16 * 29-Aug-2004 BJD Added timers 0 through 3
17 * 29-Aug-2004 BJD Changed index of devices we only have one of to -1
18 * 21-Aug-2004 BJD Added IRQ_TICK to RTC resources
19 * 18-Aug-2004 BJD Created initial version
22 #include <linux/kernel.h>
23 #include <linux/types.h>
24 #include <linux/interrupt.h>
25 #include <linux/list.h>
26 #include <linux/timer.h>
27 #include <linux/init.h>
28 #include <linux/platform_device.h>
30 #include <asm/mach/arch.h>
31 #include <asm/mach/map.h>
32 #include <asm/mach/irq.h>
33 #include <asm/arch/fb.h>
34 #include <asm/hardware.h>
38 #include <asm/arch/regs-serial.h>
43 /* Serial port registrations */
45 static struct resource s3c2410_uart0_resource
[] = {
47 .start
= S3C2410_PA_UART0
,
48 .end
= S3C2410_PA_UART0
+ 0x3fff,
49 .flags
= IORESOURCE_MEM
,
52 .start
= IRQ_S3CUART_RX0
,
53 .end
= IRQ_S3CUART_ERR0
,
54 .flags
= IORESOURCE_IRQ
,
58 static struct resource s3c2410_uart1_resource
[] = {
60 .start
= S3C2410_PA_UART1
,
61 .end
= S3C2410_PA_UART1
+ 0x3fff,
62 .flags
= IORESOURCE_MEM
,
65 .start
= IRQ_S3CUART_RX1
,
66 .end
= IRQ_S3CUART_ERR1
,
67 .flags
= IORESOURCE_IRQ
,
71 static struct resource s3c2410_uart2_resource
[] = {
73 .start
= S3C2410_PA_UART2
,
74 .end
= S3C2410_PA_UART2
+ 0x3fff,
75 .flags
= IORESOURCE_MEM
,
78 .start
= IRQ_S3CUART_RX2
,
79 .end
= IRQ_S3CUART_ERR2
,
80 .flags
= IORESOURCE_IRQ
,
84 struct s3c24xx_uart_resources s3c2410_uart_resources
[] __initdata
= {
86 .resources
= s3c2410_uart0_resource
,
87 .nr_resources
= ARRAY_SIZE(s3c2410_uart0_resource
),
90 .resources
= s3c2410_uart1_resource
,
91 .nr_resources
= ARRAY_SIZE(s3c2410_uart1_resource
),
94 .resources
= s3c2410_uart2_resource
,
95 .nr_resources
= ARRAY_SIZE(s3c2410_uart2_resource
),
101 static struct platform_device s3c24xx_uart_device0
= {
105 static struct platform_device s3c24xx_uart_device1
= {
109 static struct platform_device s3c24xx_uart_device2
= {
113 struct platform_device
*s3c24xx_uart_src
[3] = {
114 &s3c24xx_uart_device0
,
115 &s3c24xx_uart_device1
,
116 &s3c24xx_uart_device2
,
119 struct platform_device
*s3c24xx_uart_devs
[3] = {
122 /* USB Host Controller */
124 static struct resource s3c_usb_resource
[] = {
126 .start
= S3C24XX_PA_USBHOST
,
127 .end
= S3C24XX_PA_USBHOST
+ S3C24XX_SZ_USBHOST
- 1,
128 .flags
= IORESOURCE_MEM
,
133 .flags
= IORESOURCE_IRQ
,
137 static u64 s3c_device_usb_dmamask
= 0xffffffffUL
;
139 struct platform_device s3c_device_usb
= {
140 .name
= "s3c2410-ohci",
142 .num_resources
= ARRAY_SIZE(s3c_usb_resource
),
143 .resource
= s3c_usb_resource
,
145 .dma_mask
= &s3c_device_usb_dmamask
,
146 .coherent_dma_mask
= 0xffffffffUL
150 EXPORT_SYMBOL(s3c_device_usb
);
154 static struct resource s3c_lcd_resource
[] = {
156 .start
= S3C24XX_PA_LCD
,
157 .end
= S3C24XX_PA_LCD
+ S3C24XX_SZ_LCD
- 1,
158 .flags
= IORESOURCE_MEM
,
163 .flags
= IORESOURCE_IRQ
,
168 static u64 s3c_device_lcd_dmamask
= 0xffffffffUL
;
170 struct platform_device s3c_device_lcd
= {
171 .name
= "s3c2410-lcd",
173 .num_resources
= ARRAY_SIZE(s3c_lcd_resource
),
174 .resource
= s3c_lcd_resource
,
176 .dma_mask
= &s3c_device_lcd_dmamask
,
177 .coherent_dma_mask
= 0xffffffffUL
181 EXPORT_SYMBOL(s3c_device_lcd
);
183 void __init
s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info
*pd
)
185 struct s3c2410fb_mach_info
*npd
;
187 npd
= kmalloc(sizeof(*npd
), GFP_KERNEL
);
189 memcpy(npd
, pd
, sizeof(*npd
));
190 s3c_device_lcd
.dev
.platform_data
= npd
;
192 printk(KERN_ERR
"no memory for LCD platform data\n");
196 /* NAND Controller */
198 static struct resource s3c_nand_resource
[] = {
200 .start
= S3C2410_PA_NAND
,
201 .end
= S3C2410_PA_NAND
+ S3C24XX_SZ_NAND
- 1,
202 .flags
= IORESOURCE_MEM
,
206 struct platform_device s3c_device_nand
= {
207 .name
= "s3c2410-nand",
209 .num_resources
= ARRAY_SIZE(s3c_nand_resource
),
210 .resource
= s3c_nand_resource
,
213 EXPORT_SYMBOL(s3c_device_nand
);
215 /* USB Device (Gadget)*/
217 static struct resource s3c_usbgadget_resource
[] = {
219 .start
= S3C24XX_PA_USBDEV
,
220 .end
= S3C24XX_PA_USBDEV
+ S3C24XX_SZ_USBDEV
- 1,
221 .flags
= IORESOURCE_MEM
,
226 .flags
= IORESOURCE_IRQ
,
231 struct platform_device s3c_device_usbgadget
= {
232 .name
= "s3c2410-usbgadget",
234 .num_resources
= ARRAY_SIZE(s3c_usbgadget_resource
),
235 .resource
= s3c_usbgadget_resource
,
238 EXPORT_SYMBOL(s3c_device_usbgadget
);
242 static struct resource s3c_wdt_resource
[] = {
244 .start
= S3C24XX_PA_WATCHDOG
,
245 .end
= S3C24XX_PA_WATCHDOG
+ S3C24XX_SZ_WATCHDOG
- 1,
246 .flags
= IORESOURCE_MEM
,
251 .flags
= IORESOURCE_IRQ
,
256 struct platform_device s3c_device_wdt
= {
257 .name
= "s3c2410-wdt",
259 .num_resources
= ARRAY_SIZE(s3c_wdt_resource
),
260 .resource
= s3c_wdt_resource
,
263 EXPORT_SYMBOL(s3c_device_wdt
);
267 static struct resource s3c_i2c_resource
[] = {
269 .start
= S3C24XX_PA_IIC
,
270 .end
= S3C24XX_PA_IIC
+ S3C24XX_SZ_IIC
- 1,
271 .flags
= IORESOURCE_MEM
,
276 .flags
= IORESOURCE_IRQ
,
281 struct platform_device s3c_device_i2c
= {
282 .name
= "s3c2410-i2c",
284 .num_resources
= ARRAY_SIZE(s3c_i2c_resource
),
285 .resource
= s3c_i2c_resource
,
288 EXPORT_SYMBOL(s3c_device_i2c
);
292 static struct resource s3c_iis_resource
[] = {
294 .start
= S3C24XX_PA_IIS
,
295 .end
= S3C24XX_PA_IIS
+ S3C24XX_SZ_IIS
-1,
296 .flags
= IORESOURCE_MEM
,
300 static u64 s3c_device_iis_dmamask
= 0xffffffffUL
;
302 struct platform_device s3c_device_iis
= {
303 .name
= "s3c2410-iis",
305 .num_resources
= ARRAY_SIZE(s3c_iis_resource
),
306 .resource
= s3c_iis_resource
,
308 .dma_mask
= &s3c_device_iis_dmamask
,
309 .coherent_dma_mask
= 0xffffffffUL
313 EXPORT_SYMBOL(s3c_device_iis
);
317 static struct resource s3c_rtc_resource
[] = {
319 .start
= S3C24XX_PA_RTC
,
320 .end
= S3C24XX_PA_RTC
+ 0xff,
321 .flags
= IORESOURCE_MEM
,
326 .flags
= IORESOURCE_IRQ
,
331 .flags
= IORESOURCE_IRQ
335 struct platform_device s3c_device_rtc
= {
336 .name
= "s3c2410-rtc",
338 .num_resources
= ARRAY_SIZE(s3c_rtc_resource
),
339 .resource
= s3c_rtc_resource
,
342 EXPORT_SYMBOL(s3c_device_rtc
);
346 static struct resource s3c_adc_resource
[] = {
348 .start
= S3C24XX_PA_ADC
,
349 .end
= S3C24XX_PA_ADC
+ S3C24XX_SZ_ADC
- 1,
350 .flags
= IORESOURCE_MEM
,
355 .flags
= IORESOURCE_IRQ
,
360 .flags
= IORESOURCE_IRQ
,
365 struct platform_device s3c_device_adc
= {
366 .name
= "s3c2410-adc",
368 .num_resources
= ARRAY_SIZE(s3c_adc_resource
),
369 .resource
= s3c_adc_resource
,
374 static struct resource s3c_sdi_resource
[] = {
376 .start
= S3C2410_PA_SDI
,
377 .end
= S3C2410_PA_SDI
+ S3C24XX_SZ_SDI
- 1,
378 .flags
= IORESOURCE_MEM
,
383 .flags
= IORESOURCE_IRQ
,
388 struct platform_device s3c_device_sdi
= {
389 .name
= "s3c2410-sdi",
391 .num_resources
= ARRAY_SIZE(s3c_sdi_resource
),
392 .resource
= s3c_sdi_resource
,
395 EXPORT_SYMBOL(s3c_device_sdi
);
399 static struct resource s3c_spi0_resource
[] = {
401 .start
= S3C24XX_PA_SPI
,
402 .end
= S3C24XX_PA_SPI
+ 0x1f,
403 .flags
= IORESOURCE_MEM
,
408 .flags
= IORESOURCE_IRQ
,
413 static u64 s3c_device_spi0_dmamask
= 0xffffffffUL
;
415 struct platform_device s3c_device_spi0
= {
416 .name
= "s3c2410-spi",
418 .num_resources
= ARRAY_SIZE(s3c_spi0_resource
),
419 .resource
= s3c_spi0_resource
,
421 .dma_mask
= &s3c_device_spi0_dmamask
,
422 .coherent_dma_mask
= 0xffffffffUL
426 EXPORT_SYMBOL(s3c_device_spi0
);
430 static struct resource s3c_spi1_resource
[] = {
432 .start
= S3C24XX_PA_SPI
+ 0x20,
433 .end
= S3C24XX_PA_SPI
+ 0x20 + 0x1f,
434 .flags
= IORESOURCE_MEM
,
439 .flags
= IORESOURCE_IRQ
,
444 static u64 s3c_device_spi1_dmamask
= 0xffffffffUL
;
446 struct platform_device s3c_device_spi1
= {
447 .name
= "s3c2410-spi",
449 .num_resources
= ARRAY_SIZE(s3c_spi1_resource
),
450 .resource
= s3c_spi1_resource
,
452 .dma_mask
= &s3c_device_spi1_dmamask
,
453 .coherent_dma_mask
= 0xffffffffUL
457 EXPORT_SYMBOL(s3c_device_spi1
);
459 /* pwm timer blocks */
461 static struct resource s3c_timer0_resource
[] = {
463 .start
= S3C24XX_PA_TIMER
+ 0x0C,
464 .end
= S3C24XX_PA_TIMER
+ 0x0C + 0xB,
465 .flags
= IORESOURCE_MEM
,
470 .flags
= IORESOURCE_IRQ
,
475 struct platform_device s3c_device_timer0
= {
476 .name
= "s3c2410-timer",
478 .num_resources
= ARRAY_SIZE(s3c_timer0_resource
),
479 .resource
= s3c_timer0_resource
,
482 EXPORT_SYMBOL(s3c_device_timer0
);
486 static struct resource s3c_timer1_resource
[] = {
488 .start
= S3C24XX_PA_TIMER
+ 0x18,
489 .end
= S3C24XX_PA_TIMER
+ 0x23,
490 .flags
= IORESOURCE_MEM
,
495 .flags
= IORESOURCE_IRQ
,
500 struct platform_device s3c_device_timer1
= {
501 .name
= "s3c2410-timer",
503 .num_resources
= ARRAY_SIZE(s3c_timer1_resource
),
504 .resource
= s3c_timer1_resource
,
507 EXPORT_SYMBOL(s3c_device_timer1
);
511 static struct resource s3c_timer2_resource
[] = {
513 .start
= S3C24XX_PA_TIMER
+ 0x24,
514 .end
= S3C24XX_PA_TIMER
+ 0x2F,
515 .flags
= IORESOURCE_MEM
,
520 .flags
= IORESOURCE_IRQ
,
525 struct platform_device s3c_device_timer2
= {
526 .name
= "s3c2410-timer",
528 .num_resources
= ARRAY_SIZE(s3c_timer2_resource
),
529 .resource
= s3c_timer2_resource
,
532 EXPORT_SYMBOL(s3c_device_timer2
);
536 static struct resource s3c_timer3_resource
[] = {
538 .start
= S3C24XX_PA_TIMER
+ 0x30,
539 .end
= S3C24XX_PA_TIMER
+ 0x3B,
540 .flags
= IORESOURCE_MEM
,
545 .flags
= IORESOURCE_IRQ
,
550 struct platform_device s3c_device_timer3
= {
551 .name
= "s3c2410-timer",
553 .num_resources
= ARRAY_SIZE(s3c_timer3_resource
),
554 .resource
= s3c_timer3_resource
,
557 EXPORT_SYMBOL(s3c_device_timer3
);
559 #ifdef CONFIG_CPU_S3C2440
561 /* Camif Controller */
563 static struct resource s3c_camif_resource
[] = {
565 .start
= S3C2440_PA_CAMIF
,
566 .end
= S3C2440_PA_CAMIF
+ S3C2440_SZ_CAMIF
- 1,
567 .flags
= IORESOURCE_MEM
,
572 .flags
= IORESOURCE_IRQ
,
577 static u64 s3c_device_camif_dmamask
= 0xffffffffUL
;
579 struct platform_device s3c_device_camif
= {
580 .name
= "s3c2440-camif",
582 .num_resources
= ARRAY_SIZE(s3c_camif_resource
),
583 .resource
= s3c_camif_resource
,
585 .dma_mask
= &s3c_device_camif_dmamask
,
586 .coherent_dma_mask
= 0xffffffffUL
590 EXPORT_SYMBOL(s3c_device_camif
);
592 #endif // CONFIG_CPU_S32440