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>
21 void __init pxa_register_device(struct platform_device *dev, void *data)
25 dev->dev.platform_data = data;
27 ret = platform_device_register(dev);
29 dev_err(&dev->dev, "unable to register device: %d\n", ret);
32 static struct resource pxamci_resources[] = {
36 .flags = IORESOURCE_MEM,
41 .flags = IORESOURCE_IRQ,
46 .flags = IORESOURCE_DMA,
51 .flags = IORESOURCE_DMA,
55 static u64 pxamci_dmamask = 0xffffffffUL;
57 struct platform_device pxa_device_mci = {
61 .dma_mask = &pxamci_dmamask,
62 .coherent_dma_mask = 0xffffffff,
64 .num_resources = ARRAY_SIZE(pxamci_resources),
65 .resource = pxamci_resources,
68 void __init pxa_set_mci_info(struct pxamci_platform_data *info)
70 pxa_register_device(&pxa_device_mci, info);
74 static struct pxa2xx_udc_mach_info pxa_udc_info;
76 void __init pxa_set_udc_info(struct pxa2xx_udc_mach_info *info)
78 memcpy(&pxa_udc_info, info, sizeof *info);
81 static struct resource pxa2xx_udc_resources[] = {
85 .flags = IORESOURCE_MEM,
90 .flags = IORESOURCE_IRQ,
94 static u64 udc_dma_mask = ~(u32)0;
96 struct platform_device pxa25x_device_udc = {
99 .resource = pxa2xx_udc_resources,
100 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
102 .platform_data = &pxa_udc_info,
103 .dma_mask = &udc_dma_mask,
107 struct platform_device pxa27x_device_udc = {
108 .name = "pxa27x-udc",
110 .resource = pxa2xx_udc_resources,
111 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
113 .platform_data = &pxa_udc_info,
114 .dma_mask = &udc_dma_mask,
118 static struct resource pxafb_resources[] = {
122 .flags = IORESOURCE_MEM,
127 .flags = IORESOURCE_IRQ,
131 static u64 fb_dma_mask = ~(u64)0;
133 struct platform_device pxa_device_fb = {
137 .dma_mask = &fb_dma_mask,
138 .coherent_dma_mask = 0xffffffff,
140 .num_resources = ARRAY_SIZE(pxafb_resources),
141 .resource = pxafb_resources,
144 void __init set_pxa_fb_info(struct pxafb_mach_info *info)
146 pxa_register_device(&pxa_device_fb, info);
149 void __init set_pxa_fb_parent(struct device *parent_dev)
151 pxa_device_fb.dev.parent = parent_dev;
154 static struct resource pxa_resource_ffuart[] = {
156 .start = __PREG(FFUART),
157 .end = __PREG(FFUART) + 35,
158 .flags = IORESOURCE_MEM,
162 .flags = IORESOURCE_IRQ,
166 struct platform_device pxa_device_ffuart= {
167 .name = "pxa2xx-uart",
169 .resource = pxa_resource_ffuart,
170 .num_resources = ARRAY_SIZE(pxa_resource_ffuart),
173 static struct resource pxa_resource_btuart[] = {
175 .start = __PREG(BTUART),
176 .end = __PREG(BTUART) + 35,
177 .flags = IORESOURCE_MEM,
181 .flags = IORESOURCE_IRQ,
185 struct platform_device pxa_device_btuart = {
186 .name = "pxa2xx-uart",
188 .resource = pxa_resource_btuart,
189 .num_resources = ARRAY_SIZE(pxa_resource_btuart),
192 static struct resource pxa_resource_stuart[] = {
194 .start = __PREG(STUART),
195 .end = __PREG(STUART) + 35,
196 .flags = IORESOURCE_MEM,
200 .flags = IORESOURCE_IRQ,
204 struct platform_device pxa_device_stuart = {
205 .name = "pxa2xx-uart",
207 .resource = pxa_resource_stuart,
208 .num_resources = ARRAY_SIZE(pxa_resource_stuart),
211 static struct resource pxa_resource_hwuart[] = {
213 .start = __PREG(HWUART),
214 .end = __PREG(HWUART) + 47,
215 .flags = IORESOURCE_MEM,
219 .flags = IORESOURCE_IRQ,
223 struct platform_device pxa_device_hwuart = {
224 .name = "pxa2xx-uart",
226 .resource = pxa_resource_hwuart,
227 .num_resources = ARRAY_SIZE(pxa_resource_hwuart),
230 static struct resource pxai2c_resources[] = {
234 .flags = IORESOURCE_MEM,
238 .flags = IORESOURCE_IRQ,
242 struct platform_device pxa_device_i2c = {
243 .name = "pxa2xx-i2c",
245 .resource = pxai2c_resources,
246 .num_resources = ARRAY_SIZE(pxai2c_resources),
249 static unsigned long pxa27x_i2c_mfp_cfg[] = {
254 void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info)
257 pxa2xx_mfp_config(ARRAY_AND_SIZE(pxa27x_i2c_mfp_cfg));
258 pxa_register_device(&pxa_device_i2c, info);
261 static struct resource pxai2s_resources[] = {
265 .flags = IORESOURCE_MEM,
269 .flags = IORESOURCE_IRQ,
273 struct platform_device pxa_device_i2s = {
274 .name = "pxa2xx-i2s",
276 .resource = pxai2s_resources,
277 .num_resources = ARRAY_SIZE(pxai2s_resources),
280 static u64 pxaficp_dmamask = ~(u32)0;
282 struct platform_device pxa_device_ficp = {
286 .dma_mask = &pxaficp_dmamask,
287 .coherent_dma_mask = 0xffffffff,
291 void __init pxa_set_ficp_info(struct pxaficp_platform_data *info)
293 pxa_register_device(&pxa_device_ficp, info);
296 struct platform_device pxa_device_rtc = {
297 .name = "sa1100-rtc",
303 static struct resource pxa25x_resource_pwm0[] = {
307 .flags = IORESOURCE_MEM,
311 struct platform_device pxa25x_device_pwm0 = {
312 .name = "pxa25x-pwm",
314 .resource = pxa25x_resource_pwm0,
315 .num_resources = ARRAY_SIZE(pxa25x_resource_pwm0),
318 static struct resource pxa25x_resource_pwm1[] = {
322 .flags = IORESOURCE_MEM,
326 struct platform_device pxa25x_device_pwm1 = {
327 .name = "pxa25x-pwm",
329 .resource = pxa25x_resource_pwm1,
330 .num_resources = ARRAY_SIZE(pxa25x_resource_pwm1),
333 static u64 pxa25x_ssp_dma_mask = DMA_BIT_MASK(32);
335 static struct resource pxa25x_resource_ssp[] = {
339 .flags = IORESOURCE_MEM,
344 .flags = IORESOURCE_IRQ,
350 .flags = IORESOURCE_DMA,
356 .flags = IORESOURCE_DMA,
360 struct platform_device pxa25x_device_ssp = {
361 .name = "pxa25x-ssp",
364 .dma_mask = &pxa25x_ssp_dma_mask,
365 .coherent_dma_mask = DMA_BIT_MASK(32),
367 .resource = pxa25x_resource_ssp,
368 .num_resources = ARRAY_SIZE(pxa25x_resource_ssp),
371 static u64 pxa25x_nssp_dma_mask = DMA_BIT_MASK(32);
373 static struct resource pxa25x_resource_nssp[] = {
377 .flags = IORESOURCE_MEM,
382 .flags = IORESOURCE_IRQ,
388 .flags = IORESOURCE_DMA,
394 .flags = IORESOURCE_DMA,
398 struct platform_device pxa25x_device_nssp = {
399 .name = "pxa25x-nssp",
402 .dma_mask = &pxa25x_nssp_dma_mask,
403 .coherent_dma_mask = DMA_BIT_MASK(32),
405 .resource = pxa25x_resource_nssp,
406 .num_resources = ARRAY_SIZE(pxa25x_resource_nssp),
409 static u64 pxa25x_assp_dma_mask = DMA_BIT_MASK(32);
411 static struct resource pxa25x_resource_assp[] = {
415 .flags = IORESOURCE_MEM,
420 .flags = IORESOURCE_IRQ,
426 .flags = IORESOURCE_DMA,
432 .flags = IORESOURCE_DMA,
436 struct platform_device pxa25x_device_assp = {
437 /* ASSP is basically equivalent to NSSP */
438 .name = "pxa25x-nssp",
441 .dma_mask = &pxa25x_assp_dma_mask,
442 .coherent_dma_mask = DMA_BIT_MASK(32),
444 .resource = pxa25x_resource_assp,
445 .num_resources = ARRAY_SIZE(pxa25x_resource_assp),
447 #endif /* CONFIG_PXA25x */
449 #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
451 static struct resource pxa27x_resource_keypad[] = {
455 .flags = IORESOURCE_MEM,
460 .flags = IORESOURCE_IRQ,
464 struct platform_device pxa27x_device_keypad = {
465 .name = "pxa27x-keypad",
467 .resource = pxa27x_resource_keypad,
468 .num_resources = ARRAY_SIZE(pxa27x_resource_keypad),
471 void __init pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info)
473 pxa_register_device(&pxa27x_device_keypad, info);
476 static u64 pxa27x_ohci_dma_mask = DMA_BIT_MASK(32);
478 static struct resource pxa27x_resource_ohci[] = {
482 .flags = IORESOURCE_MEM,
487 .flags = IORESOURCE_IRQ,
491 struct platform_device pxa27x_device_ohci = {
492 .name = "pxa27x-ohci",
495 .dma_mask = &pxa27x_ohci_dma_mask,
496 .coherent_dma_mask = DMA_BIT_MASK(32),
498 .num_resources = ARRAY_SIZE(pxa27x_resource_ohci),
499 .resource = pxa27x_resource_ohci,
502 void __init pxa_set_ohci_info(struct pxaohci_platform_data *info)
504 pxa_register_device(&pxa27x_device_ohci, info);
507 static u64 pxa27x_ssp1_dma_mask = DMA_BIT_MASK(32);
509 static struct resource pxa27x_resource_ssp1[] = {
513 .flags = IORESOURCE_MEM,
518 .flags = IORESOURCE_IRQ,
524 .flags = IORESOURCE_DMA,
530 .flags = IORESOURCE_DMA,
534 struct platform_device pxa27x_device_ssp1 = {
535 .name = "pxa27x-ssp",
538 .dma_mask = &pxa27x_ssp1_dma_mask,
539 .coherent_dma_mask = DMA_BIT_MASK(32),
541 .resource = pxa27x_resource_ssp1,
542 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp1),
545 static u64 pxa27x_ssp2_dma_mask = DMA_BIT_MASK(32);
547 static struct resource pxa27x_resource_ssp2[] = {
551 .flags = IORESOURCE_MEM,
556 .flags = IORESOURCE_IRQ,
562 .flags = IORESOURCE_DMA,
568 .flags = IORESOURCE_DMA,
572 struct platform_device pxa27x_device_ssp2 = {
573 .name = "pxa27x-ssp",
576 .dma_mask = &pxa27x_ssp2_dma_mask,
577 .coherent_dma_mask = DMA_BIT_MASK(32),
579 .resource = pxa27x_resource_ssp2,
580 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp2),
583 static u64 pxa27x_ssp3_dma_mask = DMA_BIT_MASK(32);
585 static struct resource pxa27x_resource_ssp3[] = {
589 .flags = IORESOURCE_MEM,
594 .flags = IORESOURCE_IRQ,
600 .flags = IORESOURCE_DMA,
606 .flags = IORESOURCE_DMA,
610 struct platform_device pxa27x_device_ssp3 = {
611 .name = "pxa27x-ssp",
614 .dma_mask = &pxa27x_ssp3_dma_mask,
615 .coherent_dma_mask = DMA_BIT_MASK(32),
617 .resource = pxa27x_resource_ssp3,
618 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3),
621 static struct resource pxa27x_resource_pwm0[] = {
625 .flags = IORESOURCE_MEM,
629 struct platform_device pxa27x_device_pwm0 = {
630 .name = "pxa27x-pwm",
632 .resource = pxa27x_resource_pwm0,
633 .num_resources = ARRAY_SIZE(pxa27x_resource_pwm0),
636 static struct resource pxa27x_resource_pwm1[] = {
640 .flags = IORESOURCE_MEM,
644 struct platform_device pxa27x_device_pwm1 = {
645 .name = "pxa27x-pwm",
647 .resource = pxa27x_resource_pwm1,
648 .num_resources = ARRAY_SIZE(pxa27x_resource_pwm1),
651 static struct resource pxa27x_resource_camera[] = {
655 .flags = IORESOURCE_MEM,
660 .flags = IORESOURCE_IRQ,
664 static u64 pxa27x_dma_mask_camera = DMA_BIT_MASK(32);
666 static struct platform_device pxa27x_device_camera = {
667 .name = "pxa27x-camera",
668 .id = 0, /* This is used to put cameras on this interface */
670 .dma_mask = &pxa27x_dma_mask_camera,
671 .coherent_dma_mask = 0xffffffff,
673 .num_resources = ARRAY_SIZE(pxa27x_resource_camera),
674 .resource = pxa27x_resource_camera,
677 void __init pxa_set_camera_info(struct pxacamera_platform_data *info)
679 pxa_register_device(&pxa27x_device_camera, info);
681 #endif /* CONFIG_PXA27x || CONFIG_PXA3xx */
684 static u64 pxa3xx_ssp4_dma_mask = DMA_BIT_MASK(32);
686 static struct resource pxa3xx_resource_ssp4[] = {
690 .flags = IORESOURCE_MEM,
695 .flags = IORESOURCE_IRQ,
701 .flags = IORESOURCE_DMA,
707 .flags = IORESOURCE_DMA,
711 struct platform_device pxa3xx_device_ssp4 = {
712 /* PXA3xx SSP is basically equivalent to PXA27x */
713 .name = "pxa27x-ssp",
716 .dma_mask = &pxa3xx_ssp4_dma_mask,
717 .coherent_dma_mask = DMA_BIT_MASK(32),
719 .resource = pxa3xx_resource_ssp4,
720 .num_resources = ARRAY_SIZE(pxa3xx_resource_ssp4),
723 static struct resource pxa3xx_resources_mci2[] = {
727 .flags = IORESOURCE_MEM,
732 .flags = IORESOURCE_IRQ,
737 .flags = IORESOURCE_DMA,
742 .flags = IORESOURCE_DMA,
746 struct platform_device pxa3xx_device_mci2 = {
747 .name = "pxa2xx-mci",
750 .dma_mask = &pxamci_dmamask,
751 .coherent_dma_mask = 0xffffffff,
753 .num_resources = ARRAY_SIZE(pxa3xx_resources_mci2),
754 .resource = pxa3xx_resources_mci2,
757 void __init pxa3xx_set_mci2_info(struct pxamci_platform_data *info)
759 pxa_register_device(&pxa3xx_device_mci2, info);
762 static struct resource pxa3xx_resources_mci3[] = {
766 .flags = IORESOURCE_MEM,
771 .flags = IORESOURCE_IRQ,
776 .flags = IORESOURCE_DMA,
781 .flags = IORESOURCE_DMA,
785 struct platform_device pxa3xx_device_mci3 = {
786 .name = "pxa2xx-mci",
789 .dma_mask = &pxamci_dmamask,
790 .coherent_dma_mask = 0xffffffff,
792 .num_resources = ARRAY_SIZE(pxa3xx_resources_mci3),
793 .resource = pxa3xx_resources_mci3,
796 void __init pxa3xx_set_mci3_info(struct pxamci_platform_data *info)
798 pxa_register_device(&pxa3xx_device_mci3, info);
801 #endif /* CONFIG_PXA3xx */