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>
10 #include <linux/platform_data/usb-pxa3xx-ulpi.h>
11 #include <linux/platform_data/video-pxafb.h>
12 #include <linux/platform_data/mmc-pxamci.h>
13 #include <linux/platform_data/irda-pxaficp.h>
14 #include <mach/irqs.h>
15 #include <linux/platform_data/usb-ohci-pxa27x.h>
16 #include <linux/platform_data/keypad-pxa27x.h>
17 #include <linux/platform_data/camera-pxa.h>
18 #include <mach/audio.h>
19 #include <mach/hardware.h>
20 #include <linux/platform_data/mtd-nand-pxa3xx.h>
25 void __init pxa_register_device(struct platform_device *dev, void *data)
29 dev->dev.platform_data = data;
31 ret = platform_device_register(dev);
33 dev_err(&dev->dev, "unable to register device: %d\n", ret);
36 static struct resource pxa_resource_pmu = {
39 .flags = IORESOURCE_IRQ,
42 struct platform_device pxa_device_pmu = {
45 .resource = &pxa_resource_pmu,
49 static struct resource pxamci_resources[] = {
53 .flags = IORESOURCE_MEM,
58 .flags = IORESOURCE_IRQ,
63 .flags = IORESOURCE_DMA,
68 .flags = IORESOURCE_DMA,
72 static u64 pxamci_dmamask = 0xffffffffUL;
74 struct platform_device pxa_device_mci = {
78 .dma_mask = &pxamci_dmamask,
79 .coherent_dma_mask = 0xffffffff,
81 .num_resources = ARRAY_SIZE(pxamci_resources),
82 .resource = pxamci_resources,
85 void __init pxa_set_mci_info(struct pxamci_platform_data *info)
87 pxa_register_device(&pxa_device_mci, info);
91 static struct pxa2xx_udc_mach_info pxa_udc_info = {
95 void __init pxa_set_udc_info(struct pxa2xx_udc_mach_info *info)
97 memcpy(&pxa_udc_info, info, sizeof *info);
100 static struct resource pxa2xx_udc_resources[] = {
104 .flags = IORESOURCE_MEM,
109 .flags = IORESOURCE_IRQ,
113 static u64 udc_dma_mask = ~(u32)0;
115 struct platform_device pxa25x_device_udc = {
116 .name = "pxa25x-udc",
118 .resource = pxa2xx_udc_resources,
119 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
121 .platform_data = &pxa_udc_info,
122 .dma_mask = &udc_dma_mask,
126 struct platform_device pxa27x_device_udc = {
127 .name = "pxa27x-udc",
129 .resource = pxa2xx_udc_resources,
130 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
132 .platform_data = &pxa_udc_info,
133 .dma_mask = &udc_dma_mask,
138 static struct resource pxa3xx_u2d_resources[] = {
142 .flags = IORESOURCE_MEM,
147 .flags = IORESOURCE_IRQ,
151 struct platform_device pxa3xx_device_u2d = {
152 .name = "pxa3xx-u2d",
154 .resource = pxa3xx_u2d_resources,
155 .num_resources = ARRAY_SIZE(pxa3xx_u2d_resources),
158 void __init pxa3xx_set_u2d_info(struct pxa3xx_u2d_platform_data *info)
160 pxa_register_device(&pxa3xx_device_u2d, info);
162 #endif /* CONFIG_PXA3xx */
164 static struct resource pxafb_resources[] = {
168 .flags = IORESOURCE_MEM,
173 .flags = IORESOURCE_IRQ,
177 static u64 fb_dma_mask = ~(u64)0;
179 struct platform_device pxa_device_fb = {
183 .dma_mask = &fb_dma_mask,
184 .coherent_dma_mask = 0xffffffff,
186 .num_resources = ARRAY_SIZE(pxafb_resources),
187 .resource = pxafb_resources,
190 void __init pxa_set_fb_info(struct device *parent, struct pxafb_mach_info *info)
192 pxa_device_fb.dev.parent = parent;
193 pxa_register_device(&pxa_device_fb, info);
196 static struct resource pxa_resource_ffuart[] = {
200 .flags = IORESOURCE_MEM,
204 .flags = IORESOURCE_IRQ,
208 struct platform_device pxa_device_ffuart = {
209 .name = "pxa2xx-uart",
211 .resource = pxa_resource_ffuart,
212 .num_resources = ARRAY_SIZE(pxa_resource_ffuart),
215 void __init pxa_set_ffuart_info(void *info)
217 pxa_register_device(&pxa_device_ffuart, info);
220 static struct resource pxa_resource_btuart[] = {
224 .flags = IORESOURCE_MEM,
228 .flags = IORESOURCE_IRQ,
232 struct platform_device pxa_device_btuart = {
233 .name = "pxa2xx-uart",
235 .resource = pxa_resource_btuart,
236 .num_resources = ARRAY_SIZE(pxa_resource_btuart),
239 void __init pxa_set_btuart_info(void *info)
241 pxa_register_device(&pxa_device_btuart, info);
244 static struct resource pxa_resource_stuart[] = {
248 .flags = IORESOURCE_MEM,
252 .flags = IORESOURCE_IRQ,
256 struct platform_device pxa_device_stuart = {
257 .name = "pxa2xx-uart",
259 .resource = pxa_resource_stuart,
260 .num_resources = ARRAY_SIZE(pxa_resource_stuart),
263 void __init pxa_set_stuart_info(void *info)
265 pxa_register_device(&pxa_device_stuart, info);
268 static struct resource pxa_resource_hwuart[] = {
272 .flags = IORESOURCE_MEM,
276 .flags = IORESOURCE_IRQ,
280 struct platform_device pxa_device_hwuart = {
281 .name = "pxa2xx-uart",
283 .resource = pxa_resource_hwuart,
284 .num_resources = ARRAY_SIZE(pxa_resource_hwuart),
287 void __init pxa_set_hwuart_info(void *info)
290 pxa_register_device(&pxa_device_hwuart, info);
292 pr_info("UART: Ignoring attempt to register HWUART on non-PXA255 hardware");
295 static struct resource pxai2c_resources[] = {
299 .flags = IORESOURCE_MEM,
303 .flags = IORESOURCE_IRQ,
307 struct platform_device pxa_device_i2c = {
308 .name = "pxa2xx-i2c",
310 .resource = pxai2c_resources,
311 .num_resources = ARRAY_SIZE(pxai2c_resources),
314 void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info)
316 pxa_register_device(&pxa_device_i2c, info);
320 static struct resource pxa27x_resources_i2c_power[] = {
324 .flags = IORESOURCE_MEM,
328 .flags = IORESOURCE_IRQ,
332 struct platform_device pxa27x_device_i2c_power = {
333 .name = "pxa2xx-i2c",
335 .resource = pxa27x_resources_i2c_power,
336 .num_resources = ARRAY_SIZE(pxa27x_resources_i2c_power),
340 static struct resource pxai2s_resources[] = {
344 .flags = IORESOURCE_MEM,
348 .flags = IORESOURCE_IRQ,
352 struct platform_device pxa_device_i2s = {
353 .name = "pxa2xx-i2s",
355 .resource = pxai2s_resources,
356 .num_resources = ARRAY_SIZE(pxai2s_resources),
359 struct platform_device pxa_device_asoc_ssp1 = {
360 .name = "pxa-ssp-dai",
364 struct platform_device pxa_device_asoc_ssp2= {
365 .name = "pxa-ssp-dai",
369 struct platform_device pxa_device_asoc_ssp3 = {
370 .name = "pxa-ssp-dai",
374 struct platform_device pxa_device_asoc_ssp4 = {
375 .name = "pxa-ssp-dai",
379 struct platform_device pxa_device_asoc_platform = {
380 .name = "pxa-pcm-audio",
384 static u64 pxaficp_dmamask = ~(u32)0;
386 static struct resource pxa_ir_resources[] = {
390 .flags = IORESOURCE_IRQ,
395 .flags = IORESOURCE_IRQ,
399 struct platform_device pxa_device_ficp = {
402 .num_resources = ARRAY_SIZE(pxa_ir_resources),
403 .resource = pxa_ir_resources,
405 .dma_mask = &pxaficp_dmamask,
406 .coherent_dma_mask = 0xffffffff,
410 void __init pxa_set_ficp_info(struct pxaficp_platform_data *info)
412 pxa_register_device(&pxa_device_ficp, info);
415 static struct resource pxa_rtc_resources[] = {
418 .end = 0x40900000 + 0x3b,
419 .flags = IORESOURCE_MEM,
425 .flags = IORESOURCE_IRQ,
428 .start = IRQ_RTCAlrm,
431 .flags = IORESOURCE_IRQ,
435 struct platform_device pxa_device_rtc = {
438 .num_resources = ARRAY_SIZE(pxa_rtc_resources),
439 .resource = pxa_rtc_resources,
442 static struct resource sa1100_rtc_resources[] = {
447 .flags = IORESOURCE_IRQ,
449 .start = IRQ_RTCAlrm,
452 .flags = IORESOURCE_IRQ,
456 struct platform_device sa1100_device_rtc = {
457 .name = "sa1100-rtc",
459 .num_resources = ARRAY_SIZE(sa1100_rtc_resources),
460 .resource = sa1100_rtc_resources,
463 static struct resource pxa_ac97_resources[] = {
466 .end = 0x40500000 + 0xfff,
467 .flags = IORESOURCE_MEM,
472 .flags = IORESOURCE_IRQ,
476 static u64 pxa_ac97_dmamask = 0xffffffffUL;
478 struct platform_device pxa_device_ac97 = {
479 .name = "pxa2xx-ac97",
482 .dma_mask = &pxa_ac97_dmamask,
483 .coherent_dma_mask = 0xffffffff,
485 .num_resources = ARRAY_SIZE(pxa_ac97_resources),
486 .resource = pxa_ac97_resources,
489 void __init pxa_set_ac97_info(pxa2xx_audio_ops_t *ops)
491 pxa_register_device(&pxa_device_ac97, ops);
496 static struct resource pxa25x_resource_pwm0[] = {
500 .flags = IORESOURCE_MEM,
504 struct platform_device pxa25x_device_pwm0 = {
505 .name = "pxa25x-pwm",
507 .resource = pxa25x_resource_pwm0,
508 .num_resources = ARRAY_SIZE(pxa25x_resource_pwm0),
511 static struct resource pxa25x_resource_pwm1[] = {
515 .flags = IORESOURCE_MEM,
519 struct platform_device pxa25x_device_pwm1 = {
520 .name = "pxa25x-pwm",
522 .resource = pxa25x_resource_pwm1,
523 .num_resources = ARRAY_SIZE(pxa25x_resource_pwm1),
526 static u64 pxa25x_ssp_dma_mask = DMA_BIT_MASK(32);
528 static struct resource pxa25x_resource_ssp[] = {
532 .flags = IORESOURCE_MEM,
537 .flags = IORESOURCE_IRQ,
543 .flags = IORESOURCE_DMA,
549 .flags = IORESOURCE_DMA,
553 struct platform_device pxa25x_device_ssp = {
554 .name = "pxa25x-ssp",
557 .dma_mask = &pxa25x_ssp_dma_mask,
558 .coherent_dma_mask = DMA_BIT_MASK(32),
560 .resource = pxa25x_resource_ssp,
561 .num_resources = ARRAY_SIZE(pxa25x_resource_ssp),
564 static u64 pxa25x_nssp_dma_mask = DMA_BIT_MASK(32);
566 static struct resource pxa25x_resource_nssp[] = {
570 .flags = IORESOURCE_MEM,
575 .flags = IORESOURCE_IRQ,
581 .flags = IORESOURCE_DMA,
587 .flags = IORESOURCE_DMA,
591 struct platform_device pxa25x_device_nssp = {
592 .name = "pxa25x-nssp",
595 .dma_mask = &pxa25x_nssp_dma_mask,
596 .coherent_dma_mask = DMA_BIT_MASK(32),
598 .resource = pxa25x_resource_nssp,
599 .num_resources = ARRAY_SIZE(pxa25x_resource_nssp),
602 static u64 pxa25x_assp_dma_mask = DMA_BIT_MASK(32);
604 static struct resource pxa25x_resource_assp[] = {
608 .flags = IORESOURCE_MEM,
613 .flags = IORESOURCE_IRQ,
619 .flags = IORESOURCE_DMA,
625 .flags = IORESOURCE_DMA,
629 struct platform_device pxa25x_device_assp = {
630 /* ASSP is basically equivalent to NSSP */
631 .name = "pxa25x-nssp",
634 .dma_mask = &pxa25x_assp_dma_mask,
635 .coherent_dma_mask = DMA_BIT_MASK(32),
637 .resource = pxa25x_resource_assp,
638 .num_resources = ARRAY_SIZE(pxa25x_resource_assp),
640 #endif /* CONFIG_PXA25x */
642 #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
643 static struct resource pxa27x_resource_camera[] = {
647 .flags = IORESOURCE_MEM,
652 .flags = IORESOURCE_IRQ,
656 static u64 pxa27x_dma_mask_camera = DMA_BIT_MASK(32);
658 static struct platform_device pxa27x_device_camera = {
659 .name = "pxa27x-camera",
660 .id = 0, /* This is used to put cameras on this interface */
662 .dma_mask = &pxa27x_dma_mask_camera,
663 .coherent_dma_mask = 0xffffffff,
665 .num_resources = ARRAY_SIZE(pxa27x_resource_camera),
666 .resource = pxa27x_resource_camera,
669 void __init pxa_set_camera_info(struct pxacamera_platform_data *info)
671 pxa_register_device(&pxa27x_device_camera, info);
674 static u64 pxa27x_ohci_dma_mask = DMA_BIT_MASK(32);
676 static struct resource pxa27x_resource_ohci[] = {
680 .flags = IORESOURCE_MEM,
685 .flags = IORESOURCE_IRQ,
689 struct platform_device pxa27x_device_ohci = {
690 .name = "pxa27x-ohci",
693 .dma_mask = &pxa27x_ohci_dma_mask,
694 .coherent_dma_mask = DMA_BIT_MASK(32),
696 .num_resources = ARRAY_SIZE(pxa27x_resource_ohci),
697 .resource = pxa27x_resource_ohci,
700 void __init pxa_set_ohci_info(struct pxaohci_platform_data *info)
702 pxa_register_device(&pxa27x_device_ohci, info);
704 #endif /* CONFIG_PXA27x || CONFIG_PXA3xx */
706 #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
707 static struct resource pxa27x_resource_keypad[] = {
711 .flags = IORESOURCE_MEM,
716 .flags = IORESOURCE_IRQ,
720 struct platform_device pxa27x_device_keypad = {
721 .name = "pxa27x-keypad",
723 .resource = pxa27x_resource_keypad,
724 .num_resources = ARRAY_SIZE(pxa27x_resource_keypad),
727 void __init pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info)
729 pxa_register_device(&pxa27x_device_keypad, info);
732 static u64 pxa27x_ssp1_dma_mask = DMA_BIT_MASK(32);
734 static struct resource pxa27x_resource_ssp1[] = {
738 .flags = IORESOURCE_MEM,
743 .flags = IORESOURCE_IRQ,
749 .flags = IORESOURCE_DMA,
755 .flags = IORESOURCE_DMA,
759 struct platform_device pxa27x_device_ssp1 = {
760 .name = "pxa27x-ssp",
763 .dma_mask = &pxa27x_ssp1_dma_mask,
764 .coherent_dma_mask = DMA_BIT_MASK(32),
766 .resource = pxa27x_resource_ssp1,
767 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp1),
770 static u64 pxa27x_ssp2_dma_mask = DMA_BIT_MASK(32);
772 static struct resource pxa27x_resource_ssp2[] = {
776 .flags = IORESOURCE_MEM,
781 .flags = IORESOURCE_IRQ,
787 .flags = IORESOURCE_DMA,
793 .flags = IORESOURCE_DMA,
797 struct platform_device pxa27x_device_ssp2 = {
798 .name = "pxa27x-ssp",
801 .dma_mask = &pxa27x_ssp2_dma_mask,
802 .coherent_dma_mask = DMA_BIT_MASK(32),
804 .resource = pxa27x_resource_ssp2,
805 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp2),
808 static u64 pxa27x_ssp3_dma_mask = DMA_BIT_MASK(32);
810 static struct resource pxa27x_resource_ssp3[] = {
814 .flags = IORESOURCE_MEM,
819 .flags = IORESOURCE_IRQ,
825 .flags = IORESOURCE_DMA,
831 .flags = IORESOURCE_DMA,
835 struct platform_device pxa27x_device_ssp3 = {
836 .name = "pxa27x-ssp",
839 .dma_mask = &pxa27x_ssp3_dma_mask,
840 .coherent_dma_mask = DMA_BIT_MASK(32),
842 .resource = pxa27x_resource_ssp3,
843 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3),
846 static struct resource pxa27x_resource_pwm0[] = {
850 .flags = IORESOURCE_MEM,
854 struct platform_device pxa27x_device_pwm0 = {
855 .name = "pxa27x-pwm",
857 .resource = pxa27x_resource_pwm0,
858 .num_resources = ARRAY_SIZE(pxa27x_resource_pwm0),
861 static struct resource pxa27x_resource_pwm1[] = {
865 .flags = IORESOURCE_MEM,
869 struct platform_device pxa27x_device_pwm1 = {
870 .name = "pxa27x-pwm",
872 .resource = pxa27x_resource_pwm1,
873 .num_resources = ARRAY_SIZE(pxa27x_resource_pwm1),
875 #endif /* CONFIG_PXA27x || CONFIG_PXA3xx */
878 static struct resource pxa3xx_resources_mci2[] = {
882 .flags = IORESOURCE_MEM,
887 .flags = IORESOURCE_IRQ,
892 .flags = IORESOURCE_DMA,
897 .flags = IORESOURCE_DMA,
901 struct platform_device pxa3xx_device_mci2 = {
902 .name = "pxa2xx-mci",
905 .dma_mask = &pxamci_dmamask,
906 .coherent_dma_mask = 0xffffffff,
908 .num_resources = ARRAY_SIZE(pxa3xx_resources_mci2),
909 .resource = pxa3xx_resources_mci2,
912 void __init pxa3xx_set_mci2_info(struct pxamci_platform_data *info)
914 pxa_register_device(&pxa3xx_device_mci2, info);
917 static struct resource pxa3xx_resources_mci3[] = {
921 .flags = IORESOURCE_MEM,
926 .flags = IORESOURCE_IRQ,
931 .flags = IORESOURCE_DMA,
936 .flags = IORESOURCE_DMA,
940 struct platform_device pxa3xx_device_mci3 = {
941 .name = "pxa2xx-mci",
944 .dma_mask = &pxamci_dmamask,
945 .coherent_dma_mask = 0xffffffff,
947 .num_resources = ARRAY_SIZE(pxa3xx_resources_mci3),
948 .resource = pxa3xx_resources_mci3,
951 void __init pxa3xx_set_mci3_info(struct pxamci_platform_data *info)
953 pxa_register_device(&pxa3xx_device_mci3, info);
956 static struct resource pxa3xx_resources_gcu[] = {
960 .flags = IORESOURCE_MEM,
965 .flags = IORESOURCE_IRQ,
969 static u64 pxa3xx_gcu_dmamask = DMA_BIT_MASK(32);
971 struct platform_device pxa3xx_device_gcu = {
972 .name = "pxa3xx-gcu",
974 .num_resources = ARRAY_SIZE(pxa3xx_resources_gcu),
975 .resource = pxa3xx_resources_gcu,
977 .dma_mask = &pxa3xx_gcu_dmamask,
978 .coherent_dma_mask = 0xffffffff,
982 #endif /* CONFIG_PXA3xx */
984 #if defined(CONFIG_PXA3xx)
985 static struct resource pxa3xx_resources_i2c_power[] = {
989 .flags = IORESOURCE_MEM,
993 .flags = IORESOURCE_IRQ,
997 struct platform_device pxa3xx_device_i2c_power = {
998 .name = "pxa3xx-pwri2c",
1000 .resource = pxa3xx_resources_i2c_power,
1001 .num_resources = ARRAY_SIZE(pxa3xx_resources_i2c_power),
1004 static struct resource pxa3xx_resources_nand[] = {
1006 .start = 0x43100000,
1008 .flags = IORESOURCE_MEM,
1013 .flags = IORESOURCE_IRQ,
1016 /* DRCMR for Data DMA */
1019 .flags = IORESOURCE_DMA,
1022 /* DRCMR for Command DMA */
1025 .flags = IORESOURCE_DMA,
1029 static u64 pxa3xx_nand_dma_mask = DMA_BIT_MASK(32);
1031 struct platform_device pxa3xx_device_nand = {
1032 .name = "pxa3xx-nand",
1035 .dma_mask = &pxa3xx_nand_dma_mask,
1036 .coherent_dma_mask = DMA_BIT_MASK(32),
1038 .num_resources = ARRAY_SIZE(pxa3xx_resources_nand),
1039 .resource = pxa3xx_resources_nand,
1042 void __init pxa3xx_set_nand_info(struct pxa3xx_nand_platform_data *info)
1044 pxa_register_device(&pxa3xx_device_nand, info);
1047 static u64 pxa3xx_ssp4_dma_mask = DMA_BIT_MASK(32);
1049 static struct resource pxa3xx_resource_ssp4[] = {
1051 .start = 0x41a00000,
1053 .flags = IORESOURCE_MEM,
1058 .flags = IORESOURCE_IRQ,
1064 .flags = IORESOURCE_DMA,
1070 .flags = IORESOURCE_DMA,
1074 struct platform_device pxa3xx_device_ssp4 = {
1075 /* PXA3xx SSP is basically equivalent to PXA27x */
1076 .name = "pxa27x-ssp",
1079 .dma_mask = &pxa3xx_ssp4_dma_mask,
1080 .coherent_dma_mask = DMA_BIT_MASK(32),
1082 .resource = pxa3xx_resource_ssp4,
1083 .num_resources = ARRAY_SIZE(pxa3xx_resource_ssp4),
1085 #endif /* CONFIG_PXA3xx */
1087 struct resource pxa_resource_gpio[] = {
1089 .start = 0x40e00000,
1091 .flags = IORESOURCE_MEM,
1096 .flags = IORESOURCE_IRQ,
1101 .flags = IORESOURCE_IRQ,
1103 .start = IRQ_GPIO_2_x,
1104 .end = IRQ_GPIO_2_x,
1106 .flags = IORESOURCE_IRQ,
1110 struct platform_device pxa25x_device_gpio = {
1111 #ifdef CONFIG_CPU_PXA26x
1112 .name = "pxa26x-gpio",
1114 .name = "pxa25x-gpio",
1117 .num_resources = ARRAY_SIZE(pxa_resource_gpio),
1118 .resource = pxa_resource_gpio,
1121 struct platform_device pxa27x_device_gpio = {
1122 .name = "pxa27x-gpio",
1124 .num_resources = ARRAY_SIZE(pxa_resource_gpio),
1125 .resource = pxa_resource_gpio,
1128 struct platform_device pxa3xx_device_gpio = {
1129 .name = "pxa3xx-gpio",
1131 .num_resources = ARRAY_SIZE(pxa_resource_gpio),
1132 .resource = pxa_resource_gpio,
1135 struct platform_device pxa93x_device_gpio = {
1136 .name = "pxa93x-gpio",
1138 .num_resources = ARRAY_SIZE(pxa_resource_gpio),
1139 .resource = pxa_resource_gpio,
1142 /* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1.
1143 * See comment in arch/arm/mach-pxa/ssp.c::ssp_probe() */
1144 void __init pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_master *info)
1146 struct platform_device *pd;
1148 pd = platform_device_alloc("pxa2xx-spi", id);
1150 printk(KERN_ERR "pxa2xx-spi: failed to allocate device id %d\n",
1155 pd->dev.platform_data = info;
1156 platform_device_add(pd);