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 static u64 otg_dmamask = DMA_BIT_MASK(32);
122 static struct resource mxc_otg_resources[] = {
124 .start = MX25_OTG_BASE_ADDR,
125 .end = MX25_OTG_BASE_ADDR + 0x1ff,
126 .flags = IORESOURCE_MEM,
130 .flags = IORESOURCE_IRQ,
134 struct platform_device mxc_otg = {
138 .coherent_dma_mask = 0xffffffff,
139 .dma_mask = &otg_dmamask,
141 .resource = mxc_otg_resources,
142 .num_resources = ARRAY_SIZE(mxc_otg_resources),
145 /* OTG gadget device */
146 struct platform_device otg_udc_device = {
147 .name = "fsl-usb2-udc",
150 .dma_mask = &otg_dmamask,
151 .coherent_dma_mask = 0xffffffff,
153 .resource = mxc_otg_resources,
154 .num_resources = ARRAY_SIZE(mxc_otg_resources),
157 static u64 usbh2_dmamask = DMA_BIT_MASK(32);
159 static struct resource mxc_usbh2_resources[] = {
161 .start = MX25_OTG_BASE_ADDR + 0x400,
162 .end = MX25_OTG_BASE_ADDR + 0x5ff,
163 .flags = IORESOURCE_MEM,
167 .flags = IORESOURCE_IRQ,
171 struct platform_device mxc_usbh2 = {
175 .coherent_dma_mask = 0xffffffff,
176 .dma_mask = &usbh2_dmamask,
178 .resource = mxc_usbh2_resources,
179 .num_resources = ARRAY_SIZE(mxc_usbh2_resources),
182 static struct resource mxc_spi_resources0[] = {
186 .flags = IORESOURCE_MEM,
190 .flags = IORESOURCE_IRQ,
194 struct platform_device mxc_spi_device0 = {
197 .num_resources = ARRAY_SIZE(mxc_spi_resources0),
198 .resource = mxc_spi_resources0,
201 static struct resource mxc_spi_resources1[] = {
205 .flags = IORESOURCE_MEM,
209 .flags = IORESOURCE_IRQ,
213 struct platform_device mxc_spi_device1 = {
216 .num_resources = ARRAY_SIZE(mxc_spi_resources1),
217 .resource = mxc_spi_resources1,
220 static struct resource mxc_spi_resources2[] = {
224 .flags = IORESOURCE_MEM,
228 .flags = IORESOURCE_IRQ,
232 struct platform_device mxc_spi_device2 = {
235 .num_resources = ARRAY_SIZE(mxc_spi_resources2),
236 .resource = mxc_spi_resources2,
239 static struct resource mxc_pwm_resources0[] = {
243 .flags = IORESOURCE_MEM,
247 .flags = IORESOURCE_IRQ,
251 struct platform_device mxc_pwm_device0 = {
254 .num_resources = ARRAY_SIZE(mxc_pwm_resources0),
255 .resource = mxc_pwm_resources0,
258 static struct resource mxc_pwm_resources1[] = {
262 .flags = IORESOURCE_MEM,
266 .flags = IORESOURCE_IRQ,
270 struct platform_device mxc_pwm_device1 = {
273 .num_resources = ARRAY_SIZE(mxc_pwm_resources1),
274 .resource = mxc_pwm_resources1,
277 static struct resource mxc_pwm_resources2[] = {
281 .flags = IORESOURCE_MEM,
285 .flags = IORESOURCE_IRQ,
289 struct platform_device mxc_pwm_device2 = {
292 .num_resources = ARRAY_SIZE(mxc_pwm_resources2),
293 .resource = mxc_pwm_resources2,
296 static struct resource mxc_keypad_resources[] = {
300 .flags = IORESOURCE_MEM,
304 .flags = IORESOURCE_IRQ,
308 struct platform_device mxc_keypad_device = {
309 .name = "mxc-keypad",
311 .num_resources = ARRAY_SIZE(mxc_keypad_resources),
312 .resource = mxc_keypad_resources,
315 static struct resource mxc_pwm_resources3[] = {
319 .flags = IORESOURCE_MEM,
323 .flags = IORESOURCE_IRQ,
327 struct platform_device mxc_pwm_device3 = {
330 .num_resources = ARRAY_SIZE(mxc_pwm_resources3),
331 .resource = mxc_pwm_resources3,
334 static struct resource mxc_i2c_1_resources[] = {
338 .flags = IORESOURCE_MEM,
342 .flags = IORESOURCE_IRQ,
346 struct platform_device mxc_i2c_device0 = {
349 .num_resources = ARRAY_SIZE(mxc_i2c_1_resources),
350 .resource = mxc_i2c_1_resources,
353 static struct resource mxc_i2c_2_resources[] = {
357 .flags = IORESOURCE_MEM,
361 .flags = IORESOURCE_IRQ,
365 struct platform_device mxc_i2c_device1 = {
368 .num_resources = ARRAY_SIZE(mxc_i2c_2_resources),
369 .resource = mxc_i2c_2_resources,
372 static struct resource mxc_i2c_3_resources[] = {
376 .flags = IORESOURCE_MEM,
380 .flags = IORESOURCE_IRQ,
384 struct platform_device mxc_i2c_device2 = {
387 .num_resources = ARRAY_SIZE(mxc_i2c_3_resources),
388 .resource = mxc_i2c_3_resources,
391 static struct mxc_gpio_port imx_gpio_ports[] = {
393 .chip.label = "gpio-0",
394 .base = (void __iomem *)MX25_GPIO1_BASE_ADDR_VIRT,
396 .virtual_irq_start = MXC_GPIO_IRQ_START,
398 .chip.label = "gpio-1",
399 .base = (void __iomem *)MX25_GPIO2_BASE_ADDR_VIRT,
401 .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
403 .chip.label = "gpio-2",
404 .base = (void __iomem *)MX25_GPIO3_BASE_ADDR_VIRT,
406 .virtual_irq_start = MXC_GPIO_IRQ_START + 64,
408 .chip.label = "gpio-3",
409 .base = (void __iomem *)MX25_GPIO4_BASE_ADDR_VIRT,
411 .virtual_irq_start = MXC_GPIO_IRQ_START + 96,
415 int __init mxc_register_gpios(void)
417 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
420 static struct resource mx25_fec_resources[] = {
422 .start = MX25_FEC_BASE_ADDR,
423 .end = MX25_FEC_BASE_ADDR + 0xfff,
424 .flags = IORESOURCE_MEM,
427 .start = MX25_INT_FEC,
429 .flags = IORESOURCE_IRQ,
433 struct platform_device mx25_fec_device = {
436 .num_resources = ARRAY_SIZE(mx25_fec_resources),
437 .resource = mx25_fec_resources,
440 static struct resource mxc_nand_resources[] = {
442 .start = MX25_NFC_BASE_ADDR,
443 .end = MX25_NFC_BASE_ADDR + 0x1fff,
444 .flags = IORESOURCE_MEM,
447 .start = MX25_INT_NANDFC,
448 .end = MX25_INT_NANDFC,
449 .flags = IORESOURCE_IRQ,
453 struct platform_device mxc_nand_device = {
456 .num_resources = ARRAY_SIZE(mxc_nand_resources),
457 .resource = mxc_nand_resources,
460 static struct resource mx25_rtc_resources[] = {
462 .start = MX25_DRYICE_BASE_ADDR,
463 .end = MX25_DRYICE_BASE_ADDR + 0x40,
464 .flags = IORESOURCE_MEM,
467 .start = MX25_INT_DRYICE,
468 .flags = IORESOURCE_IRQ
472 struct platform_device mx25_rtc_device = {
475 .num_resources = ARRAY_SIZE(mx25_rtc_resources),
476 .resource = mx25_rtc_resources,
479 static struct resource mx25_fb_resources[] = {
481 .start = MX25_LCDC_BASE_ADDR,
482 .end = MX25_LCDC_BASE_ADDR + 0xfff,
483 .flags = IORESOURCE_MEM,
486 .start = MX25_INT_LCDC,
487 .end = MX25_INT_LCDC,
488 .flags = IORESOURCE_IRQ,
492 struct platform_device mx25_fb_device = {
495 .resource = mx25_fb_resources,
496 .num_resources = ARRAY_SIZE(mx25_fb_resources),
498 .coherent_dma_mask = 0xFFFFFFFF,
502 static struct resource mxc_wdt_resources[] = {
504 .start = MX25_WDOG_BASE_ADDR,
505 .end = MX25_WDOG_BASE_ADDR + SZ_16K - 1,
506 .flags = IORESOURCE_MEM,
510 struct platform_device mxc_wdt = {
513 .num_resources = ARRAY_SIZE(mxc_wdt_resources),
514 .resource = mxc_wdt_resources,
517 static struct resource mx25_kpp_resources[] = {
519 .start = MX25_KPP_BASE_ADDR,
520 .end = MX25_KPP_BASE_ADDR + 0xf,
521 .flags = IORESOURCE_MEM,
524 .start = MX25_INT_KPP,
526 .flags = IORESOURCE_IRQ,
530 struct platform_device mx25_kpp_device = {
531 .name = "imx-keypad",
533 .num_resources = ARRAY_SIZE(mx25_kpp_resources),
534 .resource = mx25_kpp_resources,