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/ohci.h>
17 void __init pxa_register_device(struct platform_device *dev, void *data)
21 dev->dev.platform_data = data;
23 ret = platform_device_register(dev);
25 dev_err(&dev->dev, "unable to register device: %d\n", ret);
28 static struct resource pxamci_resources[] = {
32 .flags = IORESOURCE_MEM,
37 .flags = IORESOURCE_IRQ,
42 .flags = IORESOURCE_DMA,
47 .flags = IORESOURCE_DMA,
51 static u64 pxamci_dmamask = 0xffffffffUL;
53 struct platform_device pxa_device_mci = {
57 .dma_mask = &pxamci_dmamask,
58 .coherent_dma_mask = 0xffffffff,
60 .num_resources = ARRAY_SIZE(pxamci_resources),
61 .resource = pxamci_resources,
64 void __init pxa_set_mci_info(struct pxamci_platform_data *info)
66 pxa_register_device(&pxa_device_mci, info);
70 static struct pxa2xx_udc_mach_info pxa_udc_info;
72 void __init pxa_set_udc_info(struct pxa2xx_udc_mach_info *info)
74 memcpy(&pxa_udc_info, info, sizeof *info);
77 static struct resource pxa2xx_udc_resources[] = {
81 .flags = IORESOURCE_MEM,
86 .flags = IORESOURCE_IRQ,
90 static u64 udc_dma_mask = ~(u32)0;
92 struct platform_device pxa_device_udc = {
95 .resource = pxa2xx_udc_resources,
96 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
98 .platform_data = &pxa_udc_info,
99 .dma_mask = &udc_dma_mask,
103 static struct resource pxafb_resources[] = {
107 .flags = IORESOURCE_MEM,
112 .flags = IORESOURCE_IRQ,
116 static u64 fb_dma_mask = ~(u64)0;
118 struct platform_device pxa_device_fb = {
122 .dma_mask = &fb_dma_mask,
123 .coherent_dma_mask = 0xffffffff,
125 .num_resources = ARRAY_SIZE(pxafb_resources),
126 .resource = pxafb_resources,
129 void __init set_pxa_fb_info(struct pxafb_mach_info *info)
131 pxa_register_device(&pxa_device_fb, info);
134 void __init set_pxa_fb_parent(struct device *parent_dev)
136 pxa_device_fb.dev.parent = parent_dev;
139 static struct resource pxa_resource_ffuart[] = {
141 .start = __PREG(FFUART),
142 .end = __PREG(FFUART) + 35,
143 .flags = IORESOURCE_MEM,
147 .flags = IORESOURCE_IRQ,
151 struct platform_device pxa_device_ffuart= {
152 .name = "pxa2xx-uart",
154 .resource = pxa_resource_ffuart,
155 .num_resources = ARRAY_SIZE(pxa_resource_ffuart),
158 static struct resource pxa_resource_btuart[] = {
160 .start = __PREG(BTUART),
161 .end = __PREG(BTUART) + 35,
162 .flags = IORESOURCE_MEM,
166 .flags = IORESOURCE_IRQ,
170 struct platform_device pxa_device_btuart = {
171 .name = "pxa2xx-uart",
173 .resource = pxa_resource_btuart,
174 .num_resources = ARRAY_SIZE(pxa_resource_btuart),
177 static struct resource pxa_resource_stuart[] = {
179 .start = __PREG(STUART),
180 .end = __PREG(STUART) + 35,
181 .flags = IORESOURCE_MEM,
185 .flags = IORESOURCE_IRQ,
189 struct platform_device pxa_device_stuart = {
190 .name = "pxa2xx-uart",
192 .resource = pxa_resource_stuart,
193 .num_resources = ARRAY_SIZE(pxa_resource_stuart),
196 static struct resource pxa_resource_hwuart[] = {
198 .start = __PREG(HWUART),
199 .end = __PREG(HWUART) + 47,
200 .flags = IORESOURCE_MEM,
204 .flags = IORESOURCE_IRQ,
208 struct platform_device pxa_device_hwuart = {
209 .name = "pxa2xx-uart",
211 .resource = pxa_resource_hwuart,
212 .num_resources = ARRAY_SIZE(pxa_resource_hwuart),
215 static struct resource pxai2c_resources[] = {
219 .flags = IORESOURCE_MEM,
223 .flags = IORESOURCE_IRQ,
227 struct platform_device pxa_device_i2c = {
228 .name = "pxa2xx-i2c",
230 .resource = pxai2c_resources,
231 .num_resources = ARRAY_SIZE(pxai2c_resources),
234 void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info)
236 pxa_register_device(&pxa_device_i2c, info);
239 static struct resource pxai2s_resources[] = {
243 .flags = IORESOURCE_MEM,
247 .flags = IORESOURCE_IRQ,
251 struct platform_device pxa_device_i2s = {
252 .name = "pxa2xx-i2s",
254 .resource = pxai2s_resources,
255 .num_resources = ARRAY_SIZE(pxai2s_resources),
258 static u64 pxaficp_dmamask = ~(u32)0;
260 struct platform_device pxa_device_ficp = {
264 .dma_mask = &pxaficp_dmamask,
265 .coherent_dma_mask = 0xffffffff,
269 void __init pxa_set_ficp_info(struct pxaficp_platform_data *info)
271 pxa_register_device(&pxa_device_ficp, info);
274 struct platform_device pxa_device_rtc = {
275 .name = "sa1100-rtc",
281 static u64 pxa25x_ssp_dma_mask = DMA_BIT_MASK(32);
283 static struct resource pxa25x_resource_ssp[] = {
287 .flags = IORESOURCE_MEM,
292 .flags = IORESOURCE_IRQ,
298 .flags = IORESOURCE_DMA,
304 .flags = IORESOURCE_DMA,
308 struct platform_device pxa25x_device_ssp = {
309 .name = "pxa25x-ssp",
312 .dma_mask = &pxa25x_ssp_dma_mask,
313 .coherent_dma_mask = DMA_BIT_MASK(32),
315 .resource = pxa25x_resource_ssp,
316 .num_resources = ARRAY_SIZE(pxa25x_resource_ssp),
319 static u64 pxa25x_nssp_dma_mask = DMA_BIT_MASK(32);
321 static struct resource pxa25x_resource_nssp[] = {
325 .flags = IORESOURCE_MEM,
330 .flags = IORESOURCE_IRQ,
336 .flags = IORESOURCE_DMA,
342 .flags = IORESOURCE_DMA,
346 struct platform_device pxa25x_device_nssp = {
347 .name = "pxa25x-nssp",
350 .dma_mask = &pxa25x_nssp_dma_mask,
351 .coherent_dma_mask = DMA_BIT_MASK(32),
353 .resource = pxa25x_resource_nssp,
354 .num_resources = ARRAY_SIZE(pxa25x_resource_nssp),
357 static u64 pxa25x_assp_dma_mask = DMA_BIT_MASK(32);
359 static struct resource pxa25x_resource_assp[] = {
363 .flags = IORESOURCE_MEM,
368 .flags = IORESOURCE_IRQ,
374 .flags = IORESOURCE_DMA,
380 .flags = IORESOURCE_DMA,
384 struct platform_device pxa25x_device_assp = {
385 /* ASSP is basically equivalent to NSSP */
386 .name = "pxa25x-nssp",
389 .dma_mask = &pxa25x_assp_dma_mask,
390 .coherent_dma_mask = DMA_BIT_MASK(32),
392 .resource = pxa25x_resource_assp,
393 .num_resources = ARRAY_SIZE(pxa25x_resource_assp),
395 #endif /* CONFIG_PXA25x */
397 #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
399 static u64 pxa27x_ohci_dma_mask = DMA_BIT_MASK(32);
401 static struct resource pxa27x_resource_ohci[] = {
405 .flags = IORESOURCE_MEM,
410 .flags = IORESOURCE_IRQ,
414 struct platform_device pxa27x_device_ohci = {
415 .name = "pxa27x-ohci",
418 .dma_mask = &pxa27x_ohci_dma_mask,
419 .coherent_dma_mask = DMA_BIT_MASK(32),
421 .num_resources = ARRAY_SIZE(pxa27x_resource_ohci),
422 .resource = pxa27x_resource_ohci,
425 void __init pxa_set_ohci_info(struct pxaohci_platform_data *info)
427 pxa_register_device(&pxa27x_device_ohci, info);
430 static u64 pxa27x_ssp1_dma_mask = DMA_BIT_MASK(32);
432 static struct resource pxa27x_resource_ssp1[] = {
436 .flags = IORESOURCE_MEM,
441 .flags = IORESOURCE_IRQ,
447 .flags = IORESOURCE_DMA,
453 .flags = IORESOURCE_DMA,
457 struct platform_device pxa27x_device_ssp1 = {
458 .name = "pxa27x-ssp",
461 .dma_mask = &pxa27x_ssp1_dma_mask,
462 .coherent_dma_mask = DMA_BIT_MASK(32),
464 .resource = pxa27x_resource_ssp1,
465 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp1),
468 static u64 pxa27x_ssp2_dma_mask = DMA_BIT_MASK(32);
470 static struct resource pxa27x_resource_ssp2[] = {
474 .flags = IORESOURCE_MEM,
479 .flags = IORESOURCE_IRQ,
485 .flags = IORESOURCE_DMA,
491 .flags = IORESOURCE_DMA,
495 struct platform_device pxa27x_device_ssp2 = {
496 .name = "pxa27x-ssp",
499 .dma_mask = &pxa27x_ssp2_dma_mask,
500 .coherent_dma_mask = DMA_BIT_MASK(32),
502 .resource = pxa27x_resource_ssp2,
503 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp2),
506 static u64 pxa27x_ssp3_dma_mask = DMA_BIT_MASK(32);
508 static struct resource pxa27x_resource_ssp3[] = {
512 .flags = IORESOURCE_MEM,
517 .flags = IORESOURCE_IRQ,
523 .flags = IORESOURCE_DMA,
529 .flags = IORESOURCE_DMA,
533 struct platform_device pxa27x_device_ssp3 = {
534 .name = "pxa27x-ssp",
537 .dma_mask = &pxa27x_ssp3_dma_mask,
538 .coherent_dma_mask = DMA_BIT_MASK(32),
540 .resource = pxa27x_resource_ssp3,
541 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3),
543 #endif /* CONFIG_PXA27x || CONFIG_PXA3xx */
546 static u64 pxa3xx_ssp4_dma_mask = DMA_BIT_MASK(32);
548 static struct resource pxa3xx_resource_ssp4[] = {
552 .flags = IORESOURCE_MEM,
557 .flags = IORESOURCE_IRQ,
563 .flags = IORESOURCE_DMA,
569 .flags = IORESOURCE_DMA,
573 struct platform_device pxa3xx_device_ssp4 = {
574 /* PXA3xx SSP is basically equivalent to PXA27x */
575 .name = "pxa27x-ssp",
578 .dma_mask = &pxa3xx_ssp4_dma_mask,
579 .coherent_dma_mask = DMA_BIT_MASK(32),
581 .resource = pxa3xx_resource_ssp4,
582 .num_resources = ARRAY_SIZE(pxa3xx_resource_ssp4),
585 static struct resource pxa3xx_resources_mci2[] = {
589 .flags = IORESOURCE_MEM,
594 .flags = IORESOURCE_IRQ,
599 .flags = IORESOURCE_DMA,
604 .flags = IORESOURCE_DMA,
608 struct platform_device pxa3xx_device_mci2 = {
609 .name = "pxa2xx-mci",
612 .dma_mask = &pxamci_dmamask,
613 .coherent_dma_mask = 0xffffffff,
615 .num_resources = ARRAY_SIZE(pxa3xx_resources_mci2),
616 .resource = pxa3xx_resources_mci2,
619 void __init pxa3xx_set_mci2_info(struct pxamci_platform_data *info)
621 pxa_register_device(&pxa3xx_device_mci2, info);
624 static struct resource pxa3xx_resources_mci3[] = {
628 .flags = IORESOURCE_MEM,
633 .flags = IORESOURCE_IRQ,
638 .flags = IORESOURCE_DMA,
643 .flags = IORESOURCE_DMA,
647 struct platform_device pxa3xx_device_mci3 = {
648 .name = "pxa2xx-mci",
651 .dma_mask = &pxamci_dmamask,
652 .coherent_dma_mask = 0xffffffff,
654 .num_resources = ARRAY_SIZE(pxa3xx_resources_mci3),
655 .resource = pxa3xx_resources_mci3,
658 void __init pxa3xx_set_mci3_info(struct pxamci_platform_data *info)
660 pxa_register_device(&pxa3xx_device_mci3, info);
663 #endif /* CONFIG_PXA3xx */