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>
42 /* Serial port registrations */
44 struct platform_device
*s3c24xx_uart_devs
[3];
46 /* USB Host Controller */
48 static struct resource s3c_usb_resource
[] = {
50 .start
= S3C24XX_PA_USBHOST
,
51 .end
= S3C24XX_PA_USBHOST
+ S3C24XX_SZ_USBHOST
- 1,
52 .flags
= IORESOURCE_MEM
,
57 .flags
= IORESOURCE_IRQ
,
61 static u64 s3c_device_usb_dmamask
= 0xffffffffUL
;
63 struct platform_device s3c_device_usb
= {
64 .name
= "s3c2410-ohci",
66 .num_resources
= ARRAY_SIZE(s3c_usb_resource
),
67 .resource
= s3c_usb_resource
,
69 .dma_mask
= &s3c_device_usb_dmamask
,
70 .coherent_dma_mask
= 0xffffffffUL
74 EXPORT_SYMBOL(s3c_device_usb
);
78 static struct resource s3c_lcd_resource
[] = {
80 .start
= S3C24XX_PA_LCD
,
81 .end
= S3C24XX_PA_LCD
+ S3C24XX_SZ_LCD
- 1,
82 .flags
= IORESOURCE_MEM
,
87 .flags
= IORESOURCE_IRQ
,
92 static u64 s3c_device_lcd_dmamask
= 0xffffffffUL
;
94 struct platform_device s3c_device_lcd
= {
95 .name
= "s3c2410-lcd",
97 .num_resources
= ARRAY_SIZE(s3c_lcd_resource
),
98 .resource
= s3c_lcd_resource
,
100 .dma_mask
= &s3c_device_lcd_dmamask
,
101 .coherent_dma_mask
= 0xffffffffUL
105 EXPORT_SYMBOL(s3c_device_lcd
);
107 void __init
s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info
*pd
)
109 struct s3c2410fb_mach_info
*npd
;
111 npd
= kmalloc(sizeof(*npd
), GFP_KERNEL
);
113 memcpy(npd
, pd
, sizeof(*npd
));
114 s3c_device_lcd
.dev
.platform_data
= npd
;
116 printk(KERN_ERR
"no memory for LCD platform data\n");
120 /* NAND Controller */
122 static struct resource s3c_nand_resource
[] = {
124 .start
= S3C2410_PA_NAND
,
125 .end
= S3C2410_PA_NAND
+ S3C24XX_SZ_NAND
- 1,
126 .flags
= IORESOURCE_MEM
,
130 struct platform_device s3c_device_nand
= {
131 .name
= "s3c2410-nand",
133 .num_resources
= ARRAY_SIZE(s3c_nand_resource
),
134 .resource
= s3c_nand_resource
,
137 EXPORT_SYMBOL(s3c_device_nand
);
139 /* USB Device (Gadget)*/
141 static struct resource s3c_usbgadget_resource
[] = {
143 .start
= S3C24XX_PA_USBDEV
,
144 .end
= S3C24XX_PA_USBDEV
+ S3C24XX_SZ_USBDEV
- 1,
145 .flags
= IORESOURCE_MEM
,
150 .flags
= IORESOURCE_IRQ
,
155 struct platform_device s3c_device_usbgadget
= {
156 .name
= "s3c2410-usbgadget",
158 .num_resources
= ARRAY_SIZE(s3c_usbgadget_resource
),
159 .resource
= s3c_usbgadget_resource
,
162 EXPORT_SYMBOL(s3c_device_usbgadget
);
166 static struct resource s3c_wdt_resource
[] = {
168 .start
= S3C24XX_PA_WATCHDOG
,
169 .end
= S3C24XX_PA_WATCHDOG
+ S3C24XX_SZ_WATCHDOG
- 1,
170 .flags
= IORESOURCE_MEM
,
175 .flags
= IORESOURCE_IRQ
,
180 struct platform_device s3c_device_wdt
= {
181 .name
= "s3c2410-wdt",
183 .num_resources
= ARRAY_SIZE(s3c_wdt_resource
),
184 .resource
= s3c_wdt_resource
,
187 EXPORT_SYMBOL(s3c_device_wdt
);
191 static struct resource s3c_i2c_resource
[] = {
193 .start
= S3C24XX_PA_IIC
,
194 .end
= S3C24XX_PA_IIC
+ S3C24XX_SZ_IIC
- 1,
195 .flags
= IORESOURCE_MEM
,
200 .flags
= IORESOURCE_IRQ
,
205 struct platform_device s3c_device_i2c
= {
206 .name
= "s3c2410-i2c",
208 .num_resources
= ARRAY_SIZE(s3c_i2c_resource
),
209 .resource
= s3c_i2c_resource
,
212 EXPORT_SYMBOL(s3c_device_i2c
);
216 static struct resource s3c_iis_resource
[] = {
218 .start
= S3C24XX_PA_IIS
,
219 .end
= S3C24XX_PA_IIS
+ S3C24XX_SZ_IIS
-1,
220 .flags
= IORESOURCE_MEM
,
224 static u64 s3c_device_iis_dmamask
= 0xffffffffUL
;
226 struct platform_device s3c_device_iis
= {
227 .name
= "s3c2410-iis",
229 .num_resources
= ARRAY_SIZE(s3c_iis_resource
),
230 .resource
= s3c_iis_resource
,
232 .dma_mask
= &s3c_device_iis_dmamask
,
233 .coherent_dma_mask
= 0xffffffffUL
237 EXPORT_SYMBOL(s3c_device_iis
);
241 static struct resource s3c_rtc_resource
[] = {
243 .start
= S3C24XX_PA_RTC
,
244 .end
= S3C24XX_PA_RTC
+ 0xff,
245 .flags
= IORESOURCE_MEM
,
250 .flags
= IORESOURCE_IRQ
,
255 .flags
= IORESOURCE_IRQ
259 struct platform_device s3c_device_rtc
= {
260 .name
= "s3c2410-rtc",
262 .num_resources
= ARRAY_SIZE(s3c_rtc_resource
),
263 .resource
= s3c_rtc_resource
,
266 EXPORT_SYMBOL(s3c_device_rtc
);
270 static struct resource s3c_adc_resource
[] = {
272 .start
= S3C24XX_PA_ADC
,
273 .end
= S3C24XX_PA_ADC
+ S3C24XX_SZ_ADC
- 1,
274 .flags
= IORESOURCE_MEM
,
279 .flags
= IORESOURCE_IRQ
,
284 .flags
= IORESOURCE_IRQ
,
289 struct platform_device s3c_device_adc
= {
290 .name
= "s3c2410-adc",
292 .num_resources
= ARRAY_SIZE(s3c_adc_resource
),
293 .resource
= s3c_adc_resource
,
298 static struct resource s3c_sdi_resource
[] = {
300 .start
= S3C2410_PA_SDI
,
301 .end
= S3C2410_PA_SDI
+ S3C24XX_SZ_SDI
- 1,
302 .flags
= IORESOURCE_MEM
,
307 .flags
= IORESOURCE_IRQ
,
312 struct platform_device s3c_device_sdi
= {
313 .name
= "s3c2410-sdi",
315 .num_resources
= ARRAY_SIZE(s3c_sdi_resource
),
316 .resource
= s3c_sdi_resource
,
319 EXPORT_SYMBOL(s3c_device_sdi
);
323 static struct resource s3c_spi0_resource
[] = {
325 .start
= S3C24XX_PA_SPI
,
326 .end
= S3C24XX_PA_SPI
+ 0x1f,
327 .flags
= IORESOURCE_MEM
,
332 .flags
= IORESOURCE_IRQ
,
337 static u64 s3c_device_spi0_dmamask
= 0xffffffffUL
;
339 struct platform_device s3c_device_spi0
= {
340 .name
= "s3c2410-spi",
342 .num_resources
= ARRAY_SIZE(s3c_spi0_resource
),
343 .resource
= s3c_spi0_resource
,
345 .dma_mask
= &s3c_device_spi0_dmamask
,
346 .coherent_dma_mask
= 0xffffffffUL
350 EXPORT_SYMBOL(s3c_device_spi0
);
354 static struct resource s3c_spi1_resource
[] = {
356 .start
= S3C24XX_PA_SPI
+ 0x20,
357 .end
= S3C24XX_PA_SPI
+ 0x20 + 0x1f,
358 .flags
= IORESOURCE_MEM
,
363 .flags
= IORESOURCE_IRQ
,
368 static u64 s3c_device_spi1_dmamask
= 0xffffffffUL
;
370 struct platform_device s3c_device_spi1
= {
371 .name
= "s3c2410-spi",
373 .num_resources
= ARRAY_SIZE(s3c_spi1_resource
),
374 .resource
= s3c_spi1_resource
,
376 .dma_mask
= &s3c_device_spi1_dmamask
,
377 .coherent_dma_mask
= 0xffffffffUL
381 EXPORT_SYMBOL(s3c_device_spi1
);
383 /* pwm timer blocks */
385 static struct resource s3c_timer0_resource
[] = {
387 .start
= S3C24XX_PA_TIMER
+ 0x0C,
388 .end
= S3C24XX_PA_TIMER
+ 0x0C + 0xB,
389 .flags
= IORESOURCE_MEM
,
394 .flags
= IORESOURCE_IRQ
,
399 struct platform_device s3c_device_timer0
= {
400 .name
= "s3c2410-timer",
402 .num_resources
= ARRAY_SIZE(s3c_timer0_resource
),
403 .resource
= s3c_timer0_resource
,
406 EXPORT_SYMBOL(s3c_device_timer0
);
410 static struct resource s3c_timer1_resource
[] = {
412 .start
= S3C24XX_PA_TIMER
+ 0x18,
413 .end
= S3C24XX_PA_TIMER
+ 0x23,
414 .flags
= IORESOURCE_MEM
,
419 .flags
= IORESOURCE_IRQ
,
424 struct platform_device s3c_device_timer1
= {
425 .name
= "s3c2410-timer",
427 .num_resources
= ARRAY_SIZE(s3c_timer1_resource
),
428 .resource
= s3c_timer1_resource
,
431 EXPORT_SYMBOL(s3c_device_timer1
);
435 static struct resource s3c_timer2_resource
[] = {
437 .start
= S3C24XX_PA_TIMER
+ 0x24,
438 .end
= S3C24XX_PA_TIMER
+ 0x2F,
439 .flags
= IORESOURCE_MEM
,
444 .flags
= IORESOURCE_IRQ
,
449 struct platform_device s3c_device_timer2
= {
450 .name
= "s3c2410-timer",
452 .num_resources
= ARRAY_SIZE(s3c_timer2_resource
),
453 .resource
= s3c_timer2_resource
,
456 EXPORT_SYMBOL(s3c_device_timer2
);
460 static struct resource s3c_timer3_resource
[] = {
462 .start
= S3C24XX_PA_TIMER
+ 0x30,
463 .end
= S3C24XX_PA_TIMER
+ 0x3B,
464 .flags
= IORESOURCE_MEM
,
469 .flags
= IORESOURCE_IRQ
,
474 struct platform_device s3c_device_timer3
= {
475 .name
= "s3c2410-timer",
477 .num_resources
= ARRAY_SIZE(s3c_timer3_resource
),
478 .resource
= s3c_timer3_resource
,
481 EXPORT_SYMBOL(s3c_device_timer3
);
483 #ifdef CONFIG_CPU_S3C2440
485 /* Camif Controller */
487 static struct resource s3c_camif_resource
[] = {
489 .start
= S3C2440_PA_CAMIF
,
490 .end
= S3C2440_PA_CAMIF
+ S3C2440_SZ_CAMIF
- 1,
491 .flags
= IORESOURCE_MEM
,
496 .flags
= IORESOURCE_IRQ
,
501 static u64 s3c_device_camif_dmamask
= 0xffffffffUL
;
503 struct platform_device s3c_device_camif
= {
504 .name
= "s3c2440-camif",
506 .num_resources
= ARRAY_SIZE(s3c_camif_resource
),
507 .resource
= s3c_camif_resource
,
509 .dma_mask
= &s3c_device_camif_dmamask
,
510 .coherent_dma_mask
= 0xffffffffUL
514 EXPORT_SYMBOL(s3c_device_camif
);
516 #endif // CONFIG_CPU_S32440