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 pxa_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 static struct resource pxafb_resources[] = {
111 .flags = IORESOURCE_MEM,
116 .flags = IORESOURCE_IRQ,
120 static u64 fb_dma_mask = ~(u64)0;
122 struct platform_device pxa_device_fb = {
126 .dma_mask = &fb_dma_mask,
127 .coherent_dma_mask = 0xffffffff,
129 .num_resources = ARRAY_SIZE(pxafb_resources),
130 .resource = pxafb_resources,
133 void __init set_pxa_fb_info(struct pxafb_mach_info *info)
135 pxa_register_device(&pxa_device_fb, info);
138 void __init set_pxa_fb_parent(struct device *parent_dev)
140 pxa_device_fb.dev.parent = parent_dev;
143 static struct resource pxa_resource_ffuart[] = {
145 .start = __PREG(FFUART),
146 .end = __PREG(FFUART) + 35,
147 .flags = IORESOURCE_MEM,
151 .flags = IORESOURCE_IRQ,
155 struct platform_device pxa_device_ffuart= {
156 .name = "pxa2xx-uart",
158 .resource = pxa_resource_ffuart,
159 .num_resources = ARRAY_SIZE(pxa_resource_ffuart),
162 static struct resource pxa_resource_btuart[] = {
164 .start = __PREG(BTUART),
165 .end = __PREG(BTUART) + 35,
166 .flags = IORESOURCE_MEM,
170 .flags = IORESOURCE_IRQ,
174 struct platform_device pxa_device_btuart = {
175 .name = "pxa2xx-uart",
177 .resource = pxa_resource_btuart,
178 .num_resources = ARRAY_SIZE(pxa_resource_btuart),
181 static struct resource pxa_resource_stuart[] = {
183 .start = __PREG(STUART),
184 .end = __PREG(STUART) + 35,
185 .flags = IORESOURCE_MEM,
189 .flags = IORESOURCE_IRQ,
193 struct platform_device pxa_device_stuart = {
194 .name = "pxa2xx-uart",
196 .resource = pxa_resource_stuart,
197 .num_resources = ARRAY_SIZE(pxa_resource_stuart),
200 static struct resource pxa_resource_hwuart[] = {
202 .start = __PREG(HWUART),
203 .end = __PREG(HWUART) + 47,
204 .flags = IORESOURCE_MEM,
208 .flags = IORESOURCE_IRQ,
212 struct platform_device pxa_device_hwuart = {
213 .name = "pxa2xx-uart",
215 .resource = pxa_resource_hwuart,
216 .num_resources = ARRAY_SIZE(pxa_resource_hwuart),
219 static struct resource pxai2c_resources[] = {
223 .flags = IORESOURCE_MEM,
227 .flags = IORESOURCE_IRQ,
231 struct platform_device pxa_device_i2c = {
232 .name = "pxa2xx-i2c",
234 .resource = pxai2c_resources,
235 .num_resources = ARRAY_SIZE(pxai2c_resources),
238 static unsigned long pxa27x_i2c_mfp_cfg[] = {
243 void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info)
246 pxa2xx_mfp_config(ARRAY_AND_SIZE(pxa27x_i2c_mfp_cfg));
247 pxa_register_device(&pxa_device_i2c, info);
250 static struct resource pxai2s_resources[] = {
254 .flags = IORESOURCE_MEM,
258 .flags = IORESOURCE_IRQ,
262 struct platform_device pxa_device_i2s = {
263 .name = "pxa2xx-i2s",
265 .resource = pxai2s_resources,
266 .num_resources = ARRAY_SIZE(pxai2s_resources),
269 static u64 pxaficp_dmamask = ~(u32)0;
271 struct platform_device pxa_device_ficp = {
275 .dma_mask = &pxaficp_dmamask,
276 .coherent_dma_mask = 0xffffffff,
280 void __init pxa_set_ficp_info(struct pxaficp_platform_data *info)
282 pxa_register_device(&pxa_device_ficp, info);
285 struct platform_device pxa_device_rtc = {
286 .name = "sa1100-rtc",
292 static u64 pxa25x_ssp_dma_mask = DMA_BIT_MASK(32);
294 static struct resource pxa25x_resource_ssp[] = {
298 .flags = IORESOURCE_MEM,
303 .flags = IORESOURCE_IRQ,
309 .flags = IORESOURCE_DMA,
315 .flags = IORESOURCE_DMA,
319 struct platform_device pxa25x_device_ssp = {
320 .name = "pxa25x-ssp",
323 .dma_mask = &pxa25x_ssp_dma_mask,
324 .coherent_dma_mask = DMA_BIT_MASK(32),
326 .resource = pxa25x_resource_ssp,
327 .num_resources = ARRAY_SIZE(pxa25x_resource_ssp),
330 static u64 pxa25x_nssp_dma_mask = DMA_BIT_MASK(32);
332 static struct resource pxa25x_resource_nssp[] = {
336 .flags = IORESOURCE_MEM,
341 .flags = IORESOURCE_IRQ,
347 .flags = IORESOURCE_DMA,
353 .flags = IORESOURCE_DMA,
357 struct platform_device pxa25x_device_nssp = {
358 .name = "pxa25x-nssp",
361 .dma_mask = &pxa25x_nssp_dma_mask,
362 .coherent_dma_mask = DMA_BIT_MASK(32),
364 .resource = pxa25x_resource_nssp,
365 .num_resources = ARRAY_SIZE(pxa25x_resource_nssp),
368 static u64 pxa25x_assp_dma_mask = DMA_BIT_MASK(32);
370 static struct resource pxa25x_resource_assp[] = {
374 .flags = IORESOURCE_MEM,
379 .flags = IORESOURCE_IRQ,
385 .flags = IORESOURCE_DMA,
391 .flags = IORESOURCE_DMA,
395 struct platform_device pxa25x_device_assp = {
396 /* ASSP is basically equivalent to NSSP */
397 .name = "pxa25x-nssp",
400 .dma_mask = &pxa25x_assp_dma_mask,
401 .coherent_dma_mask = DMA_BIT_MASK(32),
403 .resource = pxa25x_resource_assp,
404 .num_resources = ARRAY_SIZE(pxa25x_resource_assp),
406 #endif /* CONFIG_PXA25x */
408 #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
410 static struct resource pxa27x_resource_keypad[] = {
414 .flags = IORESOURCE_MEM,
419 .flags = IORESOURCE_IRQ,
423 struct platform_device pxa27x_device_keypad = {
424 .name = "pxa27x-keypad",
426 .resource = pxa27x_resource_keypad,
427 .num_resources = ARRAY_SIZE(pxa27x_resource_keypad),
430 void __init pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info)
432 pxa_register_device(&pxa27x_device_keypad, info);
435 static u64 pxa27x_ohci_dma_mask = DMA_BIT_MASK(32);
437 static struct resource pxa27x_resource_ohci[] = {
441 .flags = IORESOURCE_MEM,
446 .flags = IORESOURCE_IRQ,
450 struct platform_device pxa27x_device_ohci = {
451 .name = "pxa27x-ohci",
454 .dma_mask = &pxa27x_ohci_dma_mask,
455 .coherent_dma_mask = DMA_BIT_MASK(32),
457 .num_resources = ARRAY_SIZE(pxa27x_resource_ohci),
458 .resource = pxa27x_resource_ohci,
461 void __init pxa_set_ohci_info(struct pxaohci_platform_data *info)
463 pxa_register_device(&pxa27x_device_ohci, info);
466 static u64 pxa27x_ssp1_dma_mask = DMA_BIT_MASK(32);
468 static struct resource pxa27x_resource_ssp1[] = {
472 .flags = IORESOURCE_MEM,
477 .flags = IORESOURCE_IRQ,
483 .flags = IORESOURCE_DMA,
489 .flags = IORESOURCE_DMA,
493 struct platform_device pxa27x_device_ssp1 = {
494 .name = "pxa27x-ssp",
497 .dma_mask = &pxa27x_ssp1_dma_mask,
498 .coherent_dma_mask = DMA_BIT_MASK(32),
500 .resource = pxa27x_resource_ssp1,
501 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp1),
504 static u64 pxa27x_ssp2_dma_mask = DMA_BIT_MASK(32);
506 static struct resource pxa27x_resource_ssp2[] = {
510 .flags = IORESOURCE_MEM,
515 .flags = IORESOURCE_IRQ,
521 .flags = IORESOURCE_DMA,
527 .flags = IORESOURCE_DMA,
531 struct platform_device pxa27x_device_ssp2 = {
532 .name = "pxa27x-ssp",
535 .dma_mask = &pxa27x_ssp2_dma_mask,
536 .coherent_dma_mask = DMA_BIT_MASK(32),
538 .resource = pxa27x_resource_ssp2,
539 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp2),
542 static u64 pxa27x_ssp3_dma_mask = DMA_BIT_MASK(32);
544 static struct resource pxa27x_resource_ssp3[] = {
548 .flags = IORESOURCE_MEM,
553 .flags = IORESOURCE_IRQ,
559 .flags = IORESOURCE_DMA,
565 .flags = IORESOURCE_DMA,
569 struct platform_device pxa27x_device_ssp3 = {
570 .name = "pxa27x-ssp",
573 .dma_mask = &pxa27x_ssp3_dma_mask,
574 .coherent_dma_mask = DMA_BIT_MASK(32),
576 .resource = pxa27x_resource_ssp3,
577 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3),
580 static struct resource pxa27x_resource_camera[] = {
584 .flags = IORESOURCE_MEM,
589 .flags = IORESOURCE_IRQ,
593 static u64 pxa27x_dma_mask_camera = DMA_BIT_MASK(32);
595 static struct platform_device pxa27x_device_camera = {
596 .name = "pxa27x-camera",
597 .id = 0, /* This is used to put cameras on this interface */
599 .dma_mask = &pxa27x_dma_mask_camera,
600 .coherent_dma_mask = 0xffffffff,
602 .num_resources = ARRAY_SIZE(pxa27x_resource_camera),
603 .resource = pxa27x_resource_camera,
606 void __init pxa_set_camera_info(struct pxacamera_platform_data *info)
608 pxa_register_device(&pxa27x_device_camera, info);
610 #endif /* CONFIG_PXA27x || CONFIG_PXA3xx */
613 static u64 pxa3xx_ssp4_dma_mask = DMA_BIT_MASK(32);
615 static struct resource pxa3xx_resource_ssp4[] = {
619 .flags = IORESOURCE_MEM,
624 .flags = IORESOURCE_IRQ,
630 .flags = IORESOURCE_DMA,
636 .flags = IORESOURCE_DMA,
640 struct platform_device pxa3xx_device_ssp4 = {
641 /* PXA3xx SSP is basically equivalent to PXA27x */
642 .name = "pxa27x-ssp",
645 .dma_mask = &pxa3xx_ssp4_dma_mask,
646 .coherent_dma_mask = DMA_BIT_MASK(32),
648 .resource = pxa3xx_resource_ssp4,
649 .num_resources = ARRAY_SIZE(pxa3xx_resource_ssp4),
652 static struct resource pxa3xx_resources_mci2[] = {
656 .flags = IORESOURCE_MEM,
661 .flags = IORESOURCE_IRQ,
666 .flags = IORESOURCE_DMA,
671 .flags = IORESOURCE_DMA,
675 struct platform_device pxa3xx_device_mci2 = {
676 .name = "pxa2xx-mci",
679 .dma_mask = &pxamci_dmamask,
680 .coherent_dma_mask = 0xffffffff,
682 .num_resources = ARRAY_SIZE(pxa3xx_resources_mci2),
683 .resource = pxa3xx_resources_mci2,
686 void __init pxa3xx_set_mci2_info(struct pxamci_platform_data *info)
688 pxa_register_device(&pxa3xx_device_mci2, info);
691 static struct resource pxa3xx_resources_mci3[] = {
695 .flags = IORESOURCE_MEM,
700 .flags = IORESOURCE_IRQ,
705 .flags = IORESOURCE_DMA,
710 .flags = IORESOURCE_DMA,
714 struct platform_device pxa3xx_device_mci3 = {
715 .name = "pxa2xx-mci",
718 .dma_mask = &pxamci_dmamask,
719 .coherent_dma_mask = 0xffffffff,
721 .num_resources = ARRAY_SIZE(pxa3xx_resources_mci3),
722 .resource = pxa3xx_resources_mci3,
725 void __init pxa3xx_set_mci3_info(struct pxamci_platform_data *info)
727 pxa_register_device(&pxa3xx_device_mci3, info);
730 #endif /* CONFIG_PXA3xx */