ARM: S3C: move s3c_device_nand from plat-s3c24xx to plat-s3c
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / plat-s3c24xx / devs.c
blob20c114d6f6162651bc0c9eafa5a71f6b8bc9eea2
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>
24 #include <asm/mach/arch.h>
25 #include <asm/mach/map.h>
26 #include <asm/mach/irq.h>
27 #include <mach/fb.h>
28 #include <mach/hardware.h>
29 #include <asm/irq.h>
31 #include <plat/regs-serial.h>
32 #include <plat/udc.h>
34 #include <plat/devs.h>
35 #include <plat/cpu.h>
36 #include <plat/regs-spi.h>
38 /* Serial port registrations */
40 static struct resource s3c2410_uart0_resource[] = {
41 [0] = {
42 .start = S3C2410_PA_UART0,
43 .end = S3C2410_PA_UART0 + 0x3fff,
44 .flags = IORESOURCE_MEM,
46 [1] = {
47 .start = IRQ_S3CUART_RX0,
48 .end = IRQ_S3CUART_ERR0,
49 .flags = IORESOURCE_IRQ,
53 static struct resource s3c2410_uart1_resource[] = {
54 [0] = {
55 .start = S3C2410_PA_UART1,
56 .end = S3C2410_PA_UART1 + 0x3fff,
57 .flags = IORESOURCE_MEM,
59 [1] = {
60 .start = IRQ_S3CUART_RX1,
61 .end = IRQ_S3CUART_ERR1,
62 .flags = IORESOURCE_IRQ,
66 static struct resource s3c2410_uart2_resource[] = {
67 [0] = {
68 .start = S3C2410_PA_UART2,
69 .end = S3C2410_PA_UART2 + 0x3fff,
70 .flags = IORESOURCE_MEM,
72 [1] = {
73 .start = IRQ_S3CUART_RX2,
74 .end = IRQ_S3CUART_ERR2,
75 .flags = IORESOURCE_IRQ,
79 static struct resource s3c2410_uart3_resource[] = {
80 [0] = {
81 .start = S3C2443_PA_UART3,
82 .end = S3C2443_PA_UART3 + 0x3fff,
83 .flags = IORESOURCE_MEM,
85 [1] = {
86 .start = IRQ_S3CUART_RX3,
87 .end = IRQ_S3CUART_ERR3,
88 .flags = IORESOURCE_IRQ,
92 struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
93 [0] = {
94 .resources = s3c2410_uart0_resource,
95 .nr_resources = ARRAY_SIZE(s3c2410_uart0_resource),
97 [1] = {
98 .resources = s3c2410_uart1_resource,
99 .nr_resources = ARRAY_SIZE(s3c2410_uart1_resource),
101 [2] = {
102 .resources = s3c2410_uart2_resource,
103 .nr_resources = ARRAY_SIZE(s3c2410_uart2_resource),
105 [3] = {
106 .resources = s3c2410_uart3_resource,
107 .nr_resources = ARRAY_SIZE(s3c2410_uart3_resource),
111 /* yart devices */
113 static struct platform_device s3c24xx_uart_device0 = {
114 .id = 0,
117 static struct platform_device s3c24xx_uart_device1 = {
118 .id = 1,
121 static struct platform_device s3c24xx_uart_device2 = {
122 .id = 2,
125 static struct platform_device s3c24xx_uart_device3 = {
126 .id = 3,
129 struct platform_device *s3c24xx_uart_src[4] = {
130 &s3c24xx_uart_device0,
131 &s3c24xx_uart_device1,
132 &s3c24xx_uart_device2,
133 &s3c24xx_uart_device3,
136 struct platform_device *s3c24xx_uart_devs[4] = {
139 /* LCD Controller */
141 static struct resource s3c_lcd_resource[] = {
142 [0] = {
143 .start = S3C24XX_PA_LCD,
144 .end = S3C24XX_PA_LCD + S3C24XX_SZ_LCD - 1,
145 .flags = IORESOURCE_MEM,
147 [1] = {
148 .start = IRQ_LCD,
149 .end = IRQ_LCD,
150 .flags = IORESOURCE_IRQ,
155 static u64 s3c_device_lcd_dmamask = 0xffffffffUL;
157 struct platform_device s3c_device_lcd = {
158 .name = "s3c2410-lcd",
159 .id = -1,
160 .num_resources = ARRAY_SIZE(s3c_lcd_resource),
161 .resource = s3c_lcd_resource,
162 .dev = {
163 .dma_mask = &s3c_device_lcd_dmamask,
164 .coherent_dma_mask = 0xffffffffUL
168 EXPORT_SYMBOL(s3c_device_lcd);
170 void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
172 struct s3c2410fb_mach_info *npd;
174 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
175 if (npd) {
176 memcpy(npd, pd, sizeof(*npd));
177 s3c_device_lcd.dev.platform_data = npd;
178 } else {
179 printk(KERN_ERR "no memory for LCD platform data\n");
183 /* USB Device (Gadget)*/
185 static struct resource s3c_usbgadget_resource[] = {
186 [0] = {
187 .start = S3C24XX_PA_USBDEV,
188 .end = S3C24XX_PA_USBDEV + S3C24XX_SZ_USBDEV - 1,
189 .flags = IORESOURCE_MEM,
191 [1] = {
192 .start = IRQ_USBD,
193 .end = IRQ_USBD,
194 .flags = IORESOURCE_IRQ,
199 struct platform_device s3c_device_usbgadget = {
200 .name = "s3c2410-usbgadget",
201 .id = -1,
202 .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
203 .resource = s3c_usbgadget_resource,
206 EXPORT_SYMBOL(s3c_device_usbgadget);
208 void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)
210 struct s3c2410_udc_mach_info *npd;
212 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
213 if (npd) {
214 memcpy(npd, pd, sizeof(*npd));
215 s3c_device_usbgadget.dev.platform_data = npd;
216 } else {
217 printk(KERN_ERR "no memory for udc platform data\n");
222 /* Watchdog */
224 static struct resource s3c_wdt_resource[] = {
225 [0] = {
226 .start = S3C24XX_PA_WATCHDOG,
227 .end = S3C24XX_PA_WATCHDOG + S3C24XX_SZ_WATCHDOG - 1,
228 .flags = IORESOURCE_MEM,
230 [1] = {
231 .start = IRQ_WDT,
232 .end = IRQ_WDT,
233 .flags = IORESOURCE_IRQ,
238 struct platform_device s3c_device_wdt = {
239 .name = "s3c2410-wdt",
240 .id = -1,
241 .num_resources = ARRAY_SIZE(s3c_wdt_resource),
242 .resource = s3c_wdt_resource,
245 EXPORT_SYMBOL(s3c_device_wdt);
247 /* IIS */
249 static struct resource s3c_iis_resource[] = {
250 [0] = {
251 .start = S3C24XX_PA_IIS,
252 .end = S3C24XX_PA_IIS + S3C24XX_SZ_IIS -1,
253 .flags = IORESOURCE_MEM,
257 static u64 s3c_device_iis_dmamask = 0xffffffffUL;
259 struct platform_device s3c_device_iis = {
260 .name = "s3c2410-iis",
261 .id = -1,
262 .num_resources = ARRAY_SIZE(s3c_iis_resource),
263 .resource = s3c_iis_resource,
264 .dev = {
265 .dma_mask = &s3c_device_iis_dmamask,
266 .coherent_dma_mask = 0xffffffffUL
270 EXPORT_SYMBOL(s3c_device_iis);
272 /* RTC */
274 static struct resource s3c_rtc_resource[] = {
275 [0] = {
276 .start = S3C24XX_PA_RTC,
277 .end = S3C24XX_PA_RTC + 0xff,
278 .flags = IORESOURCE_MEM,
280 [1] = {
281 .start = IRQ_RTC,
282 .end = IRQ_RTC,
283 .flags = IORESOURCE_IRQ,
285 [2] = {
286 .start = IRQ_TICK,
287 .end = IRQ_TICK,
288 .flags = IORESOURCE_IRQ
292 struct platform_device s3c_device_rtc = {
293 .name = "s3c2410-rtc",
294 .id = -1,
295 .num_resources = ARRAY_SIZE(s3c_rtc_resource),
296 .resource = s3c_rtc_resource,
299 EXPORT_SYMBOL(s3c_device_rtc);
301 /* ADC */
303 static struct resource s3c_adc_resource[] = {
304 [0] = {
305 .start = S3C24XX_PA_ADC,
306 .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
307 .flags = IORESOURCE_MEM,
309 [1] = {
310 .start = IRQ_TC,
311 .end = IRQ_TC,
312 .flags = IORESOURCE_IRQ,
314 [2] = {
315 .start = IRQ_ADC,
316 .end = IRQ_ADC,
317 .flags = IORESOURCE_IRQ,
322 struct platform_device s3c_device_adc = {
323 .name = "s3c24xx-adc",
324 .id = -1,
325 .num_resources = ARRAY_SIZE(s3c_adc_resource),
326 .resource = s3c_adc_resource,
329 /* HWMON */
331 struct platform_device s3c_device_hwmon = {
332 .name = "s3c24xx-hwmon",
333 .id = -1,
334 .dev.parent = &s3c_device_adc.dev,
337 /* SDI */
339 static struct resource s3c_sdi_resource[] = {
340 [0] = {
341 .start = S3C24XX_PA_SDI,
342 .end = S3C24XX_PA_SDI + S3C24XX_SZ_SDI - 1,
343 .flags = IORESOURCE_MEM,
345 [1] = {
346 .start = IRQ_SDI,
347 .end = IRQ_SDI,
348 .flags = IORESOURCE_IRQ,
353 struct platform_device s3c_device_sdi = {
354 .name = "s3c2410-sdi",
355 .id = -1,
356 .num_resources = ARRAY_SIZE(s3c_sdi_resource),
357 .resource = s3c_sdi_resource,
360 EXPORT_SYMBOL(s3c_device_sdi);
362 /* SPI (0) */
364 static struct resource s3c_spi0_resource[] = {
365 [0] = {
366 .start = S3C24XX_PA_SPI,
367 .end = S3C24XX_PA_SPI + 0x1f,
368 .flags = IORESOURCE_MEM,
370 [1] = {
371 .start = IRQ_SPI0,
372 .end = IRQ_SPI0,
373 .flags = IORESOURCE_IRQ,
378 static u64 s3c_device_spi0_dmamask = 0xffffffffUL;
380 struct platform_device s3c_device_spi0 = {
381 .name = "s3c2410-spi",
382 .id = 0,
383 .num_resources = ARRAY_SIZE(s3c_spi0_resource),
384 .resource = s3c_spi0_resource,
385 .dev = {
386 .dma_mask = &s3c_device_spi0_dmamask,
387 .coherent_dma_mask = 0xffffffffUL
391 EXPORT_SYMBOL(s3c_device_spi0);
393 /* SPI (1) */
395 static struct resource s3c_spi1_resource[] = {
396 [0] = {
397 .start = S3C24XX_PA_SPI + S3C2410_SPI1,
398 .end = S3C24XX_PA_SPI + S3C2410_SPI1 + 0x1f,
399 .flags = IORESOURCE_MEM,
401 [1] = {
402 .start = IRQ_SPI1,
403 .end = IRQ_SPI1,
404 .flags = IORESOURCE_IRQ,
409 static u64 s3c_device_spi1_dmamask = 0xffffffffUL;
411 struct platform_device s3c_device_spi1 = {
412 .name = "s3c2410-spi",
413 .id = 1,
414 .num_resources = ARRAY_SIZE(s3c_spi1_resource),
415 .resource = s3c_spi1_resource,
416 .dev = {
417 .dma_mask = &s3c_device_spi1_dmamask,
418 .coherent_dma_mask = 0xffffffffUL
422 EXPORT_SYMBOL(s3c_device_spi1);
424 #ifdef CONFIG_CPU_S3C2440
426 /* Camif Controller */
428 static struct resource s3c_camif_resource[] = {
429 [0] = {
430 .start = S3C2440_PA_CAMIF,
431 .end = S3C2440_PA_CAMIF + S3C2440_SZ_CAMIF - 1,
432 .flags = IORESOURCE_MEM,
434 [1] = {
435 .start = IRQ_CAM,
436 .end = IRQ_CAM,
437 .flags = IORESOURCE_IRQ,
442 static u64 s3c_device_camif_dmamask = 0xffffffffUL;
444 struct platform_device s3c_device_camif = {
445 .name = "s3c2440-camif",
446 .id = -1,
447 .num_resources = ARRAY_SIZE(s3c_camif_resource),
448 .resource = s3c_camif_resource,
449 .dev = {
450 .dma_mask = &s3c_device_camif_dmamask,
451 .coherent_dma_mask = 0xffffffffUL
455 EXPORT_SYMBOL(s3c_device_camif);
457 #endif // CONFIG_CPU_S32440