Merge remote-tracking branch 'moduleh/module.h-split'
[linux-2.6/next.git] / arch / arm / plat-s3c24xx / devs.c
blobfb059a4b64b23aa2aeb0bf7b100dadfe6a1a0865
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>
22 #include <linux/io.h>
23 #include <linux/slab.h>
24 #include <linux/string.h>
25 #include <linux/dma-mapping.h>
26 #include <linux/export.h>
28 #include <asm/mach/arch.h>
29 #include <asm/mach/map.h>
30 #include <asm/mach/irq.h>
31 #include <mach/fb.h>
32 #include <mach/hardware.h>
33 #include <mach/dma.h>
34 #include <mach/irqs.h>
35 #include <asm/irq.h>
37 #include <plat/regs-serial.h>
38 #include <plat/udc.h>
39 #include <plat/mci.h>
41 #include <plat/devs.h>
42 #include <plat/cpu.h>
43 #include <plat/regs-spi.h>
44 #include <plat/ts.h>
46 /* Serial port registrations */
48 static struct resource s3c2410_uart0_resource[] = {
49 [0] = {
50 .start = S3C2410_PA_UART0,
51 .end = S3C2410_PA_UART0 + 0x3fff,
52 .flags = IORESOURCE_MEM,
54 [1] = {
55 .start = IRQ_S3CUART_RX0,
56 .end = IRQ_S3CUART_ERR0,
57 .flags = IORESOURCE_IRQ,
61 static struct resource s3c2410_uart1_resource[] = {
62 [0] = {
63 .start = S3C2410_PA_UART1,
64 .end = S3C2410_PA_UART1 + 0x3fff,
65 .flags = IORESOURCE_MEM,
67 [1] = {
68 .start = IRQ_S3CUART_RX1,
69 .end = IRQ_S3CUART_ERR1,
70 .flags = IORESOURCE_IRQ,
74 static struct resource s3c2410_uart2_resource[] = {
75 [0] = {
76 .start = S3C2410_PA_UART2,
77 .end = S3C2410_PA_UART2 + 0x3fff,
78 .flags = IORESOURCE_MEM,
80 [1] = {
81 .start = IRQ_S3CUART_RX2,
82 .end = IRQ_S3CUART_ERR2,
83 .flags = IORESOURCE_IRQ,
87 static struct resource s3c2410_uart3_resource[] = {
88 [0] = {
89 .start = S3C2443_PA_UART3,
90 .end = S3C2443_PA_UART3 + 0x3fff,
91 .flags = IORESOURCE_MEM,
93 [1] = {
94 .start = IRQ_S3CUART_RX3,
95 .end = IRQ_S3CUART_ERR3,
96 .flags = IORESOURCE_IRQ,
100 struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
101 [0] = {
102 .resources = s3c2410_uart0_resource,
103 .nr_resources = ARRAY_SIZE(s3c2410_uart0_resource),
105 [1] = {
106 .resources = s3c2410_uart1_resource,
107 .nr_resources = ARRAY_SIZE(s3c2410_uart1_resource),
109 [2] = {
110 .resources = s3c2410_uart2_resource,
111 .nr_resources = ARRAY_SIZE(s3c2410_uart2_resource),
113 [3] = {
114 .resources = s3c2410_uart3_resource,
115 .nr_resources = ARRAY_SIZE(s3c2410_uart3_resource),
119 /* LCD Controller */
121 static struct resource s3c_lcd_resource[] = {
122 [0] = {
123 .start = S3C24XX_PA_LCD,
124 .end = S3C24XX_PA_LCD + S3C24XX_SZ_LCD - 1,
125 .flags = IORESOURCE_MEM,
127 [1] = {
128 .start = IRQ_LCD,
129 .end = IRQ_LCD,
130 .flags = IORESOURCE_IRQ,
135 static u64 s3c_device_lcd_dmamask = 0xffffffffUL;
137 struct platform_device s3c_device_lcd = {
138 .name = "s3c2410-lcd",
139 .id = -1,
140 .num_resources = ARRAY_SIZE(s3c_lcd_resource),
141 .resource = s3c_lcd_resource,
142 .dev = {
143 .dma_mask = &s3c_device_lcd_dmamask,
144 .coherent_dma_mask = 0xffffffffUL
148 EXPORT_SYMBOL(s3c_device_lcd);
150 void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
152 struct s3c2410fb_mach_info *npd;
154 npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_lcd);
155 if (npd) {
156 npd->displays = kmemdup(pd->displays,
157 sizeof(struct s3c2410fb_display) * npd->num_displays,
158 GFP_KERNEL);
159 if (!npd->displays)
160 printk(KERN_ERR "no memory for LCD display data\n");
161 } else {
162 printk(KERN_ERR "no memory for LCD platform data\n");
166 /* Touchscreen */
168 static struct resource s3c_ts_resource[] = {
169 [0] = {
170 .start = S3C24XX_PA_ADC,
171 .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
172 .flags = IORESOURCE_MEM,
174 [1] = {
175 .start = IRQ_TC,
176 .end = IRQ_TC,
177 .flags = IORESOURCE_IRQ,
182 struct platform_device s3c_device_ts = {
183 .name = "s3c2410-ts",
184 .id = -1,
185 .dev.parent = &s3c_device_adc.dev,
186 .num_resources = ARRAY_SIZE(s3c_ts_resource),
187 .resource = s3c_ts_resource,
189 EXPORT_SYMBOL(s3c_device_ts);
191 void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *hard_s3c2410ts_info)
193 s3c_set_platdata(hard_s3c2410ts_info,
194 sizeof(struct s3c2410_ts_mach_info), &s3c_device_ts);
197 /* USB Device (Gadget)*/
199 static struct resource s3c_usbgadget_resource[] = {
200 [0] = {
201 .start = S3C24XX_PA_USBDEV,
202 .end = S3C24XX_PA_USBDEV + S3C24XX_SZ_USBDEV - 1,
203 .flags = IORESOURCE_MEM,
205 [1] = {
206 .start = IRQ_USBD,
207 .end = IRQ_USBD,
208 .flags = IORESOURCE_IRQ,
213 struct platform_device s3c_device_usbgadget = {
214 .name = "s3c2410-usbgadget",
215 .id = -1,
216 .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
217 .resource = s3c_usbgadget_resource,
220 EXPORT_SYMBOL(s3c_device_usbgadget);
222 void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)
224 s3c_set_platdata(pd, sizeof(*pd), &s3c_device_usbgadget);
227 /* USB High Speed 2.0 Device (Gadget) */
228 static struct resource s3c_hsudc_resource[] = {
229 [0] = {
230 .start = S3C2416_PA_HSUDC,
231 .end = S3C2416_PA_HSUDC + S3C2416_SZ_HSUDC - 1,
232 .flags = IORESOURCE_MEM,
234 [1] = {
235 .start = IRQ_USBD,
236 .end = IRQ_USBD,
237 .flags = IORESOURCE_IRQ,
241 static u64 s3c_hsudc_dmamask = DMA_BIT_MASK(32);
243 struct platform_device s3c_device_usb_hsudc = {
244 .name = "s3c-hsudc",
245 .id = -1,
246 .num_resources = ARRAY_SIZE(s3c_hsudc_resource),
247 .resource = s3c_hsudc_resource,
248 .dev = {
249 .dma_mask = &s3c_hsudc_dmamask,
250 .coherent_dma_mask = DMA_BIT_MASK(32),
254 void __init s3c24xx_hsudc_set_platdata(struct s3c24xx_hsudc_platdata *pd)
256 s3c_set_platdata(pd, sizeof(*pd), &s3c_device_usb_hsudc);
259 /* IIS */
261 static struct resource s3c_iis_resource[] = {
262 [0] = {
263 .start = S3C24XX_PA_IIS,
264 .end = S3C24XX_PA_IIS + S3C24XX_SZ_IIS -1,
265 .flags = IORESOURCE_MEM,
269 static u64 s3c_device_iis_dmamask = 0xffffffffUL;
271 struct platform_device s3c_device_iis = {
272 .name = "s3c24xx-iis",
273 .id = -1,
274 .num_resources = ARRAY_SIZE(s3c_iis_resource),
275 .resource = s3c_iis_resource,
276 .dev = {
277 .dma_mask = &s3c_device_iis_dmamask,
278 .coherent_dma_mask = 0xffffffffUL
282 EXPORT_SYMBOL(s3c_device_iis);
284 /* RTC */
286 static struct resource s3c_rtc_resource[] = {
287 [0] = {
288 .start = S3C24XX_PA_RTC,
289 .end = S3C24XX_PA_RTC + 0xff,
290 .flags = IORESOURCE_MEM,
292 [1] = {
293 .start = IRQ_RTC,
294 .end = IRQ_RTC,
295 .flags = IORESOURCE_IRQ,
297 [2] = {
298 .start = IRQ_TICK,
299 .end = IRQ_TICK,
300 .flags = IORESOURCE_IRQ
304 struct platform_device s3c_device_rtc = {
305 .name = "s3c2410-rtc",
306 .id = -1,
307 .num_resources = ARRAY_SIZE(s3c_rtc_resource),
308 .resource = s3c_rtc_resource,
311 EXPORT_SYMBOL(s3c_device_rtc);
313 /* ADC */
315 static struct resource s3c_adc_resource[] = {
316 [0] = {
317 .start = S3C24XX_PA_ADC,
318 .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
319 .flags = IORESOURCE_MEM,
321 [1] = {
322 .start = IRQ_TC,
323 .end = IRQ_TC,
324 .flags = IORESOURCE_IRQ,
326 [2] = {
327 .start = IRQ_ADC,
328 .end = IRQ_ADC,
329 .flags = IORESOURCE_IRQ,
334 struct platform_device s3c_device_adc = {
335 .name = "s3c24xx-adc",
336 .id = -1,
337 .num_resources = ARRAY_SIZE(s3c_adc_resource),
338 .resource = s3c_adc_resource,
341 /* SDI */
343 static struct resource s3c_sdi_resource[] = {
344 [0] = {
345 .start = S3C24XX_PA_SDI,
346 .end = S3C24XX_PA_SDI + S3C24XX_SZ_SDI - 1,
347 .flags = IORESOURCE_MEM,
349 [1] = {
350 .start = IRQ_SDI,
351 .end = IRQ_SDI,
352 .flags = IORESOURCE_IRQ,
357 struct platform_device s3c_device_sdi = {
358 .name = "s3c2410-sdi",
359 .id = -1,
360 .num_resources = ARRAY_SIZE(s3c_sdi_resource),
361 .resource = s3c_sdi_resource,
364 EXPORT_SYMBOL(s3c_device_sdi);
366 void __init s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata)
368 s3c_set_platdata(pdata, sizeof(struct s3c24xx_mci_pdata),
369 &s3c_device_sdi);
373 /* SPI (0) */
375 static struct resource s3c_spi0_resource[] = {
376 [0] = {
377 .start = S3C24XX_PA_SPI,
378 .end = S3C24XX_PA_SPI + 0x1f,
379 .flags = IORESOURCE_MEM,
381 [1] = {
382 .start = IRQ_SPI0,
383 .end = IRQ_SPI0,
384 .flags = IORESOURCE_IRQ,
389 static u64 s3c_device_spi0_dmamask = 0xffffffffUL;
391 struct platform_device s3c_device_spi0 = {
392 .name = "s3c2410-spi",
393 .id = 0,
394 .num_resources = ARRAY_SIZE(s3c_spi0_resource),
395 .resource = s3c_spi0_resource,
396 .dev = {
397 .dma_mask = &s3c_device_spi0_dmamask,
398 .coherent_dma_mask = 0xffffffffUL
402 EXPORT_SYMBOL(s3c_device_spi0);
404 /* SPI (1) */
406 static struct resource s3c_spi1_resource[] = {
407 [0] = {
408 .start = S3C24XX_PA_SPI + S3C2410_SPI1,
409 .end = S3C24XX_PA_SPI + S3C2410_SPI1 + 0x1f,
410 .flags = IORESOURCE_MEM,
412 [1] = {
413 .start = IRQ_SPI1,
414 .end = IRQ_SPI1,
415 .flags = IORESOURCE_IRQ,
420 static u64 s3c_device_spi1_dmamask = 0xffffffffUL;
422 struct platform_device s3c_device_spi1 = {
423 .name = "s3c2410-spi",
424 .id = 1,
425 .num_resources = ARRAY_SIZE(s3c_spi1_resource),
426 .resource = s3c_spi1_resource,
427 .dev = {
428 .dma_mask = &s3c_device_spi1_dmamask,
429 .coherent_dma_mask = 0xffffffffUL
433 EXPORT_SYMBOL(s3c_device_spi1);
435 #ifdef CONFIG_CPU_S3C2440
437 /* Camif Controller */
439 static struct resource s3c_camif_resource[] = {
440 [0] = {
441 .start = S3C2440_PA_CAMIF,
442 .end = S3C2440_PA_CAMIF + S3C2440_SZ_CAMIF - 1,
443 .flags = IORESOURCE_MEM,
445 [1] = {
446 .start = IRQ_CAM,
447 .end = IRQ_CAM,
448 .flags = IORESOURCE_IRQ,
453 static u64 s3c_device_camif_dmamask = 0xffffffffUL;
455 struct platform_device s3c_device_camif = {
456 .name = "s3c2440-camif",
457 .id = -1,
458 .num_resources = ARRAY_SIZE(s3c_camif_resource),
459 .resource = s3c_camif_resource,
460 .dev = {
461 .dma_mask = &s3c_device_camif_dmamask,
462 .coherent_dma_mask = 0xffffffffUL
466 EXPORT_SYMBOL(s3c_device_camif);
468 /* AC97 */
470 static struct resource s3c_ac97_resource[] = {
471 [0] = {
472 .start = S3C2440_PA_AC97,
473 .end = S3C2440_PA_AC97 + S3C2440_SZ_AC97 -1,
474 .flags = IORESOURCE_MEM,
476 [1] = {
477 .start = IRQ_S3C244x_AC97,
478 .end = IRQ_S3C244x_AC97,
479 .flags = IORESOURCE_IRQ,
481 [2] = {
482 .name = "PCM out",
483 .start = DMACH_PCM_OUT,
484 .end = DMACH_PCM_OUT,
485 .flags = IORESOURCE_DMA,
487 [3] = {
488 .name = "PCM in",
489 .start = DMACH_PCM_IN,
490 .end = DMACH_PCM_IN,
491 .flags = IORESOURCE_DMA,
493 [4] = {
494 .name = "Mic in",
495 .start = DMACH_MIC_IN,
496 .end = DMACH_MIC_IN,
497 .flags = IORESOURCE_DMA,
501 static u64 s3c_device_audio_dmamask = 0xffffffffUL;
503 struct platform_device s3c_device_ac97 = {
504 .name = "samsung-ac97",
505 .id = -1,
506 .num_resources = ARRAY_SIZE(s3c_ac97_resource),
507 .resource = s3c_ac97_resource,
508 .dev = {
509 .dma_mask = &s3c_device_audio_dmamask,
510 .coherent_dma_mask = 0xffffffffUL
514 EXPORT_SYMBOL(s3c_device_ac97);
516 /* ASoC I2S */
518 struct platform_device s3c2412_device_iis = {
519 .name = "s3c2412-iis",
520 .id = -1,
521 .dev = {
522 .dma_mask = &s3c_device_audio_dmamask,
523 .coherent_dma_mask = 0xffffffffUL
527 EXPORT_SYMBOL(s3c2412_device_iis);
529 #endif // CONFIG_CPU_S32440