vserver 1.9.5.x5
[linux-2.6.git] / arch / arm / mach-s3c2410 / devs.c
1 /* 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  *     29-Aug-2004 BJD  Added timers 0 through 3
14  *     29-Aug-2004 BJD  Changed index of devices we only have one of to -1
15  *     21-Aug-2004 BJD  Added IRQ_TICK to RTC resources
16  *     18-Aug-2004 BJD  Created initial version
17 */
18
19 #include <linux/kernel.h>
20 #include <linux/types.h>
21 #include <linux/interrupt.h>
22 #include <linux/list.h>
23 #include <linux/timer.h>
24 #include <linux/init.h>
25 #include <linux/device.h>
26
27 #include <asm/mach/arch.h>
28 #include <asm/mach/map.h>
29 #include <asm/mach/irq.h>
30
31 #include <asm/hardware.h>
32 #include <asm/io.h>
33 #include <asm/irq.h>
34
35 #include <asm/arch/regs-serial.h>
36
37 #include "devs.h"
38
39 /* Serial port registrations */
40
41 struct platform_device *s3c24xx_uart_devs[3];
42
43 /* USB Host Controller */
44
45 static struct resource s3c_usb_resource[] = {
46         [0] = {
47                 .start = S3C2410_PA_USBHOST,
48                 .end   = S3C2410_PA_USBHOST + S3C2410_SZ_USBHOST,
49                 .flags = IORESOURCE_MEM,
50         },
51         [1] = {
52                 .start = IRQ_USBH,
53                 .end   = IRQ_USBH,
54                 .flags = IORESOURCE_IRQ,
55         }
56 };
57
58 static u64 s3c_device_usb_dmamask = 0xffffffffUL;
59
60 struct platform_device s3c_device_usb = {
61         .name             = "s3c2410-ohci",
62         .id               = -1,
63         .num_resources    = ARRAY_SIZE(s3c_usb_resource),
64         .resource         = s3c_usb_resource,
65         .dev              = {
66                 .dma_mask = &s3c_device_usb_dmamask,
67                 .coherent_dma_mask = 0xffffffffUL
68         }
69 };
70
71 EXPORT_SYMBOL(s3c_device_usb);
72
73 /* LCD Controller */
74
75 static struct resource s3c_lcd_resource[] = {
76         [0] = {
77                 .start = S3C2410_PA_LCD,
78                 .end   = S3C2410_PA_LCD + S3C2410_SZ_LCD,
79                 .flags = IORESOURCE_MEM,
80         },
81         [1] = {
82                 .start = IRQ_LCD,
83                 .end   = IRQ_LCD,
84                 .flags = IORESOURCE_IRQ,
85         }
86
87 };
88
89 static u64 s3c_device_lcd_dmamask = 0xffffffffUL;
90
91 struct platform_device s3c_device_lcd = {
92         .name             = "s3c2410-lcd",
93         .id               = -1,
94         .num_resources    = ARRAY_SIZE(s3c_lcd_resource),
95         .resource         = s3c_lcd_resource,
96         .dev              = {
97                 .dma_mask = &s3c_device_lcd_dmamask,
98                 .coherent_dma_mask = 0xffffffffUL
99         }
100 };
101
102 EXPORT_SYMBOL(s3c_device_lcd);
103
104 /* NAND Controller */
105
106 static struct resource s3c_nand_resource[] = {
107         [0] = {
108                 .start = S3C2410_PA_NAND,
109                 .end   = S3C2410_PA_NAND + S3C2410_SZ_NAND,
110                 .flags = IORESOURCE_MEM,
111         }
112 };
113
114 struct platform_device s3c_device_nand = {
115         .name             = "s3c2410-nand",
116         .id               = -1,
117         .num_resources    = ARRAY_SIZE(s3c_nand_resource),
118         .resource         = s3c_nand_resource,
119 };
120
121 EXPORT_SYMBOL(s3c_device_nand);
122
123 /* USB Device (Gadget)*/
124
125 static struct resource s3c_usbgadget_resource[] = {
126         [0] = {
127                 .start = S3C2410_PA_USBDEV,
128                 .end   = S3C2410_PA_USBDEV + S3C2410_SZ_USBDEV,
129                 .flags = IORESOURCE_MEM,
130         },
131         [1] = {
132                 .start = IRQ_USBD,
133                 .end   = IRQ_USBD,
134                 .flags = IORESOURCE_IRQ,
135         }
136
137 };
138
139 struct platform_device s3c_device_usbgadget = {
140         .name             = "s3c2410-usbgadget",
141         .id               = -1,
142         .num_resources    = ARRAY_SIZE(s3c_usbgadget_resource),
143         .resource         = s3c_usbgadget_resource,
144 };
145
146 EXPORT_SYMBOL(s3c_device_usbgadget);
147
148 /* Watchdog */
149
150 static struct resource s3c_wdt_resource[] = {
151         [0] = {
152                 .start = S3C2410_PA_WATCHDOG,
153                 .end   = S3C2410_PA_WATCHDOG + S3C2410_SZ_WATCHDOG,
154                 .flags = IORESOURCE_MEM,
155         },
156         [1] = {
157                 .start = IRQ_WDT,
158                 .end   = IRQ_WDT,
159                 .flags = IORESOURCE_IRQ,
160         }
161
162 };
163
164 struct platform_device s3c_device_wdt = {
165         .name             = "s3c2410-wdt",
166         .id               = -1,
167         .num_resources    = ARRAY_SIZE(s3c_wdt_resource),
168         .resource         = s3c_wdt_resource,
169 };
170
171 EXPORT_SYMBOL(s3c_device_wdt);
172
173 /* I2C */
174
175 static struct resource s3c_i2c_resource[] = {
176         [0] = {
177                 .start = S3C2410_PA_IIC,
178                 .end   = S3C2410_PA_IIC + S3C2410_SZ_IIC,
179                 .flags = IORESOURCE_MEM,
180         },
181         [1] = {
182                 .start = IRQ_IIC,
183                 .end   = IRQ_IIC,
184                 .flags = IORESOURCE_IRQ,
185         }
186
187 };
188
189 struct platform_device s3c_device_i2c = {
190         .name             = "s3c2410-i2c",
191         .id               = -1,
192         .num_resources    = ARRAY_SIZE(s3c_i2c_resource),
193         .resource         = s3c_i2c_resource,
194 };
195
196 EXPORT_SYMBOL(s3c_device_i2c);
197
198 /* IIS */
199
200 static struct resource s3c_iis_resource[] = {
201         [0] = {
202                 .start = S3C2410_PA_IIS,
203                 .end   = S3C2410_PA_IIS + S3C2410_SZ_IIS,
204                 .flags = IORESOURCE_MEM,
205         }
206 };
207
208 static u64 s3c_device_iis_dmamask = 0xffffffffUL;
209
210 struct platform_device s3c_device_iis = {
211         .name             = "s3c2410-iis",
212         .id               = -1,
213         .num_resources    = ARRAY_SIZE(s3c_iis_resource),
214         .resource         = s3c_iis_resource,
215         .dev              = {
216                 .dma_mask = &s3c_device_iis_dmamask,
217                 .coherent_dma_mask = 0xffffffffUL
218         }
219 };
220
221 EXPORT_SYMBOL(s3c_device_iis);
222
223 /* RTC */
224
225 static struct resource s3c_rtc_resource[] = {
226         [0] = {
227                 .start = S3C2410_PA_RTC,
228                 .end   = S3C2410_PA_RTC + 0xff,
229                 .flags = IORESOURCE_MEM,
230         },
231         [1] = {
232                 .start = IRQ_RTC,
233                 .end   = IRQ_RTC,
234                 .flags = IORESOURCE_IRQ,
235         },
236         [2] = {
237                 .start = IRQ_TICK,
238                 .end   = IRQ_TICK,
239                 .flags = IORESOURCE_IRQ
240         }
241 };
242
243 struct platform_device s3c_device_rtc = {
244         .name             = "s3c2410-rtc",
245         .id               = -1,
246         .num_resources    = ARRAY_SIZE(s3c_rtc_resource),
247         .resource         = s3c_rtc_resource,
248 };
249
250 EXPORT_SYMBOL(s3c_device_rtc);
251
252 /* ADC */
253
254 static struct resource s3c_adc_resource[] = {
255         [0] = {
256                 .start = S3C2410_PA_ADC,
257                 .end   = S3C2410_PA_ADC + S3C2410_SZ_ADC,
258                 .flags = IORESOURCE_MEM,
259         },
260         [1] = {
261                 .start = IRQ_TC,
262                 .end   = IRQ_ADC,
263                 .flags = IORESOURCE_IRQ,
264         }
265
266 };
267
268 struct platform_device s3c_device_adc = {
269         .name             = "s3c2410-adc",
270         .id               = -1,
271         .num_resources    = ARRAY_SIZE(s3c_adc_resource),
272         .resource         = s3c_adc_resource,
273 };
274
275 /* SDI */
276
277 static struct resource s3c_sdi_resource[] = {
278         [0] = {
279                 .start = S3C2410_PA_SDI,
280                 .end   = S3C2410_PA_SDI + S3C2410_SZ_SDI,
281                 .flags = IORESOURCE_MEM,
282         },
283         [1] = {
284                 .start = IRQ_SDI,
285                 .end   = IRQ_SDI,
286                 .flags = IORESOURCE_IRQ,
287         }
288
289 };
290
291 struct platform_device s3c_device_sdi = {
292         .name             = "s3c2410-sdi",
293         .id               = -1,
294         .num_resources    = ARRAY_SIZE(s3c_sdi_resource),
295         .resource         = s3c_sdi_resource,
296 };
297
298 EXPORT_SYMBOL(s3c_device_sdi);
299
300 /* SPI (0) */
301
302 static struct resource s3c_spi0_resource[] = {
303         [0] = {
304                 .start = S3C2410_PA_SPI,
305                 .end   = S3C2410_PA_SPI + 0x1f,
306                 .flags = IORESOURCE_MEM,
307         },
308         [1] = {
309                 .start = IRQ_SPI0,
310                 .end   = IRQ_SPI0,
311                 .flags = IORESOURCE_IRQ,
312         }
313
314 };
315
316 struct platform_device s3c_device_spi0 = {
317         .name             = "s3c2410-spi",
318         .id               = 0,
319         .num_resources    = ARRAY_SIZE(s3c_spi0_resource),
320         .resource         = s3c_spi0_resource,
321 };
322
323 EXPORT_SYMBOL(s3c_device_spi0);
324
325 /* SPI (1) */
326
327 static struct resource s3c_spi1_resource[] = {
328         [0] = {
329                 .start = S3C2410_PA_SPI + 0x20,
330                 .end   = S3C2410_PA_SPI + 0x20 + 0x1f,
331                 .flags = IORESOURCE_MEM,
332         },
333         [1] = {
334                 .start = IRQ_SPI1,
335                 .end   = IRQ_SPI1,
336                 .flags = IORESOURCE_IRQ,
337         }
338
339 };
340
341 struct platform_device s3c_device_spi1 = {
342         .name             = "s3c2410-spi",
343         .id               = 1,
344         .num_resources    = ARRAY_SIZE(s3c_spi1_resource),
345         .resource         = s3c_spi1_resource,
346 };
347
348 EXPORT_SYMBOL(s3c_device_spi1);
349
350 /* pwm timer blocks */
351
352 static struct resource s3c_timer0_resource[] = {
353         [0] = {
354                 .start = S3C2410_PA_TIMER + 0x0C,
355                 .end   = S3C2410_PA_TIMER + 0x0C + 0xB,
356                 .flags = IORESOURCE_MEM,
357         },
358         [1] = {
359                 .start = IRQ_TIMER0,
360                 .end   = IRQ_TIMER0,
361                 .flags = IORESOURCE_IRQ,
362         }
363
364 };
365
366 struct platform_device s3c_device_timer0 = {
367         .name             = "s3c2410-timer",
368         .id               = 0,
369         .num_resources    = ARRAY_SIZE(s3c_timer0_resource),
370         .resource         = s3c_timer0_resource,
371 };
372
373 EXPORT_SYMBOL(s3c_device_timer0);
374
375 /* timer 1 */
376
377 static struct resource s3c_timer1_resource[] = {
378         [0] = {
379                 .start = S3C2410_PA_TIMER + 0x18,
380                 .end   = S3C2410_PA_TIMER + 0x23,
381                 .flags = IORESOURCE_MEM,
382         },
383         [1] = {
384                 .start = IRQ_TIMER1,
385                 .end   = IRQ_TIMER1,
386                 .flags = IORESOURCE_IRQ,
387         }
388
389 };
390
391 struct platform_device s3c_device_timer1 = {
392         .name             = "s3c2410-timer",
393         .id               = 1,
394         .num_resources    = ARRAY_SIZE(s3c_timer1_resource),
395         .resource         = s3c_timer1_resource,
396 };
397
398 EXPORT_SYMBOL(s3c_device_timer1);
399
400 /* timer 2 */
401
402 static struct resource s3c_timer2_resource[] = {
403         [0] = {
404                 .start = S3C2410_PA_TIMER + 0x24,
405                 .end   = S3C2410_PA_TIMER + 0x2F,
406                 .flags = IORESOURCE_MEM,
407         },
408         [1] = {
409                 .start = IRQ_TIMER2,
410                 .end   = IRQ_TIMER2,
411                 .flags = IORESOURCE_IRQ,
412         }
413
414 };
415
416 struct platform_device s3c_device_timer2 = {
417         .name             = "s3c2410-timer",
418         .id               = 2,
419         .num_resources    = ARRAY_SIZE(s3c_timer2_resource),
420         .resource         = s3c_timer2_resource,
421 };
422
423 EXPORT_SYMBOL(s3c_device_timer2);
424
425 /* timer 3 */
426
427 static struct resource s3c_timer3_resource[] = {
428         [0] = {
429                 .start = S3C2410_PA_TIMER + 0x30,
430                 .end   = S3C2410_PA_TIMER + 0x3B,
431                 .flags = IORESOURCE_MEM,
432         },
433         [1] = {
434                 .start = IRQ_TIMER3,
435                 .end   = IRQ_TIMER3,
436                 .flags = IORESOURCE_IRQ,
437         }
438
439 };
440
441 struct platform_device s3c_device_timer3 = {
442         .name             = "s3c2410-timer",
443         .id               = 3,
444         .num_resources    = ARRAY_SIZE(s3c_timer3_resource),
445         .resource         = s3c_timer3_resource,
446 };
447
448 EXPORT_SYMBOL(s3c_device_timer3);