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>
14 #include <asm/arch/pxa27x_keypad.h>
15 #include <asm/arch/camera.h>
19 void __init
pxa_register_device(struct platform_device
*dev
, void *data
)
23 dev
->dev
.platform_data
= data
;
25 ret
= platform_device_register(dev
);
27 dev_err(&dev
->dev
, "unable to register device: %d\n", ret
);
30 static struct resource pxamci_resources
[] = {
34 .flags
= IORESOURCE_MEM
,
39 .flags
= IORESOURCE_IRQ
,
44 .flags
= IORESOURCE_DMA
,
49 .flags
= IORESOURCE_DMA
,
53 static u64 pxamci_dmamask
= 0xffffffffUL
;
55 struct platform_device pxa_device_mci
= {
59 .dma_mask
= &pxamci_dmamask
,
60 .coherent_dma_mask
= 0xffffffff,
62 .num_resources
= ARRAY_SIZE(pxamci_resources
),
63 .resource
= pxamci_resources
,
66 void __init
pxa_set_mci_info(struct pxamci_platform_data
*info
)
68 pxa_register_device(&pxa_device_mci
, info
);
72 static struct pxa2xx_udc_mach_info pxa_udc_info
;
74 void __init
pxa_set_udc_info(struct pxa2xx_udc_mach_info
*info
)
76 memcpy(&pxa_udc_info
, info
, sizeof *info
);
79 static struct resource pxa2xx_udc_resources
[] = {
83 .flags
= IORESOURCE_MEM
,
88 .flags
= IORESOURCE_IRQ
,
92 static u64 udc_dma_mask
= ~(u32
)0;
94 struct platform_device pxa_device_udc
= {
97 .resource
= pxa2xx_udc_resources
,
98 .num_resources
= ARRAY_SIZE(pxa2xx_udc_resources
),
100 .platform_data
= &pxa_udc_info
,
101 .dma_mask
= &udc_dma_mask
,
105 static struct resource pxafb_resources
[] = {
109 .flags
= IORESOURCE_MEM
,
114 .flags
= IORESOURCE_IRQ
,
118 static u64 fb_dma_mask
= ~(u64
)0;
120 struct platform_device pxa_device_fb
= {
124 .dma_mask
= &fb_dma_mask
,
125 .coherent_dma_mask
= 0xffffffff,
127 .num_resources
= ARRAY_SIZE(pxafb_resources
),
128 .resource
= pxafb_resources
,
131 void __init
set_pxa_fb_info(struct pxafb_mach_info
*info
)
133 pxa_register_device(&pxa_device_fb
, info
);
136 void __init
set_pxa_fb_parent(struct device
*parent_dev
)
138 pxa_device_fb
.dev
.parent
= parent_dev
;
141 static struct resource pxa_resource_ffuart
[] = {
143 .start
= __PREG(FFUART
),
144 .end
= __PREG(FFUART
) + 35,
145 .flags
= IORESOURCE_MEM
,
149 .flags
= IORESOURCE_IRQ
,
153 struct platform_device pxa_device_ffuart
= {
154 .name
= "pxa2xx-uart",
156 .resource
= pxa_resource_ffuart
,
157 .num_resources
= ARRAY_SIZE(pxa_resource_ffuart
),
160 static struct resource pxa_resource_btuart
[] = {
162 .start
= __PREG(BTUART
),
163 .end
= __PREG(BTUART
) + 35,
164 .flags
= IORESOURCE_MEM
,
168 .flags
= IORESOURCE_IRQ
,
172 struct platform_device pxa_device_btuart
= {
173 .name
= "pxa2xx-uart",
175 .resource
= pxa_resource_btuart
,
176 .num_resources
= ARRAY_SIZE(pxa_resource_btuart
),
179 static struct resource pxa_resource_stuart
[] = {
181 .start
= __PREG(STUART
),
182 .end
= __PREG(STUART
) + 35,
183 .flags
= IORESOURCE_MEM
,
187 .flags
= IORESOURCE_IRQ
,
191 struct platform_device pxa_device_stuart
= {
192 .name
= "pxa2xx-uart",
194 .resource
= pxa_resource_stuart
,
195 .num_resources
= ARRAY_SIZE(pxa_resource_stuart
),
198 static struct resource pxa_resource_hwuart
[] = {
200 .start
= __PREG(HWUART
),
201 .end
= __PREG(HWUART
) + 47,
202 .flags
= IORESOURCE_MEM
,
206 .flags
= IORESOURCE_IRQ
,
210 struct platform_device pxa_device_hwuart
= {
211 .name
= "pxa2xx-uart",
213 .resource
= pxa_resource_hwuart
,
214 .num_resources
= ARRAY_SIZE(pxa_resource_hwuart
),
217 static struct resource pxai2c_resources
[] = {
221 .flags
= IORESOURCE_MEM
,
225 .flags
= IORESOURCE_IRQ
,
229 struct platform_device pxa_device_i2c
= {
230 .name
= "pxa2xx-i2c",
232 .resource
= pxai2c_resources
,
233 .num_resources
= ARRAY_SIZE(pxai2c_resources
),
236 void __init
pxa_set_i2c_info(struct i2c_pxa_platform_data
*info
)
238 pxa_register_device(&pxa_device_i2c
, info
);
241 static struct resource pxai2s_resources
[] = {
245 .flags
= IORESOURCE_MEM
,
249 .flags
= IORESOURCE_IRQ
,
253 struct platform_device pxa_device_i2s
= {
254 .name
= "pxa2xx-i2s",
256 .resource
= pxai2s_resources
,
257 .num_resources
= ARRAY_SIZE(pxai2s_resources
),
260 static u64 pxaficp_dmamask
= ~(u32
)0;
262 struct platform_device pxa_device_ficp
= {
266 .dma_mask
= &pxaficp_dmamask
,
267 .coherent_dma_mask
= 0xffffffff,
271 void __init
pxa_set_ficp_info(struct pxaficp_platform_data
*info
)
273 pxa_register_device(&pxa_device_ficp
, info
);
276 struct platform_device pxa_device_rtc
= {
277 .name
= "sa1100-rtc",
283 static u64 pxa25x_ssp_dma_mask
= DMA_BIT_MASK(32);
285 static struct resource pxa25x_resource_ssp
[] = {
289 .flags
= IORESOURCE_MEM
,
294 .flags
= IORESOURCE_IRQ
,
300 .flags
= IORESOURCE_DMA
,
306 .flags
= IORESOURCE_DMA
,
310 struct platform_device pxa25x_device_ssp
= {
311 .name
= "pxa25x-ssp",
314 .dma_mask
= &pxa25x_ssp_dma_mask
,
315 .coherent_dma_mask
= DMA_BIT_MASK(32),
317 .resource
= pxa25x_resource_ssp
,
318 .num_resources
= ARRAY_SIZE(pxa25x_resource_ssp
),
321 static u64 pxa25x_nssp_dma_mask
= DMA_BIT_MASK(32);
323 static struct resource pxa25x_resource_nssp
[] = {
327 .flags
= IORESOURCE_MEM
,
332 .flags
= IORESOURCE_IRQ
,
338 .flags
= IORESOURCE_DMA
,
344 .flags
= IORESOURCE_DMA
,
348 struct platform_device pxa25x_device_nssp
= {
349 .name
= "pxa25x-nssp",
352 .dma_mask
= &pxa25x_nssp_dma_mask
,
353 .coherent_dma_mask
= DMA_BIT_MASK(32),
355 .resource
= pxa25x_resource_nssp
,
356 .num_resources
= ARRAY_SIZE(pxa25x_resource_nssp
),
359 static u64 pxa25x_assp_dma_mask
= DMA_BIT_MASK(32);
361 static struct resource pxa25x_resource_assp
[] = {
365 .flags
= IORESOURCE_MEM
,
370 .flags
= IORESOURCE_IRQ
,
376 .flags
= IORESOURCE_DMA
,
382 .flags
= IORESOURCE_DMA
,
386 struct platform_device pxa25x_device_assp
= {
387 /* ASSP is basically equivalent to NSSP */
388 .name
= "pxa25x-nssp",
391 .dma_mask
= &pxa25x_assp_dma_mask
,
392 .coherent_dma_mask
= DMA_BIT_MASK(32),
394 .resource
= pxa25x_resource_assp
,
395 .num_resources
= ARRAY_SIZE(pxa25x_resource_assp
),
397 #endif /* CONFIG_PXA25x */
399 #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
401 static struct resource pxa27x_resource_keypad
[] = {
405 .flags
= IORESOURCE_MEM
,
410 .flags
= IORESOURCE_IRQ
,
414 struct platform_device pxa27x_device_keypad
= {
415 .name
= "pxa27x-keypad",
417 .resource
= pxa27x_resource_keypad
,
418 .num_resources
= ARRAY_SIZE(pxa27x_resource_keypad
),
421 void __init
pxa_set_keypad_info(struct pxa27x_keypad_platform_data
*info
)
423 pxa_register_device(&pxa27x_device_keypad
, info
);
426 static u64 pxa27x_ohci_dma_mask
= DMA_BIT_MASK(32);
428 static struct resource pxa27x_resource_ohci
[] = {
432 .flags
= IORESOURCE_MEM
,
437 .flags
= IORESOURCE_IRQ
,
441 struct platform_device pxa27x_device_ohci
= {
442 .name
= "pxa27x-ohci",
445 .dma_mask
= &pxa27x_ohci_dma_mask
,
446 .coherent_dma_mask
= DMA_BIT_MASK(32),
448 .num_resources
= ARRAY_SIZE(pxa27x_resource_ohci
),
449 .resource
= pxa27x_resource_ohci
,
452 void __init
pxa_set_ohci_info(struct pxaohci_platform_data
*info
)
454 pxa_register_device(&pxa27x_device_ohci
, info
);
457 static u64 pxa27x_ssp1_dma_mask
= DMA_BIT_MASK(32);
459 static struct resource pxa27x_resource_ssp1
[] = {
463 .flags
= IORESOURCE_MEM
,
468 .flags
= IORESOURCE_IRQ
,
474 .flags
= IORESOURCE_DMA
,
480 .flags
= IORESOURCE_DMA
,
484 struct platform_device pxa27x_device_ssp1
= {
485 .name
= "pxa27x-ssp",
488 .dma_mask
= &pxa27x_ssp1_dma_mask
,
489 .coherent_dma_mask
= DMA_BIT_MASK(32),
491 .resource
= pxa27x_resource_ssp1
,
492 .num_resources
= ARRAY_SIZE(pxa27x_resource_ssp1
),
495 static u64 pxa27x_ssp2_dma_mask
= DMA_BIT_MASK(32);
497 static struct resource pxa27x_resource_ssp2
[] = {
501 .flags
= IORESOURCE_MEM
,
506 .flags
= IORESOURCE_IRQ
,
512 .flags
= IORESOURCE_DMA
,
518 .flags
= IORESOURCE_DMA
,
522 struct platform_device pxa27x_device_ssp2
= {
523 .name
= "pxa27x-ssp",
526 .dma_mask
= &pxa27x_ssp2_dma_mask
,
527 .coherent_dma_mask
= DMA_BIT_MASK(32),
529 .resource
= pxa27x_resource_ssp2
,
530 .num_resources
= ARRAY_SIZE(pxa27x_resource_ssp2
),
533 static u64 pxa27x_ssp3_dma_mask
= DMA_BIT_MASK(32);
535 static struct resource pxa27x_resource_ssp3
[] = {
539 .flags
= IORESOURCE_MEM
,
544 .flags
= IORESOURCE_IRQ
,
550 .flags
= IORESOURCE_DMA
,
556 .flags
= IORESOURCE_DMA
,
560 struct platform_device pxa27x_device_ssp3
= {
561 .name
= "pxa27x-ssp",
564 .dma_mask
= &pxa27x_ssp3_dma_mask
,
565 .coherent_dma_mask
= DMA_BIT_MASK(32),
567 .resource
= pxa27x_resource_ssp3
,
568 .num_resources
= ARRAY_SIZE(pxa27x_resource_ssp3
),
571 static struct resource pxa27x_resource_camera
[] = {
575 .flags
= IORESOURCE_MEM
,
580 .flags
= IORESOURCE_IRQ
,
584 static u64 pxa27x_dma_mask_camera
= DMA_BIT_MASK(32);
586 static struct platform_device pxa27x_device_camera
= {
587 .name
= "pxa27x-camera",
588 .id
= 0, /* This is used to put cameras on this interface */
590 .dma_mask
= &pxa27x_dma_mask_camera
,
591 .coherent_dma_mask
= 0xffffffff,
593 .num_resources
= ARRAY_SIZE(pxa27x_resource_camera
),
594 .resource
= pxa27x_resource_camera
,
597 void __init
pxa_set_camera_info(struct pxacamera_platform_data
*info
)
599 pxa_register_device(&pxa27x_device_camera
, info
);
601 #endif /* CONFIG_PXA27x || CONFIG_PXA3xx */
604 static u64 pxa3xx_ssp4_dma_mask
= DMA_BIT_MASK(32);
606 static struct resource pxa3xx_resource_ssp4
[] = {
610 .flags
= IORESOURCE_MEM
,
615 .flags
= IORESOURCE_IRQ
,
621 .flags
= IORESOURCE_DMA
,
627 .flags
= IORESOURCE_DMA
,
631 struct platform_device pxa3xx_device_ssp4
= {
632 /* PXA3xx SSP is basically equivalent to PXA27x */
633 .name
= "pxa27x-ssp",
636 .dma_mask
= &pxa3xx_ssp4_dma_mask
,
637 .coherent_dma_mask
= DMA_BIT_MASK(32),
639 .resource
= pxa3xx_resource_ssp4
,
640 .num_resources
= ARRAY_SIZE(pxa3xx_resource_ssp4
),
643 static struct resource pxa3xx_resources_mci2
[] = {
647 .flags
= IORESOURCE_MEM
,
652 .flags
= IORESOURCE_IRQ
,
657 .flags
= IORESOURCE_DMA
,
662 .flags
= IORESOURCE_DMA
,
666 struct platform_device pxa3xx_device_mci2
= {
667 .name
= "pxa2xx-mci",
670 .dma_mask
= &pxamci_dmamask
,
671 .coherent_dma_mask
= 0xffffffff,
673 .num_resources
= ARRAY_SIZE(pxa3xx_resources_mci2
),
674 .resource
= pxa3xx_resources_mci2
,
677 void __init
pxa3xx_set_mci2_info(struct pxamci_platform_data
*info
)
679 pxa_register_device(&pxa3xx_device_mci2
, info
);
682 static struct resource pxa3xx_resources_mci3
[] = {
686 .flags
= IORESOURCE_MEM
,
691 .flags
= IORESOURCE_IRQ
,
696 .flags
= IORESOURCE_DMA
,
701 .flags
= IORESOURCE_DMA
,
705 struct platform_device pxa3xx_device_mci3
= {
706 .name
= "pxa2xx-mci",
709 .dma_mask
= &pxamci_dmamask
,
710 .coherent_dma_mask
= 0xffffffff,
712 .num_resources
= ARRAY_SIZE(pxa3xx_resources_mci3
),
713 .resource
= pxa3xx_resources_mci3
,
716 void __init
pxa3xx_set_mci3_info(struct pxamci_platform_data
*info
)
718 pxa_register_device(&pxa3xx_device_mci3
, info
);
721 #endif /* CONFIG_PXA3xx */