blob: 4eb378c89a390541ca3e17bbd3d4eefaf866031b [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
Ben Dooksdbf35992008-11-04 15:29:09 +000079static struct resource s3c2410_uart3_resource[] = {
80 [0] = {
81 .start = S3C2443_PA_UART3,
82 .end = S3C2443_PA_UART3 + 0x3fff,
83 .flags = IORESOURCE_MEM,
84 },
85 [1] = {
86 .start = IRQ_S3CUART_RX3,
87 .end = IRQ_S3CUART_ERR3,
88 .flags = IORESOURCE_IRQ,
89 },
90};
91
Ben Dooks66a9b492006-06-18 23:04:05 +010092struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
93 [0] = {
94 .resources = s3c2410_uart0_resource,
95 .nr_resources = ARRAY_SIZE(s3c2410_uart0_resource),
96 },
97 [1] = {
98 .resources = s3c2410_uart1_resource,
99 .nr_resources = ARRAY_SIZE(s3c2410_uart1_resource),
100 },
101 [2] = {
102 .resources = s3c2410_uart2_resource,
103 .nr_resources = ARRAY_SIZE(s3c2410_uart2_resource),
104 },
Ben Dooksdbf35992008-11-04 15:29:09 +0000105 [3] = {
106 .resources = s3c2410_uart3_resource,
107 .nr_resources = ARRAY_SIZE(s3c2410_uart3_resource),
108 },
Ben Dooks66a9b492006-06-18 23:04:05 +0100109};
110
111/* yart devices */
112
113static struct platform_device s3c24xx_uart_device0 = {
114 .id = 0,
115};
116
117static struct platform_device s3c24xx_uart_device1 = {
118 .id = 1,
119};
120
121static struct platform_device s3c24xx_uart_device2 = {
122 .id = 2,
123};
124
Ben Dooksdbf35992008-11-04 15:29:09 +0000125static struct platform_device s3c24xx_uart_device3 = {
126 .id = 3,
127};
128
129struct platform_device *s3c24xx_uart_src[4] = {
Ben Dooks66a9b492006-06-18 23:04:05 +0100130 &s3c24xx_uart_device0,
131 &s3c24xx_uart_device1,
132 &s3c24xx_uart_device2,
Ben Dooksdbf35992008-11-04 15:29:09 +0000133 &s3c24xx_uart_device3,
Ben Dooks66a9b492006-06-18 23:04:05 +0100134};
135
Ben Dooksdbf35992008-11-04 15:29:09 +0000136struct platform_device *s3c24xx_uart_devs[4] = {
Ben Dooks66a9b492006-06-18 23:04:05 +0100137};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139/* LCD Controller */
140
141static struct resource s3c_lcd_resource[] = {
142 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000143 .start = S3C24XX_PA_LCD,
144 .end = S3C24XX_PA_LCD + S3C24XX_SZ_LCD - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145 .flags = IORESOURCE_MEM,
146 },
147 [1] = {
148 .start = IRQ_LCD,
149 .end = IRQ_LCD,
150 .flags = IORESOURCE_IRQ,
151 }
152
153};
154
155static u64 s3c_device_lcd_dmamask = 0xffffffffUL;
156
157struct 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 = {
Ben Dooks6904b242005-06-29 11:09:15 +0100163 .dma_mask = &s3c_device_lcd_dmamask,
164 .coherent_dma_mask = 0xffffffffUL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165 }
166};
167
168EXPORT_SYMBOL(s3c_device_lcd);
169
Ben Dooks893b0302005-10-28 15:31:45 +0100170void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
Arnaud Patardf92273c2005-09-09 13:10:10 -0700171{
Ben Dooks893b0302005-10-28 15:31:45 +0100172 struct s3c2410fb_mach_info *npd;
173
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");
180 }
Arnaud Patardf92273c2005-09-09 13:10:10 -0700181}
Arnaud Patardf92273c2005-09-09 13:10:10 -0700182
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183/* NAND Controller */
184
185static struct resource s3c_nand_resource[] = {
186 [0] = {
Ben Dooksce46a9c2008-10-21 14:06:26 +0100187 .start = S3C24XX_PA_NAND,
188 .end = S3C24XX_PA_NAND + S3C24XX_SZ_NAND - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189 .flags = IORESOURCE_MEM,
190 }
191};
192
193struct platform_device s3c_device_nand = {
194 .name = "s3c2410-nand",
195 .id = -1,
196 .num_resources = ARRAY_SIZE(s3c_nand_resource),
197 .resource = s3c_nand_resource,
198};
199
200EXPORT_SYMBOL(s3c_device_nand);
201
202/* USB Device (Gadget)*/
203
204static struct resource s3c_usbgadget_resource[] = {
205 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000206 .start = S3C24XX_PA_USBDEV,
207 .end = S3C24XX_PA_USBDEV + S3C24XX_SZ_USBDEV - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208 .flags = IORESOURCE_MEM,
209 },
210 [1] = {
211 .start = IRQ_USBD,
212 .end = IRQ_USBD,
213 .flags = IORESOURCE_IRQ,
214 }
215
216};
217
218struct platform_device s3c_device_usbgadget = {
219 .name = "s3c2410-usbgadget",
220 .id = -1,
221 .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
222 .resource = s3c_usbgadget_resource,
223};
224
225EXPORT_SYMBOL(s3c_device_usbgadget);
226
Arnaud Patard0dcfc322007-02-13 00:18:33 +0100227void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)
228{
229 struct s3c2410_udc_mach_info *npd;
230
231 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
232 if (npd) {
233 memcpy(npd, pd, sizeof(*npd));
234 s3c_device_usbgadget.dev.platform_data = npd;
235 } else {
236 printk(KERN_ERR "no memory for udc platform data\n");
237 }
238}
239
240
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241/* Watchdog */
242
243static struct resource s3c_wdt_resource[] = {
244 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000245 .start = S3C24XX_PA_WATCHDOG,
246 .end = S3C24XX_PA_WATCHDOG + S3C24XX_SZ_WATCHDOG - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247 .flags = IORESOURCE_MEM,
248 },
249 [1] = {
250 .start = IRQ_WDT,
251 .end = IRQ_WDT,
252 .flags = IORESOURCE_IRQ,
253 }
254
255};
256
257struct platform_device s3c_device_wdt = {
258 .name = "s3c2410-wdt",
259 .id = -1,
260 .num_resources = ARRAY_SIZE(s3c_wdt_resource),
261 .resource = s3c_wdt_resource,
262};
263
264EXPORT_SYMBOL(s3c_device_wdt);
265
Linus Torvalds1da177e2005-04-16 15:20:36 -0700266/* IIS */
267
268static struct resource s3c_iis_resource[] = {
269 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000270 .start = S3C24XX_PA_IIS,
271 .end = S3C24XX_PA_IIS + S3C24XX_SZ_IIS -1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700272 .flags = IORESOURCE_MEM,
273 }
274};
275
276static u64 s3c_device_iis_dmamask = 0xffffffffUL;
277
278struct platform_device s3c_device_iis = {
279 .name = "s3c2410-iis",
280 .id = -1,
281 .num_resources = ARRAY_SIZE(s3c_iis_resource),
282 .resource = s3c_iis_resource,
283 .dev = {
284 .dma_mask = &s3c_device_iis_dmamask,
285 .coherent_dma_mask = 0xffffffffUL
286 }
287};
288
289EXPORT_SYMBOL(s3c_device_iis);
290
291/* RTC */
292
293static struct resource s3c_rtc_resource[] = {
294 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000295 .start = S3C24XX_PA_RTC,
296 .end = S3C24XX_PA_RTC + 0xff,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700297 .flags = IORESOURCE_MEM,
298 },
299 [1] = {
300 .start = IRQ_RTC,
301 .end = IRQ_RTC,
302 .flags = IORESOURCE_IRQ,
303 },
304 [2] = {
305 .start = IRQ_TICK,
306 .end = IRQ_TICK,
307 .flags = IORESOURCE_IRQ
308 }
309};
310
311struct platform_device s3c_device_rtc = {
312 .name = "s3c2410-rtc",
313 .id = -1,
314 .num_resources = ARRAY_SIZE(s3c_rtc_resource),
315 .resource = s3c_rtc_resource,
316};
317
318EXPORT_SYMBOL(s3c_device_rtc);
319
320/* ADC */
321
322static struct resource s3c_adc_resource[] = {
323 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000324 .start = S3C24XX_PA_ADC,
325 .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700326 .flags = IORESOURCE_MEM,
327 },
328 [1] = {
329 .start = IRQ_TC,
Ben Dooks083d06e2006-02-08 22:03:31 +0000330 .end = IRQ_TC,
331 .flags = IORESOURCE_IRQ,
332 },
333 [2] = {
334 .start = IRQ_ADC,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700335 .end = IRQ_ADC,
336 .flags = IORESOURCE_IRQ,
337 }
338
339};
340
341struct platform_device s3c_device_adc = {
Ben Dooks28ab44c5b2008-12-18 14:20:04 +0000342 .name = "s3c24xx-adc",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700343 .id = -1,
344 .num_resources = ARRAY_SIZE(s3c_adc_resource),
345 .resource = s3c_adc_resource,
346};
347
Ben Dooks28ab44c5b2008-12-18 14:20:04 +0000348/* HWMON */
349
350struct platform_device s3c_device_hwmon = {
351 .name = "s3c24xx-hwmon",
352 .id = -1,
353 .dev.parent = &s3c_device_adc.dev,
354};
355
Linus Torvalds1da177e2005-04-16 15:20:36 -0700356/* SDI */
357
358static struct resource s3c_sdi_resource[] = {
359 [0] = {
Ben Dooksce46a9c2008-10-21 14:06:26 +0100360 .start = S3C24XX_PA_SDI,
361 .end = S3C24XX_PA_SDI + S3C24XX_SZ_SDI - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700362 .flags = IORESOURCE_MEM,
363 },
364 [1] = {
365 .start = IRQ_SDI,
366 .end = IRQ_SDI,
367 .flags = IORESOURCE_IRQ,
368 }
369
370};
371
372struct platform_device s3c_device_sdi = {
373 .name = "s3c2410-sdi",
374 .id = -1,
375 .num_resources = ARRAY_SIZE(s3c_sdi_resource),
376 .resource = s3c_sdi_resource,
377};
378
379EXPORT_SYMBOL(s3c_device_sdi);
380
381/* SPI (0) */
382
383static struct resource s3c_spi0_resource[] = {
384 [0] = {
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +0000385 .start = S3C24XX_PA_SPI,
386 .end = S3C24XX_PA_SPI + 0x1f,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700387 .flags = IORESOURCE_MEM,
388 },
389 [1] = {
390 .start = IRQ_SPI0,
391 .end = IRQ_SPI0,
392 .flags = IORESOURCE_IRQ,
393 }
394
395};
396
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000397static u64 s3c_device_spi0_dmamask = 0xffffffffUL;
398
Linus Torvalds1da177e2005-04-16 15:20:36 -0700399struct platform_device s3c_device_spi0 = {
400 .name = "s3c2410-spi",
401 .id = 0,
402 .num_resources = ARRAY_SIZE(s3c_spi0_resource),
403 .resource = s3c_spi0_resource,
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000404 .dev = {
405 .dma_mask = &s3c_device_spi0_dmamask,
406 .coherent_dma_mask = 0xffffffffUL
407 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408};
409
410EXPORT_SYMBOL(s3c_device_spi0);
411
412/* SPI (1) */
413
414static struct resource s3c_spi1_resource[] = {
415 [0] = {
Sandeep Sanjay Patile9033822007-05-16 10:51:45 +0100416 .start = S3C24XX_PA_SPI + S3C2410_SPI1,
417 .end = S3C24XX_PA_SPI + S3C2410_SPI1 + 0x1f,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700418 .flags = IORESOURCE_MEM,
419 },
420 [1] = {
421 .start = IRQ_SPI1,
422 .end = IRQ_SPI1,
423 .flags = IORESOURCE_IRQ,
424 }
425
426};
427
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000428static u64 s3c_device_spi1_dmamask = 0xffffffffUL;
429
Linus Torvalds1da177e2005-04-16 15:20:36 -0700430struct platform_device s3c_device_spi1 = {
431 .name = "s3c2410-spi",
432 .id = 1,
433 .num_resources = ARRAY_SIZE(s3c_spi1_resource),
434 .resource = s3c_spi1_resource,
Albrecht Dreß66be0c32006-03-15 16:03:05 +0000435 .dev = {
436 .dma_mask = &s3c_device_spi1_dmamask,
437 .coherent_dma_mask = 0xffffffffUL
438 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700439};
440
441EXPORT_SYMBOL(s3c_device_spi1);
442
Linus Torvalds1da177e2005-04-16 15:20:36 -0700443#ifdef CONFIG_CPU_S3C2440
444
445/* Camif Controller */
446
447static struct resource s3c_camif_resource[] = {
448 [0] = {
449 .start = S3C2440_PA_CAMIF,
Ben Dooksa0e0adb2005-10-28 15:26:42 +0100450 .end = S3C2440_PA_CAMIF + S3C2440_SZ_CAMIF - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700451 .flags = IORESOURCE_MEM,
452 },
453 [1] = {
454 .start = IRQ_CAM,
455 .end = IRQ_CAM,
456 .flags = IORESOURCE_IRQ,
457 }
458
459};
460
461static u64 s3c_device_camif_dmamask = 0xffffffffUL;
462
463struct platform_device s3c_device_camif = {
464 .name = "s3c2440-camif",
465 .id = -1,
466 .num_resources = ARRAY_SIZE(s3c_camif_resource),
467 .resource = s3c_camif_resource,
468 .dev = {
469 .dma_mask = &s3c_device_camif_dmamask,
470 .coherent_dma_mask = 0xffffffffUL
471 }
472};
473
474EXPORT_SYMBOL(s3c_device_camif);
475
476#endif // CONFIG_CPU_S32440