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 <linux/slab.h>
24 #include <linux/string.h>
26 #include <asm/mach/arch.h>
27 #include <asm/mach/map.h>
28 #include <asm/mach/irq.h>
30 #include <mach/hardware.h>
32 #include <mach/irqs.h>
35 #include <plat/regs-serial.h>
39 #include <plat/devs.h>
41 #include <plat/regs-spi.h>
45 /* Serial port registrations */
47 static struct resource s3c2410_uart0_resource[] = {
49 .start = S3C2410_PA_UART0,
50 .end = S3C2410_PA_UART0 + 0x3fff,
51 .flags = IORESOURCE_MEM,
54 .start = IRQ_S3CUART_RX0,
55 .end = IRQ_S3CUART_ERR0,
56 .flags = IORESOURCE_IRQ,
60 static struct resource s3c2410_uart1_resource[] = {
62 .start = S3C2410_PA_UART1,
63 .end = S3C2410_PA_UART1 + 0x3fff,
64 .flags = IORESOURCE_MEM,
67 .start = IRQ_S3CUART_RX1,
68 .end = IRQ_S3CUART_ERR1,
69 .flags = IORESOURCE_IRQ,
73 static struct resource s3c2410_uart2_resource[] = {
75 .start = S3C2410_PA_UART2,
76 .end = S3C2410_PA_UART2 + 0x3fff,
77 .flags = IORESOURCE_MEM,
80 .start = IRQ_S3CUART_RX2,
81 .end = IRQ_S3CUART_ERR2,
82 .flags = IORESOURCE_IRQ,
86 static struct resource s3c2410_uart3_resource[] = {
88 .start = S3C2443_PA_UART3,
89 .end = S3C2443_PA_UART3 + 0x3fff,
90 .flags = IORESOURCE_MEM,
93 .start = IRQ_S3CUART_RX3,
94 .end = IRQ_S3CUART_ERR3,
95 .flags = IORESOURCE_IRQ,
99 struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
101 .resources = s3c2410_uart0_resource,
102 .nr_resources = ARRAY_SIZE(s3c2410_uart0_resource),
105 .resources = s3c2410_uart1_resource,
106 .nr_resources = ARRAY_SIZE(s3c2410_uart1_resource),
109 .resources = s3c2410_uart2_resource,
110 .nr_resources = ARRAY_SIZE(s3c2410_uart2_resource),
113 .resources = s3c2410_uart3_resource,
114 .nr_resources = ARRAY_SIZE(s3c2410_uart3_resource),
120 static struct resource s3c_lcd_resource[] = {
122 .start = S3C24XX_PA_LCD,
123 .end = S3C24XX_PA_LCD + S3C24XX_SZ_LCD - 1,
124 .flags = IORESOURCE_MEM,
129 .flags = IORESOURCE_IRQ,
134 static u64 s3c_device_lcd_dmamask = 0xffffffffUL;
136 struct platform_device s3c_device_lcd = {
137 .name = "s3c2410-lcd",
139 .num_resources = ARRAY_SIZE(s3c_lcd_resource),
140 .resource = s3c_lcd_resource,
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);
155 s3c_device_lcd.dev.platform_data = npd;
156 npd->displays = kmemdup(pd->displays,
157 sizeof(struct s3c2410fb_display) * npd->num_displays,
160 printk(KERN_ERR "no memory for LCD display data\n");
162 printk(KERN_ERR "no memory for LCD platform data\n");
168 static struct resource s3c_ts_resource[] = {
170 .start = S3C24XX_PA_ADC,
171 .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
172 .flags = IORESOURCE_MEM,
177 .flags = IORESOURCE_IRQ,
182 struct platform_device s3c_device_ts = {
183 .name = "s3c2410-ts",
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;
198 EXPORT_SYMBOL(s3c24xx_ts_set_platdata);
200 /* USB Device (Gadget)*/
202 static struct resource s3c_usbgadget_resource[] = {
204 .start = S3C24XX_PA_USBDEV,
205 .end = S3C24XX_PA_USBDEV + S3C24XX_SZ_USBDEV - 1,
206 .flags = IORESOURCE_MEM,
211 .flags = IORESOURCE_IRQ,
216 struct platform_device s3c_device_usbgadget = {
217 .name = "s3c2410-usbgadget",
219 .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
220 .resource = s3c_usbgadget_resource,
223 EXPORT_SYMBOL(s3c_device_usbgadget);
225 void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)
227 struct s3c2410_udc_mach_info *npd;
229 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
231 memcpy(npd, pd, sizeof(*npd));
232 s3c_device_usbgadget.dev.platform_data = npd;
234 printk(KERN_ERR "no memory for udc platform data\n");
241 static struct resource s3c_wdt_resource[] = {
243 .start = S3C24XX_PA_WATCHDOG,
244 .end = S3C24XX_PA_WATCHDOG + S3C24XX_SZ_WATCHDOG - 1,
245 .flags = IORESOURCE_MEM,
250 .flags = IORESOURCE_IRQ,
255 struct platform_device s3c_device_wdt = {
256 .name = "s3c2410-wdt",
258 .num_resources = ARRAY_SIZE(s3c_wdt_resource),
259 .resource = s3c_wdt_resource,
262 EXPORT_SYMBOL(s3c_device_wdt);
266 static struct resource s3c_iis_resource[] = {
268 .start = S3C24XX_PA_IIS,
269 .end = S3C24XX_PA_IIS + S3C24XX_SZ_IIS -1,
270 .flags = IORESOURCE_MEM,
274 static u64 s3c_device_iis_dmamask = 0xffffffffUL;
276 struct platform_device s3c_device_iis = {
277 .name = "s3c2410-iis",
279 .num_resources = ARRAY_SIZE(s3c_iis_resource),
280 .resource = s3c_iis_resource,
282 .dma_mask = &s3c_device_iis_dmamask,
283 .coherent_dma_mask = 0xffffffffUL
287 EXPORT_SYMBOL(s3c_device_iis);
291 static struct resource s3c_rtc_resource[] = {
293 .start = S3C24XX_PA_RTC,
294 .end = S3C24XX_PA_RTC + 0xff,
295 .flags = IORESOURCE_MEM,
300 .flags = IORESOURCE_IRQ,
305 .flags = IORESOURCE_IRQ
309 struct platform_device s3c_device_rtc = {
310 .name = "s3c2410-rtc",
312 .num_resources = ARRAY_SIZE(s3c_rtc_resource),
313 .resource = s3c_rtc_resource,
316 EXPORT_SYMBOL(s3c_device_rtc);
320 static struct resource s3c_adc_resource[] = {
322 .start = S3C24XX_PA_ADC,
323 .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
324 .flags = IORESOURCE_MEM,
329 .flags = IORESOURCE_IRQ,
334 .flags = IORESOURCE_IRQ,
339 struct platform_device s3c_device_adc = {
340 .name = "s3c24xx-adc",
342 .num_resources = ARRAY_SIZE(s3c_adc_resource),
343 .resource = s3c_adc_resource,
348 struct platform_device s3c_device_hwmon = {
351 .dev.parent = &s3c_device_adc.dev,
356 static struct resource s3c_sdi_resource[] = {
358 .start = S3C24XX_PA_SDI,
359 .end = S3C24XX_PA_SDI + S3C24XX_SZ_SDI - 1,
360 .flags = IORESOURCE_MEM,
365 .flags = IORESOURCE_IRQ,
370 struct platform_device s3c_device_sdi = {
371 .name = "s3c2410-sdi",
373 .num_resources = ARRAY_SIZE(s3c_sdi_resource),
374 .resource = s3c_sdi_resource,
377 EXPORT_SYMBOL(s3c_device_sdi);
379 void __init s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata)
381 struct s3c24xx_mci_pdata *npd;
383 npd = kmemdup(pdata, sizeof(struct s3c24xx_mci_pdata), GFP_KERNEL);
385 printk(KERN_ERR "%s: no memory to copy pdata", __func__);
387 s3c_device_sdi.dev.platform_data = npd;
393 static struct resource s3c_spi0_resource[] = {
395 .start = S3C24XX_PA_SPI,
396 .end = S3C24XX_PA_SPI + 0x1f,
397 .flags = IORESOURCE_MEM,
402 .flags = IORESOURCE_IRQ,
407 static u64 s3c_device_spi0_dmamask = 0xffffffffUL;
409 struct platform_device s3c_device_spi0 = {
410 .name = "s3c2410-spi",
412 .num_resources = ARRAY_SIZE(s3c_spi0_resource),
413 .resource = s3c_spi0_resource,
415 .dma_mask = &s3c_device_spi0_dmamask,
416 .coherent_dma_mask = 0xffffffffUL
420 EXPORT_SYMBOL(s3c_device_spi0);
424 static struct resource s3c_spi1_resource[] = {
426 .start = S3C24XX_PA_SPI + S3C2410_SPI1,
427 .end = S3C24XX_PA_SPI + S3C2410_SPI1 + 0x1f,
428 .flags = IORESOURCE_MEM,
433 .flags = IORESOURCE_IRQ,
438 static u64 s3c_device_spi1_dmamask = 0xffffffffUL;
440 struct platform_device s3c_device_spi1 = {
441 .name = "s3c2410-spi",
443 .num_resources = ARRAY_SIZE(s3c_spi1_resource),
444 .resource = s3c_spi1_resource,
446 .dma_mask = &s3c_device_spi1_dmamask,
447 .coherent_dma_mask = 0xffffffffUL
451 EXPORT_SYMBOL(s3c_device_spi1);
453 #ifdef CONFIG_CPU_S3C2440
455 /* Camif Controller */
457 static struct resource s3c_camif_resource[] = {
459 .start = S3C2440_PA_CAMIF,
460 .end = S3C2440_PA_CAMIF + S3C2440_SZ_CAMIF - 1,
461 .flags = IORESOURCE_MEM,
466 .flags = IORESOURCE_IRQ,
471 static u64 s3c_device_camif_dmamask = 0xffffffffUL;
473 struct platform_device s3c_device_camif = {
474 .name = "s3c2440-camif",
476 .num_resources = ARRAY_SIZE(s3c_camif_resource),
477 .resource = s3c_camif_resource,
479 .dma_mask = &s3c_device_camif_dmamask,
480 .coherent_dma_mask = 0xffffffffUL
484 EXPORT_SYMBOL(s3c_device_camif);
488 static struct resource s3c_ac97_resource[] = {
490 .start = S3C2440_PA_AC97,
491 .end = S3C2440_PA_AC97 + S3C2440_SZ_AC97 -1,
492 .flags = IORESOURCE_MEM,
495 .start = IRQ_S3C244x_AC97,
496 .end = IRQ_S3C244x_AC97,
497 .flags = IORESOURCE_IRQ,
501 .start = DMACH_PCM_OUT,
502 .end = DMACH_PCM_OUT,
503 .flags = IORESOURCE_DMA,
507 .start = DMACH_PCM_IN,
509 .flags = IORESOURCE_DMA,
513 .start = DMACH_MIC_IN,
515 .flags = IORESOURCE_DMA,
519 static u64 s3c_device_ac97_dmamask = 0xffffffffUL;
521 struct platform_device s3c_device_ac97 = {
524 .num_resources = ARRAY_SIZE(s3c_ac97_resource),
525 .resource = s3c_ac97_resource,
527 .dma_mask = &s3c_device_ac97_dmamask,
528 .coherent_dma_mask = 0xffffffffUL
532 EXPORT_SYMBOL(s3c_device_ac97);
534 #endif // CONFIG_CPU_S32440