blob: 4553ad6c7adc53d9895fec6ee85f54ff0d59e10c [file] [log] [blame]
Ben Dooksa21765a2007-02-11 18:31:01 +01001/* linux/arch/arm/plat-s3c24xx/devs.c
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 *
3 * Copyright (c) 2004 Simtec Electronics
Ben Dooks916a0022006-09-06 19:03:21 +01004 * Ben Dooks <ben@simtec.co.uk>
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 *
Ben Dooks916a0022006-09-06 19:03:21 +01006 * Base S3C24XX platform device definitions
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 *
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.
11 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070012*/
13
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>
Ben Dooksb6d1f542006-12-17 23:22:26 +010020#include <linux/serial_core.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010021#include <linux/platform_device.h>
Russell Kingfced80c2008-09-06 12:10:45 +010022#include <linux/io.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
24#include <asm/mach/arch.h>
25#include <asm/mach/map.h>
26#include <asm/mach/irq.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010027#include <mach/fb.h>
28#include <mach/hardware.h>
Mark Brownd91e9a72009-08-05 18:29:57 +010029#include <mach/dma.h>
30#include <mach/irqs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#include <asm/irq.h>
32
Ben Dooksa2b7ba92008-10-07 22:26:09 +010033#include <plat/regs-serial.h>
Ben Dooks57bd4b92008-10-30 10:14:37 +000034#include <plat/udc.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070035
Ben Dooksa2b7ba92008-10-07 22:26:09 +010036#include <plat/devs.h>
37#include <plat/cpu.h>
Ben Dooks13622702008-10-30 10:14:38 +000038#include <plat/regs-spi.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
40/* Serial port registrations */
41
Ben Dooks66a9b492006-06-18 23:04:05 +010042static struct resource s3c2410_uart0_resource[] = {
43 [0] = {
44 .start = S3C2410_PA_UART0,
45 .end = S3C2410_PA_UART0 + 0x3fff,
46 .flags = IORESOURCE_MEM,
47 },
48 [1] = {
49 .start = IRQ_S3CUART_RX0,
50 .end = IRQ_S3CUART_ERR0,
51 .flags = IORESOURCE_IRQ,
52 }
53};
54
55static struct resource s3c2410_uart1_resource[] = {
56 [0] = {
57 .start = S3C2410_PA_UART1,
58 .end = S3C2410_PA_UART1 + 0x3fff,
59 .flags = IORESOURCE_MEM,
60 },
61 [1] = {
62 .start = IRQ_S3CUART_RX1,
63 .end = IRQ_S3CUART_ERR1,
64 .flags = IORESOURCE_IRQ,
65 }
66};
67
68static struct resource s3c2410_uart2_resource[] = {
69 [0] = {
70 .start = S3C2410_PA_UART2,
71 .end = S3C2410_PA_UART2 + 0x3fff,
72 .flags = IORESOURCE_MEM,
73 },
74 [1] = {
75 .start = IRQ_S3CUART_RX2,
76 .end = IRQ_S3CUART_ERR2,
77 .flags = IORESOURCE_IRQ,
78 }
79};
80
Ben Dooksdbf35992008-11-04 15:29:09 +000081static struct resource s3c2410_uart3_resource[] = {
82 [0] = {
83 .start = S3C2443_PA_UART3,
84 .end = S3C2443_PA_UART3 + 0x3fff,
85 .flags = IORESOURCE_MEM,
86 },
87 [1] = {
88 .start = IRQ_S3CUART_RX3,
89 .end = IRQ_S3CUART_ERR3,
90 .flags = IORESOURCE_IRQ,
91 },
92};
93
Ben Dooks66a9b492006-06-18 23:04:05 +010094struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
95 [0] = {
96 .resources = s3c2410_uart0_resource,
97 .nr_resources = ARRAY_SIZE(s3c2410_uart0_resource),
98 },
99 [1] = {
100 .resources = s3c2410_uart1_resource,
101 .nr_resources = ARRAY_SIZE(s3c2410_uart1_resource),
102 },
103 [2] = {
104 .resources = s3c2410_uart2_resource,
105 .nr_resources = ARRAY_SIZE(s3c2410_uart2_resource),
106 },
Ben Dooksdbf35992008-11-04 15:29:09 +0000107 [3] = {
108 .resources = s3c2410_uart3_resource,
109 .nr_resources = ARRAY_SIZE(s3c2410_uart3_resource),
110 },
Ben Dooks66a9b492006-06-18 23:04:05 +0100111};
112
113/* yart devices */
114
115static struct platform_device s3c24xx_uart_device0 = {
116 .id = 0,
117};
118
119static struct platform_device s3c24xx_uart_device1 = {
120 .id = 1,
121};
122
123static struct platform_device s3c24xx_uart_device2 = {
124 .id = 2,
125};
126
Ben Dooksdbf35992008-11-04 15:29:09 +0000127static struct platform_device s3c24xx_uart_device3 = {
128 .id = 3,
129};
130
131struct platform_device *s3c24xx_uart_src[4] = {
Ben Dooks66a9b492006-06-18 23:04:05 +0100132 &s3c24xx_uart_device0,
133 &s3c24xx_uart_device1,
134 &s3c24xx_uart_device2,
Ben Dooksdbf35992008-11-04 15:29:09 +0000135 &s3c24xx_uart_device3,
Ben Dooks66a9b492006-06-18 23:04:05 +0100136};
137
Ben Dooksdbf35992008-11-04 15:29:09 +0000138struct platform_device *s3c24xx_uart_devs[4] = {
Ben Dooks66a9b492006-06-18 23:04:05 +0100139};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141/* LCD Controller */
142
143static struct resource s3c_lcd_resource[] = {
144 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000145 .start = S3C24XX_PA_LCD,
146 .end = S3C24XX_PA_LCD + S3C24XX_SZ_LCD - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147 .flags = IORESOURCE_MEM,
148 },
149 [1] = {
150 .start = IRQ_LCD,
151 .end = IRQ_LCD,
152 .flags = IORESOURCE_IRQ,
153 }
154
155};
156
157static u64 s3c_device_lcd_dmamask = 0xffffffffUL;
158
159struct platform_device s3c_device_lcd = {
160 .name = "s3c2410-lcd",
161 .id = -1,
162 .num_resources = ARRAY_SIZE(s3c_lcd_resource),
163 .resource = s3c_lcd_resource,
164 .dev = {
Ben Dooks6904b242005-06-29 11:09:15 +0100165 .dma_mask = &s3c_device_lcd_dmamask,
166 .coherent_dma_mask = 0xffffffffUL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167 }
168};
169
170EXPORT_SYMBOL(s3c_device_lcd);
171
Ben Dooks893b0302005-10-28 15:31:45 +0100172void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
Arnaud Patardf92273c2005-09-09 13:10:10 -0700173{
Ben Dooks893b0302005-10-28 15:31:45 +0100174 struct s3c2410fb_mach_info *npd;
175
176 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
177 if (npd) {
178 memcpy(npd, pd, sizeof(*npd));
179 s3c_device_lcd.dev.platform_data = npd;
180 } else {
181 printk(KERN_ERR "no memory for LCD platform data\n");
182 }
Arnaud Patardf92273c2005-09-09 13:10:10 -0700183}
Arnaud Patardf92273c2005-09-09 13:10:10 -0700184
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185/* NAND Controller */
186
187static struct resource s3c_nand_resource[] = {
188 [0] = {
Ben Dooksce46a9c2008-10-21 14:06:26 +0100189 .start = S3C24XX_PA_NAND,
190 .end = S3C24XX_PA_NAND + S3C24XX_SZ_NAND - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191 .flags = IORESOURCE_MEM,
192 }
193};
194
195struct platform_device s3c_device_nand = {
196 .name = "s3c2410-nand",
197 .id = -1,
198 .num_resources = ARRAY_SIZE(s3c_nand_resource),
199 .resource = s3c_nand_resource,
200};
201
202EXPORT_SYMBOL(s3c_device_nand);
203
204/* USB Device (Gadget)*/
205
206static struct resource s3c_usbgadget_resource[] = {
207 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000208 .start = S3C24XX_PA_USBDEV,
209 .end = S3C24XX_PA_USBDEV + S3C24XX_SZ_USBDEV - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210 .flags = IORESOURCE_MEM,
211 },
212 [1] = {
213 .start = IRQ_USBD,
214 .end = IRQ_USBD,
215 .flags = IORESOURCE_IRQ,
216 }
217
218};
219
220struct platform_device s3c_device_usbgadget = {
221 .name = "s3c2410-usbgadget",
222 .id = -1,
223 .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
224 .resource = s3c_usbgadget_resource,
225};
226
227EXPORT_SYMBOL(s3c_device_usbgadget);
228
Arnaud Patard0dcfc322007-02-13 00:18:33 +0100229void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)
230{
231 struct s3c2410_udc_mach_info *npd;
232
233 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
234 if (npd) {
235 memcpy(npd, pd, sizeof(*npd));
236 s3c_device_usbgadget.dev.platform_data = npd;
237 } else {
238 printk(KERN_ERR "no memory for udc platform data\n");
239 }
240}
241
242
Linus Torvalds1da177e2005-04-16 15:20:36 -0700243/* Watchdog */
244
245static struct resource s3c_wdt_resource[] = {
246 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000247 .start = S3C24XX_PA_WATCHDOG,
248 .end = S3C24XX_PA_WATCHDOG + S3C24XX_SZ_WATCHDOG - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249 .flags = IORESOURCE_MEM,
250 },
251 [1] = {
252 .start = IRQ_WDT,
253 .end = IRQ_WDT,
254 .flags = IORESOURCE_IRQ,
255 }
256
257};
258
259struct platform_device s3c_device_wdt = {
260 .name = "s3c2410-wdt",
261 .id = -1,
262 .num_resources = ARRAY_SIZE(s3c_wdt_resource),
263 .resource = s3c_wdt_resource,
264};
265
266EXPORT_SYMBOL(s3c_device_wdt);
267
Linus Torvalds1da177e2005-04-16 15:20:36 -0700268/* IIS */
269
270static struct resource s3c_iis_resource[] = {
271 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000272 .start = S3C24XX_PA_IIS,
273 .end = S3C24XX_PA_IIS + S3C24XX_SZ_IIS -1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700274 .flags = IORESOURCE_MEM,
275 }
276};
277
278static u64 s3c_device_iis_dmamask = 0xffffffffUL;
279
280struct platform_device s3c_device_iis = {
281 .name = "s3c2410-iis",
282 .id = -1,
283 .num_resources = ARRAY_SIZE(s3c_iis_resource),
284 .resource = s3c_iis_resource,
285 .dev = {
286 .dma_mask = &s3c_device_iis_dmamask,
287 .coherent_dma_mask = 0xffffffffUL
288 }
289};
290
291EXPORT_SYMBOL(s3c_device_iis);
292
293/* RTC */
294
295static struct resource s3c_rtc_resource[] = {
296 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000297 .start = S3C24XX_PA_RTC,
298 .end = S3C24XX_PA_RTC + 0xff,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299 .flags = IORESOURCE_MEM,
300 },
301 [1] = {
302 .start = IRQ_RTC,
303 .end = IRQ_RTC,
304 .flags = IORESOURCE_IRQ,
305 },
306 [2] = {
307 .start = IRQ_TICK,
308 .end = IRQ_TICK,
309 .flags = IORESOURCE_IRQ
310 }
311};
312
313struct platform_device s3c_device_rtc = {
314 .name = "s3c2410-rtc",
315 .id = -1,
316 .num_resources = ARRAY_SIZE(s3c_rtc_resource),
317 .resource = s3c_rtc_resource,
318};
319
320EXPORT_SYMBOL(s3c_device_rtc);
321
322/* ADC */
323
324static struct resource s3c_adc_resource[] = {
325 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000326 .start = S3C24XX_PA_ADC,
327 .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700328 .flags = IORESOURCE_MEM,
329 },
330 [1] = {
331 .start = IRQ_TC,
Ben Dooks083d06e2006-02-08 22:03:31 +0000332 .end = IRQ_TC,
333 .flags = IORESOURCE_IRQ,
334 },
335 [2] = {
336 .start = IRQ_ADC,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700337 .end = IRQ_ADC,
338 .flags = IORESOURCE_IRQ,
339 }
340
341};
342
343struct platform_device s3c_device_adc = {
Ben Dooks28ab44c5b2008-12-18 14:20:04 +0000344 .name = "s3c24xx-adc",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700345 .id = -1,
346 .num_resources = ARRAY_SIZE(s3c_adc_resource),
347 .resource = s3c_adc_resource,
348};
349
Ben Dooks28ab44c5b2008-12-18 14:20:04 +0000350/* HWMON */
351
352struct platform_device s3c_device_hwmon = {
353 .name = "s3c24xx-hwmon",
354 .id = -1,
355 .dev.parent = &s3c_device_adc.dev,
356};
357
Linus Torvalds1da177e2005-04-16 15:20:36 -0700358/* SDI */
359
360static struct resource s3c_sdi_resource[] = {
361 [0] = {
Ben Dooksce46a9c2008-10-21 14:06:26 +0100362 .start = S3C24XX_PA_SDI,
363 .end = S3C24XX_PA_SDI + S3C24XX_SZ_SDI - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700364 .flags = IORESOURCE_MEM,
365 },
366 [1] = {
367 .start = IRQ_SDI,
368 .end = IRQ_SDI,
369 .flags = IORESOURCE_IRQ,
370 }
371
372};
373
374struct platform_device s3c_device_sdi = {
375 .name = "s3c2410-sdi",
376 .id = -1,
377 .num_resources = ARRAY_SIZE(s3c_sdi_resource),
378 .resource = s3c_sdi_resource,
379};
380
381EXPORT_SYMBOL(s3c_device_sdi);
382
383/* SPI (0) */
384
385static struct resource s3c_spi0_resource[] = {
386 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000387 .start = S3C24XX_PA_SPI,
388 .end = S3C24XX_PA_SPI + 0x1f,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700389 .flags = IORESOURCE_MEM,
390 },
391 [1] = {
392 .start = IRQ_SPI0,
393 .end = IRQ_SPI0,
394 .flags = IORESOURCE_IRQ,
395 }
396
397};
398
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000399static u64 s3c_device_spi0_dmamask = 0xffffffffUL;
400
Linus Torvalds1da177e2005-04-16 15:20:36 -0700401struct platform_device s3c_device_spi0 = {
402 .name = "s3c2410-spi",
403 .id = 0,
404 .num_resources = ARRAY_SIZE(s3c_spi0_resource),
405 .resource = s3c_spi0_resource,
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000406 .dev = {
407 .dma_mask = &s3c_device_spi0_dmamask,
408 .coherent_dma_mask = 0xffffffffUL
409 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700410};
411
412EXPORT_SYMBOL(s3c_device_spi0);
413
414/* SPI (1) */
415
416static struct resource s3c_spi1_resource[] = {
417 [0] = {
Sandeep Sanjay Patile9033822007-05-16 10:51:45 +0100418 .start = S3C24XX_PA_SPI + S3C2410_SPI1,
419 .end = S3C24XX_PA_SPI + S3C2410_SPI1 + 0x1f,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700420 .flags = IORESOURCE_MEM,
421 },
422 [1] = {
423 .start = IRQ_SPI1,
424 .end = IRQ_SPI1,
425 .flags = IORESOURCE_IRQ,
426 }
427
428};
429
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000430static u64 s3c_device_spi1_dmamask = 0xffffffffUL;
431
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432struct platform_device s3c_device_spi1 = {
433 .name = "s3c2410-spi",
434 .id = 1,
435 .num_resources = ARRAY_SIZE(s3c_spi1_resource),
436 .resource = s3c_spi1_resource,
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000437 .dev = {
438 .dma_mask = &s3c_device_spi1_dmamask,
439 .coherent_dma_mask = 0xffffffffUL
440 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700441};
442
443EXPORT_SYMBOL(s3c_device_spi1);
444
Linus Torvalds1da177e2005-04-16 15:20:36 -0700445#ifdef CONFIG_CPU_S3C2440
446
447/* Camif Controller */
448
449static struct resource s3c_camif_resource[] = {
450 [0] = {
451 .start = S3C2440_PA_CAMIF,
Ben Dooksa0e0adb2005-10-28 15:26:42 +0100452 .end = S3C2440_PA_CAMIF + S3C2440_SZ_CAMIF - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700453 .flags = IORESOURCE_MEM,
454 },
455 [1] = {
456 .start = IRQ_CAM,
457 .end = IRQ_CAM,
458 .flags = IORESOURCE_IRQ,
459 }
460
461};
462
463static u64 s3c_device_camif_dmamask = 0xffffffffUL;
464
465struct platform_device s3c_device_camif = {
466 .name = "s3c2440-camif",
467 .id = -1,
468 .num_resources = ARRAY_SIZE(s3c_camif_resource),
469 .resource = s3c_camif_resource,
470 .dev = {
471 .dma_mask = &s3c_device_camif_dmamask,
472 .coherent_dma_mask = 0xffffffffUL
473 }
474};
475
476EXPORT_SYMBOL(s3c_device_camif);
477
Mark Brownd91e9a72009-08-05 18:29:57 +0100478/* AC97 */
479
480static struct resource s3c_ac97_resource[] = {
481 [0] = {
482 .start = S3C2440_PA_AC97,
483 .end = S3C2440_PA_AC97 + S3C2440_SZ_AC97 -1,
484 .flags = IORESOURCE_MEM,
485 },
486 [1] = {
487 .start = IRQ_S3C244x_AC97,
488 .end = IRQ_S3C244x_AC97,
489 .flags = IORESOURCE_IRQ,
490 },
491 [2] = {
492 .name = "PCM out",
493 .start = DMACH_PCM_OUT,
494 .end = DMACH_PCM_OUT,
495 .flags = IORESOURCE_DMA,
496 },
497 [3] = {
498 .name = "PCM in",
499 .start = DMACH_PCM_IN,
500 .end = DMACH_PCM_IN,
501 .flags = IORESOURCE_DMA,
502 },
503 [4] = {
504 .name = "Mic in",
505 .start = DMACH_MIC_IN,
506 .end = DMACH_MIC_IN,
507 .flags = IORESOURCE_DMA,
508 },
509};
510
511static u64 s3c_device_ac97_dmamask = 0xffffffffUL;
512
513struct platform_device s3c_device_ac97 = {
514 .name = "s3c-ac97",
515 .id = -1,
516 .num_resources = ARRAY_SIZE(s3c_ac97_resource),
517 .resource = s3c_ac97_resource,
518 .dev = {
519 .dma_mask = &s3c_device_ac97_dmamask,
520 .coherent_dma_mask = 0xffffffffUL
521 }
522};
523
524EXPORT_SYMBOL(s3c_device_ac97);
525
Linus Torvalds1da177e2005-04-16 15:20:36 -0700526#endif // CONFIG_CPU_S32440