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