1 #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>
7 #include <asm/arch/gpio.h>
8 #include <asm/arch/udc.h>
9 #include <asm/arch/pxafb.h>
10 #include <asm/arch/mmc.h>
11 #include <asm/arch/irda.h>
12 #include <asm/arch/i2c.h>
13 #include <asm/arch/ohci.h>
14 #include <asm/arch/pxa27x_keypad.h>
18 void __init pxa_register_device(struct platform_device *dev, void *data)
22 dev->dev.platform_data = data;
24 ret = platform_device_register(dev);
26 dev_err(&dev->dev, "unable to register device: %d\n", ret);
29 static struct resource pxamci_resources[] = {
33 .flags = IORESOURCE_MEM,
38 .flags = IORESOURCE_IRQ,
43 .flags = IORESOURCE_DMA,
48 .flags = IORESOURCE_DMA,
52 static u64 pxamci_dmamask = 0xffffffffUL;
54 struct platform_device pxa_device_mci = {
58 .dma_mask = &pxamci_dmamask,
59 .coherent_dma_mask = 0xffffffff,
61 .num_resources = ARRAY_SIZE(pxamci_resources),
62 .resource = pxamci_resources,
65 void __init pxa_set_mci_info(struct pxamci_platform_data *info)
67 pxa_register_device(&pxa_device_mci, info);
71 static struct pxa2xx_udc_mach_info pxa_udc_info;
73 void __init pxa_set_udc_info(struct pxa2xx_udc_mach_info *info)
75 memcpy(&pxa_udc_info, info, sizeof *info);
78 static struct resource pxa2xx_udc_resources[] = {
82 .flags = IORESOURCE_MEM,
87 .flags = IORESOURCE_IRQ,
91 static u64 udc_dma_mask = ~(u32)0;
93 struct platform_device pxa_device_udc = {
96 .resource = pxa2xx_udc_resources,
97 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
99 .platform_data = &pxa_udc_info,
100 .dma_mask = &udc_dma_mask,
104 static struct resource pxafb_resources[] = {
108 .flags = IORESOURCE_MEM,
113 .flags = IORESOURCE_IRQ,
117 static u64 fb_dma_mask = ~(u64)0;
119 struct platform_device pxa_device_fb = {
123 .dma_mask = &fb_dma_mask,
124 .coherent_dma_mask = 0xffffffff,
126 .num_resources = ARRAY_SIZE(pxafb_resources),
127 .resource = pxafb_resources,
130 void __init set_pxa_fb_info(struct pxafb_mach_info *info)
132 pxa_register_device(&pxa_device_fb, info);
135 void __init set_pxa_fb_parent(struct device *parent_dev)
137 pxa_device_fb.dev.parent = parent_dev;
140 static struct resource pxa_resource_ffuart[] = {
142 .start = __PREG(FFUART),
143 .end = __PREG(FFUART) + 35,
144 .flags = IORESOURCE_MEM,
148 .flags = IORESOURCE_IRQ,
152 struct platform_device pxa_device_ffuart= {
153 .name = "pxa2xx-uart",
155 .resource = pxa_resource_ffuart,
156 .num_resources = ARRAY_SIZE(pxa_resource_ffuart),
159 static struct resource pxa_resource_btuart[] = {
161 .start = __PREG(BTUART),
162 .end = __PREG(BTUART) + 35,
163 .flags = IORESOURCE_MEM,
167 .flags = IORESOURCE_IRQ,
171 struct platform_device pxa_device_btuart = {
172 .name = "pxa2xx-uart",
174 .resource = pxa_resource_btuart,
175 .num_resources = ARRAY_SIZE(pxa_resource_btuart),
178 static struct resource pxa_resource_stuart[] = {
180 .start = __PREG(STUART),
181 .end = __PREG(STUART) + 35,
182 .flags = IORESOURCE_MEM,
186 .flags = IORESOURCE_IRQ,
190 struct platform_device pxa_device_stuart = {
191 .name = "pxa2xx-uart",
193 .resource = pxa_resource_stuart,
194 .num_resources = ARRAY_SIZE(pxa_resource_stuart),
197 static struct resource pxa_resource_hwuart[] = {
199 .start = __PREG(HWUART),
200 .end = __PREG(HWUART) + 47,
201 .flags = IORESOURCE_MEM,
205 .flags = IORESOURCE_IRQ,
209 struct platform_device pxa_device_hwuart = {
210 .name = "pxa2xx-uart",
212 .resource = pxa_resource_hwuart,
213 .num_resources = ARRAY_SIZE(pxa_resource_hwuart),
216 static struct resource pxai2c_resources[] = {
220 .flags = IORESOURCE_MEM,
224 .flags = IORESOURCE_IRQ,
228 struct platform_device pxa_device_i2c = {
229 .name = "pxa2xx-i2c",
231 .resource = pxai2c_resources,
232 .num_resources = ARRAY_SIZE(pxai2c_resources),
235 void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info)
237 pxa_register_device(&pxa_device_i2c, info);
240 static struct resource pxai2s_resources[] = {
244 .flags = IORESOURCE_MEM,
248 .flags = IORESOURCE_IRQ,
252 struct platform_device pxa_device_i2s = {
253 .name = "pxa2xx-i2s",
255 .resource = pxai2s_resources,
256 .num_resources = ARRAY_SIZE(pxai2s_resources),
259 static u64 pxaficp_dmamask = ~(u32)0;
261 struct platform_device pxa_device_ficp = {
265 .dma_mask = &pxaficp_dmamask,
266 .coherent_dma_mask = 0xffffffff,
270 void __init pxa_set_ficp_info(struct pxaficp_platform_data *info)
272 pxa_register_device(&pxa_device_ficp, info);
275 struct platform_device pxa_device_rtc = {
276 .name = "sa1100-rtc",
282 static u64 pxa25x_ssp_dma_mask = DMA_BIT_MASK(32);
284 static struct resource pxa25x_resource_ssp[] = {
288 .flags = IORESOURCE_MEM,
293 .flags = IORESOURCE_IRQ,
299 .flags = IORESOURCE_DMA,
305 .flags = IORESOURCE_DMA,
309 struct platform_device pxa25x_device_ssp = {
310 .name = "pxa25x-ssp",
313 .dma_mask = &pxa25x_ssp_dma_mask,
314 .coherent_dma_mask = DMA_BIT_MASK(32),
316 .resource = pxa25x_resource_ssp,
317 .num_resources = ARRAY_SIZE(pxa25x_resource_ssp),
320 static u64 pxa25x_nssp_dma_mask = DMA_BIT_MASK(32);
322 static struct resource pxa25x_resource_nssp[] = {
326 .flags = IORESOURCE_MEM,
331 .flags = IORESOURCE_IRQ,
337 .flags = IORESOURCE_DMA,
343 .flags = IORESOURCE_DMA,
347 struct platform_device pxa25x_device_nssp = {
348 .name = "pxa25x-nssp",
351 .dma_mask = &pxa25x_nssp_dma_mask,
352 .coherent_dma_mask = DMA_BIT_MASK(32),
354 .resource = pxa25x_resource_nssp,
355 .num_resources = ARRAY_SIZE(pxa25x_resource_nssp),
358 static u64 pxa25x_assp_dma_mask = DMA_BIT_MASK(32);
360 static struct resource pxa25x_resource_assp[] = {
364 .flags = IORESOURCE_MEM,
369 .flags = IORESOURCE_IRQ,
375 .flags = IORESOURCE_DMA,
381 .flags = IORESOURCE_DMA,
385 struct platform_device pxa25x_device_assp = {
386 /* ASSP is basically equivalent to NSSP */
387 .name = "pxa25x-nssp",
390 .dma_mask = &pxa25x_assp_dma_mask,
391 .coherent_dma_mask = DMA_BIT_MASK(32),
393 .resource = pxa25x_resource_assp,
394 .num_resources = ARRAY_SIZE(pxa25x_resource_assp),
396 #endif /* CONFIG_PXA25x */
398 #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
400 static struct resource pxa27x_resource_keypad[] = {
404 .flags = IORESOURCE_MEM,
409 .flags = IORESOURCE_IRQ,
413 struct platform_device pxa27x_device_keypad = {
414 .name = "pxa27x-keypad",
416 .resource = pxa27x_resource_keypad,
417 .num_resources = ARRAY_SIZE(pxa27x_resource_keypad),
420 void __init pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info)
422 pxa_register_device(&pxa27x_device_keypad, info);
425 static u64 pxa27x_ohci_dma_mask = DMA_BIT_MASK(32);
427 static struct resource pxa27x_resource_ohci[] = {
431 .flags = IORESOURCE_MEM,
436 .flags = IORESOURCE_IRQ,
440 struct platform_device pxa27x_device_ohci = {
441 .name = "pxa27x-ohci",
444 .dma_mask = &pxa27x_ohci_dma_mask,
445 .coherent_dma_mask = DMA_BIT_MASK(32),
447 .num_resources = ARRAY_SIZE(pxa27x_resource_ohci),
448 .resource = pxa27x_resource_ohci,
451 void __init pxa_set_ohci_info(struct pxaohci_platform_data *info)
453 pxa_register_device(&pxa27x_device_ohci, info);
456 static u64 pxa27x_ssp1_dma_mask = DMA_BIT_MASK(32);
458 static struct resource pxa27x_resource_ssp1[] = {
462 .flags = IORESOURCE_MEM,
467 .flags = IORESOURCE_IRQ,
473 .flags = IORESOURCE_DMA,
479 .flags = IORESOURCE_DMA,
483 struct platform_device pxa27x_device_ssp1 = {
484 .name = "pxa27x-ssp",
487 .dma_mask = &pxa27x_ssp1_dma_mask,
488 .coherent_dma_mask = DMA_BIT_MASK(32),
490 .resource = pxa27x_resource_ssp1,
491 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp1),
494 static u64 pxa27x_ssp2_dma_mask = DMA_BIT_MASK(32);
496 static struct resource pxa27x_resource_ssp2[] = {
500 .flags = IORESOURCE_MEM,
505 .flags = IORESOURCE_IRQ,
511 .flags = IORESOURCE_DMA,
517 .flags = IORESOURCE_DMA,
521 struct platform_device pxa27x_device_ssp2 = {
522 .name = "pxa27x-ssp",
525 .dma_mask = &pxa27x_ssp2_dma_mask,
526 .coherent_dma_mask = DMA_BIT_MASK(32),
528 .resource = pxa27x_resource_ssp2,
529 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp2),
532 static u64 pxa27x_ssp3_dma_mask = DMA_BIT_MASK(32);
534 static struct resource pxa27x_resource_ssp3[] = {
538 .flags = IORESOURCE_MEM,
543 .flags = IORESOURCE_IRQ,
549 .flags = IORESOURCE_DMA,
555 .flags = IORESOURCE_DMA,
559 struct platform_device pxa27x_device_ssp3 = {
560 .name = "pxa27x-ssp",
563 .dma_mask = &pxa27x_ssp3_dma_mask,
564 .coherent_dma_mask = DMA_BIT_MASK(32),
566 .resource = pxa27x_resource_ssp3,
567 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3),
569 #endif /* CONFIG_PXA27x || CONFIG_PXA3xx */
572 static u64 pxa3xx_ssp4_dma_mask = DMA_BIT_MASK(32);
574 static struct resource pxa3xx_resource_ssp4[] = {
578 .flags = IORESOURCE_MEM,
583 .flags = IORESOURCE_IRQ,
589 .flags = IORESOURCE_DMA,
595 .flags = IORESOURCE_DMA,
599 struct platform_device pxa3xx_device_ssp4 = {
600 /* PXA3xx SSP is basically equivalent to PXA27x */
601 .name = "pxa27x-ssp",
604 .dma_mask = &pxa3xx_ssp4_dma_mask,
605 .coherent_dma_mask = DMA_BIT_MASK(32),
607 .resource = pxa3xx_resource_ssp4,
608 .num_resources = ARRAY_SIZE(pxa3xx_resource_ssp4),
611 static struct resource pxa3xx_resources_mci2[] = {
615 .flags = IORESOURCE_MEM,
620 .flags = IORESOURCE_IRQ,
625 .flags = IORESOURCE_DMA,
630 .flags = IORESOURCE_DMA,
634 struct platform_device pxa3xx_device_mci2 = {
635 .name = "pxa2xx-mci",
638 .dma_mask = &pxamci_dmamask,
639 .coherent_dma_mask = 0xffffffff,
641 .num_resources = ARRAY_SIZE(pxa3xx_resources_mci2),
642 .resource = pxa3xx_resources_mci2,
645 void __init pxa3xx_set_mci2_info(struct pxamci_platform_data *info)
647 pxa_register_device(&pxa3xx_device_mci2, info);
650 static struct resource pxa3xx_resources_mci3[] = {
654 .flags = IORESOURCE_MEM,
659 .flags = IORESOURCE_IRQ,
664 .flags = IORESOURCE_DMA,
669 .flags = IORESOURCE_DMA,
673 struct platform_device pxa3xx_device_mci3 = {
674 .name = "pxa2xx-mci",
677 .dma_mask = &pxamci_dmamask,
678 .coherent_dma_mask = 0xffffffff,
680 .num_resources = ARRAY_SIZE(pxa3xx_resources_mci3),
681 .resource = pxa3xx_resources_mci3,
684 void __init pxa3xx_set_mci3_info(struct pxamci_platform_data *info)
686 pxa_register_device(&pxa3xx_device_mci3, info);
689 #endif /* CONFIG_PXA3xx */