blob: 986d4e5408f5735749dbfb5961c396914f05cf0e [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>
Ben Dooks22c810a2010-01-18 16:24:22 +090035#include <plat/mci.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070036
Ben Dooksa2b7ba92008-10-07 22:26:09 +010037#include <plat/devs.h>
38#include <plat/cpu.h>
Ben Dooks13622702008-10-30 10:14:38 +000039#include <plat/regs-spi.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070040
Arnaud Patardce8877b2009-12-23 19:25:05 +000041#include <mach/ts.h>
42
Linus Torvalds1da177e2005-04-16 15:20:36 -070043/* Serial port registrations */
44
Ben Dooks66a9b492006-06-18 23:04:05 +010045static struct resource s3c2410_uart0_resource[] = {
46 [0] = {
47 .start = S3C2410_PA_UART0,
48 .end = S3C2410_PA_UART0 + 0x3fff,
49 .flags = IORESOURCE_MEM,
50 },
51 [1] = {
52 .start = IRQ_S3CUART_RX0,
53 .end = IRQ_S3CUART_ERR0,
54 .flags = IORESOURCE_IRQ,
55 }
56};
57
58static struct resource s3c2410_uart1_resource[] = {
59 [0] = {
60 .start = S3C2410_PA_UART1,
61 .end = S3C2410_PA_UART1 + 0x3fff,
62 .flags = IORESOURCE_MEM,
63 },
64 [1] = {
65 .start = IRQ_S3CUART_RX1,
66 .end = IRQ_S3CUART_ERR1,
67 .flags = IORESOURCE_IRQ,
68 }
69};
70
71static struct resource s3c2410_uart2_resource[] = {
72 [0] = {
73 .start = S3C2410_PA_UART2,
74 .end = S3C2410_PA_UART2 + 0x3fff,
75 .flags = IORESOURCE_MEM,
76 },
77 [1] = {
78 .start = IRQ_S3CUART_RX2,
79 .end = IRQ_S3CUART_ERR2,
80 .flags = IORESOURCE_IRQ,
81 }
82};
83
Ben Dooksdbf35992008-11-04 15:29:09 +000084static struct resource s3c2410_uart3_resource[] = {
85 [0] = {
86 .start = S3C2443_PA_UART3,
87 .end = S3C2443_PA_UART3 + 0x3fff,
88 .flags = IORESOURCE_MEM,
89 },
90 [1] = {
91 .start = IRQ_S3CUART_RX3,
92 .end = IRQ_S3CUART_ERR3,
93 .flags = IORESOURCE_IRQ,
94 },
95};
96
Ben Dooks66a9b492006-06-18 23:04:05 +010097struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
98 [0] = {
99 .resources = s3c2410_uart0_resource,
100 .nr_resources = ARRAY_SIZE(s3c2410_uart0_resource),
101 },
102 [1] = {
103 .resources = s3c2410_uart1_resource,
104 .nr_resources = ARRAY_SIZE(s3c2410_uart1_resource),
105 },
106 [2] = {
107 .resources = s3c2410_uart2_resource,
108 .nr_resources = ARRAY_SIZE(s3c2410_uart2_resource),
109 },
Ben Dooksdbf35992008-11-04 15:29:09 +0000110 [3] = {
111 .resources = s3c2410_uart3_resource,
112 .nr_resources = ARRAY_SIZE(s3c2410_uart3_resource),
113 },
Ben Dooks66a9b492006-06-18 23:04:05 +0100114};
115
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116/* LCD Controller */
117
118static struct resource s3c_lcd_resource[] = {
119 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000120 .start = S3C24XX_PA_LCD,
121 .end = S3C24XX_PA_LCD + S3C24XX_SZ_LCD - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122 .flags = IORESOURCE_MEM,
123 },
124 [1] = {
125 .start = IRQ_LCD,
126 .end = IRQ_LCD,
127 .flags = IORESOURCE_IRQ,
128 }
129
130};
131
132static u64 s3c_device_lcd_dmamask = 0xffffffffUL;
133
134struct platform_device s3c_device_lcd = {
135 .name = "s3c2410-lcd",
136 .id = -1,
137 .num_resources = ARRAY_SIZE(s3c_lcd_resource),
138 .resource = s3c_lcd_resource,
139 .dev = {
Ben Dooks6904b242005-06-29 11:09:15 +0100140 .dma_mask = &s3c_device_lcd_dmamask,
141 .coherent_dma_mask = 0xffffffffUL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142 }
143};
144
145EXPORT_SYMBOL(s3c_device_lcd);
146
Ben Dooks893b0302005-10-28 15:31:45 +0100147void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
Arnaud Patardf92273c2005-09-09 13:10:10 -0700148{
Ben Dooks893b0302005-10-28 15:31:45 +0100149 struct s3c2410fb_mach_info *npd;
150
151 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
152 if (npd) {
153 memcpy(npd, pd, sizeof(*npd));
154 s3c_device_lcd.dev.platform_data = npd;
155 } else {
156 printk(KERN_ERR "no memory for LCD platform data\n");
157 }
Arnaud Patardf92273c2005-09-09 13:10:10 -0700158}
Arnaud Patardf92273c2005-09-09 13:10:10 -0700159
Arnaud Patardce8877b2009-12-23 19:25:05 +0000160/* Touchscreen */
161struct platform_device s3c_device_ts = {
162 .name = "s3c2410-ts",
163 .id = -1,
164};
165EXPORT_SYMBOL(s3c_device_ts);
166
167static struct s3c2410_ts_mach_info s3c2410ts_info;
168
169void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *hard_s3c2410ts_info)
170{
171 memcpy(&s3c2410ts_info, hard_s3c2410ts_info, sizeof(struct s3c2410_ts_mach_info));
172 s3c_device_ts.dev.platform_data = &s3c2410ts_info;
173}
174EXPORT_SYMBOL(s3c24xx_ts_set_platdata);
175
Linus Torvalds1da177e2005-04-16 15:20:36 -0700176/* USB Device (Gadget)*/
177
178static struct resource s3c_usbgadget_resource[] = {
179 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000180 .start = S3C24XX_PA_USBDEV,
181 .end = S3C24XX_PA_USBDEV + S3C24XX_SZ_USBDEV - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182 .flags = IORESOURCE_MEM,
183 },
184 [1] = {
185 .start = IRQ_USBD,
186 .end = IRQ_USBD,
187 .flags = IORESOURCE_IRQ,
188 }
189
190};
191
192struct platform_device s3c_device_usbgadget = {
193 .name = "s3c2410-usbgadget",
194 .id = -1,
195 .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
196 .resource = s3c_usbgadget_resource,
197};
198
199EXPORT_SYMBOL(s3c_device_usbgadget);
200
Arnaud Patard0dcfc322007-02-13 00:18:33 +0100201void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)
202{
203 struct s3c2410_udc_mach_info *npd;
204
205 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
206 if (npd) {
207 memcpy(npd, pd, sizeof(*npd));
208 s3c_device_usbgadget.dev.platform_data = npd;
209 } else {
210 printk(KERN_ERR "no memory for udc platform data\n");
211 }
212}
213
214
Linus Torvalds1da177e2005-04-16 15:20:36 -0700215/* Watchdog */
216
217static struct resource s3c_wdt_resource[] = {
218 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000219 .start = S3C24XX_PA_WATCHDOG,
220 .end = S3C24XX_PA_WATCHDOG + S3C24XX_SZ_WATCHDOG - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221 .flags = IORESOURCE_MEM,
222 },
223 [1] = {
224 .start = IRQ_WDT,
225 .end = IRQ_WDT,
226 .flags = IORESOURCE_IRQ,
227 }
228
229};
230
231struct platform_device s3c_device_wdt = {
232 .name = "s3c2410-wdt",
233 .id = -1,
234 .num_resources = ARRAY_SIZE(s3c_wdt_resource),
235 .resource = s3c_wdt_resource,
236};
237
238EXPORT_SYMBOL(s3c_device_wdt);
239
Linus Torvalds1da177e2005-04-16 15:20:36 -0700240/* IIS */
241
242static struct resource s3c_iis_resource[] = {
243 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000244 .start = S3C24XX_PA_IIS,
245 .end = S3C24XX_PA_IIS + S3C24XX_SZ_IIS -1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246 .flags = IORESOURCE_MEM,
247 }
248};
249
250static u64 s3c_device_iis_dmamask = 0xffffffffUL;
251
252struct platform_device s3c_device_iis = {
253 .name = "s3c2410-iis",
254 .id = -1,
255 .num_resources = ARRAY_SIZE(s3c_iis_resource),
256 .resource = s3c_iis_resource,
257 .dev = {
258 .dma_mask = &s3c_device_iis_dmamask,
259 .coherent_dma_mask = 0xffffffffUL
260 }
261};
262
263EXPORT_SYMBOL(s3c_device_iis);
264
265/* RTC */
266
267static struct resource s3c_rtc_resource[] = {
268 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000269 .start = S3C24XX_PA_RTC,
270 .end = S3C24XX_PA_RTC + 0xff,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700271 .flags = IORESOURCE_MEM,
272 },
273 [1] = {
274 .start = IRQ_RTC,
275 .end = IRQ_RTC,
276 .flags = IORESOURCE_IRQ,
277 },
278 [2] = {
279 .start = IRQ_TICK,
280 .end = IRQ_TICK,
281 .flags = IORESOURCE_IRQ
282 }
283};
284
285struct platform_device s3c_device_rtc = {
286 .name = "s3c2410-rtc",
287 .id = -1,
288 .num_resources = ARRAY_SIZE(s3c_rtc_resource),
289 .resource = s3c_rtc_resource,
290};
291
292EXPORT_SYMBOL(s3c_device_rtc);
293
294/* ADC */
295
296static struct resource s3c_adc_resource[] = {
297 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000298 .start = S3C24XX_PA_ADC,
299 .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700300 .flags = IORESOURCE_MEM,
301 },
302 [1] = {
303 .start = IRQ_TC,
Ben Dooks083d06e2006-02-08 22:03:31 +0000304 .end = IRQ_TC,
305 .flags = IORESOURCE_IRQ,
306 },
307 [2] = {
308 .start = IRQ_ADC,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700309 .end = IRQ_ADC,
310 .flags = IORESOURCE_IRQ,
311 }
312
313};
314
315struct platform_device s3c_device_adc = {
Ben Dooks28ab44c5b2008-12-18 14:20:04 +0000316 .name = "s3c24xx-adc",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700317 .id = -1,
318 .num_resources = ARRAY_SIZE(s3c_adc_resource),
319 .resource = s3c_adc_resource,
320};
321
Ben Dooks28ab44c5b2008-12-18 14:20:04 +0000322/* HWMON */
323
324struct platform_device s3c_device_hwmon = {
Ben Dooksc197cec2009-07-18 10:12:25 +0100325 .name = "s3c-hwmon",
Ben Dooks28ab44c5b2008-12-18 14:20:04 +0000326 .id = -1,
327 .dev.parent = &s3c_device_adc.dev,
328};
329
Linus Torvalds1da177e2005-04-16 15:20:36 -0700330/* SDI */
331
332static struct resource s3c_sdi_resource[] = {
333 [0] = {
Ben Dooksce46a9c2008-10-21 14:06:26 +0100334 .start = S3C24XX_PA_SDI,
335 .end = S3C24XX_PA_SDI + S3C24XX_SZ_SDI - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700336 .flags = IORESOURCE_MEM,
337 },
338 [1] = {
339 .start = IRQ_SDI,
340 .end = IRQ_SDI,
341 .flags = IORESOURCE_IRQ,
342 }
343
344};
345
346struct platform_device s3c_device_sdi = {
347 .name = "s3c2410-sdi",
348 .id = -1,
349 .num_resources = ARRAY_SIZE(s3c_sdi_resource),
350 .resource = s3c_sdi_resource,
351};
352
353EXPORT_SYMBOL(s3c_device_sdi);
354
Ben Dooks22c810a2010-01-18 16:24:22 +0900355void s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata)
356{
357 struct s3c24xx_mci_pdata *npd;
358
359 npd = kmemdup(pdata, sizeof(struct s3c24xx_mci_pdata), GFP_KERNEL);
360 if (!npd)
361 printk(KERN_ERR "%s: no memory to copy pdata", __func__);
362
363 s3c_device_sdi.dev.platform_data = npd;
364}
365
366
Linus Torvalds1da177e2005-04-16 15:20:36 -0700367/* SPI (0) */
368
369static struct resource s3c_spi0_resource[] = {
370 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000371 .start = S3C24XX_PA_SPI,
372 .end = S3C24XX_PA_SPI + 0x1f,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700373 .flags = IORESOURCE_MEM,
374 },
375 [1] = {
376 .start = IRQ_SPI0,
377 .end = IRQ_SPI0,
378 .flags = IORESOURCE_IRQ,
379 }
380
381};
382
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000383static u64 s3c_device_spi0_dmamask = 0xffffffffUL;
384
Linus Torvalds1da177e2005-04-16 15:20:36 -0700385struct platform_device s3c_device_spi0 = {
386 .name = "s3c2410-spi",
387 .id = 0,
388 .num_resources = ARRAY_SIZE(s3c_spi0_resource),
389 .resource = s3c_spi0_resource,
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000390 .dev = {
391 .dma_mask = &s3c_device_spi0_dmamask,
392 .coherent_dma_mask = 0xffffffffUL
393 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700394};
395
396EXPORT_SYMBOL(s3c_device_spi0);
397
398/* SPI (1) */
399
400static struct resource s3c_spi1_resource[] = {
401 [0] = {
Sandeep Sanjay Patile9033822007-05-16 10:51:45 +0100402 .start = S3C24XX_PA_SPI + S3C2410_SPI1,
403 .end = S3C24XX_PA_SPI + S3C2410_SPI1 + 0x1f,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700404 .flags = IORESOURCE_MEM,
405 },
406 [1] = {
407 .start = IRQ_SPI1,
408 .end = IRQ_SPI1,
409 .flags = IORESOURCE_IRQ,
410 }
411
412};
413
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000414static u64 s3c_device_spi1_dmamask = 0xffffffffUL;
415
Linus Torvalds1da177e2005-04-16 15:20:36 -0700416struct platform_device s3c_device_spi1 = {
417 .name = "s3c2410-spi",
418 .id = 1,
419 .num_resources = ARRAY_SIZE(s3c_spi1_resource),
420 .resource = s3c_spi1_resource,
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000421 .dev = {
422 .dma_mask = &s3c_device_spi1_dmamask,
423 .coherent_dma_mask = 0xffffffffUL
424 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700425};
426
427EXPORT_SYMBOL(s3c_device_spi1);
428
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429#ifdef CONFIG_CPU_S3C2440
430
431/* Camif Controller */
432
433static struct resource s3c_camif_resource[] = {
434 [0] = {
435 .start = S3C2440_PA_CAMIF,
Ben Dooksa0e0adb2005-10-28 15:26:42 +0100436 .end = S3C2440_PA_CAMIF + S3C2440_SZ_CAMIF - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700437 .flags = IORESOURCE_MEM,
438 },
439 [1] = {
440 .start = IRQ_CAM,
441 .end = IRQ_CAM,
442 .flags = IORESOURCE_IRQ,
443 }
444
445};
446
447static u64 s3c_device_camif_dmamask = 0xffffffffUL;
448
449struct platform_device s3c_device_camif = {
450 .name = "s3c2440-camif",
451 .id = -1,
452 .num_resources = ARRAY_SIZE(s3c_camif_resource),
453 .resource = s3c_camif_resource,
454 .dev = {
455 .dma_mask = &s3c_device_camif_dmamask,
456 .coherent_dma_mask = 0xffffffffUL
457 }
458};
459
460EXPORT_SYMBOL(s3c_device_camif);
461
Mark Brownd91e9a72009-08-05 18:29:57 +0100462/* AC97 */
463
464static struct resource s3c_ac97_resource[] = {
465 [0] = {
466 .start = S3C2440_PA_AC97,
467 .end = S3C2440_PA_AC97 + S3C2440_SZ_AC97 -1,
468 .flags = IORESOURCE_MEM,
469 },
470 [1] = {
471 .start = IRQ_S3C244x_AC97,
472 .end = IRQ_S3C244x_AC97,
473 .flags = IORESOURCE_IRQ,
474 },
475 [2] = {
476 .name = "PCM out",
477 .start = DMACH_PCM_OUT,
478 .end = DMACH_PCM_OUT,
479 .flags = IORESOURCE_DMA,
480 },
481 [3] = {
482 .name = "PCM in",
483 .start = DMACH_PCM_IN,
484 .end = DMACH_PCM_IN,
485 .flags = IORESOURCE_DMA,
486 },
487 [4] = {
488 .name = "Mic in",
489 .start = DMACH_MIC_IN,
490 .end = DMACH_MIC_IN,
491 .flags = IORESOURCE_DMA,
492 },
493};
494
495static u64 s3c_device_ac97_dmamask = 0xffffffffUL;
496
497struct platform_device s3c_device_ac97 = {
498 .name = "s3c-ac97",
499 .id = -1,
500 .num_resources = ARRAY_SIZE(s3c_ac97_resource),
501 .resource = s3c_ac97_resource,
502 .dev = {
503 .dma_mask = &s3c_device_ac97_dmamask,
504 .coherent_dma_mask = 0xffffffffUL
505 }
506};
507
508EXPORT_SYMBOL(s3c_device_ac97);
509
Linus Torvalds1da177e2005-04-16 15:20:36 -0700510#endif // CONFIG_CPU_S32440