]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/arm/plat-s3c24xx/devs.c
[ARM] 4173/1: S3C24XX usb device platform datas
[net-next-2.6.git] / arch / arm / plat-s3c24xx / devs.c
CommitLineData
a21765a7 1/* linux/arch/arm/plat-s3c24xx/devs.c
1da177e4
LT
2 *
3 * Copyright (c) 2004 Simtec Electronics
916a0021 4 * Ben Dooks <ben@simtec.co.uk>
1da177e4 5 *
916a0021 6 * Base S3C24XX platform device definitions
1da177e4
LT
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 *
1da177e4
LT
12*/
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>
b6d1f542 20#include <linux/serial_core.h>
d052d1be 21#include <linux/platform_device.h>
1da177e4
LT
22
23#include <asm/mach/arch.h>
24#include <asm/mach/map.h>
25#include <asm/mach/irq.h>
f92273c1 26#include <asm/arch/fb.h>
1da177e4
LT
27#include <asm/hardware.h>
28#include <asm/io.h>
29#include <asm/irq.h>
30
31#include <asm/arch/regs-serial.h>
0dcfc328 32#include <asm/arch/udc.h>
1da177e4 33
a21765a7
BD
34#include <asm/plat-s3c24xx/devs.h>
35#include <asm/plat-s3c24xx/cpu.h>
1da177e4
LT
36
37/* Serial port registrations */
38
66a9b49a
BD
39static struct resource s3c2410_uart0_resource[] = {
40 [0] = {
41 .start = S3C2410_PA_UART0,
42 .end = S3C2410_PA_UART0 + 0x3fff,
43 .flags = IORESOURCE_MEM,
44 },
45 [1] = {
46 .start = IRQ_S3CUART_RX0,
47 .end = IRQ_S3CUART_ERR0,
48 .flags = IORESOURCE_IRQ,
49 }
50};
51
52static struct resource s3c2410_uart1_resource[] = {
53 [0] = {
54 .start = S3C2410_PA_UART1,
55 .end = S3C2410_PA_UART1 + 0x3fff,
56 .flags = IORESOURCE_MEM,
57 },
58 [1] = {
59 .start = IRQ_S3CUART_RX1,
60 .end = IRQ_S3CUART_ERR1,
61 .flags = IORESOURCE_IRQ,
62 }
63};
64
65static struct resource s3c2410_uart2_resource[] = {
66 [0] = {
67 .start = S3C2410_PA_UART2,
68 .end = S3C2410_PA_UART2 + 0x3fff,
69 .flags = IORESOURCE_MEM,
70 },
71 [1] = {
72 .start = IRQ_S3CUART_RX2,
73 .end = IRQ_S3CUART_ERR2,
74 .flags = IORESOURCE_IRQ,
75 }
76};
77
78struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
79 [0] = {
80 .resources = s3c2410_uart0_resource,
81 .nr_resources = ARRAY_SIZE(s3c2410_uart0_resource),
82 },
83 [1] = {
84 .resources = s3c2410_uart1_resource,
85 .nr_resources = ARRAY_SIZE(s3c2410_uart1_resource),
86 },
87 [2] = {
88 .resources = s3c2410_uart2_resource,
89 .nr_resources = ARRAY_SIZE(s3c2410_uart2_resource),
90 },
91};
92
93/* yart devices */
94
95static struct platform_device s3c24xx_uart_device0 = {
96 .id = 0,
97};
98
99static struct platform_device s3c24xx_uart_device1 = {
100 .id = 1,
101};
102
103static struct platform_device s3c24xx_uart_device2 = {
104 .id = 2,
105};
106
107struct platform_device *s3c24xx_uart_src[3] = {
108 &s3c24xx_uart_device0,
109 &s3c24xx_uart_device1,
110 &s3c24xx_uart_device2,
111};
112
113struct platform_device *s3c24xx_uart_devs[3] = {
114};
1da177e4
LT
115
116/* USB Host Controller */
117
118static struct resource s3c_usb_resource[] = {
119 [0] = {
0367a8d3
LCVR
120 .start = S3C24XX_PA_USBHOST,
121 .end = S3C24XX_PA_USBHOST + S3C24XX_SZ_USBHOST - 1,
1da177e4
LT
122 .flags = IORESOURCE_MEM,
123 },
124 [1] = {
125 .start = IRQ_USBH,
126 .end = IRQ_USBH,
127 .flags = IORESOURCE_IRQ,
128 }
129};
130
131static u64 s3c_device_usb_dmamask = 0xffffffffUL;
132
133struct platform_device s3c_device_usb = {
134 .name = "s3c2410-ohci",
135 .id = -1,
136 .num_resources = ARRAY_SIZE(s3c_usb_resource),
137 .resource = s3c_usb_resource,
138 .dev = {
139 .dma_mask = &s3c_device_usb_dmamask,
140 .coherent_dma_mask = 0xffffffffUL
141 }
142};
143
144EXPORT_SYMBOL(s3c_device_usb);
145
146/* LCD Controller */
147
148static struct resource s3c_lcd_resource[] = {
149 [0] = {
0367a8d3
LCVR
150 .start = S3C24XX_PA_LCD,
151 .end = S3C24XX_PA_LCD + S3C24XX_SZ_LCD - 1,
1da177e4
LT
152 .flags = IORESOURCE_MEM,
153 },
154 [1] = {
155 .start = IRQ_LCD,
156 .end = IRQ_LCD,
157 .flags = IORESOURCE_IRQ,
158 }
159
160};
161
162static u64 s3c_device_lcd_dmamask = 0xffffffffUL;
163
164struct platform_device s3c_device_lcd = {
165 .name = "s3c2410-lcd",
166 .id = -1,
167 .num_resources = ARRAY_SIZE(s3c_lcd_resource),
168 .resource = s3c_lcd_resource,
169 .dev = {
6904b246
BD
170 .dma_mask = &s3c_device_lcd_dmamask,
171 .coherent_dma_mask = 0xffffffffUL
1da177e4
LT
172 }
173};
174
175EXPORT_SYMBOL(s3c_device_lcd);
176
893b0309 177void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
f92273c1 178{
893b0309
BD
179 struct s3c2410fb_mach_info *npd;
180
181 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
182 if (npd) {
183 memcpy(npd, pd, sizeof(*npd));
184 s3c_device_lcd.dev.platform_data = npd;
185 } else {
186 printk(KERN_ERR "no memory for LCD platform data\n");
187 }
f92273c1 188}
f92273c1 189
1da177e4
LT
190/* NAND Controller */
191
192static struct resource s3c_nand_resource[] = {
193 [0] = {
194 .start = S3C2410_PA_NAND,
a0e0adb9 195 .end = S3C2410_PA_NAND + S3C24XX_SZ_NAND - 1,
1da177e4
LT
196 .flags = IORESOURCE_MEM,
197 }
198};
199
200struct platform_device s3c_device_nand = {
201 .name = "s3c2410-nand",
202 .id = -1,
203 .num_resources = ARRAY_SIZE(s3c_nand_resource),
204 .resource = s3c_nand_resource,
205};
206
207EXPORT_SYMBOL(s3c_device_nand);
208
209/* USB Device (Gadget)*/
210
211static struct resource s3c_usbgadget_resource[] = {
212 [0] = {
0367a8d3
LCVR
213 .start = S3C24XX_PA_USBDEV,
214 .end = S3C24XX_PA_USBDEV + S3C24XX_SZ_USBDEV - 1,
1da177e4
LT
215 .flags = IORESOURCE_MEM,
216 },
217 [1] = {
218 .start = IRQ_USBD,
219 .end = IRQ_USBD,
220 .flags = IORESOURCE_IRQ,
221 }
222
223};
224
225struct platform_device s3c_device_usbgadget = {
226 .name = "s3c2410-usbgadget",
227 .id = -1,
228 .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
229 .resource = s3c_usbgadget_resource,
230};
231
232EXPORT_SYMBOL(s3c_device_usbgadget);
233
0dcfc328
AP
234void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)
235{
236 struct s3c2410_udc_mach_info *npd;
237
238 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
239 if (npd) {
240 memcpy(npd, pd, sizeof(*npd));
241 s3c_device_usbgadget.dev.platform_data = npd;
242 } else {
243 printk(KERN_ERR "no memory for udc platform data\n");
244 }
245}
246
247
1da177e4
LT
248/* Watchdog */
249
250static struct resource s3c_wdt_resource[] = {
251 [0] = {
0367a8d3
LCVR
252 .start = S3C24XX_PA_WATCHDOG,
253 .end = S3C24XX_PA_WATCHDOG + S3C24XX_SZ_WATCHDOG - 1,
1da177e4
LT
254 .flags = IORESOURCE_MEM,
255 },
256 [1] = {
257 .start = IRQ_WDT,
258 .end = IRQ_WDT,
259 .flags = IORESOURCE_IRQ,
260 }
261
262};
263
264struct platform_device s3c_device_wdt = {
265 .name = "s3c2410-wdt",
266 .id = -1,
267 .num_resources = ARRAY_SIZE(s3c_wdt_resource),
268 .resource = s3c_wdt_resource,
269};
270
271EXPORT_SYMBOL(s3c_device_wdt);
272
273/* I2C */
274
275static struct resource s3c_i2c_resource[] = {
276 [0] = {
0367a8d3
LCVR
277 .start = S3C24XX_PA_IIC,
278 .end = S3C24XX_PA_IIC + S3C24XX_SZ_IIC - 1,
1da177e4
LT
279 .flags = IORESOURCE_MEM,
280 },
281 [1] = {
282 .start = IRQ_IIC,
283 .end = IRQ_IIC,
284 .flags = IORESOURCE_IRQ,
285 }
286
287};
288
289struct platform_device s3c_device_i2c = {
290 .name = "s3c2410-i2c",
291 .id = -1,
292 .num_resources = ARRAY_SIZE(s3c_i2c_resource),
293 .resource = s3c_i2c_resource,
294};
295
296EXPORT_SYMBOL(s3c_device_i2c);
297
298/* IIS */
299
300static struct resource s3c_iis_resource[] = {
301 [0] = {
0367a8d3
LCVR
302 .start = S3C24XX_PA_IIS,
303 .end = S3C24XX_PA_IIS + S3C24XX_SZ_IIS -1,
1da177e4
LT
304 .flags = IORESOURCE_MEM,
305 }
306};
307
308static u64 s3c_device_iis_dmamask = 0xffffffffUL;
309
310struct platform_device s3c_device_iis = {
311 .name = "s3c2410-iis",
312 .id = -1,
313 .num_resources = ARRAY_SIZE(s3c_iis_resource),
314 .resource = s3c_iis_resource,
315 .dev = {
316 .dma_mask = &s3c_device_iis_dmamask,
317 .coherent_dma_mask = 0xffffffffUL
318 }
319};
320
321EXPORT_SYMBOL(s3c_device_iis);
322
323/* RTC */
324
325static struct resource s3c_rtc_resource[] = {
326 [0] = {
0367a8d3
LCVR
327 .start = S3C24XX_PA_RTC,
328 .end = S3C24XX_PA_RTC + 0xff,
1da177e4
LT
329 .flags = IORESOURCE_MEM,
330 },
331 [1] = {
332 .start = IRQ_RTC,
333 .end = IRQ_RTC,
334 .flags = IORESOURCE_IRQ,
335 },
336 [2] = {
337 .start = IRQ_TICK,
338 .end = IRQ_TICK,
339 .flags = IORESOURCE_IRQ
340 }
341};
342
343struct platform_device s3c_device_rtc = {
344 .name = "s3c2410-rtc",
345 .id = -1,
346 .num_resources = ARRAY_SIZE(s3c_rtc_resource),
347 .resource = s3c_rtc_resource,
348};
349
350EXPORT_SYMBOL(s3c_device_rtc);
351
352/* ADC */
353
354static struct resource s3c_adc_resource[] = {
355 [0] = {
0367a8d3
LCVR
356 .start = S3C24XX_PA_ADC,
357 .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
1da177e4
LT
358 .flags = IORESOURCE_MEM,
359 },
360 [1] = {
361 .start = IRQ_TC,
083d06ed
BD
362 .end = IRQ_TC,
363 .flags = IORESOURCE_IRQ,
364 },
365 [2] = {
366 .start = IRQ_ADC,
1da177e4
LT
367 .end = IRQ_ADC,
368 .flags = IORESOURCE_IRQ,
369 }
370
371};
372
373struct platform_device s3c_device_adc = {
374 .name = "s3c2410-adc",
375 .id = -1,
376 .num_resources = ARRAY_SIZE(s3c_adc_resource),
377 .resource = s3c_adc_resource,
378};
379
380/* SDI */
381
382static struct resource s3c_sdi_resource[] = {
383 [0] = {
384 .start = S3C2410_PA_SDI,
a0e0adb9 385 .end = S3C2410_PA_SDI + S3C24XX_SZ_SDI - 1,
1da177e4
LT
386 .flags = IORESOURCE_MEM,
387 },
388 [1] = {
389 .start = IRQ_SDI,
390 .end = IRQ_SDI,
391 .flags = IORESOURCE_IRQ,
392 }
393
394};
395
396struct platform_device s3c_device_sdi = {
397 .name = "s3c2410-sdi",
398 .id = -1,
399 .num_resources = ARRAY_SIZE(s3c_sdi_resource),
400 .resource = s3c_sdi_resource,
401};
402
403EXPORT_SYMBOL(s3c_device_sdi);
404
405/* SPI (0) */
406
407static struct resource s3c_spi0_resource[] = {
408 [0] = {
0367a8d3
LCVR
409 .start = S3C24XX_PA_SPI,
410 .end = S3C24XX_PA_SPI + 0x1f,
1da177e4
LT
411 .flags = IORESOURCE_MEM,
412 },
413 [1] = {
414 .start = IRQ_SPI0,
415 .end = IRQ_SPI0,
416 .flags = IORESOURCE_IRQ,
417 }
418
419};
420