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>
30 static struct resource uart0[] = {
32 .start = UART1_BASE_ADDR,
33 .end = UART1_BASE_ADDR + 0x0B5,
34 .flags = IORESOURCE_MEM,
36 .start = MXC_INT_UART1,
38 .flags = IORESOURCE_IRQ,
42 struct platform_device mxc_uart_device0 = {
46 .num_resources = ARRAY_SIZE(uart0),
49 static struct resource uart1[] = {
51 .start = UART2_BASE_ADDR,
52 .end = UART2_BASE_ADDR + 0x0B5,
53 .flags = IORESOURCE_MEM,
55 .start = MXC_INT_UART2,
57 .flags = IORESOURCE_IRQ,
61 struct platform_device mxc_uart_device1 = {
65 .num_resources = ARRAY_SIZE(uart1),
68 static struct resource uart2[] = {
70 .start = UART3_BASE_ADDR,
71 .end = UART3_BASE_ADDR + 0x0B5,
72 .flags = IORESOURCE_MEM,
74 .start = MXC_INT_UART3,
76 .flags = IORESOURCE_IRQ,
80 struct platform_device mxc_uart_device2 = {
84 .num_resources = ARRAY_SIZE(uart2),
87 static struct resource uart3[] = {
89 .start = UART4_BASE_ADDR,
90 .end = UART4_BASE_ADDR + 0x0B5,
91 .flags = IORESOURCE_MEM,
93 .start = MXC_INT_UART4,
95 .flags = IORESOURCE_IRQ,
99 struct platform_device mxc_uart_device3 = {
103 .num_resources = ARRAY_SIZE(uart3),
106 static struct resource uart4[] = {
108 .start = UART5_BASE_ADDR,
109 .end = UART5_BASE_ADDR + 0x0B5,
110 .flags = IORESOURCE_MEM,
112 .start = MXC_INT_UART5,
113 .end = MXC_INT_UART5,
114 .flags = IORESOURCE_IRQ,
118 struct platform_device mxc_uart_device4 = {
122 .num_resources = ARRAY_SIZE(uart4),
125 /* GPIO port description */
126 static struct mxc_gpio_port imx_gpio_ports[] = {
128 .chip.label = "gpio-0",
129 .base = IO_ADDRESS(GPIO1_BASE_ADDR),
130 .irq = MXC_INT_GPIO1,
131 .virtual_irq_start = MXC_GPIO_IRQ_START,
134 .chip.label = "gpio-1",
135 .base = IO_ADDRESS(GPIO2_BASE_ADDR),
136 .irq = MXC_INT_GPIO2,
137 .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
140 .chip.label = "gpio-2",
141 .base = IO_ADDRESS(GPIO3_BASE_ADDR),
142 .irq = MXC_INT_GPIO3,
143 .virtual_irq_start = MXC_GPIO_IRQ_START + 64,
147 int __init mxc_register_gpios(void)
149 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
152 static struct resource mxc_w1_master_resources[] = {
154 .start = OWIRE_BASE_ADDR,
155 .end = OWIRE_BASE_ADDR + SZ_4K - 1,
156 .flags = IORESOURCE_MEM,
160 struct platform_device mxc_w1_master_device = {
163 .num_resources = ARRAY_SIZE(mxc_w1_master_resources),
164 .resource = mxc_w1_master_resources,
167 static struct resource mxc_nand_resources[] = {
169 .start = NFC_BASE_ADDR,
170 .end = NFC_BASE_ADDR + 0xfff,
171 .flags = IORESOURCE_MEM
173 .start = MXC_INT_NANDFC,
174 .end = MXC_INT_NANDFC,
175 .flags = IORESOURCE_IRQ
179 struct platform_device mxc_nand_device = {
182 .num_resources = ARRAY_SIZE(mxc_nand_resources),
183 .resource = mxc_nand_resources,
186 static struct resource mxc_i2c0_resources[] = {
188 .start = I2C_BASE_ADDR,
189 .end = I2C_BASE_ADDR + SZ_4K - 1,
190 .flags = IORESOURCE_MEM,
193 .start = MXC_INT_I2C,
195 .flags = IORESOURCE_IRQ,
199 struct platform_device mxc_i2c_device0 = {
202 .num_resources = ARRAY_SIZE(mxc_i2c0_resources),
203 .resource = mxc_i2c0_resources,
206 static struct resource mxc_i2c1_resources[] = {
208 .start = I2C2_BASE_ADDR,
209 .end = I2C2_BASE_ADDR + SZ_4K - 1,
210 .flags = IORESOURCE_MEM,
213 .start = MXC_INT_I2C2,
215 .flags = IORESOURCE_IRQ,
219 struct platform_device mxc_i2c_device1 = {
222 .num_resources = ARRAY_SIZE(mxc_i2c1_resources),
223 .resource = mxc_i2c1_resources,
226 static struct resource mxc_i2c2_resources[] = {
228 .start = I2C3_BASE_ADDR,
229 .end = I2C3_BASE_ADDR + SZ_4K - 1,
230 .flags = IORESOURCE_MEM,
233 .start = MXC_INT_I2C3,
235 .flags = IORESOURCE_IRQ,
239 struct platform_device mxc_i2c_device2 = {
242 .num_resources = ARRAY_SIZE(mxc_i2c2_resources),
243 .resource = mxc_i2c2_resources,