blob: 08bc7d95a45d78c0290b8d5c15eef4c934fd8105 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* linux/arch/arm/mach-s3c2410/devs.c
2 *
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Base S3C2410 platform device definitions
7 *
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 *
12 * Modifications:
13 * 10-Mar-2005 LCVR Changed S3C2410_{VA,SZ} to S3C24XX_{VA,SZ}
14 * 10-Feb-2005 BJD Added camera from guillaume.gourat@nexvision.tv
15 * 29-Aug-2004 BJD Added timers 0 through 3
16 * 29-Aug-2004 BJD Changed index of devices we only have one of to -1
17 * 21-Aug-2004 BJD Added IRQ_TICK to RTC resources
18 * 18-Aug-2004 BJD Created initial version
19*/
20
21#include <linux/kernel.h>
22#include <linux/types.h>
23#include <linux/interrupt.h>
24#include <linux/list.h>
25#include <linux/timer.h>
26#include <linux/init.h>
27#include <linux/device.h>
28
29#include <asm/mach/arch.h>
30#include <asm/mach/map.h>
31#include <asm/mach/irq.h>
Arnaud Patardf92273c2005-09-09 13:10:10 -070032#include <asm/arch/fb.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070033#include <asm/hardware.h>
34#include <asm/io.h>
35#include <asm/irq.h>
36
37#include <asm/arch/regs-serial.h>
38
39#include "devs.h"
40
41/* Serial port registrations */
42
43struct platform_device *s3c24xx_uart_devs[3];
44
45/* USB Host Controller */
46
47static struct resource s3c_usb_resource[] = {
48 [0] = {
49 .start = S3C2410_PA_USBHOST,
Ben Dooksa0e0adb2005-10-28 15:26:42 +010050 .end = S3C2410_PA_USBHOST + S3C24XX_SZ_USBHOST - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -070051 .flags = IORESOURCE_MEM,
52 },
53 [1] = {
54 .start = IRQ_USBH,
55 .end = IRQ_USBH,
56 .flags = IORESOURCE_IRQ,
57 }
58};
59
60static u64 s3c_device_usb_dmamask = 0xffffffffUL;
61
62struct platform_device s3c_device_usb = {
63 .name = "s3c2410-ohci",
64 .id = -1,
65 .num_resources = ARRAY_SIZE(s3c_usb_resource),
66 .resource = s3c_usb_resource,
67 .dev = {
68 .dma_mask = &s3c_device_usb_dmamask,
69 .coherent_dma_mask = 0xffffffffUL
70 }
71};
72
73EXPORT_SYMBOL(s3c_device_usb);
74
75/* LCD Controller */
76
77static struct resource s3c_lcd_resource[] = {
78 [0] = {
79 .start = S3C2410_PA_LCD,
Ben Dooksa0e0adb2005-10-28 15:26:42 +010080 .end = S3C2410_PA_LCD + S3C24XX_SZ_LCD - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -070081 .flags = IORESOURCE_MEM,
82 },
83 [1] = {
84 .start = IRQ_LCD,
85 .end = IRQ_LCD,
86 .flags = IORESOURCE_IRQ,
87 }
88
89};
90
91static u64 s3c_device_lcd_dmamask = 0xffffffffUL;
92
93struct platform_device s3c_device_lcd = {
94 .name = "s3c2410-lcd",
95 .id = -1,
96 .num_resources = ARRAY_SIZE(s3c_lcd_resource),
97 .resource = s3c_lcd_resource,
98 .dev = {
Ben Dooks6904b242005-06-29 11:09:15 +010099 .dma_mask = &s3c_device_lcd_dmamask,
100 .coherent_dma_mask = 0xffffffffUL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101 }
102};
103
104EXPORT_SYMBOL(s3c_device_lcd);
105
Ben Dooks893b0302005-10-28 15:31:45 +0100106void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
Arnaud Patardf92273c2005-09-09 13:10:10 -0700107{
Ben Dooks893b0302005-10-28 15:31:45 +0100108 struct s3c2410fb_mach_info *npd;
109
110 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
111 if (npd) {
112 memcpy(npd, pd, sizeof(*npd));
113 s3c_device_lcd.dev.platform_data = npd;
114 } else {
115 printk(KERN_ERR "no memory for LCD platform data\n");
116 }
Arnaud Patardf92273c2005-09-09 13:10:10 -0700117}
Arnaud Patardf92273c2005-09-09 13:10:10 -0700118
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119/* NAND Controller */
120
121static struct resource s3c_nand_resource[] = {
122 [0] = {
123 .start = S3C2410_PA_NAND,
Ben Dooksa0e0adb2005-10-28 15:26:42 +0100124 .end = S3C2410_PA_NAND + S3C24XX_SZ_NAND - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125 .flags = IORESOURCE_MEM,
126 }
127};
128
129struct platform_device s3c_device_nand = {
130 .name = "s3c2410-nand",
131 .id = -1,
132 .num_resources = ARRAY_SIZE(s3c_nand_resource),
133 .resource = s3c_nand_resource,
134};
135
136EXPORT_SYMBOL(s3c_device_nand);
137
138/* USB Device (Gadget)*/
139
140static struct resource s3c_usbgadget_resource[] = {
141 [0] = {
142 .start = S3C2410_PA_USBDEV,
Ben Dooksa0e0adb2005-10-28 15:26:42 +0100143 .end = S3C2410_PA_USBDEV + S3C24XX_SZ_USBDEV - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144 .flags = IORESOURCE_MEM,
145 },
146 [1] = {
147 .start = IRQ_USBD,
148 .end = IRQ_USBD,
149 .flags = IORESOURCE_IRQ,
150 }
151
152};
153
154struct platform_device s3c_device_usbgadget = {
155 .name = "s3c2410-usbgadget",
156 .id = -1,
157 .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
158 .resource = s3c_usbgadget_resource,
159};
160
161EXPORT_SYMBOL(s3c_device_usbgadget);
162
163/* Watchdog */
164
165static struct resource s3c_wdt_resource[] = {
166 [0] = {
167 .start = S3C2410_PA_WATCHDOG,
Ben Dooksa0e0adb2005-10-28 15:26:42 +0100168 .end = S3C2410_PA_WATCHDOG + S3C24XX_SZ_WATCHDOG - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169 .flags = IORESOURCE_MEM,
170 },
171 [1] = {
172 .start = IRQ_WDT,
173 .end = IRQ_WDT,
174 .flags = IORESOURCE_IRQ,
175 }
176
177};
178
179struct platform_device s3c_device_wdt = {
180 .name = "s3c2410-wdt",
181 .id = -1,
182 .num_resources = ARRAY_SIZE(s3c_wdt_resource),
183 .resource = s3c_wdt_resource,
184};
185
186EXPORT_SYMBOL(s3c_device_wdt);
187
188/* I2C */
189
190static struct resource s3c_i2c_resource[] = {
191 [0] = {
192 .start = S3C2410_PA_IIC,
Ben Dooksa0e0adb2005-10-28 15:26:42 +0100193 .end = S3C2410_PA_IIC + S3C24XX_SZ_IIC - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700194 .flags = IORESOURCE_MEM,
195 },
196 [1] = {
197 .start = IRQ_IIC,
198 .end = IRQ_IIC,
199 .flags = IORESOURCE_IRQ,
200 }
201
202};
203
204struct platform_device s3c_device_i2c = {
205 .name = "s3c2410-i2c",
206 .id = -1,
207 .num_resources = ARRAY_SIZE(s3c_i2c_resource),
208 .resource = s3c_i2c_resource,
209};
210
211EXPORT_SYMBOL(s3c_device_i2c);
212
213/* IIS */
214
215static struct resource s3c_iis_resource[] = {
216 [0] = {
217 .start = S3C2410_PA_IIS,
Ben Dooksa0e0adb2005-10-28 15:26:42 +0100218 .end = S3C2410_PA_IIS + S3C24XX_SZ_IIS -1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700219 .flags = IORESOURCE_MEM,
220 }
221};
222
223static u64 s3c_device_iis_dmamask = 0xffffffffUL;
224
225struct platform_device s3c_device_iis = {
226 .name = "s3c2410-iis",
227 .id = -1,
228 .num_resources = ARRAY_SIZE(s3c_iis_resource),
229 .resource = s3c_iis_resource,
230 .dev = {
231 .dma_mask = &s3c_device_iis_dmamask,
232 .coherent_dma_mask = 0xffffffffUL
233 }
234};
235
236EXPORT_SYMBOL(s3c_device_iis);
237
238/* RTC */
239
240static struct resource s3c_rtc_resource[] = {
241 [0] = {
242 .start = S3C2410_PA_RTC,
243 .end = S3C2410_PA_RTC + 0xff,
244 .flags = IORESOURCE_MEM,
245 },
246 [1] = {
247 .start = IRQ_RTC,
248 .end = IRQ_RTC,
249 .flags = IORESOURCE_IRQ,
250 },
251 [2] = {
252 .start = IRQ_TICK,
253 .end = IRQ_TICK,
254 .flags = IORESOURCE_IRQ
255 }
256};
257
258struct platform_device s3c_device_rtc = {
259 .name = "s3c2410-rtc",
260 .id = -1,
261 .num_resources = ARRAY_SIZE(s3c_rtc_resource),
262 .resource = s3c_rtc_resource,
263};
264
265EXPORT_SYMBOL(s3c_device_rtc);
266
267/* ADC */
268
269static struct resource s3c_adc_resource[] = {
270 [0] = {
271 .start = S3C2410_PA_ADC,
Ben Dooksa0e0adb2005-10-28 15:26:42 +0100272 .end = S3C2410_PA_ADC + S3C24XX_SZ_ADC - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700273 .flags = IORESOURCE_MEM,
274 },
275 [1] = {
276 .start = IRQ_TC,
277 .end = IRQ_ADC,
278 .flags = IORESOURCE_IRQ,
279 }
280
281};
282
283struct platform_device s3c_device_adc = {
284 .name = "s3c2410-adc",
285 .id = -1,
286 .num_resources = ARRAY_SIZE(s3c_adc_resource),
287 .resource = s3c_adc_resource,
288};
289
290/* SDI */
291
292static struct resource s3c_sdi_resource[] = {
293 [0] = {
294 .start = S3C2410_PA_SDI,
Ben Dooksa0e0adb2005-10-28 15:26:42 +0100295 .end = S3C2410_PA_SDI + S3C24XX_SZ_SDI - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700296 .flags = IORESOURCE_MEM,
297 },
298 [1] = {
299 .start = IRQ_SDI,
300 .end = IRQ_SDI,
301 .flags = IORESOURCE_IRQ,
302 }
303
304};
305
306struct platform_device s3c_device_sdi = {
307 .name = "s3c2410-sdi",
308 .id = -1,
309 .num_resources = ARRAY_SIZE(s3c_sdi_resource),
310 .resource = s3c_sdi_resource,
311};
312
313EXPORT_SYMBOL(s3c_device_sdi);
314
315/* SPI (0) */
316
317static struct resource s3c_spi0_resource[] = {
318 [0] = {
319 .start = S3C2410_PA_SPI,
320 .end = S3C2410_PA_SPI + 0x1f,
321 .flags = IORESOURCE_MEM,
322 },
323 [1] = {
324 .start = IRQ_SPI0,
325 .end = IRQ_SPI0,
326 .flags = IORESOURCE_IRQ,
327 }
328
329};
330
331struct platform_device s3c_device_spi0 = {
332 .name = "s3c2410-spi",
333 .id = 0,
334 .num_resources = ARRAY_SIZE(s3c_spi0_resource),
335 .resource = s3c_spi0_resource,
336};
337
338EXPORT_SYMBOL(s3c_device_spi0);
339
340/* SPI (1) */
341
342static struct resource s3c_spi1_resource[] = {
343 [0] = {
344 .start = S3C2410_PA_SPI + 0x20,
345 .end = S3C2410_PA_SPI + 0x20 + 0x1f,
346 .flags = IORESOURCE_MEM,
347 },
348 [1] = {
349 .start = IRQ_SPI1,
350 .end = IRQ_SPI1,
351 .flags = IORESOURCE_IRQ,
352 }
353
354};
355
356struct platform_device s3c_device_spi1 = {
357 .name = "s3c2410-spi",
358 .id = 1,
359 .num_resources = ARRAY_SIZE(s3c_spi1_resource),
360 .resource = s3c_spi1_resource,
361};
362
363EXPORT_SYMBOL(s3c_device_spi1);
364
365/* pwm timer blocks */
366
367static struct resource s3c_timer0_resource[] = {
368 [0] = {
369 .start = S3C2410_PA_TIMER + 0x0C,
370 .end = S3C2410_PA_TIMER + 0x0C + 0xB,
371 .flags = IORESOURCE_MEM,
372 },
373 [1] = {
374 .start = IRQ_TIMER0,
375 .end = IRQ_TIMER0,
376 .flags = IORESOURCE_IRQ,
377 }
378
379};
380
381struct platform_device s3c_device_timer0 = {
382 .name = "s3c2410-timer",
383 .id = 0,
384 .num_resources = ARRAY_SIZE(s3c_timer0_resource),
385 .resource = s3c_timer0_resource,
386};
387
388EXPORT_SYMBOL(s3c_device_timer0);
389
390/* timer 1 */
391
392static struct resource s3c_timer1_resource[] = {
393 [0] = {
394 .start = S3C2410_PA_TIMER + 0x18,
395 .end = S3C2410_PA_TIMER + 0x23,
396 .flags = IORESOURCE_MEM,
397 },
398 [1] = {
399 .start = IRQ_TIMER1,
400 .end = IRQ_TIMER1,
401 .flags = IORESOURCE_IRQ,
402 }
403
404};
405
406struct platform_device s3c_device_timer1 = {
407 .name = "s3c2410-timer",
408 .id = 1,
409 .num_resources = ARRAY_SIZE(s3c_timer1_resource),
410 .resource = s3c_timer1_resource,
411};
412
413EXPORT_SYMBOL(s3c_device_timer1);
414
415/* timer 2 */
416
417static struct resource s3c_timer2_resource[] = {
418 [0] = {
419 .start = S3C2410_PA_TIMER + 0x24,
420 .end = S3C2410_PA_TIMER + 0x2F,
421 .flags = IORESOURCE_MEM,
422 },
423 [1] = {
424 .start = IRQ_TIMER2,
425 .end = IRQ_TIMER2,
426 .flags = IORESOURCE_IRQ,
427 }
428
429};
430
431struct platform_device s3c_device_timer2 = {
432 .name = "s3c2410-timer",
433 .id = 2,
434 .num_resources = ARRAY_SIZE(s3c_timer2_resource),
435 .resource = s3c_timer2_resource,
436};
437
438EXPORT_SYMBOL(s3c_device_timer2);
439
440/* timer 3 */
441
442static struct resource s3c_timer3_resource[] = {
443 [0] = {
444 .start = S3C2410_PA_TIMER + 0x30,
445 .end = S3C2410_PA_TIMER + 0x3B,
446 .flags = IORESOURCE_MEM,
447 },
448 [1] = {
449 .start = IRQ_TIMER3,
450 .end = IRQ_TIMER3,
451 .flags = IORESOURCE_IRQ,
452 }
453
454};
455
456struct platform_device s3c_device_timer3 = {
457 .name = "s3c2410-timer",
458 .id = 3,
459 .num_resources = ARRAY_SIZE(s3c_timer3_resource),
460 .resource = s3c_timer3_resource,
461};
462
463EXPORT_SYMBOL(s3c_device_timer3);
464
465#ifdef CONFIG_CPU_S3C2440
466
467/* Camif Controller */
468
469static struct resource s3c_camif_resource[] = {
470 [0] = {
471 .start = S3C2440_PA_CAMIF,
Ben Dooksa0e0adb2005-10-28 15:26:42 +0100472 .end = S3C2440_PA_CAMIF + S3C2440_SZ_CAMIF - 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700473 .flags = IORESOURCE_MEM,
474 },
475 [1] = {
476 .start = IRQ_CAM,
477 .end = IRQ_CAM,
478 .flags = IORESOURCE_IRQ,
479 }
480
481};
482
483static u64 s3c_device_camif_dmamask = 0xffffffffUL;
484
485struct platform_device s3c_device_camif = {
486 .name = "s3c2440-camif",
487 .id = -1,
488 .num_resources = ARRAY_SIZE(s3c_camif_resource),
489 .resource = s3c_camif_resource,
490 .dev = {
491 .dma_mask = &s3c_device_camif_dmamask,
492 .coherent_dma_mask = 0xffffffffUL
493 }
494};
495
496EXPORT_SYMBOL(s3c_device_camif);
497
498#endif // CONFIG_CPU_S32440