blob: 65447dc736c2fd5b3f0fd4e3ce4c46c3c9711dc3 [file] [log] [blame]
eric miao8f58de72007-12-19 17:14:02 +08001#include <linux/module.h>
2#include <linux/kernel.h>
3#include <linux/init.h>
4#include <linux/platform_device.h>
5#include <linux/dma-mapping.h>
6
Eric Miao09a53582010-06-14 00:43:00 +08007#include <asm/pmu.h>
Russell Kinga09e64f2008-08-05 16:14:15 +01008#include <mach/udc.h>
9#include <mach/pxafb.h>
10#include <mach/mmc.h>
11#include <mach/irda.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010012#include <mach/ohci.h>
13#include <mach/pxa27x_keypad.h>
14#include <mach/pxa2xx_spi.h>
15#include <mach/camera.h>
16#include <mach/audio.h>
Eric Miao75e874c2009-12-16 21:35:52 +080017#include <mach/hardware.h>
Haojian Zhuang82b95ec2009-09-10 13:55:23 +080018#include <plat/i2c.h>
19#include <plat/pxa3xx_nand.h>
eric miao8f58de72007-12-19 17:14:02 +080020
21#include "devices.h"
Philipp Zabelbc3a5952008-06-02 18:49:27 +010022#include "generic.h"
eric miao8f58de72007-12-19 17:14:02 +080023
24void __init pxa_register_device(struct platform_device *dev, void *data)
25{
26 int ret;
27
28 dev->dev.platform_data = data;
29
30 ret = platform_device_register(dev);
31 if (ret)
32 dev_err(&dev->dev, "unable to register device: %d\n", ret);
33}
34
Eric Miao09a53582010-06-14 00:43:00 +080035static struct resource pxa_resource_pmu = {
36 .start = IRQ_PMU,
37 .end = IRQ_PMU,
38 .flags = IORESOURCE_IRQ,
39};
40
41struct platform_device pxa_device_pmu = {
42 .name = "arm-pmu",
43 .id = ARM_PMU_DEVICE_CPU,
44 .resource = &pxa_resource_pmu,
45 .num_resources = 1,
46};
47
eric miao8f58de72007-12-19 17:14:02 +080048static struct resource pxamci_resources[] = {
49 [0] = {
50 .start = 0x41100000,
51 .end = 0x41100fff,
52 .flags = IORESOURCE_MEM,
53 },
54 [1] = {
55 .start = IRQ_MMC,
56 .end = IRQ_MMC,
57 .flags = IORESOURCE_IRQ,
58 },
59 [2] = {
60 .start = 21,
61 .end = 21,
62 .flags = IORESOURCE_DMA,
63 },
64 [3] = {
65 .start = 22,
66 .end = 22,
67 .flags = IORESOURCE_DMA,
68 },
69};
70
71static u64 pxamci_dmamask = 0xffffffffUL;
72
73struct platform_device pxa_device_mci = {
74 .name = "pxa2xx-mci",
Bridge Wufafc9d32007-12-21 19:00:13 +080075 .id = 0,
eric miao8f58de72007-12-19 17:14:02 +080076 .dev = {
77 .dma_mask = &pxamci_dmamask,
78 .coherent_dma_mask = 0xffffffff,
79 },
80 .num_resources = ARRAY_SIZE(pxamci_resources),
81 .resource = pxamci_resources,
82};
83
84void __init pxa_set_mci_info(struct pxamci_platform_data *info)
85{
86 pxa_register_device(&pxa_device_mci, info);
87}
88
89
Philipp Zabel12576292009-05-26 22:03:32 +020090static struct pxa2xx_udc_mach_info pxa_udc_info = {
91 .gpio_pullup = -1,
92 .gpio_vbus = -1,
93};
eric miao8f58de72007-12-19 17:14:02 +080094
95void __init pxa_set_udc_info(struct pxa2xx_udc_mach_info *info)
96{
97 memcpy(&pxa_udc_info, info, sizeof *info);
98}
99
100static struct resource pxa2xx_udc_resources[] = {
101 [0] = {
102 .start = 0x40600000,
103 .end = 0x4060ffff,
104 .flags = IORESOURCE_MEM,
105 },
106 [1] = {
107 .start = IRQ_USB,
108 .end = IRQ_USB,
109 .flags = IORESOURCE_IRQ,
110 },
111};
112
113static u64 udc_dma_mask = ~(u32)0;
114
Philipp Zabel7a857622008-06-22 23:36:39 +0100115struct platform_device pxa25x_device_udc = {
116 .name = "pxa25x-udc",
117 .id = -1,
118 .resource = pxa2xx_udc_resources,
119 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
120 .dev = {
121 .platform_data = &pxa_udc_info,
122 .dma_mask = &udc_dma_mask,
123 }
124};
125
126struct platform_device pxa27x_device_udc = {
127 .name = "pxa27x-udc",
eric miao8f58de72007-12-19 17:14:02 +0800128 .id = -1,
129 .resource = pxa2xx_udc_resources,
130 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
131 .dev = {
132 .platform_data = &pxa_udc_info,
133 .dma_mask = &udc_dma_mask,
134 }
135};
136
137static struct resource pxafb_resources[] = {
138 [0] = {
139 .start = 0x44000000,
140 .end = 0x4400ffff,
141 .flags = IORESOURCE_MEM,
142 },
143 [1] = {
144 .start = IRQ_LCD,
145 .end = IRQ_LCD,
146 .flags = IORESOURCE_IRQ,
147 },
148};
149
150static u64 fb_dma_mask = ~(u64)0;
151
152struct platform_device pxa_device_fb = {
153 .name = "pxa2xx-fb",
154 .id = -1,
155 .dev = {
156 .dma_mask = &fb_dma_mask,
157 .coherent_dma_mask = 0xffffffff,
158 },
159 .num_resources = ARRAY_SIZE(pxafb_resources),
160 .resource = pxafb_resources,
161};
162
163void __init set_pxa_fb_info(struct pxafb_mach_info *info)
164{
165 pxa_register_device(&pxa_device_fb, info);
166}
167
168void __init set_pxa_fb_parent(struct device *parent_dev)
169{
170 pxa_device_fb.dev.parent = parent_dev;
171}
172
173static struct resource pxa_resource_ffuart[] = {
174 {
Eric Miao02f65262008-11-28 14:08:53 +0800175 .start = 0x40100000,
176 .end = 0x40100023,
eric miao8f58de72007-12-19 17:14:02 +0800177 .flags = IORESOURCE_MEM,
178 }, {
179 .start = IRQ_FFUART,
180 .end = IRQ_FFUART,
181 .flags = IORESOURCE_IRQ,
182 }
183};
184
Russell Kingcc155c62009-11-09 13:34:08 +0800185struct platform_device pxa_device_ffuart = {
eric miao8f58de72007-12-19 17:14:02 +0800186 .name = "pxa2xx-uart",
187 .id = 0,
188 .resource = pxa_resource_ffuart,
189 .num_resources = ARRAY_SIZE(pxa_resource_ffuart),
190};
191
Russell Kingcc155c62009-11-09 13:34:08 +0800192void __init pxa_set_ffuart_info(void *info)
193{
194 pxa_register_device(&pxa_device_ffuart, info);
195}
196
eric miao8f58de72007-12-19 17:14:02 +0800197static struct resource pxa_resource_btuart[] = {
198 {
Eric Miao02f65262008-11-28 14:08:53 +0800199 .start = 0x40200000,
200 .end = 0x40200023,
eric miao8f58de72007-12-19 17:14:02 +0800201 .flags = IORESOURCE_MEM,
202 }, {
203 .start = IRQ_BTUART,
204 .end = IRQ_BTUART,
205 .flags = IORESOURCE_IRQ,
206 }
207};
208
209struct platform_device pxa_device_btuart = {
210 .name = "pxa2xx-uart",
211 .id = 1,
212 .resource = pxa_resource_btuart,
213 .num_resources = ARRAY_SIZE(pxa_resource_btuart),
214};
215
Russell Kingcc155c62009-11-09 13:34:08 +0800216void __init pxa_set_btuart_info(void *info)
217{
218 pxa_register_device(&pxa_device_btuart, info);
219}
220
eric miao8f58de72007-12-19 17:14:02 +0800221static struct resource pxa_resource_stuart[] = {
222 {
Eric Miao02f65262008-11-28 14:08:53 +0800223 .start = 0x40700000,
224 .end = 0x40700023,
eric miao8f58de72007-12-19 17:14:02 +0800225 .flags = IORESOURCE_MEM,
226 }, {
227 .start = IRQ_STUART,
228 .end = IRQ_STUART,
229 .flags = IORESOURCE_IRQ,
230 }
231};
232
233struct platform_device pxa_device_stuart = {
234 .name = "pxa2xx-uart",
235 .id = 2,
236 .resource = pxa_resource_stuart,
237 .num_resources = ARRAY_SIZE(pxa_resource_stuart),
238};
239
Russell Kingcc155c62009-11-09 13:34:08 +0800240void __init pxa_set_stuart_info(void *info)
241{
242 pxa_register_device(&pxa_device_stuart, info);
243}
244
eric miao8f58de72007-12-19 17:14:02 +0800245static struct resource pxa_resource_hwuart[] = {
246 {
Eric Miao02f65262008-11-28 14:08:53 +0800247 .start = 0x41600000,
248 .end = 0x4160002F,
eric miao8f58de72007-12-19 17:14:02 +0800249 .flags = IORESOURCE_MEM,
250 }, {
251 .start = IRQ_HWUART,
252 .end = IRQ_HWUART,
253 .flags = IORESOURCE_IRQ,
254 }
255};
256
257struct platform_device pxa_device_hwuart = {
258 .name = "pxa2xx-uart",
259 .id = 3,
260 .resource = pxa_resource_hwuart,
261 .num_resources = ARRAY_SIZE(pxa_resource_hwuart),
262};
263
Russell Kingcc155c62009-11-09 13:34:08 +0800264void __init pxa_set_hwuart_info(void *info)
265{
266 if (cpu_is_pxa255())
267 pxa_register_device(&pxa_device_hwuart, info);
268 else
269 pr_info("UART: Ignoring attempt to register HWUART on non-PXA255 hardware");
270}
271
eric miao8f58de72007-12-19 17:14:02 +0800272static struct resource pxai2c_resources[] = {
273 {
274 .start = 0x40301680,
275 .end = 0x403016a3,
276 .flags = IORESOURCE_MEM,
277 }, {
278 .start = IRQ_I2C,
279 .end = IRQ_I2C,
280 .flags = IORESOURCE_IRQ,
281 },
282};
283
284struct platform_device pxa_device_i2c = {
285 .name = "pxa2xx-i2c",
286 .id = 0,
287 .resource = pxai2c_resources,
288 .num_resources = ARRAY_SIZE(pxai2c_resources),
289};
290
291void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info)
292{
293 pxa_register_device(&pxa_device_i2c, info);
294}
295
Eric Miao99464292008-11-28 15:01:55 +0800296#ifdef CONFIG_PXA27x
297static struct resource pxa27x_resources_i2c_power[] = {
298 {
299 .start = 0x40f00180,
300 .end = 0x40f001a3,
301 .flags = IORESOURCE_MEM,
302 }, {
303 .start = IRQ_PWRI2C,
304 .end = IRQ_PWRI2C,
305 .flags = IORESOURCE_IRQ,
306 },
307};
308
309struct platform_device pxa27x_device_i2c_power = {
310 .name = "pxa2xx-i2c",
311 .id = 1,
312 .resource = pxa27x_resources_i2c_power,
313 .num_resources = ARRAY_SIZE(pxa27x_resources_i2c_power),
314};
315#endif
316
317#ifdef CONFIG_PXA3xx
318static struct resource pxa3xx_resources_i2c_power[] = {
319 {
320 .start = 0x40f500c0,
321 .end = 0x40f500d3,
322 .flags = IORESOURCE_MEM,
323 }, {
324 .start = IRQ_PWRI2C,
325 .end = IRQ_PWRI2C,
326 .flags = IORESOURCE_IRQ,
327 },
328};
329
330struct platform_device pxa3xx_device_i2c_power = {
Eric Miaof23d4912009-04-13 14:43:25 +0800331 .name = "pxa3xx-pwri2c",
Eric Miao99464292008-11-28 15:01:55 +0800332 .id = 1,
333 .resource = pxa3xx_resources_i2c_power,
334 .num_resources = ARRAY_SIZE(pxa3xx_resources_i2c_power),
335};
336#endif
337
eric miao8f58de72007-12-19 17:14:02 +0800338static struct resource pxai2s_resources[] = {
339 {
340 .start = 0x40400000,
341 .end = 0x40400083,
342 .flags = IORESOURCE_MEM,
343 }, {
344 .start = IRQ_I2S,
345 .end = IRQ_I2S,
346 .flags = IORESOURCE_IRQ,
347 },
348};
349
350struct platform_device pxa_device_i2s = {
351 .name = "pxa2xx-i2s",
352 .id = -1,
353 .resource = pxai2s_resources,
354 .num_resources = ARRAY_SIZE(pxai2s_resources),
355};
356
357static u64 pxaficp_dmamask = ~(u32)0;
358
359struct platform_device pxa_device_ficp = {
360 .name = "pxa2xx-ir",
361 .id = -1,
362 .dev = {
363 .dma_mask = &pxaficp_dmamask,
364 .coherent_dma_mask = 0xffffffff,
365 },
366};
367
368void __init pxa_set_ficp_info(struct pxaficp_platform_data *info)
369{
370 pxa_register_device(&pxa_device_ficp, info);
371}
372
Robert Jarzmik72493142008-11-13 23:50:56 +0100373static struct resource pxa_rtc_resources[] = {
374 [0] = {
375 .start = 0x40900000,
376 .end = 0x40900000 + 0x3b,
377 .flags = IORESOURCE_MEM,
378 },
379 [1] = {
380 .start = IRQ_RTC1Hz,
381 .end = IRQ_RTC1Hz,
382 .flags = IORESOURCE_IRQ,
383 },
384 [2] = {
385 .start = IRQ_RTCAlrm,
386 .end = IRQ_RTCAlrm,
387 .flags = IORESOURCE_IRQ,
388 },
389};
390
391struct platform_device sa1100_device_rtc = {
eric miao8f58de72007-12-19 17:14:02 +0800392 .name = "sa1100-rtc",
393 .id = -1,
394};
395
Robert Jarzmik72493142008-11-13 23:50:56 +0100396struct platform_device pxa_device_rtc = {
397 .name = "pxa-rtc",
398 .id = -1,
399 .num_resources = ARRAY_SIZE(pxa_rtc_resources),
400 .resource = pxa_rtc_resources,
401};
402
Mark Brown9f19d632008-06-10 12:30:05 +0100403static struct resource pxa_ac97_resources[] = {
404 [0] = {
405 .start = 0x40500000,
406 .end = 0x40500000 + 0xfff,
407 .flags = IORESOURCE_MEM,
408 },
409 [1] = {
410 .start = IRQ_AC97,
411 .end = IRQ_AC97,
412 .flags = IORESOURCE_IRQ,
413 },
414};
415
416static u64 pxa_ac97_dmamask = 0xffffffffUL;
417
418struct platform_device pxa_device_ac97 = {
419 .name = "pxa2xx-ac97",
420 .id = -1,
421 .dev = {
422 .dma_mask = &pxa_ac97_dmamask,
423 .coherent_dma_mask = 0xffffffff,
424 },
425 .num_resources = ARRAY_SIZE(pxa_ac97_resources),
426 .resource = pxa_ac97_resources,
427};
428
429void __init pxa_set_ac97_info(pxa2xx_audio_ops_t *ops)
430{
431 pxa_register_device(&pxa_device_ac97, ops);
432}
433
eric miao8f58de72007-12-19 17:14:02 +0800434#ifdef CONFIG_PXA25x
435
eric miao75540c12008-04-13 21:44:04 +0100436static struct resource pxa25x_resource_pwm0[] = {
437 [0] = {
438 .start = 0x40b00000,
439 .end = 0x40b0000f,
440 .flags = IORESOURCE_MEM,
441 },
442};
443
444struct platform_device pxa25x_device_pwm0 = {
445 .name = "pxa25x-pwm",
446 .id = 0,
447 .resource = pxa25x_resource_pwm0,
448 .num_resources = ARRAY_SIZE(pxa25x_resource_pwm0),
449};
450
451static struct resource pxa25x_resource_pwm1[] = {
452 [0] = {
453 .start = 0x40c00000,
454 .end = 0x40c0000f,
455 .flags = IORESOURCE_MEM,
456 },
457};
458
459struct platform_device pxa25x_device_pwm1 = {
460 .name = "pxa25x-pwm",
461 .id = 1,
462 .resource = pxa25x_resource_pwm1,
463 .num_resources = ARRAY_SIZE(pxa25x_resource_pwm1),
464};
465
eric miao8f58de72007-12-19 17:14:02 +0800466static u64 pxa25x_ssp_dma_mask = DMA_BIT_MASK(32);
467
468static struct resource pxa25x_resource_ssp[] = {
469 [0] = {
470 .start = 0x41000000,
471 .end = 0x4100001f,
472 .flags = IORESOURCE_MEM,
473 },
474 [1] = {
475 .start = IRQ_SSP,
476 .end = IRQ_SSP,
477 .flags = IORESOURCE_IRQ,
478 },
479 [2] = {
480 /* DRCMR for RX */
481 .start = 13,
482 .end = 13,
483 .flags = IORESOURCE_DMA,
484 },
485 [3] = {
486 /* DRCMR for TX */
487 .start = 14,
488 .end = 14,
489 .flags = IORESOURCE_DMA,
490 },
491};
492
493struct platform_device pxa25x_device_ssp = {
494 .name = "pxa25x-ssp",
495 .id = 0,
496 .dev = {
497 .dma_mask = &pxa25x_ssp_dma_mask,
498 .coherent_dma_mask = DMA_BIT_MASK(32),
499 },
500 .resource = pxa25x_resource_ssp,
501 .num_resources = ARRAY_SIZE(pxa25x_resource_ssp),
502};
503
504static u64 pxa25x_nssp_dma_mask = DMA_BIT_MASK(32);
505
506static struct resource pxa25x_resource_nssp[] = {
507 [0] = {
508 .start = 0x41400000,
509 .end = 0x4140002f,
510 .flags = IORESOURCE_MEM,
511 },
512 [1] = {
513 .start = IRQ_NSSP,
514 .end = IRQ_NSSP,
515 .flags = IORESOURCE_IRQ,
516 },
517 [2] = {
518 /* DRCMR for RX */
519 .start = 15,
520 .end = 15,
521 .flags = IORESOURCE_DMA,
522 },
523 [3] = {
524 /* DRCMR for TX */
525 .start = 16,
526 .end = 16,
527 .flags = IORESOURCE_DMA,
528 },
529};
530
531struct platform_device pxa25x_device_nssp = {
532 .name = "pxa25x-nssp",
533 .id = 1,
534 .dev = {
535 .dma_mask = &pxa25x_nssp_dma_mask,
536 .coherent_dma_mask = DMA_BIT_MASK(32),
537 },
538 .resource = pxa25x_resource_nssp,
539 .num_resources = ARRAY_SIZE(pxa25x_resource_nssp),
540};
541
542static u64 pxa25x_assp_dma_mask = DMA_BIT_MASK(32);
543
544static struct resource pxa25x_resource_assp[] = {
545 [0] = {
546 .start = 0x41500000,
547 .end = 0x4150002f,
548 .flags = IORESOURCE_MEM,
549 },
550 [1] = {
551 .start = IRQ_ASSP,
552 .end = IRQ_ASSP,
553 .flags = IORESOURCE_IRQ,
554 },
555 [2] = {
556 /* DRCMR for RX */
557 .start = 23,
558 .end = 23,
559 .flags = IORESOURCE_DMA,
560 },
561 [3] = {
562 /* DRCMR for TX */
563 .start = 24,
564 .end = 24,
565 .flags = IORESOURCE_DMA,
566 },
567};
568
569struct platform_device pxa25x_device_assp = {
570 /* ASSP is basically equivalent to NSSP */
571 .name = "pxa25x-nssp",
572 .id = 2,
573 .dev = {
574 .dma_mask = &pxa25x_assp_dma_mask,
575 .coherent_dma_mask = DMA_BIT_MASK(32),
576 },
577 .resource = pxa25x_resource_assp,
578 .num_resources = ARRAY_SIZE(pxa25x_resource_assp),
579};
580#endif /* CONFIG_PXA25x */
581
582#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
583
eric miao37320982008-01-23 13:39:13 +0800584static struct resource pxa27x_resource_keypad[] = {
585 [0] = {
586 .start = 0x41500000,
587 .end = 0x4150004c,
588 .flags = IORESOURCE_MEM,
589 },
590 [1] = {
591 .start = IRQ_KEYPAD,
592 .end = IRQ_KEYPAD,
593 .flags = IORESOURCE_IRQ,
594 },
595};
596
597struct platform_device pxa27x_device_keypad = {
598 .name = "pxa27x-keypad",
599 .id = -1,
600 .resource = pxa27x_resource_keypad,
601 .num_resources = ARRAY_SIZE(pxa27x_resource_keypad),
602};
603
604void __init pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info)
605{
606 pxa_register_device(&pxa27x_device_keypad, info);
607}
608
eric miaoec68e452007-12-12 09:29:33 +0800609static u64 pxa27x_ohci_dma_mask = DMA_BIT_MASK(32);
610
611static struct resource pxa27x_resource_ohci[] = {
612 [0] = {
613 .start = 0x4C000000,
614 .end = 0x4C00ff6f,
615 .flags = IORESOURCE_MEM,
616 },
617 [1] = {
618 .start = IRQ_USBH1,
619 .end = IRQ_USBH1,
620 .flags = IORESOURCE_IRQ,
621 },
622};
623
624struct platform_device pxa27x_device_ohci = {
625 .name = "pxa27x-ohci",
626 .id = -1,
627 .dev = {
628 .dma_mask = &pxa27x_ohci_dma_mask,
629 .coherent_dma_mask = DMA_BIT_MASK(32),
630 },
631 .num_resources = ARRAY_SIZE(pxa27x_resource_ohci),
632 .resource = pxa27x_resource_ohci,
633};
634
635void __init pxa_set_ohci_info(struct pxaohci_platform_data *info)
636{
637 pxa_register_device(&pxa27x_device_ohci, info);
638}
639
eric miao8f58de72007-12-19 17:14:02 +0800640static u64 pxa27x_ssp1_dma_mask = DMA_BIT_MASK(32);
641
642static struct resource pxa27x_resource_ssp1[] = {
643 [0] = {
644 .start = 0x41000000,
645 .end = 0x4100003f,
646 .flags = IORESOURCE_MEM,
647 },
648 [1] = {
649 .start = IRQ_SSP,
650 .end = IRQ_SSP,
651 .flags = IORESOURCE_IRQ,
652 },
653 [2] = {
654 /* DRCMR for RX */
655 .start = 13,
656 .end = 13,
657 .flags = IORESOURCE_DMA,
658 },
659 [3] = {
660 /* DRCMR for TX */
661 .start = 14,
662 .end = 14,
663 .flags = IORESOURCE_DMA,
664 },
665};
666
667struct platform_device pxa27x_device_ssp1 = {
668 .name = "pxa27x-ssp",
669 .id = 0,
670 .dev = {
671 .dma_mask = &pxa27x_ssp1_dma_mask,
672 .coherent_dma_mask = DMA_BIT_MASK(32),
673 },
674 .resource = pxa27x_resource_ssp1,
675 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp1),
676};
677
678static u64 pxa27x_ssp2_dma_mask = DMA_BIT_MASK(32);
679
680static struct resource pxa27x_resource_ssp2[] = {
681 [0] = {
682 .start = 0x41700000,
683 .end = 0x4170003f,
684 .flags = IORESOURCE_MEM,
685 },
686 [1] = {
687 .start = IRQ_SSP2,
688 .end = IRQ_SSP2,
689 .flags = IORESOURCE_IRQ,
690 },
691 [2] = {
692 /* DRCMR for RX */
693 .start = 15,
694 .end = 15,
695 .flags = IORESOURCE_DMA,
696 },
697 [3] = {
698 /* DRCMR for TX */
699 .start = 16,
700 .end = 16,
701 .flags = IORESOURCE_DMA,
702 },
703};
704
705struct platform_device pxa27x_device_ssp2 = {
706 .name = "pxa27x-ssp",
707 .id = 1,
708 .dev = {
709 .dma_mask = &pxa27x_ssp2_dma_mask,
710 .coherent_dma_mask = DMA_BIT_MASK(32),
711 },
712 .resource = pxa27x_resource_ssp2,
713 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp2),
714};
715
716static u64 pxa27x_ssp3_dma_mask = DMA_BIT_MASK(32);
717
718static struct resource pxa27x_resource_ssp3[] = {
719 [0] = {
720 .start = 0x41900000,
721 .end = 0x4190003f,
722 .flags = IORESOURCE_MEM,
723 },
724 [1] = {
725 .start = IRQ_SSP3,
726 .end = IRQ_SSP3,
727 .flags = IORESOURCE_IRQ,
728 },
729 [2] = {
730 /* DRCMR for RX */
731 .start = 66,
732 .end = 66,
733 .flags = IORESOURCE_DMA,
734 },
735 [3] = {
736 /* DRCMR for TX */
737 .start = 67,
738 .end = 67,
739 .flags = IORESOURCE_DMA,
740 },
741};
742
743struct platform_device pxa27x_device_ssp3 = {
744 .name = "pxa27x-ssp",
745 .id = 2,
746 .dev = {
747 .dma_mask = &pxa27x_ssp3_dma_mask,
748 .coherent_dma_mask = DMA_BIT_MASK(32),
749 },
750 .resource = pxa27x_resource_ssp3,
751 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3),
752};
Guennadi Liakhovetski3f3acef2008-04-11 22:19:45 +0200753
eric miao75540c12008-04-13 21:44:04 +0100754static struct resource pxa27x_resource_pwm0[] = {
755 [0] = {
756 .start = 0x40b00000,
757 .end = 0x40b0001f,
758 .flags = IORESOURCE_MEM,
759 },
760};
761
762struct platform_device pxa27x_device_pwm0 = {
763 .name = "pxa27x-pwm",
764 .id = 0,
765 .resource = pxa27x_resource_pwm0,
766 .num_resources = ARRAY_SIZE(pxa27x_resource_pwm0),
767};
768
769static struct resource pxa27x_resource_pwm1[] = {
770 [0] = {
771 .start = 0x40c00000,
772 .end = 0x40c0001f,
773 .flags = IORESOURCE_MEM,
774 },
775};
776
777struct platform_device pxa27x_device_pwm1 = {
778 .name = "pxa27x-pwm",
779 .id = 1,
780 .resource = pxa27x_resource_pwm1,
781 .num_resources = ARRAY_SIZE(pxa27x_resource_pwm1),
782};
783
Guennadi Liakhovetski3f3acef2008-04-11 22:19:45 +0200784static struct resource pxa27x_resource_camera[] = {
785 [0] = {
786 .start = 0x50000000,
787 .end = 0x50000fff,
788 .flags = IORESOURCE_MEM,
789 },
790 [1] = {
791 .start = IRQ_CAMERA,
792 .end = IRQ_CAMERA,
793 .flags = IORESOURCE_IRQ,
794 },
795};
796
797static u64 pxa27x_dma_mask_camera = DMA_BIT_MASK(32);
798
799static struct platform_device pxa27x_device_camera = {
800 .name = "pxa27x-camera",
801 .id = 0, /* This is used to put cameras on this interface */
802 .dev = {
803 .dma_mask = &pxa27x_dma_mask_camera,
804 .coherent_dma_mask = 0xffffffff,
805 },
806 .num_resources = ARRAY_SIZE(pxa27x_resource_camera),
807 .resource = pxa27x_resource_camera,
808};
809
810void __init pxa_set_camera_info(struct pxacamera_platform_data *info)
811{
812 pxa_register_device(&pxa27x_device_camera, info);
813}
eric miao8f58de72007-12-19 17:14:02 +0800814#endif /* CONFIG_PXA27x || CONFIG_PXA3xx */
815
816#ifdef CONFIG_PXA3xx
817static u64 pxa3xx_ssp4_dma_mask = DMA_BIT_MASK(32);
818
819static struct resource pxa3xx_resource_ssp4[] = {
820 [0] = {
821 .start = 0x41a00000,
822 .end = 0x41a0003f,
823 .flags = IORESOURCE_MEM,
824 },
825 [1] = {
826 .start = IRQ_SSP4,
827 .end = IRQ_SSP4,
828 .flags = IORESOURCE_IRQ,
829 },
830 [2] = {
831 /* DRCMR for RX */
832 .start = 2,
833 .end = 2,
834 .flags = IORESOURCE_DMA,
835 },
836 [3] = {
837 /* DRCMR for TX */
838 .start = 3,
839 .end = 3,
840 .flags = IORESOURCE_DMA,
841 },
842};
843
844struct platform_device pxa3xx_device_ssp4 = {
845 /* PXA3xx SSP is basically equivalent to PXA27x */
846 .name = "pxa27x-ssp",
847 .id = 3,
848 .dev = {
849 .dma_mask = &pxa3xx_ssp4_dma_mask,
850 .coherent_dma_mask = DMA_BIT_MASK(32),
851 },
852 .resource = pxa3xx_resource_ssp4,
853 .num_resources = ARRAY_SIZE(pxa3xx_resource_ssp4),
854};
Bridge Wu8d33b052007-12-21 19:15:36 +0800855
856static struct resource pxa3xx_resources_mci2[] = {
857 [0] = {
858 .start = 0x42000000,
859 .end = 0x42000fff,
860 .flags = IORESOURCE_MEM,
861 },
862 [1] = {
863 .start = IRQ_MMC2,
864 .end = IRQ_MMC2,
865 .flags = IORESOURCE_IRQ,
866 },
867 [2] = {
868 .start = 93,
869 .end = 93,
870 .flags = IORESOURCE_DMA,
871 },
872 [3] = {
873 .start = 94,
874 .end = 94,
875 .flags = IORESOURCE_DMA,
876 },
877};
878
879struct platform_device pxa3xx_device_mci2 = {
880 .name = "pxa2xx-mci",
881 .id = 1,
882 .dev = {
883 .dma_mask = &pxamci_dmamask,
884 .coherent_dma_mask = 0xffffffff,
885 },
886 .num_resources = ARRAY_SIZE(pxa3xx_resources_mci2),
887 .resource = pxa3xx_resources_mci2,
888};
889
890void __init pxa3xx_set_mci2_info(struct pxamci_platform_data *info)
891{
892 pxa_register_device(&pxa3xx_device_mci2, info);
893}
894
Bridge Wu5a1f21b2007-12-21 19:27:08 +0800895static struct resource pxa3xx_resources_mci3[] = {
896 [0] = {
897 .start = 0x42500000,
898 .end = 0x42500fff,
899 .flags = IORESOURCE_MEM,
900 },
901 [1] = {
902 .start = IRQ_MMC3,
903 .end = IRQ_MMC3,
904 .flags = IORESOURCE_IRQ,
905 },
906 [2] = {
907 .start = 100,
908 .end = 100,
909 .flags = IORESOURCE_DMA,
910 },
911 [3] = {
912 .start = 101,
913 .end = 101,
914 .flags = IORESOURCE_DMA,
915 },
916};
917
918struct platform_device pxa3xx_device_mci3 = {
919 .name = "pxa2xx-mci",
920 .id = 2,
921 .dev = {
922 .dma_mask = &pxamci_dmamask,
923 .coherent_dma_mask = 0xffffffff,
924 },
925 .num_resources = ARRAY_SIZE(pxa3xx_resources_mci3),
926 .resource = pxa3xx_resources_mci3,
927};
928
929void __init pxa3xx_set_mci3_info(struct pxamci_platform_data *info)
930{
931 pxa_register_device(&pxa3xx_device_mci3, info);
932}
933
Eric Miao9ae819a2008-06-02 15:22:03 +0800934static struct resource pxa3xx_resources_nand[] = {
935 [0] = {
936 .start = 0x43100000,
937 .end = 0x43100053,
938 .flags = IORESOURCE_MEM,
939 },
940 [1] = {
941 .start = IRQ_NAND,
942 .end = IRQ_NAND,
943 .flags = IORESOURCE_IRQ,
944 },
945 [2] = {
946 /* DRCMR for Data DMA */
947 .start = 97,
948 .end = 97,
949 .flags = IORESOURCE_DMA,
950 },
951 [3] = {
952 /* DRCMR for Command DMA */
953 .start = 99,
954 .end = 99,
955 .flags = IORESOURCE_DMA,
956 },
957};
958
959static u64 pxa3xx_nand_dma_mask = DMA_BIT_MASK(32);
960
961struct platform_device pxa3xx_device_nand = {
962 .name = "pxa3xx-nand",
963 .id = -1,
964 .dev = {
965 .dma_mask = &pxa3xx_nand_dma_mask,
966 .coherent_dma_mask = DMA_BIT_MASK(32),
967 },
968 .num_resources = ARRAY_SIZE(pxa3xx_resources_nand),
969 .resource = pxa3xx_resources_nand,
970};
971
972void __init pxa3xx_set_nand_info(struct pxa3xx_nand_platform_data *info)
973{
974 pxa_register_device(&pxa3xx_device_nand, info);
975}
Daniel Mack1ff2c332009-07-09 19:04:49 +0200976
977static struct resource pxa3xx_resources_gcu[] = {
978 {
979 .start = 0x54000000,
980 .end = 0x54000fff,
981 .flags = IORESOURCE_MEM,
982 },
983 {
984 .start = IRQ_GCU,
985 .end = IRQ_GCU,
986 .flags = IORESOURCE_IRQ,
987 },
988};
989
990static u64 pxa3xx_gcu_dmamask = DMA_BIT_MASK(32);
991
992struct platform_device pxa3xx_device_gcu = {
993 .name = "pxa3xx-gcu",
994 .id = -1,
995 .num_resources = ARRAY_SIZE(pxa3xx_resources_gcu),
996 .resource = pxa3xx_resources_gcu,
997 .dev = {
998 .dma_mask = &pxa3xx_gcu_dmamask,
999 .coherent_dma_mask = 0xffffffff,
1000 },
1001};
1002
eric miao8f58de72007-12-19 17:14:02 +08001003#endif /* CONFIG_PXA3xx */
Guennadi Liakhovetskie1722742008-06-13 09:17:31 +01001004
1005/* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1.
1006 * See comment in arch/arm/mach-pxa/ssp.c::ssp_probe() */
1007void __init pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_master *info)
1008{
1009 struct platform_device *pd;
1010
1011 pd = platform_device_alloc("pxa2xx-spi", id);
1012 if (pd == NULL) {
1013 printk(KERN_ERR "pxa2xx-spi: failed to allocate device id %d\n",
1014 id);
1015 return;
1016 }
1017
1018 pd->dev.platform_data = info;
1019 platform_device_add(pd);
1020}