[ARM] 3045/2: S3C2410 - change init for lcd platform data
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-s3c2410 / devs.c
blob08bc7d95a45d78c0290b8d5c15eef4c934fd8105
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.
12 * Modifications:
13 * 10-Mar-2005 LCVR Changed S3C2410_{VA,SZ} to S3C24XX_{VA,SZ}
14 * 10-Feb-2005 BJD Added camera from guillaume.gourat@nexvision.tv
15 * 29-Aug-2004 BJD Added timers 0 through 3
16 * 29-Aug-2004 BJD Changed index of devices we only have one of to -1
17 * 21-Aug-2004 BJD Added IRQ_TICK to RTC resources
18 * 18-Aug-2004 BJD Created initial version
21 #include <linux/kernel.h>
22 #include <linux/types.h>
23 #include <linux/interrupt.h>
24 #include <linux/list.h>
25 #include <linux/timer.h>
26 #include <linux/init.h>
27 #include <linux/device.h>
29 #include <asm/mach/arch.h>
30 #include <asm/mach/map.h>
31 #include <asm/mach/irq.h>
32 #include <asm/arch/fb.h>
33 #include <asm/hardware.h>
34 #include <asm/io.h>
35 #include <asm/irq.h>
37 #include <asm/arch/regs-serial.h>
39 #include "devs.h"
41 /* Serial port registrations */
43 struct platform_device *s3c24xx_uart_devs[3];
45 /* USB Host Controller */
47 static struct resource s3c_usb_resource[] = {
48 [0] = {
49 .start = S3C2410_PA_USBHOST,
50 .end = S3C2410_PA_USBHOST + S3C24XX_SZ_USBHOST - 1,
51 .flags = IORESOURCE_MEM,
53 [1] = {
54 .start = IRQ_USBH,
55 .end = IRQ_USBH,
56 .flags = IORESOURCE_IRQ,
60 static u64 s3c_device_usb_dmamask = 0xffffffffUL;
62 struct platform_device s3c_device_usb = {
63 .name = "s3c2410-ohci",
64 .id = -1,
65 .num_resources = ARRAY_SIZE(s3c_usb_resource),
66 .resource = s3c_usb_resource,
67 .dev = {
68 .dma_mask = &s3c_device_usb_dmamask,
69 .coherent_dma_mask = 0xffffffffUL
73 EXPORT_SYMBOL(s3c_device_usb);
75 /* LCD Controller */
77 static struct resource s3c_lcd_resource[] = {
78 [0] = {
79 .start = S3C2410_PA_LCD,
80 .end = S3C2410_PA_LCD + S3C24XX_SZ_LCD - 1,
81 .flags = IORESOURCE_MEM,
83 [1] = {
84 .start = IRQ_LCD,
85 .end = IRQ_LCD,
86 .flags = IORESOURCE_IRQ,
91 static u64 s3c_device_lcd_dmamask = 0xffffffffUL;
93 struct platform_device s3c_device_lcd = {
94 .name = "s3c2410-lcd",
95 .id = -1,
96 .num_resources = ARRAY_SIZE(s3c_lcd_resource),
97 .resource = s3c_lcd_resource,
98 .dev = {
99 .dma_mask = &s3c_device_lcd_dmamask,
100 .coherent_dma_mask = 0xffffffffUL
104 EXPORT_SYMBOL(s3c_device_lcd);
106 void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
108 struct s3c2410fb_mach_info *npd;
110 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
111 if (npd) {
112 memcpy(npd, pd, sizeof(*npd));
113 s3c_device_lcd.dev.platform_data = npd;
114 } else {
115 printk(KERN_ERR "no memory for LCD platform data\n");
119 /* NAND Controller */
121 static struct resource s3c_nand_resource[] = {
122 [0] = {
123 .start = S3C2410_PA_NAND,
124 .end = S3C2410_PA_NAND + S3C24XX_SZ_NAND - 1,
125 .flags = IORESOURCE_MEM,
129 struct platform_device s3c_device_nand = {
130 .name = "s3c2410-nand",
131 .id = -1,
132 .num_resources = ARRAY_SIZE(s3c_nand_resource),
133 .resource = s3c_nand_resource,
136 EXPORT_SYMBOL(s3c_device_nand);
138 /* USB Device (Gadget)*/
140 static struct resource s3c_usbgadget_resource[] = {
141 [0] = {
142 .start = S3C2410_PA_USBDEV,
143 .end = S3C2410_PA_USBDEV + S3C24XX_SZ_USBDEV - 1,
144 .flags = IORESOURCE_MEM,
146 [1] = {
147 .start = IRQ_USBD,
148 .end = IRQ_USBD,
149 .flags = IORESOURCE_IRQ,
154 struct platform_device s3c_device_usbgadget = {
155 .name = "s3c2410-usbgadget",
156 .id = -1,
157 .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
158 .resource = s3c_usbgadget_resource,
161 EXPORT_SYMBOL(s3c_device_usbgadget);
163 /* Watchdog */
165 static struct resource s3c_wdt_resource[] = {
166 [0] = {
167 .start = S3C2410_PA_WATCHDOG,
168 .end = S3C2410_PA_WATCHDOG + S3C24XX_SZ_WATCHDOG - 1,
169 .flags = IORESOURCE_MEM,
171 [1] = {
172 .start = IRQ_WDT,
173 .end = IRQ_WDT,
174 .flags = IORESOURCE_IRQ,
179 struct platform_device s3c_device_wdt = {
180 .name = "s3c2410-wdt",
181 .id = -1,
182 .num_resources = ARRAY_SIZE(s3c_wdt_resource),
183 .resource = s3c_wdt_resource,
186 EXPORT_SYMBOL(s3c_device_wdt);
188 /* I2C */
190 static struct resource s3c_i2c_resource[] = {
191 [0] = {
192 .start = S3C2410_PA_IIC,
193 .end = S3C2410_PA_IIC + S3C24XX_SZ_IIC - 1,
194 .flags = IORESOURCE_MEM,
196 [1] = {
197 .start = IRQ_IIC,
198 .end = IRQ_IIC,
199 .flags = IORESOURCE_IRQ,
204 struct platform_device s3c_device_i2c = {
205 .name = "s3c2410-i2c",
206 .id = -1,
207 .num_resources = ARRAY_SIZE(s3c_i2c_resource),
208 .resource = s3c_i2c_resource,
211 EXPORT_SYMBOL(s3c_device_i2c);
213 /* IIS */
215 static struct resource s3c_iis_resource[] = {
216 [0] = {
217 .start = S3C2410_PA_IIS,
218 .end = S3C2410_PA_IIS + S3C24XX_SZ_IIS -1,
219 .flags = IORESOURCE_MEM,
223 static u64 s3c_device_iis_dmamask = 0xffffffffUL;
225 struct platform_device s3c_device_iis = {
226 .name = "s3c2410-iis",
227 .id = -1,
228 .num_resources = ARRAY_SIZE(s3c_iis_resource),
229 .resource = s3c_iis_resource,
230 .dev = {
231 .dma_mask = &s3c_device_iis_dmamask,
232 .coherent_dma_mask = 0xffffffffUL
236 EXPORT_SYMBOL(s3c_device_iis);
238 /* RTC */
240 static struct resource s3c_rtc_resource[] = {
241 [0] = {
242 .start = S3C2410_PA_RTC,
243 .end = S3C2410_PA_RTC + 0xff,
244 .flags = IORESOURCE_MEM,
246 [1] = {
247 .start = IRQ_RTC,
248 .end = IRQ_RTC,
249 .flags = IORESOURCE_IRQ,
251 [2] = {
252 .start = IRQ_TICK,
253 .end = IRQ_TICK,
254 .flags = IORESOURCE_IRQ
258 struct platform_device s3c_device_rtc = {
259 .name = "s3c2410-rtc",
260 .id = -1,
261 .num_resources = ARRAY_SIZE(s3c_rtc_resource),
262 .resource = s3c_rtc_resource,
265 EXPORT_SYMBOL(s3c_device_rtc);
267 /* ADC */
269 static struct resource s3c_adc_resource[] = {
270 [0] = {
271 .start = S3C2410_PA_ADC,
272 .end = S3C2410_PA_ADC + S3C24XX_SZ_ADC - 1,
273 .flags = IORESOURCE_MEM,
275 [1] = {
276 .start = IRQ_TC,
277 .end = IRQ_ADC,
278 .flags = IORESOURCE_IRQ,
283 struct platform_device s3c_device_adc = {
284 .name = "s3c2410-adc",
285 .id = -1,
286 .num_resources = ARRAY_SIZE(s3c_adc_resource),
287 .resource = s3c_adc_resource,
290 /* SDI */
292 static struct resource s3c_sdi_resource[] = {
293 [0] = {
294 .start = S3C2410_PA_SDI,
295 .end = S3C2410_PA_SDI + S3C24XX_SZ_SDI - 1,
296 .flags = IORESOURCE_MEM,
298 [1] = {
299 .start = IRQ_SDI,
300 .end = IRQ_SDI,
301 .flags = IORESOURCE_IRQ,
306 struct platform_device s3c_device_sdi = {
307 .name = "s3c2410-sdi",
308 .id = -1,
309 .num_resources = ARRAY_SIZE(s3c_sdi_resource),
310 .resource = s3c_sdi_resource,
313 EXPORT_SYMBOL(s3c_device_sdi);
315 /* SPI (0) */
317 static struct resource s3c_spi0_resource[] = {
318 [0] = {
319 .start = S3C2410_PA_SPI,
320 .end = S3C2410_PA_SPI + 0x1f,
321 .flags = IORESOURCE_MEM,
323 [1] = {
324 .start = IRQ_SPI0,
325 .end = IRQ_SPI0,
326 .flags = IORESOURCE_IRQ,
331 struct platform_device s3c_device_spi0 = {
332 .name = "s3c2410-spi",
333 .id = 0,
334 .num_resources = ARRAY_SIZE(s3c_spi0_resource),
335 .resource = s3c_spi0_resource,
338 EXPORT_SYMBOL(s3c_device_spi0);
340 /* SPI (1) */
342 static struct resource s3c_spi1_resource[] = {
343 [0] = {
344 .start = S3C2410_PA_SPI + 0x20,
345 .end = S3C2410_PA_SPI + 0x20 + 0x1f,
346 .flags = IORESOURCE_MEM,
348 [1] = {
349 .start = IRQ_SPI1,
350 .end = IRQ_SPI1,
351 .flags = IORESOURCE_IRQ,
356 struct platform_device s3c_device_spi1 = {
357 .name = "s3c2410-spi",
358 .id = 1,
359 .num_resources = ARRAY_SIZE(s3c_spi1_resource),
360 .resource = s3c_spi1_resource,
363 EXPORT_SYMBOL(s3c_device_spi1);
365 /* pwm timer blocks */
367 static struct resource s3c_timer0_resource[] = {
368 [0] = {
369 .start = S3C2410_PA_TIMER + 0x0C,
370 .end = S3C2410_PA_TIMER + 0x0C + 0xB,
371 .flags = IORESOURCE_MEM,
373 [1] = {
374 .start = IRQ_TIMER0,
375 .end = IRQ_TIMER0,
376 .flags = IORESOURCE_IRQ,
381 struct platform_device s3c_device_timer0 = {
382 .name = "s3c2410-timer",
383 .id = 0,
384 .num_resources = ARRAY_SIZE(s3c_timer0_resource),
385 .resource = s3c_timer0_resource,
388 EXPORT_SYMBOL(s3c_device_timer0);
390 /* timer 1 */
392 static struct resource s3c_timer1_resource[] = {
393 [0] = {
394 .start = S3C2410_PA_TIMER + 0x18,
395 .end = S3C2410_PA_TIMER + 0x23,
396 .flags = IORESOURCE_MEM,
398 [1] = {
399 .start = IRQ_TIMER1,
400 .end = IRQ_TIMER1,
401 .flags = IORESOURCE_IRQ,
406 struct platform_device s3c_device_timer1 = {
407 .name = "s3c2410-timer",
408 .id = 1,
409 .num_resources = ARRAY_SIZE(s3c_timer1_resource),
410 .resource = s3c_timer1_resource,
413 EXPORT_SYMBOL(s3c_device_timer1);
415 /* timer 2 */
417 static struct resource s3c_timer2_resource[] = {
418 [0] = {
419 .start = S3C2410_PA_TIMER + 0x24,
420 .end = S3C2410_PA_TIMER + 0x2F,
421 .flags = IORESOURCE_MEM,
423 [1] = {
424 .start = IRQ_TIMER2,
425 .end = IRQ_TIMER2,
426 .flags = IORESOURCE_IRQ,
431 struct platform_device s3c_device_timer2 = {
432 .name = "s3c2410-timer",
433 .id = 2,
434 .num_resources = ARRAY_SIZE(s3c_timer2_resource),
435 .resource = s3c_timer2_resource,
438 EXPORT_SYMBOL(s3c_device_timer2);
440 /* timer 3 */
442 static struct resource s3c_timer3_resource[] = {
443 [0] = {
444 .start = S3C2410_PA_TIMER + 0x30,
445 .end = S3C2410_PA_TIMER + 0x3B,
446 .flags = IORESOURCE_MEM,
448 [1] = {
449 .start = IRQ_TIMER3,
450 .end = IRQ_TIMER3,
451 .flags = IORESOURCE_IRQ,
456 struct platform_device s3c_device_timer3 = {
457 .name = "s3c2410-timer",
458 .id = 3,
459 .num_resources = ARRAY_SIZE(s3c_timer3_resource),
460 .resource = s3c_timer3_resource,
463 EXPORT_SYMBOL(s3c_device_timer3);
465 #ifdef CONFIG_CPU_S3C2440
467 /* Camif Controller */
469 static struct resource s3c_camif_resource[] = {
470 [0] = {
471 .start = S3C2440_PA_CAMIF,
472 .end = S3C2440_PA_CAMIF + S3C2440_SZ_CAMIF - 1,
473 .flags = IORESOURCE_MEM,
475 [1] = {
476 .start = IRQ_CAM,
477 .end = IRQ_CAM,
478 .flags = IORESOURCE_IRQ,
483 static u64 s3c_device_camif_dmamask = 0xffffffffUL;
485 struct platform_device s3c_device_camif = {
486 .name = "s3c2440-camif",
487 .id = -1,
488 .num_resources = ARRAY_SIZE(s3c_camif_resource),
489 .resource = s3c_camif_resource,
490 .dev = {
491 .dma_mask = &s3c_device_camif_dmamask,
492 .coherent_dma_mask = 0xffffffffUL
496 EXPORT_SYMBOL(s3c_device_camif);
498 #endif // CONFIG_CPU_S32440