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>
16 void __init pxa_register_device(struct platform_device *dev, void *data)
20 dev->dev.platform_data = data;
22 ret = platform_device_register(dev);
24 dev_err(&dev->dev, "unable to register device: %d\n", ret);
27 static struct resource pxamci_resources[] = {
31 .flags = IORESOURCE_MEM,
36 .flags = IORESOURCE_IRQ,
41 .flags = IORESOURCE_DMA,
46 .flags = IORESOURCE_DMA,
50 static u64 pxamci_dmamask = 0xffffffffUL;
52 struct platform_device pxa_device_mci = {
56 .dma_mask = &pxamci_dmamask,
57 .coherent_dma_mask = 0xffffffff,
59 .num_resources = ARRAY_SIZE(pxamci_resources),
60 .resource = pxamci_resources,
63 void __init pxa_set_mci_info(struct pxamci_platform_data *info)
65 pxa_register_device(&pxa_device_mci, info);
69 static struct pxa2xx_udc_mach_info pxa_udc_info;
71 void __init pxa_set_udc_info(struct pxa2xx_udc_mach_info *info)
73 memcpy(&pxa_udc_info, info, sizeof *info);
76 static struct resource pxa2xx_udc_resources[] = {
80 .flags = IORESOURCE_MEM,
85 .flags = IORESOURCE_IRQ,
89 static u64 udc_dma_mask = ~(u32)0;
91 struct platform_device pxa_device_udc = {
94 .resource = pxa2xx_udc_resources,
95 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
97 .platform_data = &pxa_udc_info,
98 .dma_mask = &udc_dma_mask,
102 static struct resource pxafb_resources[] = {
106 .flags = IORESOURCE_MEM,
111 .flags = IORESOURCE_IRQ,
115 static u64 fb_dma_mask = ~(u64)0;
117 struct platform_device pxa_device_fb = {
121 .dma_mask = &fb_dma_mask,
122 .coherent_dma_mask = 0xffffffff,
124 .num_resources = ARRAY_SIZE(pxafb_resources),
125 .resource = pxafb_resources,
128 void __init set_pxa_fb_info(struct pxafb_mach_info *info)
130 pxa_register_device(&pxa_device_fb, info);
133 void __init set_pxa_fb_parent(struct device *parent_dev)
135 pxa_device_fb.dev.parent = parent_dev;
138 static struct resource pxa_resource_ffuart[] = {
140 .start = __PREG(FFUART),
141 .end = __PREG(FFUART) + 35,
142 .flags = IORESOURCE_MEM,
146 .flags = IORESOURCE_IRQ,
150 struct platform_device pxa_device_ffuart= {
151 .name = "pxa2xx-uart",
153 .resource = pxa_resource_ffuart,
154 .num_resources = ARRAY_SIZE(pxa_resource_ffuart),
157 static struct resource pxa_resource_btuart[] = {
159 .start = __PREG(BTUART),
160 .end = __PREG(BTUART) + 35,
161 .flags = IORESOURCE_MEM,
165 .flags = IORESOURCE_IRQ,
169 struct platform_device pxa_device_btuart = {
170 .name = "pxa2xx-uart",
172 .resource = pxa_resource_btuart,
173 .num_resources = ARRAY_SIZE(pxa_resource_btuart),
176 static struct resource pxa_resource_stuart[] = {
178 .start = __PREG(STUART),
179 .end = __PREG(STUART) + 35,
180 .flags = IORESOURCE_MEM,
184 .flags = IORESOURCE_IRQ,
188 struct platform_device pxa_device_stuart = {
189 .name = "pxa2xx-uart",
191 .resource = pxa_resource_stuart,
192 .num_resources = ARRAY_SIZE(pxa_resource_stuart),
195 static struct resource pxa_resource_hwuart[] = {
197 .start = __PREG(HWUART),
198 .end = __PREG(HWUART) + 47,
199 .flags = IORESOURCE_MEM,
203 .flags = IORESOURCE_IRQ,
207 struct platform_device pxa_device_hwuart = {
208 .name = "pxa2xx-uart",
210 .resource = pxa_resource_hwuart,
211 .num_resources = ARRAY_SIZE(pxa_resource_hwuart),
214 static struct resource pxai2c_resources[] = {
218 .flags = IORESOURCE_MEM,
222 .flags = IORESOURCE_IRQ,
226 struct platform_device pxa_device_i2c = {
227 .name = "pxa2xx-i2c",
229 .resource = pxai2c_resources,
230 .num_resources = ARRAY_SIZE(pxai2c_resources),
233 void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info)
235 pxa_register_device(&pxa_device_i2c, info);
238 static struct resource pxai2s_resources[] = {
242 .flags = IORESOURCE_MEM,
246 .flags = IORESOURCE_IRQ,
250 struct platform_device pxa_device_i2s = {
251 .name = "pxa2xx-i2s",
253 .resource = pxai2s_resources,
254 .num_resources = ARRAY_SIZE(pxai2s_resources),
257 static u64 pxaficp_dmamask = ~(u32)0;
259 struct platform_device pxa_device_ficp = {
263 .dma_mask = &pxaficp_dmamask,
264 .coherent_dma_mask = 0xffffffff,
268 void __init pxa_set_ficp_info(struct pxaficp_platform_data *info)
270 pxa_register_device(&pxa_device_ficp, info);
273 struct platform_device pxa_device_rtc = {
274 .name = "sa1100-rtc",
280 static u64 pxa25x_ssp_dma_mask = DMA_BIT_MASK(32);
282 static struct resource pxa25x_resource_ssp[] = {
286 .flags = IORESOURCE_MEM,
291 .flags = IORESOURCE_IRQ,
297 .flags = IORESOURCE_DMA,
303 .flags = IORESOURCE_DMA,
307 struct platform_device pxa25x_device_ssp = {
308 .name = "pxa25x-ssp",
311 .dma_mask = &pxa25x_ssp_dma_mask,
312 .coherent_dma_mask = DMA_BIT_MASK(32),
314 .resource = pxa25x_resource_ssp,
315 .num_resources = ARRAY_SIZE(pxa25x_resource_ssp),
318 static u64 pxa25x_nssp_dma_mask = DMA_BIT_MASK(32);
320 static struct resource pxa25x_resource_nssp[] = {
324 .flags = IORESOURCE_MEM,
329 .flags = IORESOURCE_IRQ,
335 .flags = IORESOURCE_DMA,
341 .flags = IORESOURCE_DMA,
345 struct platform_device pxa25x_device_nssp = {
346 .name = "pxa25x-nssp",
349 .dma_mask = &pxa25x_nssp_dma_mask,
350 .coherent_dma_mask = DMA_BIT_MASK(32),
352 .resource = pxa25x_resource_nssp,
353 .num_resources = ARRAY_SIZE(pxa25x_resource_nssp),
356 static u64 pxa25x_assp_dma_mask = DMA_BIT_MASK(32);
358 static struct resource pxa25x_resource_assp[] = {
362 .flags = IORESOURCE_MEM,
367 .flags = IORESOURCE_IRQ,
373 .flags = IORESOURCE_DMA,
379 .flags = IORESOURCE_DMA,
383 struct platform_device pxa25x_device_assp = {
384 /* ASSP is basically equivalent to NSSP */
385 .name = "pxa25x-nssp",
388 .dma_mask = &pxa25x_assp_dma_mask,
389 .coherent_dma_mask = DMA_BIT_MASK(32),
391 .resource = pxa25x_resource_assp,
392 .num_resources = ARRAY_SIZE(pxa25x_resource_assp),
394 #endif /* CONFIG_PXA25x */
396 #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
398 static u64 pxa27x_ohci_dma_mask = DMA_BIT_MASK(32);
400 static struct resource pxa27x_resource_ohci[] = {
404 .flags = IORESOURCE_MEM,
409 .flags = IORESOURCE_IRQ,
413 struct platform_device pxa27x_device_ohci = {
414 .name = "pxa27x-ohci",
417 .dma_mask = &pxa27x_ohci_dma_mask,
418 .coherent_dma_mask = DMA_BIT_MASK(32),
420 .num_resources = ARRAY_SIZE(pxa27x_resource_ohci),
421 .resource = pxa27x_resource_ohci,
424 void __init pxa_set_ohci_info(struct pxaohci_platform_data *info)
426 pxa_register_device(&pxa27x_device_ohci, info);
429 static u64 pxa27x_ssp1_dma_mask = DMA_BIT_MASK(32);
431 static struct resource pxa27x_resource_ssp1[] = {
435 .flags = IORESOURCE_MEM,
440 .flags = IORESOURCE_IRQ,
446 .flags = IORESOURCE_DMA,
452 .flags = IORESOURCE_DMA,
456 struct platform_device pxa27x_device_ssp1 = {
457 .name = "pxa27x-ssp",
460 .dma_mask = &pxa27x_ssp1_dma_mask,
461 .coherent_dma_mask = DMA_BIT_MASK(32),
463 .resource = pxa27x_resource_ssp1,
464 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp1),
467 static u64 pxa27x_ssp2_dma_mask = DMA_BIT_MASK(32);
469 static struct resource pxa27x_resource_ssp2[] = {
473 .flags = IORESOURCE_MEM,
478 .flags = IORESOURCE_IRQ,
484 .flags = IORESOURCE_DMA,
490 .flags = IORESOURCE_DMA,
494 struct platform_device pxa27x_device_ssp2 = {
495 .name = "pxa27x-ssp",
498 .dma_mask = &pxa27x_ssp2_dma_mask,
499 .coherent_dma_mask = DMA_BIT_MASK(32),
501 .resource = pxa27x_resource_ssp2,
502 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp2),
505 static u64 pxa27x_ssp3_dma_mask = DMA_BIT_MASK(32);
507 static struct resource pxa27x_resource_ssp3[] = {
511 .flags = IORESOURCE_MEM,
516 .flags = IORESOURCE_IRQ,
522 .flags = IORESOURCE_DMA,
528 .flags = IORESOURCE_DMA,
532 struct platform_device pxa27x_device_ssp3 = {
533 .name = "pxa27x-ssp",
536 .dma_mask = &pxa27x_ssp3_dma_mask,
537 .coherent_dma_mask = DMA_BIT_MASK(32),
539 .resource = pxa27x_resource_ssp3,
540 .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3),
542 #endif /* CONFIG_PXA27x || CONFIG_PXA3xx */
545 static u64 pxa3xx_ssp4_dma_mask = DMA_BIT_MASK(32);
547 static struct resource pxa3xx_resource_ssp4[] = {
551 .flags = IORESOURCE_MEM,
556 .flags = IORESOURCE_IRQ,
562 .flags = IORESOURCE_DMA,
568 .flags = IORESOURCE_DMA,
572 struct platform_device pxa3xx_device_ssp4 = {
573 /* PXA3xx SSP is basically equivalent to PXA27x */
574 .name = "pxa27x-ssp",
577 .dma_mask = &pxa3xx_ssp4_dma_mask,
578 .coherent_dma_mask = DMA_BIT_MASK(32),
580 .resource = pxa3xx_resource_ssp4,
581 .num_resources = ARRAY_SIZE(pxa3xx_resource_ssp4),
584 static struct resource pxa3xx_resources_mci2[] = {
588 .flags = IORESOURCE_MEM,
593 .flags = IORESOURCE_IRQ,
598 .flags = IORESOURCE_DMA,
603 .flags = IORESOURCE_DMA,
607 struct platform_device pxa3xx_device_mci2 = {
608 .name = "pxa2xx-mci",
611 .dma_mask = &pxamci_dmamask,
612 .coherent_dma_mask = 0xffffffff,
614 .num_resources = ARRAY_SIZE(pxa3xx_resources_mci2),
615 .resource = pxa3xx_resources_mci2,
618 void __init pxa3xx_set_mci2_info(struct pxamci_platform_data *info)
620 pxa_register_device(&pxa3xx_device_mci2, info);
623 static struct resource pxa3xx_resources_mci3[] = {
627 .flags = IORESOURCE_MEM,
632 .flags = IORESOURCE_IRQ,
637 .flags = IORESOURCE_DMA,
642 .flags = IORESOURCE_DMA,
646 struct platform_device pxa3xx_device_mci3 = {
647 .name = "pxa2xx-mci",
650 .dma_mask = &pxamci_dmamask,
651 .coherent_dma_mask = 0xffffffff,
653 .num_resources = ARRAY_SIZE(pxa3xx_resources_mci3),
654 .resource = pxa3xx_resources_mci3,
657 void __init pxa3xx_set_mci3_info(struct pxamci_platform_data *info)
659 pxa_register_device(&pxa3xx_device_mci3, info);
662 #endif /* CONFIG_PXA3xx */