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>
15 #include <asm/arch/camera.h>
19 void __init pxa_register_device(struct platform_device *dev, void *data)
23 dev->dev.platform_data = data;
25 ret = platform_device_register(dev);
27 dev_err(&dev->dev, "unable to register device: %d\n", ret);
30 static struct resource pxamci_resources[] = {
34 .flags = IORESOURCE_MEM,
39 .flags = IORESOURCE_IRQ,
44 .flags = IORESOURCE_DMA,
49 .flags = IORESOURCE_DMA,
53 static u64 pxamci_dmamask = 0xffffffffUL;
55 struct platform_device pxa_device_mci = {
59 .dma_mask = &pxamci_dmamask,
60 .coherent_dma_mask = 0xffffffff,
62 .num_resources = ARRAY_SIZE(pxamci_resources),
63 .resource = pxamci_resources,
66 void __init pxa_set_mci_info(struct pxamci_platform_data *info)
68 pxa_register_device(&pxa_device_mci, info);
72 static struct pxa2xx_udc_mach_info pxa_udc_info;
74 void __init pxa_set_udc_info(struct pxa2xx_udc_mach_info *info)
76 memcpy(&pxa_udc_info, info, sizeof *info);
79 static struct resource pxa2xx_udc_resources[] = {
83 .flags = IORESOURCE_MEM,
88 .flags = IORESOURCE_IRQ,
92 static u64 udc_dma_mask = ~(u32)0;
94 struct platform_device pxa_device_udc = {
97 .resource = pxa2xx_udc_resources,
98 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
100 .platform_data = &pxa_udc_info,
101 .dma_mask = &udc_dma_mask,
105 static struct resource pxafb_resources[] = {
109 .flags = IORESOURCE_MEM,
114 .flags = IORESOURCE_IRQ,
118 static u64 fb_dma_mask = ~(u64)0;
120 struct platform_device pxa_device_fb = {
124 .dma_mask = &fb_dma_mask,
125 .coherent_dma_mask = 0xffffffff,
127 .num_resources = ARRAY_SIZE(pxafb_resources),
128 .resource = pxafb_resources,
131 void __init set_pxa_fb_info(struct pxafb_mach_info *info)
133 pxa_register_device(&pxa_device_fb, info);
136 void __init set_pxa_fb_parent(struct device *parent_dev)
138 pxa_device_fb.dev.parent = parent_dev;
141 static struct resource pxa_resource_ffuart[] = {
143 .start = __PREG(FFUART),
144 .end = __PREG(FFUART) + 35,
145 .flags = IORESOURCE_MEM,
149 .flags = IORESOURCE_IRQ,
153 struct platform_device pxa_device_ffuart= {
154 .name = "pxa2xx-uart",
156 .resource = pxa_resource_ffuart,
157 .num_resources = ARRAY_SIZE(pxa_resource_ffuart),
160 static struct resource pxa_resource_btuart[] = {
162 .start = __PREG(BTUART),
163 .end = __PREG(BTUART) + 35,
164 .flags = IORESOURCE_MEM,
168 .flags = IORESOURCE_IRQ,
172 struct platform_device pxa_device_btuart = {
173 .name = "pxa2xx-uart",
175 .resource = pxa_resource_btuart,
176 .num_resources = ARRAY_SIZE(pxa_resource_btuart),
179 static struct resource pxa_resource_stuart[] = {
181 .start = __PREG(STUART),
182 .end = __PREG(STUART) + 35,
183 .flags = IORESOURCE_MEM,
187 .flags = IORESOURCE_IRQ,
191 struct platform_device pxa_device_stuart = {
192 .name = "pxa2xx-uart",
194 .resource = pxa_resource_stuart,
195 .num_resources = ARRAY_SIZE(pxa_resource_stuart),
198 static struct resource pxa_resource_hwuart[] = {
200 .start = __PREG(HWUART),
201 .end = __PREG(HWUART) + 47,
202 .flags = IORESOURCE_MEM,
206 .flags = IORESOURCE_IRQ,
210 struct platform_device pxa_device_hwuart = {
211 .name = "pxa2xx-uart",
213 .resource = pxa_resource_hwuart,
214 .num_resources = ARRAY_SIZE(pxa_resource_hwuart),
217 static struct resource pxai2c_resources[] = {
221 .flags = IORESOURCE_MEM,
225 .flags = IORESOURCE_IRQ,
229 struct platform_device pxa_device_i2c = {
230 .name = "pxa2xx-i2c",
232 .resource = pxai2c_resources,
233 .num_resources = ARRAY_SIZE(pxai2c_resources),
236 void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info)
238 pxa_register_device(&pxa_device_i2c, info);
241 static struct resource pxai2s_resources[] = {
245 .flags = IORESOURCE_MEM,
249 .flags = IORESOURCE_IRQ,
253 struct platform_device pxa_device_i2s = {
254 .name = "pxa2xx-i2s",
256 .resource = pxai2s_resources,
257 .num_resources = ARRAY_SIZE(pxai2s_resources),
260 static u64 pxaficp_dmamask = ~(u32)0;
262 struct platform_device pxa_device_ficp = {
266 .dma_mask = &pxaficp_dmamask,
267 .coherent_dma_mask = 0xffffffff,
271 void __init pxa_set_ficp_info(struct pxaficp_platform_data *info)
273 pxa_register_device(&pxa_device_ficp, info);
276 struct platform_device pxa_device_rtc = {
277 .name = "sa1100-rtc",
283 static struct resource pxa25x_resource_pwm0[] = {
287 .flags = IORESOURCE_MEM,
291 struct platform_device pxa25x_device_pwm0 = {
292 .name = "pxa25x-pwm",
294 .resource = pxa25x_resource_pwm0,
295 .num_resources = ARRAY_SIZE(pxa25x_resource_pwm0),
298 static struct resource pxa25x_resource_pwm1[] = {
302 .flags = IORESOURCE_MEM,
306 struct platform_device pxa25x_device_pwm1 = {
307 .name = "pxa25x-pwm",
309 .resource = pxa25x_resource_pwm1,
310 .num_resources = ARRAY_SIZE(pxa25x_resource_pwm1),
313 static u64 pxa25x_ssp_dma_mask = DMA_BIT_MASK(32);
315 static struct resource pxa25x_resource_ssp[] = {
319 .flags = IORESOURCE_MEM,
324 .flags = IORESOURCE_IRQ,
330 .flags = IORESOURCE_DMA,
336 .flags = IORESOURCE_DMA,
340 struct platform_device pxa25x_device_ssp = {
341 .name = "pxa25x-ssp",
344 .dma_mask = &pxa25x_ssp_dma_mask,
345 .coherent_dma_mask = DMA_BIT_MASK(32),
347 .resource = pxa25x_resource_ssp,
348 .num_resources = ARRAY_SIZE(pxa25x_resource_ssp),
351 static u64 pxa25x_nssp_dma_mask = DMA_BIT_MASK(32);
353 static struct resource pxa25x_resource_nssp[] = {
357 .flags = IORESOURCE_MEM,
362 .flags = IORESOURCE_IRQ,
368 .flags = IORESOURCE_DMA,
374 .flags = IORESOURCE_DMA,
378 struct platform_device pxa25x_device_nssp = {
379 .name = "pxa25x-nssp",
382 .dma_mask = &pxa25x_nssp_dma_mask,
383 .coherent_dma_mask = DMA_BIT_MASK(32),
385 .resource = pxa25x_resource_nssp,
386 .num_resources = ARRAY_SIZE(pxa25x_resource_nssp),
389 static u64 pxa25x_assp_dma_mask = DMA_BIT_MASK(32);
391 static struct resource pxa25x_resource_assp[] = {
395 .flags = IORESOURCE_MEM,
400 .flags = IORESOURCE_IRQ,
406 .flags = IORESOURCE_DMA,
412 .flags = IORESOURCE_DMA,
416 struct platform_device pxa25x_device_assp = {
417 /* ASSP is basically equivalent to NSSP */
418 .name = "pxa25x-nssp",
421 .dma_mask = &pxa25x_assp_dma_mask,
422 .coherent_dma_mask = DMA_BIT_MASK(32),
424 .resource = pxa25x_resource_assp,
425 .num_resources = ARRAY_SIZE(pxa25x_resource_assp),
427 #endif /* CONFIG_PXA25x */
429 #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
431 static struct resource pxa27x_resource_keypad[] = {
435 .flags = IORESOURCE_MEM,
440 .flags = IORESOURCE_IRQ,
444 struct platform_device pxa27x_device_keypad = {
445 .name = "pxa27x-keypad",
447 .resource = pxa27x_resource_keypad,
448 .num_resources = ARRAY_SIZE(pxa27x_resource_keypad),
451 void __init pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info)
453 pxa_register_device(&pxa27x_device_keypad, info);
456 static u64 pxa27x_ohci_dma_mask = DMA_BIT_MASK(32);
458 static struct resource pxa27x_resource_ohci[] = {
462 .flags = IORESOURCE_MEM,
467 .flags = IORESOURCE_IRQ,
471 struct platform_device pxa27x_device_ohci = {
472 .name = "pxa27x-ohci",
475 .dma_mask = &pxa27x_ohci_dma_mask,
476 .coherent_dma_mask = DMA_BIT_MASK(32),
478 .num_resources = ARRAY_SIZE(pxa27x_resource_ohci),
479 .resource = pxa27x_resource_ohci,
482 void __init pxa_set_ohci_info(struct pxaohci_platform_data *info)
484 pxa_register_device(&pxa27x_device_ohci, info);
487 static u64 pxa27x_ssp1_dma_mask = DMA_BIT_MASK(32);
489 static struct resource pxa27x_resource_ssp1[] = {
493 .flags = IORESOURCE_MEM,
498 .flags = IORESOURCE_IRQ,
504 .flags = IORESOURCE_DMA,
510 .flags = IORESOURCE_DMA,
514 struct platform_device pxa27x_device_ssp1 = {
515 .name = "pxa27x-ssp",
518 .dma_mask = &pxa27x_ssp1_dma_mask,
519 .coherent_dma_mask = DMA_BIT_MASK(32),
521 .resource = pxa27x_resource_ssp1,
522 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp1),
525 static u64 pxa27x_ssp2_dma_mask = DMA_BIT_MASK(32);
527 static struct resource pxa27x_resource_ssp2[] = {
531 .flags = IORESOURCE_MEM,
536 .flags = IORESOURCE_IRQ,
542 .flags = IORESOURCE_DMA,
548 .flags = IORESOURCE_DMA,
552 struct platform_device pxa27x_device_ssp2 = {
553 .name = "pxa27x-ssp",
556 .dma_mask = &pxa27x_ssp2_dma_mask,
557 .coherent_dma_mask = DMA_BIT_MASK(32),
559 .resource = pxa27x_resource_ssp2,
560 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp2),
563 static u64 pxa27x_ssp3_dma_mask = DMA_BIT_MASK(32);
565 static struct resource pxa27x_resource_ssp3[] = {
569 .flags = IORESOURCE_MEM,
574 .flags = IORESOURCE_IRQ,
580 .flags = IORESOURCE_DMA,
586 .flags = IORESOURCE_DMA,
590 struct platform_device pxa27x_device_ssp3 = {
591 .name = "pxa27x-ssp",
594 .dma_mask = &pxa27x_ssp3_dma_mask,
595 .coherent_dma_mask = DMA_BIT_MASK(32),
597 .resource = pxa27x_resource_ssp3,
598 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3),
601 static struct resource pxa27x_resource_pwm0[] = {
605 .flags = IORESOURCE_MEM,
609 struct platform_device pxa27x_device_pwm0 = {
610 .name = "pxa27x-pwm",
612 .resource = pxa27x_resource_pwm0,
613 .num_resources = ARRAY_SIZE(pxa27x_resource_pwm0),
616 static struct resource pxa27x_resource_pwm1[] = {
620 .flags = IORESOURCE_MEM,
624 struct platform_device pxa27x_device_pwm1 = {
625 .name = "pxa27x-pwm",
627 .resource = pxa27x_resource_pwm1,
628 .num_resources = ARRAY_SIZE(pxa27x_resource_pwm1),
631 static struct resource pxa27x_resource_camera[] = {
635 .flags = IORESOURCE_MEM,
640 .flags = IORESOURCE_IRQ,
644 static u64 pxa27x_dma_mask_camera = DMA_BIT_MASK(32);
646 static struct platform_device pxa27x_device_camera = {
647 .name = "pxa27x-camera",
648 .id = 0, /* This is used to put cameras on this interface */
650 .dma_mask = &pxa27x_dma_mask_camera,
651 .coherent_dma_mask = 0xffffffff,
653 .num_resources = ARRAY_SIZE(pxa27x_resource_camera),
654 .resource = pxa27x_resource_camera,
657 void __init pxa_set_camera_info(struct pxacamera_platform_data *info)
659 pxa_register_device(&pxa27x_device_camera, info);
661 #endif /* CONFIG_PXA27x || CONFIG_PXA3xx */
664 static u64 pxa3xx_ssp4_dma_mask = DMA_BIT_MASK(32);
666 static struct resource pxa3xx_resource_ssp4[] = {
670 .flags = IORESOURCE_MEM,
675 .flags = IORESOURCE_IRQ,
681 .flags = IORESOURCE_DMA,
687 .flags = IORESOURCE_DMA,
691 struct platform_device pxa3xx_device_ssp4 = {
692 /* PXA3xx SSP is basically equivalent to PXA27x */
693 .name = "pxa27x-ssp",
696 .dma_mask = &pxa3xx_ssp4_dma_mask,
697 .coherent_dma_mask = DMA_BIT_MASK(32),
699 .resource = pxa3xx_resource_ssp4,
700 .num_resources = ARRAY_SIZE(pxa3xx_resource_ssp4),
703 static struct resource pxa3xx_resources_mci2[] = {
707 .flags = IORESOURCE_MEM,
712 .flags = IORESOURCE_IRQ,
717 .flags = IORESOURCE_DMA,
722 .flags = IORESOURCE_DMA,
726 struct platform_device pxa3xx_device_mci2 = {
727 .name = "pxa2xx-mci",
730 .dma_mask = &pxamci_dmamask,
731 .coherent_dma_mask = 0xffffffff,
733 .num_resources = ARRAY_SIZE(pxa3xx_resources_mci2),
734 .resource = pxa3xx_resources_mci2,
737 void __init pxa3xx_set_mci2_info(struct pxamci_platform_data *info)
739 pxa_register_device(&pxa3xx_device_mci2, info);
742 static struct resource pxa3xx_resources_mci3[] = {
746 .flags = IORESOURCE_MEM,
751 .flags = IORESOURCE_IRQ,
756 .flags = IORESOURCE_DMA,
761 .flags = IORESOURCE_DMA,
765 struct platform_device pxa3xx_device_mci3 = {
766 .name = "pxa2xx-mci",
769 .dma_mask = &pxamci_dmamask,
770 .coherent_dma_mask = 0xffffffff,
772 .num_resources = ARRAY_SIZE(pxa3xx_resources_mci3),
773 .resource = pxa3xx_resources_mci3,
776 void __init pxa3xx_set_mci3_info(struct pxamci_platform_data *info)
778 pxa_register_device(&pxa3xx_device_mci3, info);
781 #endif /* CONFIG_PXA3xx */