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>
6 #include <linux/spi/pxa2xx_spi.h>
7 #include <linux/i2c/pxa-i2c.h>
11 #include <mach/pxa3xx-u2d.h>
12 #include <mach/pxafb.h>
14 #include <mach/irda.h>
15 #include <mach/irqs.h>
16 #include <mach/ohci.h>
17 #include <plat/pxa27x_keypad.h>
18 #include <mach/camera.h>
19 #include <mach/audio.h>
20 #include <mach/hardware.h>
21 #include <plat/pxa3xx_nand.h>
26 void __init pxa_register_device(struct platform_device *dev, void *data)
30 dev->dev.platform_data = data;
32 ret = platform_device_register(dev);
34 dev_err(&dev->dev, "unable to register device: %d\n", ret);
37 static struct resource pxa_resource_pmu = {
40 .flags = IORESOURCE_IRQ,
43 struct platform_device pxa_device_pmu = {
45 .id = ARM_PMU_DEVICE_CPU,
46 .resource = &pxa_resource_pmu,
50 static struct resource pxamci_resources[] = {
54 .flags = IORESOURCE_MEM,
59 .flags = IORESOURCE_IRQ,
64 .flags = IORESOURCE_DMA,
69 .flags = IORESOURCE_DMA,
73 static u64 pxamci_dmamask = 0xffffffffUL;
75 struct platform_device pxa_device_mci = {
79 .dma_mask = &pxamci_dmamask,
80 .coherent_dma_mask = 0xffffffff,
82 .num_resources = ARRAY_SIZE(pxamci_resources),
83 .resource = pxamci_resources,
86 void __init pxa_set_mci_info(struct pxamci_platform_data *info)
88 pxa_register_device(&pxa_device_mci, info);
92 static struct pxa2xx_udc_mach_info pxa_udc_info = {
96 void __init pxa_set_udc_info(struct pxa2xx_udc_mach_info *info)
98 memcpy(&pxa_udc_info, info, sizeof *info);
101 static struct resource pxa2xx_udc_resources[] = {
105 .flags = IORESOURCE_MEM,
110 .flags = IORESOURCE_IRQ,
114 static u64 udc_dma_mask = ~(u32)0;
116 struct platform_device pxa25x_device_udc = {
117 .name = "pxa25x-udc",
119 .resource = pxa2xx_udc_resources,
120 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
122 .platform_data = &pxa_udc_info,
123 .dma_mask = &udc_dma_mask,
127 struct platform_device pxa27x_device_udc = {
128 .name = "pxa27x-udc",
130 .resource = pxa2xx_udc_resources,
131 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
133 .platform_data = &pxa_udc_info,
134 .dma_mask = &udc_dma_mask,
139 static struct resource pxa3xx_u2d_resources[] = {
143 .flags = IORESOURCE_MEM,
148 .flags = IORESOURCE_IRQ,
152 struct platform_device pxa3xx_device_u2d = {
153 .name = "pxa3xx-u2d",
155 .resource = pxa3xx_u2d_resources,
156 .num_resources = ARRAY_SIZE(pxa3xx_u2d_resources),
159 void __init pxa3xx_set_u2d_info(struct pxa3xx_u2d_platform_data *info)
161 pxa_register_device(&pxa3xx_device_u2d, info);
163 #endif /* CONFIG_PXA3xx */
165 static struct resource pxafb_resources[] = {
169 .flags = IORESOURCE_MEM,
174 .flags = IORESOURCE_IRQ,
178 static u64 fb_dma_mask = ~(u64)0;
180 struct platform_device pxa_device_fb = {
184 .dma_mask = &fb_dma_mask,
185 .coherent_dma_mask = 0xffffffff,
187 .num_resources = ARRAY_SIZE(pxafb_resources),
188 .resource = pxafb_resources,
191 void __init pxa_set_fb_info(struct device *parent, struct pxafb_mach_info *info)
193 pxa_device_fb.dev.parent = parent;
194 pxa_register_device(&pxa_device_fb, info);
197 static struct resource pxa_resource_ffuart[] = {
201 .flags = IORESOURCE_MEM,
205 .flags = IORESOURCE_IRQ,
209 struct platform_device pxa_device_ffuart = {
210 .name = "pxa2xx-uart",
212 .resource = pxa_resource_ffuart,
213 .num_resources = ARRAY_SIZE(pxa_resource_ffuart),
216 void __init pxa_set_ffuart_info(void *info)
218 pxa_register_device(&pxa_device_ffuart, info);
221 static struct resource pxa_resource_btuart[] = {
225 .flags = IORESOURCE_MEM,
229 .flags = IORESOURCE_IRQ,
233 struct platform_device pxa_device_btuart = {
234 .name = "pxa2xx-uart",
236 .resource = pxa_resource_btuart,
237 .num_resources = ARRAY_SIZE(pxa_resource_btuart),
240 void __init pxa_set_btuart_info(void *info)
242 pxa_register_device(&pxa_device_btuart, info);
245 static struct resource pxa_resource_stuart[] = {
249 .flags = IORESOURCE_MEM,
253 .flags = IORESOURCE_IRQ,
257 struct platform_device pxa_device_stuart = {
258 .name = "pxa2xx-uart",
260 .resource = pxa_resource_stuart,
261 .num_resources = ARRAY_SIZE(pxa_resource_stuart),
264 void __init pxa_set_stuart_info(void *info)
266 pxa_register_device(&pxa_device_stuart, info);
269 static struct resource pxa_resource_hwuart[] = {
273 .flags = IORESOURCE_MEM,
277 .flags = IORESOURCE_IRQ,
281 struct platform_device pxa_device_hwuart = {
282 .name = "pxa2xx-uart",
284 .resource = pxa_resource_hwuart,
285 .num_resources = ARRAY_SIZE(pxa_resource_hwuart),
288 void __init pxa_set_hwuart_info(void *info)
291 pxa_register_device(&pxa_device_hwuart, info);
293 pr_info("UART: Ignoring attempt to register HWUART on non-PXA255 hardware");
296 static struct resource pxai2c_resources[] = {
300 .flags = IORESOURCE_MEM,
304 .flags = IORESOURCE_IRQ,
308 struct platform_device pxa_device_i2c = {
309 .name = "pxa2xx-i2c",
311 .resource = pxai2c_resources,
312 .num_resources = ARRAY_SIZE(pxai2c_resources),
315 void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info)
317 pxa_register_device(&pxa_device_i2c, info);
321 static struct resource pxa27x_resources_i2c_power[] = {
325 .flags = IORESOURCE_MEM,
329 .flags = IORESOURCE_IRQ,
333 struct platform_device pxa27x_device_i2c_power = {
334 .name = "pxa2xx-i2c",
336 .resource = pxa27x_resources_i2c_power,
337 .num_resources = ARRAY_SIZE(pxa27x_resources_i2c_power),
341 static struct resource pxai2s_resources[] = {
345 .flags = IORESOURCE_MEM,
349 .flags = IORESOURCE_IRQ,
353 struct platform_device pxa_device_i2s = {
354 .name = "pxa2xx-i2s",
356 .resource = pxai2s_resources,
357 .num_resources = ARRAY_SIZE(pxai2s_resources),
360 struct platform_device pxa_device_asoc_ssp1 = {
361 .name = "pxa-ssp-dai",
365 struct platform_device pxa_device_asoc_ssp2= {
366 .name = "pxa-ssp-dai",
370 struct platform_device pxa_device_asoc_ssp3 = {
371 .name = "pxa-ssp-dai",
375 struct platform_device pxa_device_asoc_ssp4 = {
376 .name = "pxa-ssp-dai",
380 struct platform_device pxa_device_asoc_platform = {
381 .name = "pxa-pcm-audio",
385 static u64 pxaficp_dmamask = ~(u32)0;
387 struct platform_device pxa_device_ficp = {
391 .dma_mask = &pxaficp_dmamask,
392 .coherent_dma_mask = 0xffffffff,
396 void __init pxa_set_ficp_info(struct pxaficp_platform_data *info)
398 pxa_register_device(&pxa_device_ficp, info);
401 static struct resource pxa_rtc_resources[] = {
404 .end = 0x40900000 + 0x3b,
405 .flags = IORESOURCE_MEM,
411 .flags = IORESOURCE_IRQ,
414 .start = IRQ_RTCAlrm,
417 .flags = IORESOURCE_IRQ,
421 struct platform_device pxa_device_rtc = {
424 .num_resources = ARRAY_SIZE(pxa_rtc_resources),
425 .resource = pxa_rtc_resources,
428 static struct resource sa1100_rtc_resources[] = {
433 .flags = IORESOURCE_IRQ,
435 .start = IRQ_RTCAlrm,
438 .flags = IORESOURCE_IRQ,
442 struct platform_device sa1100_device_rtc = {
443 .name = "sa1100-rtc",
445 .num_resources = ARRAY_SIZE(sa1100_rtc_resources),
446 .resource = sa1100_rtc_resources,
449 static struct resource pxa_ac97_resources[] = {
452 .end = 0x40500000 + 0xfff,
453 .flags = IORESOURCE_MEM,
458 .flags = IORESOURCE_IRQ,
462 static u64 pxa_ac97_dmamask = 0xffffffffUL;
464 struct platform_device pxa_device_ac97 = {
465 .name = "pxa2xx-ac97",
468 .dma_mask = &pxa_ac97_dmamask,
469 .coherent_dma_mask = 0xffffffff,
471 .num_resources = ARRAY_SIZE(pxa_ac97_resources),
472 .resource = pxa_ac97_resources,
475 void __init pxa_set_ac97_info(pxa2xx_audio_ops_t *ops)
477 pxa_register_device(&pxa_device_ac97, ops);
482 static struct resource pxa25x_resource_pwm0[] = {
486 .flags = IORESOURCE_MEM,
490 struct platform_device pxa25x_device_pwm0 = {
491 .name = "pxa25x-pwm",
493 .resource = pxa25x_resource_pwm0,
494 .num_resources = ARRAY_SIZE(pxa25x_resource_pwm0),
497 static struct resource pxa25x_resource_pwm1[] = {
501 .flags = IORESOURCE_MEM,
505 struct platform_device pxa25x_device_pwm1 = {
506 .name = "pxa25x-pwm",
508 .resource = pxa25x_resource_pwm1,
509 .num_resources = ARRAY_SIZE(pxa25x_resource_pwm1),
512 static u64 pxa25x_ssp_dma_mask = DMA_BIT_MASK(32);
514 static struct resource pxa25x_resource_ssp[] = {
518 .flags = IORESOURCE_MEM,
523 .flags = IORESOURCE_IRQ,
529 .flags = IORESOURCE_DMA,
535 .flags = IORESOURCE_DMA,
539 struct platform_device pxa25x_device_ssp = {
540 .name = "pxa25x-ssp",
543 .dma_mask = &pxa25x_ssp_dma_mask,
544 .coherent_dma_mask = DMA_BIT_MASK(32),
546 .resource = pxa25x_resource_ssp,
547 .num_resources = ARRAY_SIZE(pxa25x_resource_ssp),
550 static u64 pxa25x_nssp_dma_mask = DMA_BIT_MASK(32);
552 static struct resource pxa25x_resource_nssp[] = {
556 .flags = IORESOURCE_MEM,
561 .flags = IORESOURCE_IRQ,
567 .flags = IORESOURCE_DMA,
573 .flags = IORESOURCE_DMA,
577 struct platform_device pxa25x_device_nssp = {
578 .name = "pxa25x-nssp",
581 .dma_mask = &pxa25x_nssp_dma_mask,
582 .coherent_dma_mask = DMA_BIT_MASK(32),
584 .resource = pxa25x_resource_nssp,
585 .num_resources = ARRAY_SIZE(pxa25x_resource_nssp),
588 static u64 pxa25x_assp_dma_mask = DMA_BIT_MASK(32);
590 static struct resource pxa25x_resource_assp[] = {
594 .flags = IORESOURCE_MEM,
599 .flags = IORESOURCE_IRQ,
605 .flags = IORESOURCE_DMA,
611 .flags = IORESOURCE_DMA,
615 struct platform_device pxa25x_device_assp = {
616 /* ASSP is basically equivalent to NSSP */
617 .name = "pxa25x-nssp",
620 .dma_mask = &pxa25x_assp_dma_mask,
621 .coherent_dma_mask = DMA_BIT_MASK(32),
623 .resource = pxa25x_resource_assp,
624 .num_resources = ARRAY_SIZE(pxa25x_resource_assp),
626 #endif /* CONFIG_PXA25x */
628 #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
629 static struct resource pxa27x_resource_camera[] = {
633 .flags = IORESOURCE_MEM,
638 .flags = IORESOURCE_IRQ,
642 static u64 pxa27x_dma_mask_camera = DMA_BIT_MASK(32);
644 static struct platform_device pxa27x_device_camera = {
645 .name = "pxa27x-camera",
646 .id = 0, /* This is used to put cameras on this interface */
648 .dma_mask = &pxa27x_dma_mask_camera,
649 .coherent_dma_mask = 0xffffffff,
651 .num_resources = ARRAY_SIZE(pxa27x_resource_camera),
652 .resource = pxa27x_resource_camera,
655 void __init pxa_set_camera_info(struct pxacamera_platform_data *info)
657 pxa_register_device(&pxa27x_device_camera, info);
660 static u64 pxa27x_ohci_dma_mask = DMA_BIT_MASK(32);
662 static struct resource pxa27x_resource_ohci[] = {
666 .flags = IORESOURCE_MEM,
671 .flags = IORESOURCE_IRQ,
675 struct platform_device pxa27x_device_ohci = {
676 .name = "pxa27x-ohci",
679 .dma_mask = &pxa27x_ohci_dma_mask,
680 .coherent_dma_mask = DMA_BIT_MASK(32),
682 .num_resources = ARRAY_SIZE(pxa27x_resource_ohci),
683 .resource = pxa27x_resource_ohci,
686 void __init pxa_set_ohci_info(struct pxaohci_platform_data *info)
688 pxa_register_device(&pxa27x_device_ohci, info);
690 #endif /* CONFIG_PXA27x || CONFIG_PXA3xx */
692 #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) || defined(CONFIG_PXA95x)
693 static struct resource pxa27x_resource_keypad[] = {
697 .flags = IORESOURCE_MEM,
702 .flags = IORESOURCE_IRQ,
706 struct platform_device pxa27x_device_keypad = {
707 .name = "pxa27x-keypad",
709 .resource = pxa27x_resource_keypad,
710 .num_resources = ARRAY_SIZE(pxa27x_resource_keypad),
713 void __init pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info)
715 pxa_register_device(&pxa27x_device_keypad, info);
718 static u64 pxa27x_ssp1_dma_mask = DMA_BIT_MASK(32);
720 static struct resource pxa27x_resource_ssp1[] = {
724 .flags = IORESOURCE_MEM,
729 .flags = IORESOURCE_IRQ,
735 .flags = IORESOURCE_DMA,
741 .flags = IORESOURCE_DMA,
745 struct platform_device pxa27x_device_ssp1 = {
746 .name = "pxa27x-ssp",
749 .dma_mask = &pxa27x_ssp1_dma_mask,
750 .coherent_dma_mask = DMA_BIT_MASK(32),
752 .resource = pxa27x_resource_ssp1,
753 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp1),
756 static u64 pxa27x_ssp2_dma_mask = DMA_BIT_MASK(32);
758 static struct resource pxa27x_resource_ssp2[] = {
762 .flags = IORESOURCE_MEM,
767 .flags = IORESOURCE_IRQ,
773 .flags = IORESOURCE_DMA,
779 .flags = IORESOURCE_DMA,
783 struct platform_device pxa27x_device_ssp2 = {
784 .name = "pxa27x-ssp",
787 .dma_mask = &pxa27x_ssp2_dma_mask,
788 .coherent_dma_mask = DMA_BIT_MASK(32),
790 .resource = pxa27x_resource_ssp2,
791 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp2),
794 static u64 pxa27x_ssp3_dma_mask = DMA_BIT_MASK(32);
796 static struct resource pxa27x_resource_ssp3[] = {
800 .flags = IORESOURCE_MEM,
805 .flags = IORESOURCE_IRQ,
811 .flags = IORESOURCE_DMA,
817 .flags = IORESOURCE_DMA,
821 struct platform_device pxa27x_device_ssp3 = {
822 .name = "pxa27x-ssp",
825 .dma_mask = &pxa27x_ssp3_dma_mask,
826 .coherent_dma_mask = DMA_BIT_MASK(32),
828 .resource = pxa27x_resource_ssp3,
829 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3),
832 static struct resource pxa27x_resource_pwm0[] = {
836 .flags = IORESOURCE_MEM,
840 struct platform_device pxa27x_device_pwm0 = {
841 .name = "pxa27x-pwm",
843 .resource = pxa27x_resource_pwm0,
844 .num_resources = ARRAY_SIZE(pxa27x_resource_pwm0),
847 static struct resource pxa27x_resource_pwm1[] = {
851 .flags = IORESOURCE_MEM,
855 struct platform_device pxa27x_device_pwm1 = {
856 .name = "pxa27x-pwm",
858 .resource = pxa27x_resource_pwm1,
859 .num_resources = ARRAY_SIZE(pxa27x_resource_pwm1),
861 #endif /* CONFIG_PXA27x || CONFIG_PXA3xx || CONFIG_PXA95x*/
864 static struct resource pxa3xx_resources_mci2[] = {
868 .flags = IORESOURCE_MEM,
873 .flags = IORESOURCE_IRQ,
878 .flags = IORESOURCE_DMA,
883 .flags = IORESOURCE_DMA,
887 struct platform_device pxa3xx_device_mci2 = {
888 .name = "pxa2xx-mci",
891 .dma_mask = &pxamci_dmamask,
892 .coherent_dma_mask = 0xffffffff,
894 .num_resources = ARRAY_SIZE(pxa3xx_resources_mci2),
895 .resource = pxa3xx_resources_mci2,
898 void __init pxa3xx_set_mci2_info(struct pxamci_platform_data *info)
900 pxa_register_device(&pxa3xx_device_mci2, info);
903 static struct resource pxa3xx_resources_mci3[] = {
907 .flags = IORESOURCE_MEM,
912 .flags = IORESOURCE_IRQ,
917 .flags = IORESOURCE_DMA,
922 .flags = IORESOURCE_DMA,
926 struct platform_device pxa3xx_device_mci3 = {
927 .name = "pxa2xx-mci",
930 .dma_mask = &pxamci_dmamask,
931 .coherent_dma_mask = 0xffffffff,
933 .num_resources = ARRAY_SIZE(pxa3xx_resources_mci3),
934 .resource = pxa3xx_resources_mci3,
937 void __init pxa3xx_set_mci3_info(struct pxamci_platform_data *info)
939 pxa_register_device(&pxa3xx_device_mci3, info);
942 static struct resource pxa3xx_resources_gcu[] = {
946 .flags = IORESOURCE_MEM,
951 .flags = IORESOURCE_IRQ,
955 static u64 pxa3xx_gcu_dmamask = DMA_BIT_MASK(32);
957 struct platform_device pxa3xx_device_gcu = {
958 .name = "pxa3xx-gcu",
960 .num_resources = ARRAY_SIZE(pxa3xx_resources_gcu),
961 .resource = pxa3xx_resources_gcu,
963 .dma_mask = &pxa3xx_gcu_dmamask,
964 .coherent_dma_mask = 0xffffffff,
968 #endif /* CONFIG_PXA3xx */
970 #if defined(CONFIG_PXA3xx) || defined(CONFIG_PXA95x)
971 static struct resource pxa3xx_resources_i2c_power[] = {
975 .flags = IORESOURCE_MEM,
979 .flags = IORESOURCE_IRQ,
983 struct platform_device pxa3xx_device_i2c_power = {
984 .name = "pxa3xx-pwri2c",
986 .resource = pxa3xx_resources_i2c_power,
987 .num_resources = ARRAY_SIZE(pxa3xx_resources_i2c_power),
990 static struct resource pxa3xx_resources_nand[] = {
994 .flags = IORESOURCE_MEM,
999 .flags = IORESOURCE_IRQ,
1002 /* DRCMR for Data DMA */
1005 .flags = IORESOURCE_DMA,
1008 /* DRCMR for Command DMA */
1011 .flags = IORESOURCE_DMA,
1015 static u64 pxa3xx_nand_dma_mask = DMA_BIT_MASK(32);
1017 struct platform_device pxa3xx_device_nand = {
1018 .name = "pxa3xx-nand",
1021 .dma_mask = &pxa3xx_nand_dma_mask,
1022 .coherent_dma_mask = DMA_BIT_MASK(32),
1024 .num_resources = ARRAY_SIZE(pxa3xx_resources_nand),
1025 .resource = pxa3xx_resources_nand,
1028 void __init pxa3xx_set_nand_info(struct pxa3xx_nand_platform_data *info)
1030 pxa_register_device(&pxa3xx_device_nand, info);
1033 static u64 pxa3xx_ssp4_dma_mask = DMA_BIT_MASK(32);
1035 static struct resource pxa3xx_resource_ssp4[] = {
1037 .start = 0x41a00000,
1039 .flags = IORESOURCE_MEM,
1044 .flags = IORESOURCE_IRQ,
1050 .flags = IORESOURCE_DMA,
1056 .flags = IORESOURCE_DMA,
1060 struct platform_device pxa3xx_device_ssp4 = {
1061 /* PXA3xx SSP is basically equivalent to PXA27x */
1062 .name = "pxa27x-ssp",
1065 .dma_mask = &pxa3xx_ssp4_dma_mask,
1066 .coherent_dma_mask = DMA_BIT_MASK(32),
1068 .resource = pxa3xx_resource_ssp4,
1069 .num_resources = ARRAY_SIZE(pxa3xx_resource_ssp4),
1071 #endif /* CONFIG_PXA3xx || CONFIG_PXA95x */
1073 struct resource pxa_resource_gpio[] = {
1075 .start = 0x40e00000,
1077 .flags = IORESOURCE_MEM,
1082 .flags = IORESOURCE_IRQ,
1087 .flags = IORESOURCE_IRQ,
1089 .start = IRQ_GPIO_2_x,
1090 .end = IRQ_GPIO_2_x,
1092 .flags = IORESOURCE_IRQ,
1096 struct platform_device pxa_device_gpio = {
1099 .num_resources = ARRAY_SIZE(pxa_resource_gpio),
1100 .resource = pxa_resource_gpio,
1103 /* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1.
1104 * See comment in arch/arm/mach-pxa/ssp.c::ssp_probe() */
1105 void __init pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_master *info)
1107 struct platform_device *pd;
1109 pd = platform_device_alloc("pxa2xx-spi", id);
1111 printk(KERN_ERR "pxa2xx-spi: failed to allocate device id %d\n",
1116 pd->dev.platform_data = info;
1117 platform_device_add(pd);