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>
24 #include <asm/mach/arch.h>
25 #include <asm/mach/map.h>
26 #include <asm/mach/irq.h>
28 #include <mach/hardware.h>
30 #include <mach/irqs.h>
33 #include <plat/regs-serial.h>
37 #include <plat/devs.h>
39 #include <plat/regs-spi.h>
43 /* Serial port registrations */
45 static struct resource s3c2410_uart0_resource[] = {
47 .start = S3C2410_PA_UART0,
48 .end = S3C2410_PA_UART0 + 0x3fff,
49 .flags = IORESOURCE_MEM,
52 .start = IRQ_S3CUART_RX0,
53 .end = IRQ_S3CUART_ERR0,
54 .flags = IORESOURCE_IRQ,
58 static struct resource s3c2410_uart1_resource[] = {
60 .start = S3C2410_PA_UART1,
61 .end = S3C2410_PA_UART1 + 0x3fff,
62 .flags = IORESOURCE_MEM,
65 .start = IRQ_S3CUART_RX1,
66 .end = IRQ_S3CUART_ERR1,
67 .flags = IORESOURCE_IRQ,
71 static struct resource s3c2410_uart2_resource[] = {
73 .start = S3C2410_PA_UART2,
74 .end = S3C2410_PA_UART2 + 0x3fff,
75 .flags = IORESOURCE_MEM,
78 .start = IRQ_S3CUART_RX2,
79 .end = IRQ_S3CUART_ERR2,
80 .flags = IORESOURCE_IRQ,
84 static struct resource s3c2410_uart3_resource[] = {
86 .start = S3C2443_PA_UART3,
87 .end = S3C2443_PA_UART3 + 0x3fff,
88 .flags = IORESOURCE_MEM,
91 .start = IRQ_S3CUART_RX3,
92 .end = IRQ_S3CUART_ERR3,
93 .flags = IORESOURCE_IRQ,
97 struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
99 .resources = s3c2410_uart0_resource,
100 .nr_resources = ARRAY_SIZE(s3c2410_uart0_resource),
103 .resources = s3c2410_uart1_resource,
104 .nr_resources = ARRAY_SIZE(s3c2410_uart1_resource),
107 .resources = s3c2410_uart2_resource,
108 .nr_resources = ARRAY_SIZE(s3c2410_uart2_resource),
111 .resources = s3c2410_uart3_resource,
112 .nr_resources = ARRAY_SIZE(s3c2410_uart3_resource),
118 static struct resource s3c_lcd_resource[] = {
120 .start = S3C24XX_PA_LCD,
121 .end = S3C24XX_PA_LCD + S3C24XX_SZ_LCD - 1,
122 .flags = IORESOURCE_MEM,
127 .flags = IORESOURCE_IRQ,
132 static u64 s3c_device_lcd_dmamask = 0xffffffffUL;
134 struct platform_device s3c_device_lcd = {
135 .name = "s3c2410-lcd",
137 .num_resources = ARRAY_SIZE(s3c_lcd_resource),
138 .resource = s3c_lcd_resource,
140 .dma_mask = &s3c_device_lcd_dmamask,
141 .coherent_dma_mask = 0xffffffffUL
145 EXPORT_SYMBOL(s3c_device_lcd);
147 void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
149 struct s3c2410fb_mach_info *npd;
151 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
153 memcpy(npd, pd, sizeof(*npd));
154 s3c_device_lcd.dev.platform_data = npd;
156 printk(KERN_ERR "no memory for LCD platform data\n");
162 static struct resource s3c_ts_resource[] = {
164 .start = S3C24XX_PA_ADC,
165 .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
166 .flags = IORESOURCE_MEM,
171 .flags = IORESOURCE_IRQ,
176 struct platform_device s3c_device_ts = {
177 .name = "s3c2410-ts",
179 .dev.parent = &s3c_device_adc.dev,
180 .num_resources = ARRAY_SIZE(s3c_ts_resource),
181 .resource = s3c_ts_resource,
183 EXPORT_SYMBOL(s3c_device_ts);
185 static struct s3c2410_ts_mach_info s3c2410ts_info;
187 void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *hard_s3c2410ts_info)
189 memcpy(&s3c2410ts_info, hard_s3c2410ts_info, sizeof(struct s3c2410_ts_mach_info));
190 s3c_device_ts.dev.platform_data = &s3c2410ts_info;
192 EXPORT_SYMBOL(s3c24xx_ts_set_platdata);
194 /* USB Device (Gadget)*/
196 static struct resource s3c_usbgadget_resource[] = {
198 .start = S3C24XX_PA_USBDEV,
199 .end = S3C24XX_PA_USBDEV + S3C24XX_SZ_USBDEV - 1,
200 .flags = IORESOURCE_MEM,
205 .flags = IORESOURCE_IRQ,
210 struct platform_device s3c_device_usbgadget = {
211 .name = "s3c2410-usbgadget",
213 .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
214 .resource = s3c_usbgadget_resource,
217 EXPORT_SYMBOL(s3c_device_usbgadget);
219 void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)
221 struct s3c2410_udc_mach_info *npd;
223 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
225 memcpy(npd, pd, sizeof(*npd));
226 s3c_device_usbgadget.dev.platform_data = npd;
228 printk(KERN_ERR "no memory for udc platform data\n");
235 static struct resource s3c_wdt_resource[] = {
237 .start = S3C24XX_PA_WATCHDOG,
238 .end = S3C24XX_PA_WATCHDOG + S3C24XX_SZ_WATCHDOG - 1,
239 .flags = IORESOURCE_MEM,
244 .flags = IORESOURCE_IRQ,
249 struct platform_device s3c_device_wdt = {
250 .name = "s3c2410-wdt",
252 .num_resources = ARRAY_SIZE(s3c_wdt_resource),
253 .resource = s3c_wdt_resource,
256 EXPORT_SYMBOL(s3c_device_wdt);
260 static struct resource s3c_iis_resource[] = {
262 .start = S3C24XX_PA_IIS,
263 .end = S3C24XX_PA_IIS + S3C24XX_SZ_IIS -1,
264 .flags = IORESOURCE_MEM,
268 static u64 s3c_device_iis_dmamask = 0xffffffffUL;
270 struct platform_device s3c_device_iis = {
271 .name = "s3c2410-iis",
273 .num_resources = ARRAY_SIZE(s3c_iis_resource),
274 .resource = s3c_iis_resource,
276 .dma_mask = &s3c_device_iis_dmamask,
277 .coherent_dma_mask = 0xffffffffUL
281 EXPORT_SYMBOL(s3c_device_iis);
285 static struct resource s3c_rtc_resource[] = {
287 .start = S3C24XX_PA_RTC,
288 .end = S3C24XX_PA_RTC + 0xff,
289 .flags = IORESOURCE_MEM,
294 .flags = IORESOURCE_IRQ,
299 .flags = IORESOURCE_IRQ
303 struct platform_device s3c_device_rtc = {
304 .name = "s3c2410-rtc",
306 .num_resources = ARRAY_SIZE(s3c_rtc_resource),
307 .resource = s3c_rtc_resource,
310 EXPORT_SYMBOL(s3c_device_rtc);
314 static struct resource s3c_adc_resource[] = {
316 .start = S3C24XX_PA_ADC,
317 .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
318 .flags = IORESOURCE_MEM,
323 .flags = IORESOURCE_IRQ,
328 .flags = IORESOURCE_IRQ,
333 struct platform_device s3c_device_adc = {
334 .name = "s3c24xx-adc",
336 .num_resources = ARRAY_SIZE(s3c_adc_resource),
337 .resource = s3c_adc_resource,
342 struct platform_device s3c_device_hwmon = {
345 .dev.parent = &s3c_device_adc.dev,
350 static struct resource s3c_sdi_resource[] = {
352 .start = S3C24XX_PA_SDI,
353 .end = S3C24XX_PA_SDI + S3C24XX_SZ_SDI - 1,
354 .flags = IORESOURCE_MEM,
359 .flags = IORESOURCE_IRQ,
364 struct platform_device s3c_device_sdi = {
365 .name = "s3c2410-sdi",
367 .num_resources = ARRAY_SIZE(s3c_sdi_resource),
368 .resource = s3c_sdi_resource,
371 EXPORT_SYMBOL(s3c_device_sdi);
373 void s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata)
375 struct s3c24xx_mci_pdata *npd;
377 npd = kmemdup(pdata, sizeof(struct s3c24xx_mci_pdata), GFP_KERNEL);
379 printk(KERN_ERR "%s: no memory to copy pdata", __func__);
381 s3c_device_sdi.dev.platform_data = npd;
387 static struct resource s3c_spi0_resource[] = {
389 .start = S3C24XX_PA_SPI,
390 .end = S3C24XX_PA_SPI + 0x1f,
391 .flags = IORESOURCE_MEM,
396 .flags = IORESOURCE_IRQ,
401 static u64 s3c_device_spi0_dmamask = 0xffffffffUL;
403 struct platform_device s3c_device_spi0 = {
404 .name = "s3c2410-spi",
406 .num_resources = ARRAY_SIZE(s3c_spi0_resource),
407 .resource = s3c_spi0_resource,
409 .dma_mask = &s3c_device_spi0_dmamask,
410 .coherent_dma_mask = 0xffffffffUL
414 EXPORT_SYMBOL(s3c_device_spi0);
418 static struct resource s3c_spi1_resource[] = {
420 .start = S3C24XX_PA_SPI + S3C2410_SPI1,
421 .end = S3C24XX_PA_SPI + S3C2410_SPI1 + 0x1f,
422 .flags = IORESOURCE_MEM,
427 .flags = IORESOURCE_IRQ,
432 static u64 s3c_device_spi1_dmamask = 0xffffffffUL;
434 struct platform_device s3c_device_spi1 = {
435 .name = "s3c2410-spi",
437 .num_resources = ARRAY_SIZE(s3c_spi1_resource),
438 .resource = s3c_spi1_resource,
440 .dma_mask = &s3c_device_spi1_dmamask,
441 .coherent_dma_mask = 0xffffffffUL
445 EXPORT_SYMBOL(s3c_device_spi1);
447 #ifdef CONFIG_CPU_S3C2440
449 /* Camif Controller */
451 static struct resource s3c_camif_resource[] = {
453 .start = S3C2440_PA_CAMIF,
454 .end = S3C2440_PA_CAMIF + S3C2440_SZ_CAMIF - 1,
455 .flags = IORESOURCE_MEM,
460 .flags = IORESOURCE_IRQ,
465 static u64 s3c_device_camif_dmamask = 0xffffffffUL;
467 struct platform_device s3c_device_camif = {
468 .name = "s3c2440-camif",
470 .num_resources = ARRAY_SIZE(s3c_camif_resource),
471 .resource = s3c_camif_resource,
473 .dma_mask = &s3c_device_camif_dmamask,
474 .coherent_dma_mask = 0xffffffffUL
478 EXPORT_SYMBOL(s3c_device_camif);
482 static struct resource s3c_ac97_resource[] = {
484 .start = S3C2440_PA_AC97,
485 .end = S3C2440_PA_AC97 + S3C2440_SZ_AC97 -1,
486 .flags = IORESOURCE_MEM,
489 .start = IRQ_S3C244x_AC97,
490 .end = IRQ_S3C244x_AC97,
491 .flags = IORESOURCE_IRQ,
495 .start = DMACH_PCM_OUT,
496 .end = DMACH_PCM_OUT,
497 .flags = IORESOURCE_DMA,
501 .start = DMACH_PCM_IN,
503 .flags = IORESOURCE_DMA,
507 .start = DMACH_MIC_IN,
509 .flags = IORESOURCE_DMA,
513 static u64 s3c_device_ac97_dmamask = 0xffffffffUL;
515 struct platform_device s3c_device_ac97 = {
518 .num_resources = ARRAY_SIZE(s3c_ac97_resource),
519 .resource = s3c_ac97_resource,
521 .dma_mask = &s3c_device_ac97_dmamask,
522 .coherent_dma_mask = 0xffffffffUL
526 EXPORT_SYMBOL(s3c_device_ac97);
528 #endif // CONFIG_CPU_S32440