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