2 * Copyright 2009 Sascha Hauer, <kernel@pengutronix.de>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 * Boston, MA 02110-1301, USA.
19 #include <linux/platform_device.h>
20 #include <linux/dma-mapping.h>
21 #include <linux/gpio.h>
22 #include <mach/mx25.h>
23 #include <mach/irqs.h>
25 static struct resource uart0
[] = {
29 .flags
= IORESOURCE_MEM
,
33 .flags
= IORESOURCE_IRQ
,
37 struct platform_device mxc_uart_device0
= {
41 .num_resources
= ARRAY_SIZE(uart0
),
44 static struct resource uart1
[] = {
48 .flags
= IORESOURCE_MEM
,
52 .flags
= IORESOURCE_IRQ
,
56 struct platform_device mxc_uart_device1
= {
60 .num_resources
= ARRAY_SIZE(uart1
),
63 static struct resource uart2
[] = {
67 .flags
= IORESOURCE_MEM
,
71 .flags
= IORESOURCE_IRQ
,
75 struct platform_device mxc_uart_device2
= {
79 .num_resources
= ARRAY_SIZE(uart2
),
82 static struct resource uart3
[] = {
86 .flags
= IORESOURCE_MEM
,
90 .flags
= IORESOURCE_IRQ
,
94 struct platform_device mxc_uart_device3
= {
98 .num_resources
= ARRAY_SIZE(uart3
),
101 static struct resource uart4
[] = {
105 .flags
= IORESOURCE_MEM
,
109 .flags
= IORESOURCE_IRQ
,
113 struct platform_device mxc_uart_device4
= {
117 .num_resources
= ARRAY_SIZE(uart4
),
120 #define MX25_OTG_BASE_ADDR 0x53FF4000
122 static u64 otg_dmamask
= DMA_BIT_MASK(32);
124 static struct resource mxc_otg_resources
[] = {
126 .start
= MX25_OTG_BASE_ADDR
,
127 .end
= MX25_OTG_BASE_ADDR
+ 0x1ff,
128 .flags
= IORESOURCE_MEM
,
132 .flags
= IORESOURCE_IRQ
,
136 struct platform_device mxc_otg
= {
140 .coherent_dma_mask
= 0xffffffff,
141 .dma_mask
= &otg_dmamask
,
143 .resource
= mxc_otg_resources
,
144 .num_resources
= ARRAY_SIZE(mxc_otg_resources
),
147 /* OTG gadget device */
148 struct platform_device otg_udc_device
= {
149 .name
= "fsl-usb2-udc",
152 .dma_mask
= &otg_dmamask
,
153 .coherent_dma_mask
= 0xffffffff,
155 .resource
= mxc_otg_resources
,
156 .num_resources
= ARRAY_SIZE(mxc_otg_resources
),
159 static u64 usbh2_dmamask
= DMA_BIT_MASK(32);
161 static struct resource mxc_usbh2_resources
[] = {
163 .start
= MX25_OTG_BASE_ADDR
+ 0x400,
164 .end
= MX25_OTG_BASE_ADDR
+ 0x5ff,
165 .flags
= IORESOURCE_MEM
,
169 .flags
= IORESOURCE_IRQ
,
173 struct platform_device mxc_usbh2
= {
177 .coherent_dma_mask
= 0xffffffff,
178 .dma_mask
= &usbh2_dmamask
,
180 .resource
= mxc_usbh2_resources
,
181 .num_resources
= ARRAY_SIZE(mxc_usbh2_resources
),
184 static struct resource mxc_spi_resources0
[] = {
188 .flags
= IORESOURCE_MEM
,
192 .flags
= IORESOURCE_IRQ
,
196 struct platform_device mxc_spi_device0
= {
199 .num_resources
= ARRAY_SIZE(mxc_spi_resources0
),
200 .resource
= mxc_spi_resources0
,
203 static struct resource mxc_spi_resources1
[] = {
207 .flags
= IORESOURCE_MEM
,
211 .flags
= IORESOURCE_IRQ
,
215 struct platform_device mxc_spi_device1
= {
218 .num_resources
= ARRAY_SIZE(mxc_spi_resources1
),
219 .resource
= mxc_spi_resources1
,
222 static struct resource mxc_spi_resources2
[] = {
226 .flags
= IORESOURCE_MEM
,
230 .flags
= IORESOURCE_IRQ
,
234 struct platform_device mxc_spi_device2
= {
237 .num_resources
= ARRAY_SIZE(mxc_spi_resources2
),
238 .resource
= mxc_spi_resources2
,
241 static struct resource mxc_pwm_resources0
[] = {
245 .flags
= IORESOURCE_MEM
,
249 .flags
= IORESOURCE_IRQ
,
253 struct platform_device mxc_pwm_device0
= {
256 .num_resources
= ARRAY_SIZE(mxc_pwm_resources0
),
257 .resource
= mxc_pwm_resources0
,
260 static struct resource mxc_pwm_resources1
[] = {
264 .flags
= IORESOURCE_MEM
,
268 .flags
= IORESOURCE_IRQ
,
272 struct platform_device mxc_pwm_device1
= {
275 .num_resources
= ARRAY_SIZE(mxc_pwm_resources1
),
276 .resource
= mxc_pwm_resources1
,
279 static struct resource mxc_pwm_resources2
[] = {
283 .flags
= IORESOURCE_MEM
,
287 .flags
= IORESOURCE_IRQ
,
291 struct platform_device mxc_pwm_device2
= {
294 .num_resources
= ARRAY_SIZE(mxc_pwm_resources2
),
295 .resource
= mxc_pwm_resources2
,
298 static struct resource mxc_keypad_resources
[] = {
302 .flags
= IORESOURCE_MEM
,
306 .flags
= IORESOURCE_IRQ
,
310 struct platform_device mxc_keypad_device
= {
311 .name
= "mxc-keypad",
313 .num_resources
= ARRAY_SIZE(mxc_keypad_resources
),
314 .resource
= mxc_keypad_resources
,
317 static struct resource mxc_pwm_resources3
[] = {
321 .flags
= IORESOURCE_MEM
,
325 .flags
= IORESOURCE_IRQ
,
329 struct platform_device mxc_pwm_device3
= {
332 .num_resources
= ARRAY_SIZE(mxc_pwm_resources3
),
333 .resource
= mxc_pwm_resources3
,
336 static struct resource mxc_i2c_1_resources
[] = {
340 .flags
= IORESOURCE_MEM
,
344 .flags
= IORESOURCE_IRQ
,
348 struct platform_device mxc_i2c_device0
= {
351 .num_resources
= ARRAY_SIZE(mxc_i2c_1_resources
),
352 .resource
= mxc_i2c_1_resources
,
355 static struct resource mxc_i2c_2_resources
[] = {
359 .flags
= IORESOURCE_MEM
,
363 .flags
= IORESOURCE_IRQ
,
367 struct platform_device mxc_i2c_device1
= {
370 .num_resources
= ARRAY_SIZE(mxc_i2c_2_resources
),
371 .resource
= mxc_i2c_2_resources
,
374 static struct resource mxc_i2c_3_resources
[] = {
378 .flags
= IORESOURCE_MEM
,
382 .flags
= IORESOURCE_IRQ
,
386 struct platform_device mxc_i2c_device2
= {
389 .num_resources
= ARRAY_SIZE(mxc_i2c_3_resources
),
390 .resource
= mxc_i2c_3_resources
,
393 static struct mxc_gpio_port imx_gpio_ports
[] = {
395 .chip
.label
= "gpio-0",
396 .base
= (void __iomem
*)MX25_GPIO1_BASE_ADDR_VIRT
,
398 .virtual_irq_start
= MXC_GPIO_IRQ_START
,
400 .chip
.label
= "gpio-1",
401 .base
= (void __iomem
*)MX25_GPIO2_BASE_ADDR_VIRT
,
403 .virtual_irq_start
= MXC_GPIO_IRQ_START
+ 32,
405 .chip
.label
= "gpio-2",
406 .base
= (void __iomem
*)MX25_GPIO3_BASE_ADDR_VIRT
,
408 .virtual_irq_start
= MXC_GPIO_IRQ_START
+ 64,
410 .chip
.label
= "gpio-3",
411 .base
= (void __iomem
*)MX25_GPIO4_BASE_ADDR_VIRT
,
413 .virtual_irq_start
= MXC_GPIO_IRQ_START
+ 96,
417 int __init
mxc_register_gpios(void)
419 return mxc_gpio_init(imx_gpio_ports
, ARRAY_SIZE(imx_gpio_ports
));
422 static struct resource mx25_fec_resources
[] = {
424 .start
= MX25_FEC_BASE_ADDR
,
425 .end
= MX25_FEC_BASE_ADDR
+ 0xfff,
426 .flags
= IORESOURCE_MEM
,
429 .start
= MX25_INT_FEC
,
431 .flags
= IORESOURCE_IRQ
,
435 struct platform_device mx25_fec_device
= {
438 .num_resources
= ARRAY_SIZE(mx25_fec_resources
),
439 .resource
= mx25_fec_resources
,
442 static struct resource mxc_nand_resources
[] = {
444 .start
= MX25_NFC_BASE_ADDR
,
445 .end
= MX25_NFC_BASE_ADDR
+ 0x1fff,
446 .flags
= IORESOURCE_MEM
,
449 .start
= MX25_INT_NANDFC
,
450 .end
= MX25_INT_NANDFC
,
451 .flags
= IORESOURCE_IRQ
,
455 struct platform_device mxc_nand_device
= {
458 .num_resources
= ARRAY_SIZE(mxc_nand_resources
),
459 .resource
= mxc_nand_resources
,
462 static struct resource mx25_rtc_resources
[] = {
464 .start
= MX25_DRYICE_BASE_ADDR
,
465 .end
= MX25_DRYICE_BASE_ADDR
+ 0x40,
466 .flags
= IORESOURCE_MEM
,
469 .start
= MX25_INT_DRYICE
,
470 .flags
= IORESOURCE_IRQ
474 struct platform_device mx25_rtc_device
= {
477 .num_resources
= ARRAY_SIZE(mx25_rtc_resources
),
478 .resource
= mx25_rtc_resources
,
481 static struct resource mx25_fb_resources
[] = {
483 .start
= MX25_LCDC_BASE_ADDR
,
484 .end
= MX25_LCDC_BASE_ADDR
+ 0xfff,
485 .flags
= IORESOURCE_MEM
,
488 .start
= MX25_INT_LCDC
,
489 .end
= MX25_INT_LCDC
,
490 .flags
= IORESOURCE_IRQ
,
494 struct platform_device mx25_fb_device
= {
497 .resource
= mx25_fb_resources
,
498 .num_resources
= ARRAY_SIZE(mx25_fb_resources
),
500 .coherent_dma_mask
= 0xFFFFFFFF,