1 #include <linux/platform_device.h>
2 #include <linux/gpio.h>
6 static struct resource uart0
[] = {
10 .flags
= IORESOURCE_MEM
,
14 .flags
= IORESOURCE_IRQ
,
18 struct platform_device mxc_uart_device0
= {
22 .num_resources
= ARRAY_SIZE(uart0
),
25 static struct resource uart1
[] = {
29 .flags
= IORESOURCE_MEM
,
33 .flags
= IORESOURCE_IRQ
,
37 struct platform_device mxc_uart_device1
= {
41 .num_resources
= ARRAY_SIZE(uart1
),
44 static struct resource uart2
[] = {
48 .flags
= IORESOURCE_MEM
,
52 .flags
= IORESOURCE_IRQ
,
56 struct platform_device mxc_uart_device2
= {
60 .num_resources
= ARRAY_SIZE(uart2
),
63 static struct resource uart3
[] = {
67 .flags
= IORESOURCE_MEM
,
71 .flags
= IORESOURCE_IRQ
,
75 struct platform_device mxc_uart_device3
= {
79 .num_resources
= ARRAY_SIZE(uart3
),
82 static struct resource uart4
[] = {
86 .flags
= IORESOURCE_MEM
,
90 .flags
= IORESOURCE_IRQ
,
94 struct platform_device mxc_uart_device4
= {
98 .num_resources
= ARRAY_SIZE(uart4
),
101 #define MX25_OTG_BASE_ADDR 0x53FF4000
103 static u64 otg_dmamask
= DMA_BIT_MASK(32);
105 static struct resource mxc_otg_resources
[] = {
107 .start
= MX25_OTG_BASE_ADDR
,
108 .end
= MX25_OTG_BASE_ADDR
+ 0x1ff,
109 .flags
= IORESOURCE_MEM
,
113 .flags
= IORESOURCE_IRQ
,
117 struct platform_device mxc_otg
= {
121 .coherent_dma_mask
= 0xffffffff,
122 .dma_mask
= &otg_dmamask
,
124 .resource
= mxc_otg_resources
,
125 .num_resources
= ARRAY_SIZE(mxc_otg_resources
),
128 /* OTG gadget device */
129 struct platform_device otg_udc_device
= {
130 .name
= "fsl-usb2-udc",
133 .dma_mask
= &otg_dmamask
,
134 .coherent_dma_mask
= 0xffffffff,
136 .resource
= mxc_otg_resources
,
137 .num_resources
= ARRAY_SIZE(mxc_otg_resources
),
140 static u64 usbh2_dmamask
= DMA_BIT_MASK(32);
142 static struct resource mxc_usbh2_resources
[] = {
144 .start
= MX25_OTG_BASE_ADDR
+ 0x400,
145 .end
= MX25_OTG_BASE_ADDR
+ 0x5ff,
146 .flags
= IORESOURCE_MEM
,
150 .flags
= IORESOURCE_IRQ
,
154 struct platform_device mxc_usbh2
= {
158 .coherent_dma_mask
= 0xffffffff,
159 .dma_mask
= &usbh2_dmamask
,
161 .resource
= mxc_usbh2_resources
,
162 .num_resources
= ARRAY_SIZE(mxc_usbh2_resources
),
165 static struct resource mxc_spi_resources0
[] = {
169 .flags
= IORESOURCE_MEM
,
173 .flags
= IORESOURCE_IRQ
,
177 struct platform_device mxc_spi_device0
= {
180 .num_resources
= ARRAY_SIZE(mxc_spi_resources0
),
181 .resource
= mxc_spi_resources0
,
184 static struct resource mxc_spi_resources1
[] = {
188 .flags
= IORESOURCE_MEM
,
192 .flags
= IORESOURCE_IRQ
,
196 struct platform_device mxc_spi_device1
= {
199 .num_resources
= ARRAY_SIZE(mxc_spi_resources1
),
200 .resource
= mxc_spi_resources1
,
203 static struct resource mxc_spi_resources2
[] = {
207 .flags
= IORESOURCE_MEM
,
211 .flags
= IORESOURCE_IRQ
,
215 struct platform_device mxc_spi_device2
= {
218 .num_resources
= ARRAY_SIZE(mxc_spi_resources2
),
219 .resource
= mxc_spi_resources2
,
222 static struct resource mxc_pwm_resources0
[] = {
226 .flags
= IORESOURCE_MEM
,
230 .flags
= IORESOURCE_IRQ
,
234 struct platform_device mxc_pwm_device0
= {
237 .num_resources
= ARRAY_SIZE(mxc_pwm_resources0
),
238 .resource
= mxc_pwm_resources0
,
241 static struct resource mxc_pwm_resources1
[] = {
245 .flags
= IORESOURCE_MEM
,
249 .flags
= IORESOURCE_IRQ
,
253 struct platform_device mxc_pwm_device1
= {
256 .num_resources
= ARRAY_SIZE(mxc_pwm_resources1
),
257 .resource
= mxc_pwm_resources1
,
260 static struct resource mxc_pwm_resources2
[] = {
264 .flags
= IORESOURCE_MEM
,
268 .flags
= IORESOURCE_IRQ
,
272 struct platform_device mxc_pwm_device2
= {
275 .num_resources
= ARRAY_SIZE(mxc_pwm_resources2
),
276 .resource
= mxc_pwm_resources2
,
279 static struct resource mxc_keypad_resources
[] = {
283 .flags
= IORESOURCE_MEM
,
287 .flags
= IORESOURCE_IRQ
,
291 struct platform_device mxc_keypad_device
= {
292 .name
= "mxc-keypad",
294 .num_resources
= ARRAY_SIZE(mxc_keypad_resources
),
295 .resource
= mxc_keypad_resources
,
298 static struct resource mxc_pwm_resources3
[] = {
302 .flags
= IORESOURCE_MEM
,
306 .flags
= IORESOURCE_IRQ
,
310 struct platform_device mxc_pwm_device3
= {
313 .num_resources
= ARRAY_SIZE(mxc_pwm_resources3
),
314 .resource
= mxc_pwm_resources3
,
317 static struct resource mxc_i2c_1_resources
[] = {
321 .flags
= IORESOURCE_MEM
,
325 .flags
= IORESOURCE_IRQ
,
329 struct platform_device mxc_i2c_device0
= {
332 .num_resources
= ARRAY_SIZE(mxc_i2c_1_resources
),
333 .resource
= mxc_i2c_1_resources
,
336 static struct resource mxc_i2c_2_resources
[] = {
340 .flags
= IORESOURCE_MEM
,
344 .flags
= IORESOURCE_IRQ
,
348 struct platform_device mxc_i2c_device1
= {
351 .num_resources
= ARRAY_SIZE(mxc_i2c_2_resources
),
352 .resource
= mxc_i2c_2_resources
,
355 static struct resource mxc_i2c_3_resources
[] = {
359 .flags
= IORESOURCE_MEM
,
363 .flags
= IORESOURCE_IRQ
,
367 struct platform_device mxc_i2c_device2
= {
370 .num_resources
= ARRAY_SIZE(mxc_i2c_3_resources
),
371 .resource
= mxc_i2c_3_resources
,
374 static struct mxc_gpio_port imx_gpio_ports
[] = {
376 .chip
.label
= "gpio-0",
377 .base
= (void __iomem
*)MX25_GPIO1_BASE_ADDR_VIRT
,
379 .virtual_irq_start
= MXC_GPIO_IRQ_START
,
381 .chip
.label
= "gpio-1",
382 .base
= (void __iomem
*)MX25_GPIO2_BASE_ADDR_VIRT
,
384 .virtual_irq_start
= MXC_GPIO_IRQ_START
+ 32,
386 .chip
.label
= "gpio-2",
387 .base
= (void __iomem
*)MX25_GPIO3_BASE_ADDR_VIRT
,
389 .virtual_irq_start
= MXC_GPIO_IRQ_START
+ 64,
391 .chip
.label
= "gpio-3",
392 .base
= (void __iomem
*)MX25_GPIO4_BASE_ADDR_VIRT
,
394 .virtual_irq_start
= MXC_GPIO_IRQ_START
+ 96,
398 int __init
mxc_register_gpios(void)
400 return mxc_gpio_init(imx_gpio_ports
, ARRAY_SIZE(imx_gpio_ports
));