Convert h8/300 to generic timekeeping
[linux-2.6/openmoko-kernel/knife-kernel.git] / arch / arm / plat-s3c24xx / devs.c
blob0fe53b39cb2f57566200a8f234cf4e64f3cefa33
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>
28 #include <asm/io.h>
29 #include <asm/irq.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[] = {
40 [0] = {
41 .start = S3C2410_PA_UART0,
42 .end = S3C2410_PA_UART0 + 0x3fff,
43 .flags = IORESOURCE_MEM,
45 [1] = {
46 .start = IRQ_S3CUART_RX0,
47 .end = IRQ_S3CUART_ERR0,
48 .flags = IORESOURCE_IRQ,
52 static struct resource s3c2410_uart1_resource[] = {
53 [0] = {
54 .start = S3C2410_PA_UART1,
55 .end = S3C2410_PA_UART1 + 0x3fff,
56 .flags = IORESOURCE_MEM,
58 [1] = {
59 .start = IRQ_S3CUART_RX1,
60 .end = IRQ_S3CUART_ERR1,
61 .flags = IORESOURCE_IRQ,
65 static struct resource s3c2410_uart2_resource[] = {
66 [0] = {
67 .start = S3C2410_PA_UART2,
68 .end = S3C2410_PA_UART2 + 0x3fff,
69 .flags = IORESOURCE_MEM,
71 [1] = {
72 .start = IRQ_S3CUART_RX2,
73 .end = IRQ_S3CUART_ERR2,
74 .flags = IORESOURCE_IRQ,
78 struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
79 [0] = {
80 .resources = s3c2410_uart0_resource,
81 .nr_resources = ARRAY_SIZE(s3c2410_uart0_resource),
83 [1] = {
84 .resources = s3c2410_uart1_resource,
85 .nr_resources = ARRAY_SIZE(s3c2410_uart1_resource),
87 [2] = {
88 .resources = s3c2410_uart2_resource,
89 .nr_resources = ARRAY_SIZE(s3c2410_uart2_resource),
93 /* yart devices */
95 static struct platform_device s3c24xx_uart_device0 = {
96 .id = 0,
99 static struct platform_device s3c24xx_uart_device1 = {
100 .id = 1,
103 static struct platform_device s3c24xx_uart_device2 = {
104 .id = 2,
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[] = {
119 [0] = {
120 .start = S3C24XX_PA_USBHOST,
121 .end = S3C24XX_PA_USBHOST + S3C24XX_SZ_USBHOST - 1,
122 .flags = IORESOURCE_MEM,
124 [1] = {
125 .start = IRQ_USBH,
126 .end = IRQ_USBH,
127 .flags = IORESOURCE_IRQ,
131 static u64 s3c_device_usb_dmamask = 0xffffffffUL;
133 struct platform_device s3c_device_usb = {
134 .name = "s3c2410-ohci",
135 .id = -1,
136 .num_resources = ARRAY_SIZE(s3c_usb_resource),
137 .resource = s3c_usb_resource,
138 .dev = {
139 .dma_mask = &s3c_device_usb_dmamask,
140 .coherent_dma_mask = 0xffffffffUL
144 EXPORT_SYMBOL(s3c_device_usb);
146 /* LCD Controller */
148 static struct resource s3c_lcd_resource[] = {
149 [0] = {
150 .start = S3C24XX_PA_LCD,
151 .end = S3C24XX_PA_LCD + S3C24XX_SZ_LCD - 1,
152 .flags = IORESOURCE_MEM,
154 [1] = {
155 .start = IRQ_LCD,
156 .end = IRQ_LCD,
157 .flags = IORESOURCE_IRQ,
162 static u64 s3c_device_lcd_dmamask = 0xffffffffUL;
164 struct platform_device s3c_device_lcd = {
165 .name = "s3c2410-lcd",
166 .id = -1,
167 .num_resources = ARRAY_SIZE(s3c_lcd_resource),
168 .resource = s3c_lcd_resource,
169 .dev = {
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);
182 if (npd) {
183 memcpy(npd, pd, sizeof(*npd));
184 s3c_device_lcd.dev.platform_data = npd;
185 } else {
186 printk(KERN_ERR "no memory for LCD platform data\n");
190 /* NAND Controller */
192 static struct resource s3c_nand_resource[] = {
193 [0] = {
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",
202 .id = -1,
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[] = {
212 [0] = {
213 .start = S3C24XX_PA_USBDEV,
214 .end = S3C24XX_PA_USBDEV + S3C24XX_SZ_USBDEV - 1,
215 .flags = IORESOURCE_MEM,
217 [1] = {
218 .start = IRQ_USBD,
219 .end = IRQ_USBD,
220 .flags = IORESOURCE_IRQ,
225 struct platform_device s3c_device_usbgadget = {
226 .name = "s3c2410-usbgadget",
227 .id = -1,
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);
239 if (npd) {
240 memcpy(npd, pd, sizeof(*npd));
241 s3c_device_usbgadget.dev.platform_data = npd;
242 } else {
243 printk(KERN_ERR "no memory for udc platform data\n");
248 /* Watchdog */
250 static struct resource s3c_wdt_resource[] = {
251 [0] = {
252 .start = S3C24XX_PA_WATCHDOG,
253 .end = S3C24XX_PA_WATCHDOG + S3C24XX_SZ_WATCHDOG - 1,
254 .flags = IORESOURCE_MEM,
256 [1] = {
257 .start = IRQ_WDT,
258 .end = IRQ_WDT,
259 .flags = IORESOURCE_IRQ,
264 struct platform_device s3c_device_wdt = {
265 .name = "s3c2410-wdt",
266 .id = -1,
267 .num_resources = ARRAY_SIZE(s3c_wdt_resource),
268 .resource = s3c_wdt_resource,
271 EXPORT_SYMBOL(s3c_device_wdt);
273 /* I2C */
275 static struct resource s3c_i2c_resource[] = {
276 [0] = {
277 .start = S3C24XX_PA_IIC,
278 .end = S3C24XX_PA_IIC + S3C24XX_SZ_IIC - 1,
279 .flags = IORESOURCE_MEM,
281 [1] = {
282 .start = IRQ_IIC,
283 .end = IRQ_IIC,
284 .flags = IORESOURCE_IRQ,
289 struct platform_device s3c_device_i2c = {
290 .name = "s3c2410-i2c",
291 .id = -1,
292 .num_resources = ARRAY_SIZE(s3c_i2c_resource),
293 .resource = s3c_i2c_resource,
296 EXPORT_SYMBOL(s3c_device_i2c);
298 /* IIS */
300 static struct resource s3c_iis_resource[] = {
301 [0] = {
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",
312 .id = -1,
313 .num_resources = ARRAY_SIZE(s3c_iis_resource),
314 .resource = s3c_iis_resource,
315 .dev = {
316 .dma_mask = &s3c_device_iis_dmamask,
317 .coherent_dma_mask = 0xffffffffUL
321 EXPORT_SYMBOL(s3c_device_iis);
323 /* RTC */
325 static struct resource s3c_rtc_resource[] = {
326 [0] = {
327 .start = S3C24XX_PA_RTC,
328 .end = S3C24XX_PA_RTC + 0xff,
329 .flags = IORESOURCE_MEM,
331 [1] = {
332 .start = IRQ_RTC,
333 .end = IRQ_RTC,
334 .flags = IORESOURCE_IRQ,
336 [2] = {
337 .start = IRQ_TICK,
338 .end = IRQ_TICK,
339 .flags = IORESOURCE_IRQ
343 struct platform_device s3c_device_rtc = {
344 .name = "s3c2410-rtc",
345 .id = -1,
346 .num_resources = ARRAY_SIZE(s3c_rtc_resource),
347 .resource = s3c_rtc_resource,
350 EXPORT_SYMBOL(s3c_device_rtc);
352 /* ADC */
354 static struct resource s3c_adc_resource[] = {
355 [0] = {
356 .start = S3C24XX_PA_ADC,
357 .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
358 .flags = IORESOURCE_MEM,
360 [1] = {
361 .start = IRQ_TC,
362 .end = IRQ_TC,
363 .flags = IORESOURCE_IRQ,
365 [2] = {
366 .start = IRQ_ADC,
367 .end = IRQ_ADC,
368 .flags = IORESOURCE_IRQ,
373 struct platform_device s3c_device_adc = {
374 .name = "s3c2410-adc",
375 .id = -1,
376 .num_resources = ARRAY_SIZE(s3c_adc_resource),
377 .resource = s3c_adc_resource,
380 /* SDI */
382 static struct resource s3c_sdi_resource[] = {
383 [0] = {
384 .start = S3C2410_PA_SDI,
385 .end = S3C2410_PA_SDI + S3C24XX_SZ_SDI - 1,
386 .flags = IORESOURCE_MEM,
388 [1] = {
389 .start = IRQ_SDI,
390 .end = IRQ_SDI,
391 .flags = IORESOURCE_IRQ,
396 struct platform_device s3c_device_sdi = {
397 .name = "s3c2410-sdi",
398 .id = -1,
399 .num_resources = ARRAY_SIZE(s3c_sdi_resource),
400 .resource = s3c_sdi_resource,
403 EXPORT_SYMBOL(s3c_device_sdi);
405 /* SPI (0) */
407 static struct resource s3c_spi0_resource[] = {
408 [0] = {
409 .start = S3C24XX_PA_SPI,
410 .end = S3C24XX_PA_SPI + 0x1f,
411 .flags = IORESOURCE_MEM,
413 [1] = {
414 .start = IRQ_SPI0,
415 .end = IRQ_SPI0,
416 .flags = IORESOURCE_IRQ,
421 static u64 s3c_device_spi0_dmamask = 0xffffffffUL;
423 struct platform_device s3c_device_spi0 = {
424 .name = "s3c2410-spi",
425 .id = 0,
426 .num_resources = ARRAY_SIZE(s3c_spi0_resource),
427 .resource = s3c_spi0_resource,
428 .dev = {
429 .dma_mask = &s3c_device_spi0_dmamask,
430 .coherent_dma_mask = 0xffffffffUL
434 EXPORT_SYMBOL(s3c_device_spi0);
436 /* SPI (1) */
438 static struct resource s3c_spi1_resource[] = {
439 [0] = {
440 .start = S3C24XX_PA_SPI + 0x20,
441 .end = S3C24XX_PA_SPI + 0x20 + 0x1f,
442 .flags = IORESOURCE_MEM,
444 [1] = {
445 .start = IRQ_SPI1,
446 .end = IRQ_SPI1,
447 .flags = IORESOURCE_IRQ,
452 static u64 s3c_device_spi1_dmamask = 0xffffffffUL;
454 struct platform_device s3c_device_spi1 = {
455 .name = "s3c2410-spi",
456 .id = 1,
457 .num_resources = ARRAY_SIZE(s3c_spi1_resource),
458 .resource = s3c_spi1_resource,
459 .dev = {
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[] = {
470 [0] = {
471 .start = S3C24XX_PA_TIMER + 0x0C,
472 .end = S3C24XX_PA_TIMER + 0x0C + 0xB,
473 .flags = IORESOURCE_MEM,
475 [1] = {
476 .start = IRQ_TIMER0,
477 .end = IRQ_TIMER0,
478 .flags = IORESOURCE_IRQ,
483 struct platform_device s3c_device_timer0 = {
484 .name = "s3c2410-timer",
485 .id = 0,
486 .num_resources = ARRAY_SIZE(s3c_timer0_resource),
487 .resource = s3c_timer0_resource,
490 EXPORT_SYMBOL(s3c_device_timer0);
492 /* timer 1 */
494 static struct resource s3c_timer1_resource[] = {
495 [0] = {
496 .start = S3C24XX_PA_TIMER + 0x18,
497 .end = S3C24XX_PA_TIMER + 0x23,
498 .flags = IORESOURCE_MEM,
500 [1] = {
501 .start = IRQ_TIMER1,
502 .end = IRQ_TIMER1,
503 .flags = IORESOURCE_IRQ,
508 struct platform_device s3c_device_timer1 = {
509 .name = "s3c2410-timer",
510 .id = 1,
511 .num_resources = ARRAY_SIZE(s3c_timer1_resource),
512 .resource = s3c_timer1_resource,
515 EXPORT_SYMBOL(s3c_device_timer1);
517 /* timer 2 */
519 static struct resource s3c_timer2_resource[] = {
520 [0] = {
521 .start = S3C24XX_PA_TIMER + 0x24,
522 .end = S3C24XX_PA_TIMER + 0x2F,
523 .flags = IORESOURCE_MEM,
525 [1] = {
526 .start = IRQ_TIMER2,
527 .end = IRQ_TIMER2,
528 .flags = IORESOURCE_IRQ,
533 struct platform_device s3c_device_timer2 = {
534 .name = "s3c2410-timer",
535 .id = 2,
536 .num_resources = ARRAY_SIZE(s3c_timer2_resource),
537 .resource = s3c_timer2_resource,
540 EXPORT_SYMBOL(s3c_device_timer2);
542 /* timer 3 */
544 static struct resource s3c_timer3_resource[] = {
545 [0] = {
546 .start = S3C24XX_PA_TIMER + 0x30,
547 .end = S3C24XX_PA_TIMER + 0x3B,
548 .flags = IORESOURCE_MEM,
550 [1] = {
551 .start = IRQ_TIMER3,
552 .end = IRQ_TIMER3,
553 .flags = IORESOURCE_IRQ,
558 struct platform_device s3c_device_timer3 = {
559 .name = "s3c2410-timer",
560 .id = 3,
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[] = {
572 [0] = {
573 .start = S3C2440_PA_CAMIF,
574 .end = S3C2440_PA_CAMIF + S3C2440_SZ_CAMIF - 1,
575 .flags = IORESOURCE_MEM,
577 [1] = {
578 .start = IRQ_CAM,
579 .end = IRQ_CAM,
580 .flags = IORESOURCE_IRQ,
585 static u64 s3c_device_camif_dmamask = 0xffffffffUL;
587 struct platform_device s3c_device_camif = {
588 .name = "s3c2440-camif",
589 .id = -1,
590 .num_resources = ARRAY_SIZE(s3c_camif_resource),
591 .resource = s3c_camif_resource,
592 .dev = {
593 .dma_mask = &s3c_device_camif_dmamask,
594 .coherent_dma_mask = 0xffffffffUL
598 EXPORT_SYMBOL(s3c_device_camif);
600 #endif // CONFIG_CPU_S32440