blob: 14d4f0bc12539faa70d909784f4bc7ca7c86093f [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>
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#include <asm/irq.h>
30
Ben Dooksa2b7ba92008-10-07 22:26:09 +010031#include <plat/regs-serial.h>
Ben Dooks57bd4b92008-10-30 10:14:37 +000032#include <plat/udc.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070033
Ben Dooksa2b7ba92008-10-07 22:26:09 +010034#include <plat/devs.h>
35#include <plat/cpu.h>
Ben Dooks13622702008-10-30 10:14:38 +000036#include <plat/regs-spi.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070037
38/* Serial port registrations */
39
Ben Dooks66a9b492006-06-18 23:04:05 +010040static struct resource s3c2410_uart0_resource[] = {
41 [0] = {
42 .start = S3C2410_PA_UART0,
43 .end = S3C2410_PA_UART0 + 0x3fff,
44 .flags = IORESOURCE_MEM,
45 },
46 [1] = {
47 .start = IRQ_S3CUART_RX0,
48 .end = IRQ_S3CUART_ERR0,
49 .flags = IORESOURCE_IRQ,
50 }
51};
52
53static struct resource s3c2410_uart1_resource[] = {
54 [0] = {
55 .start = S3C2410_PA_UART1,
56 .end = S3C2410_PA_UART1 + 0x3fff,
57 .flags = IORESOURCE_MEM,
58 },
59 [1] = {
60 .start = IRQ_S3CUART_RX1,
61 .end = IRQ_S3CUART_ERR1,
62 .flags = IORESOURCE_IRQ,
63 }
64};
65
66static struct resource s3c2410_uart2_resource[] = {
67 [0] = {
68 .start = S3C2410_PA_UART2,
69 .end = S3C2410_PA_UART2 + 0x3fff,
70 .flags = IORESOURCE_MEM,
71 },
72 [1] = {
73 .start = IRQ_S3CUART_RX2,
74 .end = IRQ_S3CUART_ERR2,
75 .flags = IORESOURCE_IRQ,
76 }
77};
78
79struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
80 [0] = {
81 .resources = s3c2410_uart0_resource,
82 .nr_resources = ARRAY_SIZE(s3c2410_uart0_resource),
83 },
84 [1] = {
85 .resources = s3c2410_uart1_resource,
86 .nr_resources = ARRAY_SIZE(s3c2410_uart1_resource),
87 },
88 [2] = {
89 .resources = s3c2410_uart2_resource,
90 .nr_resources = ARRAY_SIZE(s3c2410_uart2_resource),
91 },
92};
93
94/* yart devices */
95
96static struct platform_device s3c24xx_uart_device0 = {
97 .id = 0,
98};
99
100static struct platform_device s3c24xx_uart_device1 = {
101 .id = 1,
102};
103
104static struct platform_device s3c24xx_uart_device2 = {
105 .id = 2,
106};
107
108struct platform_device *s3c24xx_uart_src[3] = {
109 &s3c24xx_uart_device0,
110 &s3c24xx_uart_device1,
111 &s3c24xx_uart_device2,
112};
113
114struct platform_device *s3c24xx_uart_devs[3] = {
115};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116
117/* USB Host Controller */
118
119static struct resource s3c_usb_resource[] = {
120 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000121 .start = S3C24XX_PA_USBHOST,
122 .end = S3C24XX_PA_USBHOST + S3C24XX_SZ_USBHOST - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123 .flags = IORESOURCE_MEM,
124 },
125 [1] = {
126 .start = IRQ_USBH,
127 .end = IRQ_USBH,
128 .flags = IORESOURCE_IRQ,
129 }
130};
131
132static u64 s3c_device_usb_dmamask = 0xffffffffUL;
133
134struct platform_device s3c_device_usb = {
135 .name = "s3c2410-ohci",
136 .id = -1,
137 .num_resources = ARRAY_SIZE(s3c_usb_resource),
138 .resource = s3c_usb_resource,
139 .dev = {
140 .dma_mask = &s3c_device_usb_dmamask,
141 .coherent_dma_mask = 0xffffffffUL
142 }
143};
144
145EXPORT_SYMBOL(s3c_device_usb);
146
147/* LCD Controller */
148
149static struct resource s3c_lcd_resource[] = {
150 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000151 .start = S3C24XX_PA_LCD,
152 .end = S3C24XX_PA_LCD + S3C24XX_SZ_LCD - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700153 .flags = IORESOURCE_MEM,
154 },
155 [1] = {
156 .start = IRQ_LCD,
157 .end = IRQ_LCD,
158 .flags = IORESOURCE_IRQ,
159 }
160
161};
162
163static u64 s3c_device_lcd_dmamask = 0xffffffffUL;
164
165struct platform_device s3c_device_lcd = {
166 .name = "s3c2410-lcd",
167 .id = -1,
168 .num_resources = ARRAY_SIZE(s3c_lcd_resource),
169 .resource = s3c_lcd_resource,
170 .dev = {
Ben Dooks6904b242005-06-29 11:09:15 +0100171 .dma_mask = &s3c_device_lcd_dmamask,
172 .coherent_dma_mask = 0xffffffffUL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173 }
174};
175
176EXPORT_SYMBOL(s3c_device_lcd);
177
Ben Dooks893b0302005-10-28 15:31:45 +0100178void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
Arnaud Patardf92273c2005-09-09 13:10:10 -0700179{
Ben Dooks893b0302005-10-28 15:31:45 +0100180 struct s3c2410fb_mach_info *npd;
181
182 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
183 if (npd) {
184 memcpy(npd, pd, sizeof(*npd));
185 s3c_device_lcd.dev.platform_data = npd;
186 } else {
187 printk(KERN_ERR "no memory for LCD platform data\n");
188 }
Arnaud Patardf92273c2005-09-09 13:10:10 -0700189}
Arnaud Patardf92273c2005-09-09 13:10:10 -0700190
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191/* NAND Controller */
192
193static struct resource s3c_nand_resource[] = {
194 [0] = {
Ben Dooksce46a9c2008-10-21 14:06:26 +0100195 .start = S3C24XX_PA_NAND,
196 .end = S3C24XX_PA_NAND + S3C24XX_SZ_NAND - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700197 .flags = IORESOURCE_MEM,
198 }
199};
200
201struct platform_device s3c_device_nand = {
202 .name = "s3c2410-nand",
203 .id = -1,
204 .num_resources = ARRAY_SIZE(s3c_nand_resource),
205 .resource = s3c_nand_resource,
206};
207
208EXPORT_SYMBOL(s3c_device_nand);
209
210/* USB Device (Gadget)*/
211
212static struct resource s3c_usbgadget_resource[] = {
213 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000214 .start = S3C24XX_PA_USBDEV,
215 .end = S3C24XX_PA_USBDEV + S3C24XX_SZ_USBDEV - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700216 .flags = IORESOURCE_MEM,
217 },
218 [1] = {
219 .start = IRQ_USBD,
220 .end = IRQ_USBD,
221 .flags = IORESOURCE_IRQ,
222 }
223
224};
225
226struct platform_device s3c_device_usbgadget = {
227 .name = "s3c2410-usbgadget",
228 .id = -1,
229 .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
230 .resource = s3c_usbgadget_resource,
231};
232
233EXPORT_SYMBOL(s3c_device_usbgadget);
234
Arnaud Patard0dcfc322007-02-13 00:18:33 +0100235void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)
236{
237 struct s3c2410_udc_mach_info *npd;
238
239 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
240 if (npd) {
241 memcpy(npd, pd, sizeof(*npd));
242 s3c_device_usbgadget.dev.platform_data = npd;
243 } else {
244 printk(KERN_ERR "no memory for udc platform data\n");
245 }
246}
247
248
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249/* Watchdog */
250
251static struct resource s3c_wdt_resource[] = {
252 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000253 .start = S3C24XX_PA_WATCHDOG,
254 .end = S3C24XX_PA_WATCHDOG + S3C24XX_SZ_WATCHDOG - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700255 .flags = IORESOURCE_MEM,
256 },
257 [1] = {
258 .start = IRQ_WDT,
259 .end = IRQ_WDT,
260 .flags = IORESOURCE_IRQ,
261 }
262
263};
264
265struct platform_device s3c_device_wdt = {
266 .name = "s3c2410-wdt",
267 .id = -1,
268 .num_resources = ARRAY_SIZE(s3c_wdt_resource),
269 .resource = s3c_wdt_resource,
270};
271
272EXPORT_SYMBOL(s3c_device_wdt);
273
Linus Torvalds1da177e2005-04-16 15:20:36 -0700274/* IIS */
275
276static struct resource s3c_iis_resource[] = {
277 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000278 .start = S3C24XX_PA_IIS,
279 .end = S3C24XX_PA_IIS + S3C24XX_SZ_IIS -1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700280 .flags = IORESOURCE_MEM,
281 }
282};
283
284static u64 s3c_device_iis_dmamask = 0xffffffffUL;
285
286struct platform_device s3c_device_iis = {
287 .name = "s3c2410-iis",
288 .id = -1,
289 .num_resources = ARRAY_SIZE(s3c_iis_resource),
290 .resource = s3c_iis_resource,
291 .dev = {
292 .dma_mask = &s3c_device_iis_dmamask,
293 .coherent_dma_mask = 0xffffffffUL
294 }
295};
296
297EXPORT_SYMBOL(s3c_device_iis);
298
299/* RTC */
300
301static struct resource s3c_rtc_resource[] = {
302 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000303 .start = S3C24XX_PA_RTC,
304 .end = S3C24XX_PA_RTC + 0xff,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700305 .flags = IORESOURCE_MEM,
306 },
307 [1] = {
308 .start = IRQ_RTC,
309 .end = IRQ_RTC,
310 .flags = IORESOURCE_IRQ,
311 },
312 [2] = {
313 .start = IRQ_TICK,
314 .end = IRQ_TICK,
315 .flags = IORESOURCE_IRQ
316 }
317};
318
319struct platform_device s3c_device_rtc = {
320 .name = "s3c2410-rtc",
321 .id = -1,
322 .num_resources = ARRAY_SIZE(s3c_rtc_resource),
323 .resource = s3c_rtc_resource,
324};
325
326EXPORT_SYMBOL(s3c_device_rtc);
327
328/* ADC */
329
330static struct resource s3c_adc_resource[] = {
331 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000332 .start = S3C24XX_PA_ADC,
333 .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700334 .flags = IORESOURCE_MEM,
335 },
336 [1] = {
337 .start = IRQ_TC,
Ben Dooks083d06e2006-02-08 22:03:31 +0000338 .end = IRQ_TC,
339 .flags = IORESOURCE_IRQ,
340 },
341 [2] = {
342 .start = IRQ_ADC,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700343 .end = IRQ_ADC,
344 .flags = IORESOURCE_IRQ,
345 }
346
347};
348
349struct platform_device s3c_device_adc = {
Ben Dooks28ab44c5b2008-12-18 14:20:04 +0000350 .name = "s3c24xx-adc",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351 .id = -1,
352 .num_resources = ARRAY_SIZE(s3c_adc_resource),
353 .resource = s3c_adc_resource,
354};
355
Ben Dooks28ab44c5b2008-12-18 14:20:04 +0000356/* HWMON */
357
358struct platform_device s3c_device_hwmon = {
359 .name = "s3c24xx-hwmon",
360 .id = -1,
361 .dev.parent = &s3c_device_adc.dev,
362};
363
Linus Torvalds1da177e2005-04-16 15:20:36 -0700364/* SDI */
365
366static struct resource s3c_sdi_resource[] = {
367 [0] = {
Ben Dooksce46a9c2008-10-21 14:06:26 +0100368 .start = S3C24XX_PA_SDI,
369 .end = S3C24XX_PA_SDI + S3C24XX_SZ_SDI - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700370 .flags = IORESOURCE_MEM,
371 },
372 [1] = {
373 .start = IRQ_SDI,
374 .end = IRQ_SDI,
375 .flags = IORESOURCE_IRQ,
376 }
377
378};
379
380struct platform_device s3c_device_sdi = {
381 .name = "s3c2410-sdi",
382 .id = -1,
383 .num_resources = ARRAY_SIZE(s3c_sdi_resource),
384 .resource = s3c_sdi_resource,
385};
386
387EXPORT_SYMBOL(s3c_device_sdi);
388
389/* SPI (0) */
390
391static struct resource s3c_spi0_resource[] = {
392 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000393 .start = S3C24XX_PA_SPI,
394 .end = S3C24XX_PA_SPI + 0x1f,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700395 .flags = IORESOURCE_MEM,
396 },
397 [1] = {
398 .start = IRQ_SPI0,
399 .end = IRQ_SPI0,
400 .flags = IORESOURCE_IRQ,
401 }
402
403};
404
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000405static u64 s3c_device_spi0_dmamask = 0xffffffffUL;
406
Linus Torvalds1da177e2005-04-16 15:20:36 -0700407struct platform_device s3c_device_spi0 = {
408 .name = "s3c2410-spi",
409 .id = 0,
410 .num_resources = ARRAY_SIZE(s3c_spi0_resource),
411 .resource = s3c_spi0_resource,
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000412 .dev = {
413 .dma_mask = &s3c_device_spi0_dmamask,
414 .coherent_dma_mask = 0xffffffffUL
415 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700416};
417
418EXPORT_SYMBOL(s3c_device_spi0);
419
420/* SPI (1) */
421
422static struct resource s3c_spi1_resource[] = {
423 [0] = {
Sandeep Sanjay Patile9033822007-05-16 10:51:45 +0100424 .start = S3C24XX_PA_SPI + S3C2410_SPI1,
425 .end = S3C24XX_PA_SPI + S3C2410_SPI1 + 0x1f,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700426 .flags = IORESOURCE_MEM,
427 },
428 [1] = {
429 .start = IRQ_SPI1,
430 .end = IRQ_SPI1,
431 .flags = IORESOURCE_IRQ,
432 }
433
434};
435
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000436static u64 s3c_device_spi1_dmamask = 0xffffffffUL;
437
Linus Torvalds1da177e2005-04-16 15:20:36 -0700438struct platform_device s3c_device_spi1 = {
439 .name = "s3c2410-spi",
440 .id = 1,
441 .num_resources = ARRAY_SIZE(s3c_spi1_resource),
442 .resource = s3c_spi1_resource,
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000443 .dev = {
444 .dma_mask = &s3c_device_spi1_dmamask,
445 .coherent_dma_mask = 0xffffffffUL
446 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700447};
448
449EXPORT_SYMBOL(s3c_device_spi1);
450
Linus Torvalds1da177e2005-04-16 15:20:36 -0700451#ifdef CONFIG_CPU_S3C2440
452
453/* Camif Controller */
454
455static struct resource s3c_camif_resource[] = {
456 [0] = {
457 .start = S3C2440_PA_CAMIF,
Ben Dooksa0e0adb2005-10-28 15:26:42 +0100458 .end = S3C2440_PA_CAMIF + S3C2440_SZ_CAMIF - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700459 .flags = IORESOURCE_MEM,
460 },
461 [1] = {
462 .start = IRQ_CAM,
463 .end = IRQ_CAM,
464 .flags = IORESOURCE_IRQ,
465 }
466
467};
468
469static u64 s3c_device_camif_dmamask = 0xffffffffUL;
470
471struct platform_device s3c_device_camif = {
472 .name = "s3c2440-camif",
473 .id = -1,
474 .num_resources = ARRAY_SIZE(s3c_camif_resource),
475 .resource = s3c_camif_resource,
476 .dev = {
477 .dma_mask = &s3c_device_camif_dmamask,
478 .coherent_dma_mask = 0xffffffffUL
479 }
480};
481
482EXPORT_SYMBOL(s3c_device_camif);
483
484#endif // CONFIG_CPU_S32440