kvm tools, setup: Create private directory
[linux-2.6/next.git] / arch / arm / plat-s3c24xx / devs.c
blob73667994518acdab1946029656cd31e98fa71092
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>
27 #include <asm/mach/arch.h>
28 #include <asm/mach/map.h>
29 #include <asm/mach/irq.h>
30 #include <mach/fb.h>
31 #include <mach/hardware.h>
32 #include <mach/dma.h>
33 #include <mach/irqs.h>
34 #include <asm/irq.h>
36 #include <plat/regs-serial.h>
37 #include <plat/udc.h>
38 #include <plat/mci.h>
40 #include <plat/devs.h>
41 #include <plat/cpu.h>
42 #include <plat/regs-spi.h>
43 #include <plat/ts.h>
45 /* Serial port registrations */
47 static struct resource s3c2410_uart0_resource[] = {
48 [0] = {
49 .start = S3C2410_PA_UART0,
50 .end = S3C2410_PA_UART0 + 0x3fff,
51 .flags = IORESOURCE_MEM,
53 [1] = {
54 .start = IRQ_S3CUART_RX0,
55 .end = IRQ_S3CUART_ERR0,
56 .flags = IORESOURCE_IRQ,
60 static struct resource s3c2410_uart1_resource[] = {
61 [0] = {
62 .start = S3C2410_PA_UART1,
63 .end = S3C2410_PA_UART1 + 0x3fff,
64 .flags = IORESOURCE_MEM,
66 [1] = {
67 .start = IRQ_S3CUART_RX1,
68 .end = IRQ_S3CUART_ERR1,
69 .flags = IORESOURCE_IRQ,
73 static struct resource s3c2410_uart2_resource[] = {
74 [0] = {
75 .start = S3C2410_PA_UART2,
76 .end = S3C2410_PA_UART2 + 0x3fff,
77 .flags = IORESOURCE_MEM,
79 [1] = {
80 .start = IRQ_S3CUART_RX2,
81 .end = IRQ_S3CUART_ERR2,
82 .flags = IORESOURCE_IRQ,
86 static struct resource s3c2410_uart3_resource[] = {
87 [0] = {
88 .start = S3C2443_PA_UART3,
89 .end = S3C2443_PA_UART3 + 0x3fff,
90 .flags = IORESOURCE_MEM,
92 [1] = {
93 .start = IRQ_S3CUART_RX3,
94 .end = IRQ_S3CUART_ERR3,
95 .flags = IORESOURCE_IRQ,
99 struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
100 [0] = {
101 .resources = s3c2410_uart0_resource,
102 .nr_resources = ARRAY_SIZE(s3c2410_uart0_resource),
104 [1] = {
105 .resources = s3c2410_uart1_resource,
106 .nr_resources = ARRAY_SIZE(s3c2410_uart1_resource),
108 [2] = {
109 .resources = s3c2410_uart2_resource,
110 .nr_resources = ARRAY_SIZE(s3c2410_uart2_resource),
112 [3] = {
113 .resources = s3c2410_uart3_resource,
114 .nr_resources = ARRAY_SIZE(s3c2410_uart3_resource),
118 /* LCD Controller */
120 static struct resource s3c_lcd_resource[] = {
121 [0] = {
122 .start = S3C24XX_PA_LCD,
123 .end = S3C24XX_PA_LCD + S3C24XX_SZ_LCD - 1,
124 .flags = IORESOURCE_MEM,
126 [1] = {
127 .start = IRQ_LCD,
128 .end = IRQ_LCD,
129 .flags = IORESOURCE_IRQ,
134 static u64 s3c_device_lcd_dmamask = 0xffffffffUL;
136 struct platform_device s3c_device_lcd = {
137 .name = "s3c2410-lcd",
138 .id = -1,
139 .num_resources = ARRAY_SIZE(s3c_lcd_resource),
140 .resource = s3c_lcd_resource,
141 .dev = {
142 .dma_mask = &s3c_device_lcd_dmamask,
143 .coherent_dma_mask = 0xffffffffUL
147 EXPORT_SYMBOL(s3c_device_lcd);
149 void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
151 struct s3c2410fb_mach_info *npd;
153 npd = kmemdup(pd, sizeof(*npd), GFP_KERNEL);
154 if (npd) {
155 s3c_device_lcd.dev.platform_data = 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 static struct s3c2410_ts_mach_info s3c2410ts_info;
193 void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *hard_s3c2410ts_info)
195 memcpy(&s3c2410ts_info, hard_s3c2410ts_info, sizeof(struct s3c2410_ts_mach_info));
196 s3c_device_ts.dev.platform_data = &s3c2410ts_info;
199 /* USB Device (Gadget)*/
201 static struct resource s3c_usbgadget_resource[] = {
202 [0] = {
203 .start = S3C24XX_PA_USBDEV,
204 .end = S3C24XX_PA_USBDEV + S3C24XX_SZ_USBDEV - 1,
205 .flags = IORESOURCE_MEM,
207 [1] = {
208 .start = IRQ_USBD,
209 .end = IRQ_USBD,
210 .flags = IORESOURCE_IRQ,
215 struct platform_device s3c_device_usbgadget = {
216 .name = "s3c2410-usbgadget",
217 .id = -1,
218 .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
219 .resource = s3c_usbgadget_resource,
222 EXPORT_SYMBOL(s3c_device_usbgadget);
224 void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)
226 struct s3c2410_udc_mach_info *npd;
228 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
229 if (npd) {
230 memcpy(npd, pd, sizeof(*npd));
231 s3c_device_usbgadget.dev.platform_data = npd;
232 } else {
233 printk(KERN_ERR "no memory for udc platform data\n");
237 /* USB High Speed 2.0 Device (Gadget) */
238 static struct resource s3c_hsudc_resource[] = {
239 [0] = {
240 .start = S3C2416_PA_HSUDC,
241 .end = S3C2416_PA_HSUDC + S3C2416_SZ_HSUDC - 1,
242 .flags = IORESOURCE_MEM,
244 [1] = {
245 .start = IRQ_USBD,
246 .end = IRQ_USBD,
247 .flags = IORESOURCE_IRQ,
251 static u64 s3c_hsudc_dmamask = DMA_BIT_MASK(32);
253 struct platform_device s3c_device_usb_hsudc = {
254 .name = "s3c-hsudc",
255 .id = -1,
256 .num_resources = ARRAY_SIZE(s3c_hsudc_resource),
257 .resource = s3c_hsudc_resource,
258 .dev = {
259 .dma_mask = &s3c_hsudc_dmamask,
260 .coherent_dma_mask = DMA_BIT_MASK(32),
264 void __init s3c24xx_hsudc_set_platdata(struct s3c24xx_hsudc_platdata *pd)
266 struct s3c24xx_hsudc_platdata *npd;
268 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
269 if (npd) {
270 memcpy(npd, pd, sizeof(*npd));
271 s3c_device_usb_hsudc.dev.platform_data = npd;
272 } else {
273 printk(KERN_ERR "no memory for udc platform data\n");
277 /* IIS */
279 static struct resource s3c_iis_resource[] = {
280 [0] = {
281 .start = S3C24XX_PA_IIS,
282 .end = S3C24XX_PA_IIS + S3C24XX_SZ_IIS -1,
283 .flags = IORESOURCE_MEM,
287 static u64 s3c_device_iis_dmamask = 0xffffffffUL;
289 struct platform_device s3c_device_iis = {
290 .name = "s3c24xx-iis",
291 .id = -1,
292 .num_resources = ARRAY_SIZE(s3c_iis_resource),
293 .resource = s3c_iis_resource,
294 .dev = {
295 .dma_mask = &s3c_device_iis_dmamask,
296 .coherent_dma_mask = 0xffffffffUL
300 EXPORT_SYMBOL(s3c_device_iis);
302 /* RTC */
304 static struct resource s3c_rtc_resource[] = {
305 [0] = {
306 .start = S3C24XX_PA_RTC,
307 .end = S3C24XX_PA_RTC + 0xff,
308 .flags = IORESOURCE_MEM,
310 [1] = {
311 .start = IRQ_RTC,
312 .end = IRQ_RTC,
313 .flags = IORESOURCE_IRQ,
315 [2] = {
316 .start = IRQ_TICK,
317 .end = IRQ_TICK,
318 .flags = IORESOURCE_IRQ
322 struct platform_device s3c_device_rtc = {
323 .name = "s3c2410-rtc",
324 .id = -1,
325 .num_resources = ARRAY_SIZE(s3c_rtc_resource),
326 .resource = s3c_rtc_resource,
329 EXPORT_SYMBOL(s3c_device_rtc);
331 /* ADC */
333 static struct resource s3c_adc_resource[] = {
334 [0] = {
335 .start = S3C24XX_PA_ADC,
336 .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
337 .flags = IORESOURCE_MEM,
339 [1] = {
340 .start = IRQ_TC,
341 .end = IRQ_TC,
342 .flags = IORESOURCE_IRQ,
344 [2] = {
345 .start = IRQ_ADC,
346 .end = IRQ_ADC,
347 .flags = IORESOURCE_IRQ,
352 struct platform_device s3c_device_adc = {
353 .name = "s3c24xx-adc",
354 .id = -1,
355 .num_resources = ARRAY_SIZE(s3c_adc_resource),
356 .resource = s3c_adc_resource,
359 /* SDI */
361 static struct resource s3c_sdi_resource[] = {
362 [0] = {
363 .start = S3C24XX_PA_SDI,
364 .end = S3C24XX_PA_SDI + S3C24XX_SZ_SDI - 1,
365 .flags = IORESOURCE_MEM,
367 [1] = {
368 .start = IRQ_SDI,
369 .end = IRQ_SDI,
370 .flags = IORESOURCE_IRQ,
375 struct platform_device s3c_device_sdi = {
376 .name = "s3c2410-sdi",
377 .id = -1,
378 .num_resources = ARRAY_SIZE(s3c_sdi_resource),
379 .resource = s3c_sdi_resource,
382 EXPORT_SYMBOL(s3c_device_sdi);
384 void __init s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata)
386 struct s3c24xx_mci_pdata *npd;
388 npd = kmemdup(pdata, sizeof(struct s3c24xx_mci_pdata), GFP_KERNEL);
389 if (!npd)
390 printk(KERN_ERR "%s: no memory to copy pdata", __func__);
392 s3c_device_sdi.dev.platform_data = npd;
396 /* SPI (0) */
398 static struct resource s3c_spi0_resource[] = {
399 [0] = {
400 .start = S3C24XX_PA_SPI,
401 .end = S3C24XX_PA_SPI + 0x1f,
402 .flags = IORESOURCE_MEM,
404 [1] = {
405 .start = IRQ_SPI0,
406 .end = IRQ_SPI0,
407 .flags = IORESOURCE_IRQ,
412 static u64 s3c_device_spi0_dmamask = 0xffffffffUL;
414 struct platform_device s3c_device_spi0 = {
415 .name = "s3c2410-spi",
416 .id = 0,
417 .num_resources = ARRAY_SIZE(s3c_spi0_resource),
418 .resource = s3c_spi0_resource,
419 .dev = {
420 .dma_mask = &s3c_device_spi0_dmamask,
421 .coherent_dma_mask = 0xffffffffUL
425 EXPORT_SYMBOL(s3c_device_spi0);
427 /* SPI (1) */
429 static struct resource s3c_spi1_resource[] = {
430 [0] = {
431 .start = S3C24XX_PA_SPI + S3C2410_SPI1,
432 .end = S3C24XX_PA_SPI + S3C2410_SPI1 + 0x1f,
433 .flags = IORESOURCE_MEM,
435 [1] = {
436 .start = IRQ_SPI1,
437 .end = IRQ_SPI1,
438 .flags = IORESOURCE_IRQ,
443 static u64 s3c_device_spi1_dmamask = 0xffffffffUL;
445 struct platform_device s3c_device_spi1 = {
446 .name = "s3c2410-spi",
447 .id = 1,
448 .num_resources = ARRAY_SIZE(s3c_spi1_resource),
449 .resource = s3c_spi1_resource,
450 .dev = {
451 .dma_mask = &s3c_device_spi1_dmamask,
452 .coherent_dma_mask = 0xffffffffUL
456 EXPORT_SYMBOL(s3c_device_spi1);
458 #ifdef CONFIG_CPU_S3C2440
460 /* Camif Controller */
462 static struct resource s3c_camif_resource[] = {
463 [0] = {
464 .start = S3C2440_PA_CAMIF,
465 .end = S3C2440_PA_CAMIF + S3C2440_SZ_CAMIF - 1,
466 .flags = IORESOURCE_MEM,
468 [1] = {
469 .start = IRQ_CAM,
470 .end = IRQ_CAM,
471 .flags = IORESOURCE_IRQ,
476 static u64 s3c_device_camif_dmamask = 0xffffffffUL;
478 struct platform_device s3c_device_camif = {
479 .name = "s3c2440-camif",
480 .id = -1,
481 .num_resources = ARRAY_SIZE(s3c_camif_resource),
482 .resource = s3c_camif_resource,
483 .dev = {
484 .dma_mask = &s3c_device_camif_dmamask,
485 .coherent_dma_mask = 0xffffffffUL
489 EXPORT_SYMBOL(s3c_device_camif);
491 /* AC97 */
493 static struct resource s3c_ac97_resource[] = {
494 [0] = {
495 .start = S3C2440_PA_AC97,
496 .end = S3C2440_PA_AC97 + S3C2440_SZ_AC97 -1,
497 .flags = IORESOURCE_MEM,
499 [1] = {
500 .start = IRQ_S3C244x_AC97,
501 .end = IRQ_S3C244x_AC97,
502 .flags = IORESOURCE_IRQ,
504 [2] = {
505 .name = "PCM out",
506 .start = DMACH_PCM_OUT,
507 .end = DMACH_PCM_OUT,
508 .flags = IORESOURCE_DMA,
510 [3] = {
511 .name = "PCM in",
512 .start = DMACH_PCM_IN,
513 .end = DMACH_PCM_IN,
514 .flags = IORESOURCE_DMA,
516 [4] = {
517 .name = "Mic in",
518 .start = DMACH_MIC_IN,
519 .end = DMACH_MIC_IN,
520 .flags = IORESOURCE_DMA,
524 static u64 s3c_device_audio_dmamask = 0xffffffffUL;
526 struct platform_device s3c_device_ac97 = {
527 .name = "samsung-ac97",
528 .id = -1,
529 .num_resources = ARRAY_SIZE(s3c_ac97_resource),
530 .resource = s3c_ac97_resource,
531 .dev = {
532 .dma_mask = &s3c_device_audio_dmamask,
533 .coherent_dma_mask = 0xffffffffUL
537 EXPORT_SYMBOL(s3c_device_ac97);
539 /* ASoC I2S */
541 struct platform_device s3c2412_device_iis = {
542 .name = "s3c2412-iis",
543 .id = -1,
544 .dev = {
545 .dma_mask = &s3c_device_audio_dmamask,
546 .coherent_dma_mask = 0xffffffffUL
550 EXPORT_SYMBOL(s3c2412_device_iis);
552 #endif // CONFIG_CPU_S32440