1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
28f58de7cSeric miao #include <linux/module.h>
38f58de7cSeric miao #include <linux/kernel.h>
48f58de7cSeric miao #include <linux/init.h>
58f58de7cSeric miao #include <linux/platform_device.h>
622abc0d2SRobert Jarzmik #include <linux/clkdev.h>
7a52e1736SEzequiel Garcia #include <linux/clk-provider.h>
88f58de7cSeric miao #include <linux/dma-mapping.h>
91da10c17SRobert Jarzmik #include <linux/dmaengine.h>
108348c259SSebastian Andrzej Siewior #include <linux/spi/pxa2xx_spi.h>
11f15fc9b1SWolfram Sang #include <linux/platform_data/i2c-pxa.h>
1208d3df8cSArnd Bergmann #include <linux/soc/pxa/cpu.h>
138f58de7cSeric miao
144c25c5d2SArnd Bergmann #include "udc.h"
15293b2da1SArnd Bergmann #include <linux/platform_data/video-pxafb.h>
16293b2da1SArnd Bergmann #include <linux/platform_data/mmc-pxamci.h>
17*e6acc406SArnd Bergmann #include "irqs.h"
18293b2da1SArnd Bergmann #include <linux/platform_data/usb-ohci-pxa27x.h>
194be0856fSRobert Jarzmik #include <linux/platform_data/mmp_dma.h>
208f58de7cSeric miao
21*e6acc406SArnd Bergmann #include "regs-ost.h"
22*e6acc406SArnd Bergmann #include "reset.h"
238f58de7cSeric miao #include "devices.h"
24bc3a5959SPhilipp Zabel #include "generic.h"
258f58de7cSeric miao
pxa_register_device(struct platform_device * dev,void * data)268f58de7cSeric miao void __init pxa_register_device(struct platform_device *dev, void *data)
278f58de7cSeric miao {
288f58de7cSeric miao int ret;
298f58de7cSeric miao
308f58de7cSeric miao dev->dev.platform_data = data;
318f58de7cSeric miao
328f58de7cSeric miao ret = platform_device_register(dev);
338f58de7cSeric miao if (ret)
348f58de7cSeric miao dev_err(&dev->dev, "unable to register device: %d\n", ret);
358f58de7cSeric miao }
368f58de7cSeric miao
3709a5358dSEric Miao static struct resource pxa_resource_pmu = {
3809a5358dSEric Miao .start = IRQ_PMU,
3909a5358dSEric Miao .end = IRQ_PMU,
4009a5358dSEric Miao .flags = IORESOURCE_IRQ,
4109a5358dSEric Miao };
4209a5358dSEric Miao
4309a5358dSEric Miao struct platform_device pxa_device_pmu = {
44f9eff219SMark Rutland .name = "xscale-pmu",
45df3d17e0SSudeep KarkadaNagesha .id = -1,
4609a5358dSEric Miao .resource = &pxa_resource_pmu,
4709a5358dSEric Miao .num_resources = 1,
4809a5358dSEric Miao };
4909a5358dSEric Miao
508f58de7cSeric miao static struct resource pxamci_resources[] = {
518f58de7cSeric miao [0] = {
528f58de7cSeric miao .start = 0x41100000,
538f58de7cSeric miao .end = 0x41100fff,
548f58de7cSeric miao .flags = IORESOURCE_MEM,
558f58de7cSeric miao },
568f58de7cSeric miao [1] = {
578f58de7cSeric miao .start = IRQ_MMC,
588f58de7cSeric miao .end = IRQ_MMC,
598f58de7cSeric miao .flags = IORESOURCE_IRQ,
608f58de7cSeric miao },
618f58de7cSeric miao };
628f58de7cSeric miao
638f58de7cSeric miao static u64 pxamci_dmamask = 0xffffffffUL;
648f58de7cSeric miao
658f58de7cSeric miao struct platform_device pxa_device_mci = {
668f58de7cSeric miao .name = "pxa2xx-mci",
67fafc9d3fSBridge Wu .id = 0,
688f58de7cSeric miao .dev = {
698f58de7cSeric miao .dma_mask = &pxamci_dmamask,
708f58de7cSeric miao .coherent_dma_mask = 0xffffffff,
718f58de7cSeric miao },
728f58de7cSeric miao .num_resources = ARRAY_SIZE(pxamci_resources),
738f58de7cSeric miao .resource = pxamci_resources,
748f58de7cSeric miao };
758f58de7cSeric miao
pxa_set_mci_info(struct pxamci_platform_data * info)768f58de7cSeric miao void __init pxa_set_mci_info(struct pxamci_platform_data *info)
778f58de7cSeric miao {
788f58de7cSeric miao pxa_register_device(&pxa_device_mci, info);
798f58de7cSeric miao }
808f58de7cSeric miao
811257629bSPhilipp Zabel static struct pxa2xx_udc_mach_info pxa_udc_info = {
821257629bSPhilipp Zabel .gpio_pullup = -1,
831257629bSPhilipp Zabel };
848f58de7cSeric miao
858f58de7cSeric miao static struct resource pxa2xx_udc_resources[] = {
868f58de7cSeric miao [0] = {
878f58de7cSeric miao .start = 0x40600000,
888f58de7cSeric miao .end = 0x4060ffff,
898f58de7cSeric miao .flags = IORESOURCE_MEM,
908f58de7cSeric miao },
918f58de7cSeric miao [1] = {
928f58de7cSeric miao .start = IRQ_USB,
938f58de7cSeric miao .end = IRQ_USB,
948f58de7cSeric miao .flags = IORESOURCE_IRQ,
958f58de7cSeric miao },
968f58de7cSeric miao };
978f58de7cSeric miao
988f58de7cSeric miao static u64 udc_dma_mask = ~(u32)0;
998f58de7cSeric miao
1007a857620SPhilipp Zabel struct platform_device pxa25x_device_udc = {
1017a857620SPhilipp Zabel .name = "pxa25x-udc",
1027a857620SPhilipp Zabel .id = -1,
1037a857620SPhilipp Zabel .resource = pxa2xx_udc_resources,
1047a857620SPhilipp Zabel .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
1057a857620SPhilipp Zabel .dev = {
1067a857620SPhilipp Zabel .platform_data = &pxa_udc_info,
1077a857620SPhilipp Zabel .dma_mask = &udc_dma_mask,
1087a857620SPhilipp Zabel }
1097a857620SPhilipp Zabel };
1107a857620SPhilipp Zabel
1117a857620SPhilipp Zabel struct platform_device pxa27x_device_udc = {
1127a857620SPhilipp Zabel .name = "pxa27x-udc",
1138f58de7cSeric miao .id = -1,
1148f58de7cSeric miao .resource = pxa2xx_udc_resources,
1158f58de7cSeric miao .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
1168f58de7cSeric miao .dev = {
1178f58de7cSeric miao .platform_data = &pxa_udc_info,
1188f58de7cSeric miao .dma_mask = &udc_dma_mask,
1198f58de7cSeric miao }
1208f58de7cSeric miao };
1218f58de7cSeric miao
1228f58de7cSeric miao static struct resource pxafb_resources[] = {
1238f58de7cSeric miao [0] = {
1248f58de7cSeric miao .start = 0x44000000,
1258f58de7cSeric miao .end = 0x4400ffff,
1268f58de7cSeric miao .flags = IORESOURCE_MEM,
1278f58de7cSeric miao },
1288f58de7cSeric miao [1] = {
1298f58de7cSeric miao .start = IRQ_LCD,
1308f58de7cSeric miao .end = IRQ_LCD,
1318f58de7cSeric miao .flags = IORESOURCE_IRQ,
1328f58de7cSeric miao },
1338f58de7cSeric miao };
1348f58de7cSeric miao
1358f58de7cSeric miao static u64 fb_dma_mask = ~(u64)0;
1368f58de7cSeric miao
1378f58de7cSeric miao struct platform_device pxa_device_fb = {
1388f58de7cSeric miao .name = "pxa2xx-fb",
1398f58de7cSeric miao .id = -1,
1408f58de7cSeric miao .dev = {
1418f58de7cSeric miao .dma_mask = &fb_dma_mask,
1428f58de7cSeric miao .coherent_dma_mask = 0xffffffff,
1438f58de7cSeric miao },
1448f58de7cSeric miao .num_resources = ARRAY_SIZE(pxafb_resources),
1458f58de7cSeric miao .resource = pxafb_resources,
1468f58de7cSeric miao };
1478f58de7cSeric miao
pxa_set_fb_info(struct device * parent,struct pxafb_mach_info * info)1484321e1a1SRussell King - ARM Linux void __init pxa_set_fb_info(struct device *parent, struct pxafb_mach_info *info)
1498f58de7cSeric miao {
1504321e1a1SRussell King - ARM Linux pxa_device_fb.dev.parent = parent;
1518f58de7cSeric miao pxa_register_device(&pxa_device_fb, info);
1528f58de7cSeric miao }
1538f58de7cSeric miao
1548f58de7cSeric miao static struct resource pxa_resource_ffuart[] = {
1558f58de7cSeric miao {
15602f65262SEric Miao .start = 0x40100000,
15702f65262SEric Miao .end = 0x40100023,
1588f58de7cSeric miao .flags = IORESOURCE_MEM,
1598f58de7cSeric miao }, {
1608f58de7cSeric miao .start = IRQ_FFUART,
1618f58de7cSeric miao .end = IRQ_FFUART,
1628f58de7cSeric miao .flags = IORESOURCE_IRQ,
1638f58de7cSeric miao }
1648f58de7cSeric miao };
1658f58de7cSeric miao
1668f58de7cSeric miao struct platform_device pxa_device_ffuart = {
1678f58de7cSeric miao .name = "pxa2xx-uart",
1688f58de7cSeric miao .id = 0,
1698f58de7cSeric miao .resource = pxa_resource_ffuart,
1708f58de7cSeric miao .num_resources = ARRAY_SIZE(pxa_resource_ffuart),
1718f58de7cSeric miao };
1728f58de7cSeric miao
pxa_set_ffuart_info(void * info)173cc155c6fSRussell King void __init pxa_set_ffuart_info(void *info)
174cc155c6fSRussell King {
175cc155c6fSRussell King pxa_register_device(&pxa_device_ffuart, info);
176cc155c6fSRussell King }
177cc155c6fSRussell King
1788f58de7cSeric miao static struct resource pxa_resource_btuart[] = {
1798f58de7cSeric miao {
18002f65262SEric Miao .start = 0x40200000,
18102f65262SEric Miao .end = 0x40200023,
1828f58de7cSeric miao .flags = IORESOURCE_MEM,
1838f58de7cSeric miao }, {
1848f58de7cSeric miao .start = IRQ_BTUART,
1858f58de7cSeric miao .end = IRQ_BTUART,
1868f58de7cSeric miao .flags = IORESOURCE_IRQ,
1878f58de7cSeric miao }
1888f58de7cSeric miao };
1898f58de7cSeric miao
1908f58de7cSeric miao struct platform_device pxa_device_btuart = {
1918f58de7cSeric miao .name = "pxa2xx-uart",
1928f58de7cSeric miao .id = 1,
1938f58de7cSeric miao .resource = pxa_resource_btuart,
1948f58de7cSeric miao .num_resources = ARRAY_SIZE(pxa_resource_btuart),
1958f58de7cSeric miao };
1968f58de7cSeric miao
pxa_set_btuart_info(void * info)197cc155c6fSRussell King void __init pxa_set_btuart_info(void *info)
198cc155c6fSRussell King {
199cc155c6fSRussell King pxa_register_device(&pxa_device_btuart, info);
200cc155c6fSRussell King }
201cc155c6fSRussell King
2028f58de7cSeric miao static struct resource pxa_resource_stuart[] = {
2038f58de7cSeric miao {
20402f65262SEric Miao .start = 0x40700000,
20502f65262SEric Miao .end = 0x40700023,
2068f58de7cSeric miao .flags = IORESOURCE_MEM,
2078f58de7cSeric miao }, {
2088f58de7cSeric miao .start = IRQ_STUART,
2098f58de7cSeric miao .end = IRQ_STUART,
2108f58de7cSeric miao .flags = IORESOURCE_IRQ,
2118f58de7cSeric miao }
2128f58de7cSeric miao };
2138f58de7cSeric miao
2148f58de7cSeric miao struct platform_device pxa_device_stuart = {
2158f58de7cSeric miao .name = "pxa2xx-uart",
2168f58de7cSeric miao .id = 2,
2178f58de7cSeric miao .resource = pxa_resource_stuart,
2188f58de7cSeric miao .num_resources = ARRAY_SIZE(pxa_resource_stuart),
2198f58de7cSeric miao };
2208f58de7cSeric miao
pxa_set_stuart_info(void * info)221cc155c6fSRussell King void __init pxa_set_stuart_info(void *info)
222cc155c6fSRussell King {
223cc155c6fSRussell King pxa_register_device(&pxa_device_stuart, info);
224cc155c6fSRussell King }
225cc155c6fSRussell King
2268f58de7cSeric miao static struct resource pxa_resource_hwuart[] = {
2278f58de7cSeric miao {
22802f65262SEric Miao .start = 0x41600000,
22902f65262SEric Miao .end = 0x4160002F,
2308f58de7cSeric miao .flags = IORESOURCE_MEM,
2318f58de7cSeric miao }, {
2328f58de7cSeric miao .start = IRQ_HWUART,
2338f58de7cSeric miao .end = IRQ_HWUART,
2348f58de7cSeric miao .flags = IORESOURCE_IRQ,
2358f58de7cSeric miao }
2368f58de7cSeric miao };
2378f58de7cSeric miao
2388f58de7cSeric miao struct platform_device pxa_device_hwuart = {
2398f58de7cSeric miao .name = "pxa2xx-uart",
2408f58de7cSeric miao .id = 3,
2418f58de7cSeric miao .resource = pxa_resource_hwuart,
2428f58de7cSeric miao .num_resources = ARRAY_SIZE(pxa_resource_hwuart),
2438f58de7cSeric miao };
2448f58de7cSeric miao
pxa_set_hwuart_info(void * info)245cc155c6fSRussell King void __init pxa_set_hwuart_info(void *info)
246cc155c6fSRussell King {
247cc155c6fSRussell King if (cpu_is_pxa255())
248cc155c6fSRussell King pxa_register_device(&pxa_device_hwuart, info);
249cc155c6fSRussell King else
250cc155c6fSRussell King pr_info("UART: Ignoring attempt to register HWUART on non-PXA255 hardware");
251cc155c6fSRussell King }
252cc155c6fSRussell King
2538f58de7cSeric miao static struct resource pxai2c_resources[] = {
2548f58de7cSeric miao {
2558f58de7cSeric miao .start = 0x40301680,
2568f58de7cSeric miao .end = 0x403016a3,
2578f58de7cSeric miao .flags = IORESOURCE_MEM,
2588f58de7cSeric miao }, {
2598f58de7cSeric miao .start = IRQ_I2C,
2608f58de7cSeric miao .end = IRQ_I2C,
2618f58de7cSeric miao .flags = IORESOURCE_IRQ,
2628f58de7cSeric miao },
2638f58de7cSeric miao };
2648f58de7cSeric miao
2658f58de7cSeric miao struct platform_device pxa_device_i2c = {
2668f58de7cSeric miao .name = "pxa2xx-i2c",
2678f58de7cSeric miao .id = 0,
2688f58de7cSeric miao .resource = pxai2c_resources,
2698f58de7cSeric miao .num_resources = ARRAY_SIZE(pxai2c_resources),
2708f58de7cSeric miao };
2718f58de7cSeric miao
pxa_set_i2c_info(struct i2c_pxa_platform_data * info)2728f58de7cSeric miao void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info)
2738f58de7cSeric miao {
2748f58de7cSeric miao pxa_register_device(&pxa_device_i2c, info);
2758f58de7cSeric miao }
2768f58de7cSeric miao
27799464293SEric Miao #ifdef CONFIG_PXA27x
27899464293SEric Miao static struct resource pxa27x_resources_i2c_power[] = {
27999464293SEric Miao {
28099464293SEric Miao .start = 0x40f00180,
28199464293SEric Miao .end = 0x40f001a3,
28299464293SEric Miao .flags = IORESOURCE_MEM,
28399464293SEric Miao }, {
28499464293SEric Miao .start = IRQ_PWRI2C,
28599464293SEric Miao .end = IRQ_PWRI2C,
28699464293SEric Miao .flags = IORESOURCE_IRQ,
28799464293SEric Miao },
28899464293SEric Miao };
28999464293SEric Miao
29099464293SEric Miao struct platform_device pxa27x_device_i2c_power = {
29199464293SEric Miao .name = "pxa2xx-i2c",
29299464293SEric Miao .id = 1,
29399464293SEric Miao .resource = pxa27x_resources_i2c_power,
29499464293SEric Miao .num_resources = ARRAY_SIZE(pxa27x_resources_i2c_power),
29599464293SEric Miao };
29699464293SEric Miao #endif
29799464293SEric Miao
2988f58de7cSeric miao static struct resource pxai2s_resources[] = {
2998f58de7cSeric miao {
3008f58de7cSeric miao .start = 0x40400000,
3018f58de7cSeric miao .end = 0x40400083,
3028f58de7cSeric miao .flags = IORESOURCE_MEM,
3038f58de7cSeric miao }, {
3048f58de7cSeric miao .start = IRQ_I2S,
3058f58de7cSeric miao .end = IRQ_I2S,
3068f58de7cSeric miao .flags = IORESOURCE_IRQ,
3078f58de7cSeric miao },
3088f58de7cSeric miao };
3098f58de7cSeric miao
3108f58de7cSeric miao struct platform_device pxa_device_i2s = {
3118f58de7cSeric miao .name = "pxa2xx-i2s",
3128f58de7cSeric miao .id = -1,
3138f58de7cSeric miao .resource = pxai2s_resources,
3148f58de7cSeric miao .num_resources = ARRAY_SIZE(pxai2s_resources),
3158f58de7cSeric miao };
3168f58de7cSeric miao
317f0fba2adSLiam Girdwood struct platform_device pxa_device_asoc_ssp1 = {
318f0fba2adSLiam Girdwood .name = "pxa-ssp-dai",
319f0fba2adSLiam Girdwood .id = 0,
320f0fba2adSLiam Girdwood };
321f0fba2adSLiam Girdwood
322f0fba2adSLiam Girdwood struct platform_device pxa_device_asoc_ssp2= {
323f0fba2adSLiam Girdwood .name = "pxa-ssp-dai",
324f0fba2adSLiam Girdwood .id = 1,
325f0fba2adSLiam Girdwood };
326f0fba2adSLiam Girdwood
327f0fba2adSLiam Girdwood struct platform_device pxa_device_asoc_ssp3 = {
328f0fba2adSLiam Girdwood .name = "pxa-ssp-dai",
329f0fba2adSLiam Girdwood .id = 2,
330f0fba2adSLiam Girdwood };
331f0fba2adSLiam Girdwood
332f0fba2adSLiam Girdwood struct platform_device pxa_device_asoc_ssp4 = {
333f0fba2adSLiam Girdwood .name = "pxa-ssp-dai",
334f0fba2adSLiam Girdwood .id = 3,
335f0fba2adSLiam Girdwood };
336f0fba2adSLiam Girdwood
337f0fba2adSLiam Girdwood struct platform_device pxa_device_asoc_platform = {
338f0fba2adSLiam Girdwood .name = "pxa-pcm-audio",
339f0fba2adSLiam Girdwood .id = -1,
340f0fba2adSLiam Girdwood };
341f0fba2adSLiam Girdwood
34272493146SRobert Jarzmik static struct resource pxa_rtc_resources[] = {
34372493146SRobert Jarzmik [0] = {
34472493146SRobert Jarzmik .start = 0x40900000,
34572493146SRobert Jarzmik .end = 0x40900000 + 0x3b,
34672493146SRobert Jarzmik .flags = IORESOURCE_MEM,
34772493146SRobert Jarzmik },
34872493146SRobert Jarzmik [1] = {
34972493146SRobert Jarzmik .start = IRQ_RTC1Hz,
35072493146SRobert Jarzmik .end = IRQ_RTC1Hz,
3513888c090SHaojian Zhuang .name = "rtc 1Hz",
35272493146SRobert Jarzmik .flags = IORESOURCE_IRQ,
35372493146SRobert Jarzmik },
35472493146SRobert Jarzmik [2] = {
35572493146SRobert Jarzmik .start = IRQ_RTCAlrm,
35672493146SRobert Jarzmik .end = IRQ_RTCAlrm,
3573888c090SHaojian Zhuang .name = "rtc alarm",
35872493146SRobert Jarzmik .flags = IORESOURCE_IRQ,
35972493146SRobert Jarzmik },
36072493146SRobert Jarzmik };
36172493146SRobert Jarzmik
36272493146SRobert Jarzmik struct platform_device pxa_device_rtc = {
36372493146SRobert Jarzmik .name = "pxa-rtc",
36472493146SRobert Jarzmik .id = -1,
36572493146SRobert Jarzmik .num_resources = ARRAY_SIZE(pxa_rtc_resources),
36672493146SRobert Jarzmik .resource = pxa_rtc_resources,
36772493146SRobert Jarzmik };
36872493146SRobert Jarzmik
3693888c090SHaojian Zhuang struct platform_device sa1100_device_rtc = {
3703888c090SHaojian Zhuang .name = "sa1100-rtc",
3713888c090SHaojian Zhuang .id = -1,
3722c4fabecSRob Herring .num_resources = ARRAY_SIZE(pxa_rtc_resources),
3732c4fabecSRob Herring .resource = pxa_rtc_resources,
3743888c090SHaojian Zhuang };
3753888c090SHaojian Zhuang
3768f58de7cSeric miao #ifdef CONFIG_PXA25x
3778f58de7cSeric miao
37875540c1aSeric miao static struct resource pxa25x_resource_pwm0[] = {
37975540c1aSeric miao [0] = {
38075540c1aSeric miao .start = 0x40b00000,
38175540c1aSeric miao .end = 0x40b0000f,
38275540c1aSeric miao .flags = IORESOURCE_MEM,
38375540c1aSeric miao },
38475540c1aSeric miao };
38575540c1aSeric miao
38675540c1aSeric miao struct platform_device pxa25x_device_pwm0 = {
38775540c1aSeric miao .name = "pxa25x-pwm",
38875540c1aSeric miao .id = 0,
38975540c1aSeric miao .resource = pxa25x_resource_pwm0,
39075540c1aSeric miao .num_resources = ARRAY_SIZE(pxa25x_resource_pwm0),
39175540c1aSeric miao };
39275540c1aSeric miao
39375540c1aSeric miao static struct resource pxa25x_resource_pwm1[] = {
39475540c1aSeric miao [0] = {
39575540c1aSeric miao .start = 0x40c00000,
39675540c1aSeric miao .end = 0x40c0000f,
39775540c1aSeric miao .flags = IORESOURCE_MEM,
39875540c1aSeric miao },
39975540c1aSeric miao };
40075540c1aSeric miao
40175540c1aSeric miao struct platform_device pxa25x_device_pwm1 = {
40275540c1aSeric miao .name = "pxa25x-pwm",
40375540c1aSeric miao .id = 1,
40475540c1aSeric miao .resource = pxa25x_resource_pwm1,
40575540c1aSeric miao .num_resources = ARRAY_SIZE(pxa25x_resource_pwm1),
40675540c1aSeric miao };
40775540c1aSeric miao
4088f58de7cSeric miao static u64 pxa25x_ssp_dma_mask = DMA_BIT_MASK(32);
4098f58de7cSeric miao
4108f58de7cSeric miao static struct resource pxa25x_resource_ssp[] = {
4118f58de7cSeric miao [0] = {
4128f58de7cSeric miao .start = 0x41000000,
4138f58de7cSeric miao .end = 0x4100001f,
4148f58de7cSeric miao .flags = IORESOURCE_MEM,
4158f58de7cSeric miao },
4168f58de7cSeric miao [1] = {
4178f58de7cSeric miao .start = IRQ_SSP,
4188f58de7cSeric miao .end = IRQ_SSP,
4198f58de7cSeric miao .flags = IORESOURCE_IRQ,
4208f58de7cSeric miao },
4218f58de7cSeric miao };
4228f58de7cSeric miao
4238f58de7cSeric miao struct platform_device pxa25x_device_ssp = {
4248f58de7cSeric miao .name = "pxa25x-ssp",
4258f58de7cSeric miao .id = 0,
4268f58de7cSeric miao .dev = {
4278f58de7cSeric miao .dma_mask = &pxa25x_ssp_dma_mask,
4288f58de7cSeric miao .coherent_dma_mask = DMA_BIT_MASK(32),
4298f58de7cSeric miao },
4308f58de7cSeric miao .resource = pxa25x_resource_ssp,
4318f58de7cSeric miao .num_resources = ARRAY_SIZE(pxa25x_resource_ssp),
4328f58de7cSeric miao };
4338f58de7cSeric miao
4348f58de7cSeric miao static u64 pxa25x_nssp_dma_mask = DMA_BIT_MASK(32);
4358f58de7cSeric miao
4368f58de7cSeric miao static struct resource pxa25x_resource_nssp[] = {
4378f58de7cSeric miao [0] = {
4388f58de7cSeric miao .start = 0x41400000,
4398f58de7cSeric miao .end = 0x4140002f,
4408f58de7cSeric miao .flags = IORESOURCE_MEM,
4418f58de7cSeric miao },
4428f58de7cSeric miao [1] = {
4438f58de7cSeric miao .start = IRQ_NSSP,
4448f58de7cSeric miao .end = IRQ_NSSP,
4458f58de7cSeric miao .flags = IORESOURCE_IRQ,
4468f58de7cSeric miao },
4478f58de7cSeric miao };
4488f58de7cSeric miao
4498f58de7cSeric miao struct platform_device pxa25x_device_nssp = {
4508f58de7cSeric miao .name = "pxa25x-nssp",
4518f58de7cSeric miao .id = 1,
4528f58de7cSeric miao .dev = {
4538f58de7cSeric miao .dma_mask = &pxa25x_nssp_dma_mask,
4548f58de7cSeric miao .coherent_dma_mask = DMA_BIT_MASK(32),
4558f58de7cSeric miao },
4568f58de7cSeric miao .resource = pxa25x_resource_nssp,
4578f58de7cSeric miao .num_resources = ARRAY_SIZE(pxa25x_resource_nssp),
4588f58de7cSeric miao };
4598f58de7cSeric miao
4608f58de7cSeric miao static u64 pxa25x_assp_dma_mask = DMA_BIT_MASK(32);
4618f58de7cSeric miao
4628f58de7cSeric miao static struct resource pxa25x_resource_assp[] = {
4638f58de7cSeric miao [0] = {
4648f58de7cSeric miao .start = 0x41500000,
4658f58de7cSeric miao .end = 0x4150002f,
4668f58de7cSeric miao .flags = IORESOURCE_MEM,
4678f58de7cSeric miao },
4688f58de7cSeric miao [1] = {
4698f58de7cSeric miao .start = IRQ_ASSP,
4708f58de7cSeric miao .end = IRQ_ASSP,
4718f58de7cSeric miao .flags = IORESOURCE_IRQ,
4728f58de7cSeric miao },
4738f58de7cSeric miao };
4748f58de7cSeric miao
4758f58de7cSeric miao struct platform_device pxa25x_device_assp = {
4768f58de7cSeric miao /* ASSP is basically equivalent to NSSP */
4778f58de7cSeric miao .name = "pxa25x-nssp",
4788f58de7cSeric miao .id = 2,
4798f58de7cSeric miao .dev = {
4808f58de7cSeric miao .dma_mask = &pxa25x_assp_dma_mask,
4818f58de7cSeric miao .coherent_dma_mask = DMA_BIT_MASK(32),
4828f58de7cSeric miao },
4838f58de7cSeric miao .resource = pxa25x_resource_assp,
4848f58de7cSeric miao .num_resources = ARRAY_SIZE(pxa25x_resource_assp),
4858f58de7cSeric miao };
4868f58de7cSeric miao #endif /* CONFIG_PXA25x */
4878f58de7cSeric miao
4888f58de7cSeric miao #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
489ec68e45bSeric miao static u64 pxa27x_ohci_dma_mask = DMA_BIT_MASK(32);
490ec68e45bSeric miao
491ec68e45bSeric miao static struct resource pxa27x_resource_ohci[] = {
492ec68e45bSeric miao [0] = {
493ec68e45bSeric miao .start = 0x4C000000,
494ec68e45bSeric miao .end = 0x4C00ff6f,
495ec68e45bSeric miao .flags = IORESOURCE_MEM,
496ec68e45bSeric miao },
497ec68e45bSeric miao [1] = {
498ec68e45bSeric miao .start = IRQ_USBH1,
499ec68e45bSeric miao .end = IRQ_USBH1,
500ec68e45bSeric miao .flags = IORESOURCE_IRQ,
501ec68e45bSeric miao },
502ec68e45bSeric miao };
503ec68e45bSeric miao
504ec68e45bSeric miao struct platform_device pxa27x_device_ohci = {
505ec68e45bSeric miao .name = "pxa27x-ohci",
506ec68e45bSeric miao .id = -1,
507ec68e45bSeric miao .dev = {
508ec68e45bSeric miao .dma_mask = &pxa27x_ohci_dma_mask,
509ec68e45bSeric miao .coherent_dma_mask = DMA_BIT_MASK(32),
510ec68e45bSeric miao },
511ec68e45bSeric miao .num_resources = ARRAY_SIZE(pxa27x_resource_ohci),
512ec68e45bSeric miao .resource = pxa27x_resource_ohci,
513ec68e45bSeric miao };
514ec68e45bSeric miao
pxa_set_ohci_info(struct pxaohci_platform_data * info)515ec68e45bSeric miao void __init pxa_set_ohci_info(struct pxaohci_platform_data *info)
516ec68e45bSeric miao {
517ec68e45bSeric miao pxa_register_device(&pxa27x_device_ohci, info);
518ec68e45bSeric miao }
519a4553358SHaojian Zhuang #endif /* CONFIG_PXA27x || CONFIG_PXA3xx */
520a4553358SHaojian Zhuang
52149ea7fc0SHaojian Zhuang #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
5228f58de7cSeric miao static u64 pxa27x_ssp1_dma_mask = DMA_BIT_MASK(32);
5238f58de7cSeric miao
5248f58de7cSeric miao static struct resource pxa27x_resource_ssp1[] = {
5258f58de7cSeric miao [0] = {
5268f58de7cSeric miao .start = 0x41000000,
5278f58de7cSeric miao .end = 0x4100003f,
5288f58de7cSeric miao .flags = IORESOURCE_MEM,
5298f58de7cSeric miao },
5308f58de7cSeric miao [1] = {
5318f58de7cSeric miao .start = IRQ_SSP,
5328f58de7cSeric miao .end = IRQ_SSP,
5338f58de7cSeric miao .flags = IORESOURCE_IRQ,
5348f58de7cSeric miao },
5358f58de7cSeric miao };
5368f58de7cSeric miao
5378f58de7cSeric miao struct platform_device pxa27x_device_ssp1 = {
5388f58de7cSeric miao .name = "pxa27x-ssp",
5398f58de7cSeric miao .id = 0,
5408f58de7cSeric miao .dev = {
5418f58de7cSeric miao .dma_mask = &pxa27x_ssp1_dma_mask,
5428f58de7cSeric miao .coherent_dma_mask = DMA_BIT_MASK(32),
5438f58de7cSeric miao },
5448f58de7cSeric miao .resource = pxa27x_resource_ssp1,
5458f58de7cSeric miao .num_resources = ARRAY_SIZE(pxa27x_resource_ssp1),
5468f58de7cSeric miao };
5478f58de7cSeric miao
5488f58de7cSeric miao static u64 pxa27x_ssp2_dma_mask = DMA_BIT_MASK(32);
5498f58de7cSeric miao
5508f58de7cSeric miao static struct resource pxa27x_resource_ssp2[] = {
5518f58de7cSeric miao [0] = {
5528f58de7cSeric miao .start = 0x41700000,
5538f58de7cSeric miao .end = 0x4170003f,
5548f58de7cSeric miao .flags = IORESOURCE_MEM,
5558f58de7cSeric miao },
5568f58de7cSeric miao [1] = {
5578f58de7cSeric miao .start = IRQ_SSP2,
5588f58de7cSeric miao .end = IRQ_SSP2,
5598f58de7cSeric miao .flags = IORESOURCE_IRQ,
5608f58de7cSeric miao },
5618f58de7cSeric miao };
5628f58de7cSeric miao
5638f58de7cSeric miao struct platform_device pxa27x_device_ssp2 = {
5648f58de7cSeric miao .name = "pxa27x-ssp",
5658f58de7cSeric miao .id = 1,
5668f58de7cSeric miao .dev = {
5678f58de7cSeric miao .dma_mask = &pxa27x_ssp2_dma_mask,
5688f58de7cSeric miao .coherent_dma_mask = DMA_BIT_MASK(32),
5698f58de7cSeric miao },
5708f58de7cSeric miao .resource = pxa27x_resource_ssp2,
5718f58de7cSeric miao .num_resources = ARRAY_SIZE(pxa27x_resource_ssp2),
5728f58de7cSeric miao };
5738f58de7cSeric miao
5748f58de7cSeric miao static u64 pxa27x_ssp3_dma_mask = DMA_BIT_MASK(32);
5758f58de7cSeric miao
5768f58de7cSeric miao static struct resource pxa27x_resource_ssp3[] = {
5778f58de7cSeric miao [0] = {
5788f58de7cSeric miao .start = 0x41900000,
5798f58de7cSeric miao .end = 0x4190003f,
5808f58de7cSeric miao .flags = IORESOURCE_MEM,
5818f58de7cSeric miao },
5828f58de7cSeric miao [1] = {
5838f58de7cSeric miao .start = IRQ_SSP3,
5848f58de7cSeric miao .end = IRQ_SSP3,
5858f58de7cSeric miao .flags = IORESOURCE_IRQ,
5868f58de7cSeric miao },
5878f58de7cSeric miao };
5888f58de7cSeric miao
5898f58de7cSeric miao struct platform_device pxa27x_device_ssp3 = {
5908f58de7cSeric miao .name = "pxa27x-ssp",
5918f58de7cSeric miao .id = 2,
5928f58de7cSeric miao .dev = {
5938f58de7cSeric miao .dma_mask = &pxa27x_ssp3_dma_mask,
5948f58de7cSeric miao .coherent_dma_mask = DMA_BIT_MASK(32),
5958f58de7cSeric miao },
5968f58de7cSeric miao .resource = pxa27x_resource_ssp3,
5978f58de7cSeric miao .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3),
5988f58de7cSeric miao };
5993f3acefbSGuennadi Liakhovetski
60075540c1aSeric miao static struct resource pxa27x_resource_pwm0[] = {
60175540c1aSeric miao [0] = {
60275540c1aSeric miao .start = 0x40b00000,
60375540c1aSeric miao .end = 0x40b0001f,
60475540c1aSeric miao .flags = IORESOURCE_MEM,
60575540c1aSeric miao },
60675540c1aSeric miao };
60775540c1aSeric miao
60875540c1aSeric miao struct platform_device pxa27x_device_pwm0 = {
60975540c1aSeric miao .name = "pxa27x-pwm",
61075540c1aSeric miao .id = 0,
61175540c1aSeric miao .resource = pxa27x_resource_pwm0,
61275540c1aSeric miao .num_resources = ARRAY_SIZE(pxa27x_resource_pwm0),
61375540c1aSeric miao };
61475540c1aSeric miao
61575540c1aSeric miao static struct resource pxa27x_resource_pwm1[] = {
61675540c1aSeric miao [0] = {
61775540c1aSeric miao .start = 0x40c00000,
61875540c1aSeric miao .end = 0x40c0001f,
61975540c1aSeric miao .flags = IORESOURCE_MEM,
62075540c1aSeric miao },
62175540c1aSeric miao };
62275540c1aSeric miao
62375540c1aSeric miao struct platform_device pxa27x_device_pwm1 = {
62475540c1aSeric miao .name = "pxa27x-pwm",
62575540c1aSeric miao .id = 1,
62675540c1aSeric miao .resource = pxa27x_resource_pwm1,
62775540c1aSeric miao .num_resources = ARRAY_SIZE(pxa27x_resource_pwm1),
62875540c1aSeric miao };
62949ea7fc0SHaojian Zhuang #endif /* CONFIG_PXA27x || CONFIG_PXA3xx */
6308f58de7cSeric miao
631157d2644SHaojian Zhuang struct resource pxa_resource_gpio[] = {
632157d2644SHaojian Zhuang {
633157d2644SHaojian Zhuang .start = 0x40e00000,
634157d2644SHaojian Zhuang .end = 0x40e0ffff,
635157d2644SHaojian Zhuang .flags = IORESOURCE_MEM,
636157d2644SHaojian Zhuang }, {
637157d2644SHaojian Zhuang .start = IRQ_GPIO0,
638157d2644SHaojian Zhuang .end = IRQ_GPIO0,
639157d2644SHaojian Zhuang .name = "gpio0",
640157d2644SHaojian Zhuang .flags = IORESOURCE_IRQ,
641157d2644SHaojian Zhuang }, {
642157d2644SHaojian Zhuang .start = IRQ_GPIO1,
643157d2644SHaojian Zhuang .end = IRQ_GPIO1,
644157d2644SHaojian Zhuang .name = "gpio1",
645157d2644SHaojian Zhuang .flags = IORESOURCE_IRQ,
646157d2644SHaojian Zhuang }, {
647157d2644SHaojian Zhuang .start = IRQ_GPIO_2_x,
648157d2644SHaojian Zhuang .end = IRQ_GPIO_2_x,
649157d2644SHaojian Zhuang .name = "gpio_mux",
650157d2644SHaojian Zhuang .flags = IORESOURCE_IRQ,
651157d2644SHaojian Zhuang },
652157d2644SHaojian Zhuang };
653157d2644SHaojian Zhuang
6542cab0292SHaojian Zhuang struct platform_device pxa25x_device_gpio = {
6552cab0292SHaojian Zhuang .name = "pxa25x-gpio",
6562cab0292SHaojian Zhuang .id = -1,
6572cab0292SHaojian Zhuang .num_resources = ARRAY_SIZE(pxa_resource_gpio),
6582cab0292SHaojian Zhuang .resource = pxa_resource_gpio,
6592cab0292SHaojian Zhuang };
6602cab0292SHaojian Zhuang
6612cab0292SHaojian Zhuang struct platform_device pxa27x_device_gpio = {
6622cab0292SHaojian Zhuang .name = "pxa27x-gpio",
6632cab0292SHaojian Zhuang .id = -1,
6642cab0292SHaojian Zhuang .num_resources = ARRAY_SIZE(pxa_resource_gpio),
6652cab0292SHaojian Zhuang .resource = pxa_resource_gpio,
6662cab0292SHaojian Zhuang };
6672cab0292SHaojian Zhuang
668e172274cSGuennadi Liakhovetski /* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1.
669e172274cSGuennadi Liakhovetski * See comment in arch/arm/mach-pxa/ssp.c::ssp_probe() */
pxa2xx_set_spi_info(unsigned id,struct pxa2xx_spi_controller * info)67051eea52dSLubomir Rintel void __init pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_controller *info)
671e172274cSGuennadi Liakhovetski {
672e172274cSGuennadi Liakhovetski struct platform_device *pd;
673e172274cSGuennadi Liakhovetski
674e172274cSGuennadi Liakhovetski pd = platform_device_alloc("pxa2xx-spi", id);
675e172274cSGuennadi Liakhovetski if (pd == NULL) {
676e172274cSGuennadi Liakhovetski printk(KERN_ERR "pxa2xx-spi: failed to allocate device id %d\n",
677e172274cSGuennadi Liakhovetski id);
678e172274cSGuennadi Liakhovetski return;
679e172274cSGuennadi Liakhovetski }
680e172274cSGuennadi Liakhovetski
681e172274cSGuennadi Liakhovetski pd->dev.platform_data = info;
682e172274cSGuennadi Liakhovetski platform_device_add(pd);
683e172274cSGuennadi Liakhovetski }
6844be0856fSRobert Jarzmik
6854be0856fSRobert Jarzmik static struct resource pxa_dma_resource[] = {
6864be0856fSRobert Jarzmik [0] = {
6874be0856fSRobert Jarzmik .start = 0x40000000,
6884be0856fSRobert Jarzmik .end = 0x4000ffff,
6894be0856fSRobert Jarzmik .flags = IORESOURCE_MEM,
6904be0856fSRobert Jarzmik },
6914be0856fSRobert Jarzmik [1] = {
6924be0856fSRobert Jarzmik .start = IRQ_DMA,
6934be0856fSRobert Jarzmik .end = IRQ_DMA,
6944be0856fSRobert Jarzmik .flags = IORESOURCE_IRQ,
6954be0856fSRobert Jarzmik },
6964be0856fSRobert Jarzmik };
6974be0856fSRobert Jarzmik
6984be0856fSRobert Jarzmik static u64 pxadma_dmamask = 0xffffffffUL;
6994be0856fSRobert Jarzmik
7004be0856fSRobert Jarzmik static struct platform_device pxa2xx_pxa_dma = {
7014be0856fSRobert Jarzmik .name = "pxa-dma",
7024be0856fSRobert Jarzmik .id = 0,
7034be0856fSRobert Jarzmik .dev = {
7044be0856fSRobert Jarzmik .dma_mask = &pxadma_dmamask,
7054be0856fSRobert Jarzmik .coherent_dma_mask = 0xffffffff,
7064be0856fSRobert Jarzmik },
7074be0856fSRobert Jarzmik .num_resources = ARRAY_SIZE(pxa_dma_resource),
7084be0856fSRobert Jarzmik .resource = pxa_dma_resource,
7094be0856fSRobert Jarzmik };
7104be0856fSRobert Jarzmik
pxa2xx_set_dmac_info(struct mmp_dma_platdata * dma_pdata)7111da10c17SRobert Jarzmik void __init pxa2xx_set_dmac_info(struct mmp_dma_platdata *dma_pdata)
7124be0856fSRobert Jarzmik {
7131da10c17SRobert Jarzmik pxa_register_device(&pxa2xx_pxa_dma, dma_pdata);
7144be0856fSRobert Jarzmik }
715e86bd43bSArnd Bergmann
pxa_register_wdt(unsigned int reset_status)716e86bd43bSArnd Bergmann void __init pxa_register_wdt(unsigned int reset_status)
717e86bd43bSArnd Bergmann {
718e86bd43bSArnd Bergmann struct resource res = DEFINE_RES_MEM(OST_PHYS, OST_LEN);
719e86bd43bSArnd Bergmann
720e86bd43bSArnd Bergmann reset_status &= RESET_STATUS_WATCHDOG;
721e86bd43bSArnd Bergmann platform_device_register_resndata(NULL, "sa1100_wdt", -1, &res, 1,
722e86bd43bSArnd Bergmann &reset_status, sizeof(reset_status));
723e86bd43bSArnd Bergmann }
724