2 * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright 2008 Sascha Hauer, kernel@pengutronix.de
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #include <linux/module.h>
21 #include <linux/platform_device.h>
22 #include <linux/serial.h>
23 #include <linux/gpio.h>
24 #include <mach/hardware.h>
25 #include <mach/irqs.h>
26 #include <mach/imx-uart.h>
28 static struct resource uart0
[] = {
30 .start
= UART1_BASE_ADDR
,
31 .end
= UART1_BASE_ADDR
+ 0x0B5,
32 .flags
= IORESOURCE_MEM
,
34 .start
= MXC_INT_UART1
,
36 .flags
= IORESOURCE_IRQ
,
40 struct platform_device mxc_uart_device0
= {
44 .num_resources
= ARRAY_SIZE(uart0
),
47 static struct resource uart1
[] = {
49 .start
= UART2_BASE_ADDR
,
50 .end
= UART2_BASE_ADDR
+ 0x0B5,
51 .flags
= IORESOURCE_MEM
,
53 .start
= MXC_INT_UART2
,
55 .flags
= IORESOURCE_IRQ
,
59 struct platform_device mxc_uart_device1
= {
63 .num_resources
= ARRAY_SIZE(uart1
),
66 static struct resource uart2
[] = {
68 .start
= UART3_BASE_ADDR
,
69 .end
= UART3_BASE_ADDR
+ 0x0B5,
70 .flags
= IORESOURCE_MEM
,
72 .start
= MXC_INT_UART3
,
74 .flags
= IORESOURCE_IRQ
,
78 struct platform_device mxc_uart_device2
= {
82 .num_resources
= ARRAY_SIZE(uart2
),
85 static struct resource uart3
[] = {
87 .start
= UART4_BASE_ADDR
,
88 .end
= UART4_BASE_ADDR
+ 0x0B5,
89 .flags
= IORESOURCE_MEM
,
91 .start
= MXC_INT_UART4
,
93 .flags
= IORESOURCE_IRQ
,
97 struct platform_device mxc_uart_device3
= {
101 .num_resources
= ARRAY_SIZE(uart3
),
104 static struct resource uart4
[] = {
106 .start
= UART5_BASE_ADDR
,
107 .end
= UART5_BASE_ADDR
+ 0x0B5,
108 .flags
= IORESOURCE_MEM
,
110 .start
= MXC_INT_UART5
,
111 .end
= MXC_INT_UART5
,
112 .flags
= IORESOURCE_IRQ
,
116 struct platform_device mxc_uart_device4
= {
120 .num_resources
= ARRAY_SIZE(uart4
),
123 /* GPIO port description */
124 static struct mxc_gpio_port imx_gpio_ports
[] = {
126 .chip
.label
= "gpio-0",
127 .base
= IO_ADDRESS(GPIO1_BASE_ADDR
),
128 .irq
= MXC_INT_GPIO1
,
129 .virtual_irq_start
= MXC_GPIO_IRQ_START
,
132 .chip
.label
= "gpio-1",
133 .base
= IO_ADDRESS(GPIO2_BASE_ADDR
),
134 .irq
= MXC_INT_GPIO2
,
135 .virtual_irq_start
= MXC_GPIO_IRQ_START
+ 32,
138 .chip
.label
= "gpio-2",
139 .base
= IO_ADDRESS(GPIO3_BASE_ADDR
),
140 .irq
= MXC_INT_GPIO3
,
141 .virtual_irq_start
= MXC_GPIO_IRQ_START
+ 64,
145 int __init
mxc_register_gpios(void)
147 return mxc_gpio_init(imx_gpio_ports
, ARRAY_SIZE(imx_gpio_ports
));
150 static struct resource mxc_w1_master_resources
[] = {
152 .start
= OWIRE_BASE_ADDR
,
153 .end
= OWIRE_BASE_ADDR
+ SZ_4K
- 1,
154 .flags
= IORESOURCE_MEM
,
158 struct platform_device mxc_w1_master_device
= {
161 .num_resources
= ARRAY_SIZE(mxc_w1_master_resources
),
162 .resource
= mxc_w1_master_resources
,
165 static struct resource mxc_nand_resources
[] = {
167 .start
= NFC_BASE_ADDR
,
168 .end
= NFC_BASE_ADDR
+ 0xfff,
169 .flags
= IORESOURCE_MEM
171 .start
= MXC_INT_NANDFC
,
172 .end
= MXC_INT_NANDFC
,
173 .flags
= IORESOURCE_IRQ
177 struct platform_device mxc_nand_device
= {
180 .num_resources
= ARRAY_SIZE(mxc_nand_resources
),
181 .resource
= mxc_nand_resources
,