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/mfp-pxa27x.h>
14 #include <asm/arch/ohci.h>
15 #include <asm/arch/pxa27x_keypad.h>
16 #include <asm/arch/camera.h>
17 #include <asm/arch/audio.h>
22 void __init pxa_register_device(struct platform_device *dev, void *data)
26 dev->dev.platform_data = data;
28 ret = platform_device_register(dev);
30 dev_err(&dev->dev, "unable to register device: %d\n", ret);
33 static struct resource pxamci_resources[] = {
37 .flags = IORESOURCE_MEM,
42 .flags = IORESOURCE_IRQ,
47 .flags = IORESOURCE_DMA,
52 .flags = IORESOURCE_DMA,
56 static u64 pxamci_dmamask = 0xffffffffUL;
58 struct platform_device pxa_device_mci = {
62 .dma_mask = &pxamci_dmamask,
63 .coherent_dma_mask = 0xffffffff,
65 .num_resources = ARRAY_SIZE(pxamci_resources),
66 .resource = pxamci_resources,
69 void __init pxa_set_mci_info(struct pxamci_platform_data *info)
71 pxa_register_device(&pxa_device_mci, info);
75 static struct pxa2xx_udc_mach_info pxa_udc_info;
77 void __init pxa_set_udc_info(struct pxa2xx_udc_mach_info *info)
79 memcpy(&pxa_udc_info, info, sizeof *info);
82 static struct resource pxa2xx_udc_resources[] = {
86 .flags = IORESOURCE_MEM,
91 .flags = IORESOURCE_IRQ,
95 static u64 udc_dma_mask = ~(u32)0;
97 struct platform_device pxa25x_device_udc = {
100 .resource = pxa2xx_udc_resources,
101 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
103 .platform_data = &pxa_udc_info,
104 .dma_mask = &udc_dma_mask,
108 struct platform_device pxa27x_device_udc = {
109 .name = "pxa27x-udc",
111 .resource = pxa2xx_udc_resources,
112 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
114 .platform_data = &pxa_udc_info,
115 .dma_mask = &udc_dma_mask,
119 static struct resource pxafb_resources[] = {
123 .flags = IORESOURCE_MEM,
128 .flags = IORESOURCE_IRQ,
132 static u64 fb_dma_mask = ~(u64)0;
134 struct platform_device pxa_device_fb = {
138 .dma_mask = &fb_dma_mask,
139 .coherent_dma_mask = 0xffffffff,
141 .num_resources = ARRAY_SIZE(pxafb_resources),
142 .resource = pxafb_resources,
145 void __init set_pxa_fb_info(struct pxafb_mach_info *info)
147 pxa_register_device(&pxa_device_fb, info);
150 void __init set_pxa_fb_parent(struct device *parent_dev)
152 pxa_device_fb.dev.parent = parent_dev;
155 static struct resource pxa_resource_ffuart[] = {
157 .start = __PREG(FFUART),
158 .end = __PREG(FFUART) + 35,
159 .flags = IORESOURCE_MEM,
163 .flags = IORESOURCE_IRQ,
167 struct platform_device pxa_device_ffuart= {
168 .name = "pxa2xx-uart",
170 .resource = pxa_resource_ffuart,
171 .num_resources = ARRAY_SIZE(pxa_resource_ffuart),
174 static struct resource pxa_resource_btuart[] = {
176 .start = __PREG(BTUART),
177 .end = __PREG(BTUART) + 35,
178 .flags = IORESOURCE_MEM,
182 .flags = IORESOURCE_IRQ,
186 struct platform_device pxa_device_btuart = {
187 .name = "pxa2xx-uart",
189 .resource = pxa_resource_btuart,
190 .num_resources = ARRAY_SIZE(pxa_resource_btuart),
193 static struct resource pxa_resource_stuart[] = {
195 .start = __PREG(STUART),
196 .end = __PREG(STUART) + 35,
197 .flags = IORESOURCE_MEM,
201 .flags = IORESOURCE_IRQ,
205 struct platform_device pxa_device_stuart = {
206 .name = "pxa2xx-uart",
208 .resource = pxa_resource_stuart,
209 .num_resources = ARRAY_SIZE(pxa_resource_stuart),
212 static struct resource pxa_resource_hwuart[] = {
214 .start = __PREG(HWUART),
215 .end = __PREG(HWUART) + 47,
216 .flags = IORESOURCE_MEM,
220 .flags = IORESOURCE_IRQ,
224 struct platform_device pxa_device_hwuart = {
225 .name = "pxa2xx-uart",
227 .resource = pxa_resource_hwuart,
228 .num_resources = ARRAY_SIZE(pxa_resource_hwuart),
231 static struct resource pxai2c_resources[] = {
235 .flags = IORESOURCE_MEM,
239 .flags = IORESOURCE_IRQ,
243 struct platform_device pxa_device_i2c = {
244 .name = "pxa2xx-i2c",
246 .resource = pxai2c_resources,
247 .num_resources = ARRAY_SIZE(pxai2c_resources),
250 static unsigned long pxa27x_i2c_mfp_cfg[] = {
255 void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info)
258 pxa2xx_mfp_config(ARRAY_AND_SIZE(pxa27x_i2c_mfp_cfg));
259 pxa_register_device(&pxa_device_i2c, info);
262 static struct resource pxai2s_resources[] = {
266 .flags = IORESOURCE_MEM,
270 .flags = IORESOURCE_IRQ,
274 struct platform_device pxa_device_i2s = {
275 .name = "pxa2xx-i2s",
277 .resource = pxai2s_resources,
278 .num_resources = ARRAY_SIZE(pxai2s_resources),
281 static u64 pxaficp_dmamask = ~(u32)0;
283 struct platform_device pxa_device_ficp = {
287 .dma_mask = &pxaficp_dmamask,
288 .coherent_dma_mask = 0xffffffff,
292 void __init pxa_set_ficp_info(struct pxaficp_platform_data *info)
294 pxa_register_device(&pxa_device_ficp, info);
297 struct platform_device pxa_device_rtc = {
298 .name = "sa1100-rtc",
302 static struct resource pxa_ac97_resources[] = {
305 .end = 0x40500000 + 0xfff,
306 .flags = IORESOURCE_MEM,
311 .flags = IORESOURCE_IRQ,
315 static u64 pxa_ac97_dmamask = 0xffffffffUL;
317 struct platform_device pxa_device_ac97 = {
318 .name = "pxa2xx-ac97",
321 .dma_mask = &pxa_ac97_dmamask,
322 .coherent_dma_mask = 0xffffffff,
324 .num_resources = ARRAY_SIZE(pxa_ac97_resources),
325 .resource = pxa_ac97_resources,
328 void __init pxa_set_ac97_info(pxa2xx_audio_ops_t *ops)
330 pxa_register_device(&pxa_device_ac97, ops);
335 static struct resource pxa25x_resource_pwm0[] = {
339 .flags = IORESOURCE_MEM,
343 struct platform_device pxa25x_device_pwm0 = {
344 .name = "pxa25x-pwm",
346 .resource = pxa25x_resource_pwm0,
347 .num_resources = ARRAY_SIZE(pxa25x_resource_pwm0),
350 static struct resource pxa25x_resource_pwm1[] = {
354 .flags = IORESOURCE_MEM,
358 struct platform_device pxa25x_device_pwm1 = {
359 .name = "pxa25x-pwm",
361 .resource = pxa25x_resource_pwm1,
362 .num_resources = ARRAY_SIZE(pxa25x_resource_pwm1),
365 static u64 pxa25x_ssp_dma_mask = DMA_BIT_MASK(32);
367 static struct resource pxa25x_resource_ssp[] = {
371 .flags = IORESOURCE_MEM,
376 .flags = IORESOURCE_IRQ,
382 .flags = IORESOURCE_DMA,
388 .flags = IORESOURCE_DMA,
392 struct platform_device pxa25x_device_ssp = {
393 .name = "pxa25x-ssp",
396 .dma_mask = &pxa25x_ssp_dma_mask,
397 .coherent_dma_mask = DMA_BIT_MASK(32),
399 .resource = pxa25x_resource_ssp,
400 .num_resources = ARRAY_SIZE(pxa25x_resource_ssp),
403 static u64 pxa25x_nssp_dma_mask = DMA_BIT_MASK(32);
405 static struct resource pxa25x_resource_nssp[] = {
409 .flags = IORESOURCE_MEM,
414 .flags = IORESOURCE_IRQ,
420 .flags = IORESOURCE_DMA,
426 .flags = IORESOURCE_DMA,
430 struct platform_device pxa25x_device_nssp = {
431 .name = "pxa25x-nssp",
434 .dma_mask = &pxa25x_nssp_dma_mask,
435 .coherent_dma_mask = DMA_BIT_MASK(32),
437 .resource = pxa25x_resource_nssp,
438 .num_resources = ARRAY_SIZE(pxa25x_resource_nssp),
441 static u64 pxa25x_assp_dma_mask = DMA_BIT_MASK(32);
443 static struct resource pxa25x_resource_assp[] = {
447 .flags = IORESOURCE_MEM,
452 .flags = IORESOURCE_IRQ,
458 .flags = IORESOURCE_DMA,
464 .flags = IORESOURCE_DMA,
468 struct platform_device pxa25x_device_assp = {
469 /* ASSP is basically equivalent to NSSP */
470 .name = "pxa25x-nssp",
473 .dma_mask = &pxa25x_assp_dma_mask,
474 .coherent_dma_mask = DMA_BIT_MASK(32),
476 .resource = pxa25x_resource_assp,
477 .num_resources = ARRAY_SIZE(pxa25x_resource_assp),
479 #endif /* CONFIG_PXA25x */
481 #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
483 static struct resource pxa27x_resource_keypad[] = {
487 .flags = IORESOURCE_MEM,
492 .flags = IORESOURCE_IRQ,
496 struct platform_device pxa27x_device_keypad = {
497 .name = "pxa27x-keypad",
499 .resource = pxa27x_resource_keypad,
500 .num_resources = ARRAY_SIZE(pxa27x_resource_keypad),
503 void __init pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info)
505 pxa_register_device(&pxa27x_device_keypad, info);
508 static u64 pxa27x_ohci_dma_mask = DMA_BIT_MASK(32);
510 static struct resource pxa27x_resource_ohci[] = {
514 .flags = IORESOURCE_MEM,
519 .flags = IORESOURCE_IRQ,
523 struct platform_device pxa27x_device_ohci = {
524 .name = "pxa27x-ohci",
527 .dma_mask = &pxa27x_ohci_dma_mask,
528 .coherent_dma_mask = DMA_BIT_MASK(32),
530 .num_resources = ARRAY_SIZE(pxa27x_resource_ohci),
531 .resource = pxa27x_resource_ohci,
534 void __init pxa_set_ohci_info(struct pxaohci_platform_data *info)
536 pxa_register_device(&pxa27x_device_ohci, info);
539 static u64 pxa27x_ssp1_dma_mask = DMA_BIT_MASK(32);
541 static struct resource pxa27x_resource_ssp1[] = {
545 .flags = IORESOURCE_MEM,
550 .flags = IORESOURCE_IRQ,
556 .flags = IORESOURCE_DMA,
562 .flags = IORESOURCE_DMA,
566 struct platform_device pxa27x_device_ssp1 = {
567 .name = "pxa27x-ssp",
570 .dma_mask = &pxa27x_ssp1_dma_mask,
571 .coherent_dma_mask = DMA_BIT_MASK(32),
573 .resource = pxa27x_resource_ssp1,
574 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp1),
577 static u64 pxa27x_ssp2_dma_mask = DMA_BIT_MASK(32);
579 static struct resource pxa27x_resource_ssp2[] = {
583 .flags = IORESOURCE_MEM,
588 .flags = IORESOURCE_IRQ,
594 .flags = IORESOURCE_DMA,
600 .flags = IORESOURCE_DMA,
604 struct platform_device pxa27x_device_ssp2 = {
605 .name = "pxa27x-ssp",
608 .dma_mask = &pxa27x_ssp2_dma_mask,
609 .coherent_dma_mask = DMA_BIT_MASK(32),
611 .resource = pxa27x_resource_ssp2,
612 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp2),
615 static u64 pxa27x_ssp3_dma_mask = DMA_BIT_MASK(32);
617 static struct resource pxa27x_resource_ssp3[] = {
621 .flags = IORESOURCE_MEM,
626 .flags = IORESOURCE_IRQ,
632 .flags = IORESOURCE_DMA,
638 .flags = IORESOURCE_DMA,
642 struct platform_device pxa27x_device_ssp3 = {
643 .name = "pxa27x-ssp",
646 .dma_mask = &pxa27x_ssp3_dma_mask,
647 .coherent_dma_mask = DMA_BIT_MASK(32),
649 .resource = pxa27x_resource_ssp3,
650 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3),
653 static struct resource pxa27x_resource_pwm0[] = {
657 .flags = IORESOURCE_MEM,
661 struct platform_device pxa27x_device_pwm0 = {
662 .name = "pxa27x-pwm",
664 .resource = pxa27x_resource_pwm0,
665 .num_resources = ARRAY_SIZE(pxa27x_resource_pwm0),
668 static struct resource pxa27x_resource_pwm1[] = {
672 .flags = IORESOURCE_MEM,
676 struct platform_device pxa27x_device_pwm1 = {
677 .name = "pxa27x-pwm",
679 .resource = pxa27x_resource_pwm1,
680 .num_resources = ARRAY_SIZE(pxa27x_resource_pwm1),
683 static struct resource pxa27x_resource_camera[] = {
687 .flags = IORESOURCE_MEM,
692 .flags = IORESOURCE_IRQ,
696 static u64 pxa27x_dma_mask_camera = DMA_BIT_MASK(32);
698 static struct platform_device pxa27x_device_camera = {
699 .name = "pxa27x-camera",
700 .id = 0, /* This is used to put cameras on this interface */
702 .dma_mask = &pxa27x_dma_mask_camera,
703 .coherent_dma_mask = 0xffffffff,
705 .num_resources = ARRAY_SIZE(pxa27x_resource_camera),
706 .resource = pxa27x_resource_camera,
709 void __init pxa_set_camera_info(struct pxacamera_platform_data *info)
711 pxa_register_device(&pxa27x_device_camera, info);
713 #endif /* CONFIG_PXA27x || CONFIG_PXA3xx */
716 static u64 pxa3xx_ssp4_dma_mask = DMA_BIT_MASK(32);
718 static struct resource pxa3xx_resource_ssp4[] = {
722 .flags = IORESOURCE_MEM,
727 .flags = IORESOURCE_IRQ,
733 .flags = IORESOURCE_DMA,
739 .flags = IORESOURCE_DMA,
743 struct platform_device pxa3xx_device_ssp4 = {
744 /* PXA3xx SSP is basically equivalent to PXA27x */
745 .name = "pxa27x-ssp",
748 .dma_mask = &pxa3xx_ssp4_dma_mask,
749 .coherent_dma_mask = DMA_BIT_MASK(32),
751 .resource = pxa3xx_resource_ssp4,
752 .num_resources = ARRAY_SIZE(pxa3xx_resource_ssp4),
755 static struct resource pxa3xx_resources_mci2[] = {
759 .flags = IORESOURCE_MEM,
764 .flags = IORESOURCE_IRQ,
769 .flags = IORESOURCE_DMA,
774 .flags = IORESOURCE_DMA,
778 struct platform_device pxa3xx_device_mci2 = {
779 .name = "pxa2xx-mci",
782 .dma_mask = &pxamci_dmamask,
783 .coherent_dma_mask = 0xffffffff,
785 .num_resources = ARRAY_SIZE(pxa3xx_resources_mci2),
786 .resource = pxa3xx_resources_mci2,
789 void __init pxa3xx_set_mci2_info(struct pxamci_platform_data *info)
791 pxa_register_device(&pxa3xx_device_mci2, info);
794 static struct resource pxa3xx_resources_mci3[] = {
798 .flags = IORESOURCE_MEM,
803 .flags = IORESOURCE_IRQ,
808 .flags = IORESOURCE_DMA,
813 .flags = IORESOURCE_DMA,
817 struct platform_device pxa3xx_device_mci3 = {
818 .name = "pxa2xx-mci",
821 .dma_mask = &pxamci_dmamask,
822 .coherent_dma_mask = 0xffffffff,
824 .num_resources = ARRAY_SIZE(pxa3xx_resources_mci3),
825 .resource = pxa3xx_resources_mci3,
828 void __init pxa3xx_set_mci3_info(struct pxamci_platform_data *info)
830 pxa_register_device(&pxa3xx_device_mci3, info);
833 #endif /* CONFIG_PXA3xx */