[ARM] mxc: add missing include
[safe/jmp/linux-2.6] / arch / arm / mach-mx3 / devices.c
1 /*
2  * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3  * Copyright 2008 Sascha Hauer, kernel@pengutronix.de
4  *
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.
13  *
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.
18  */
19
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>
27
28 #include "devices.h"
29
30 static struct resource uart0[] = {
31         {
32                 .start = UART1_BASE_ADDR,
33                 .end = UART1_BASE_ADDR + 0x0B5,
34                 .flags = IORESOURCE_MEM,
35         }, {
36                 .start = MXC_INT_UART1,
37                 .end = MXC_INT_UART1,
38                 .flags = IORESOURCE_IRQ,
39         },
40 };
41
42 struct platform_device mxc_uart_device0 = {
43         .name = "imx-uart",
44         .id = 0,
45         .resource = uart0,
46         .num_resources = ARRAY_SIZE(uart0),
47 };
48
49 static struct resource uart1[] = {
50         {
51                 .start = UART2_BASE_ADDR,
52                 .end = UART2_BASE_ADDR + 0x0B5,
53                 .flags = IORESOURCE_MEM,
54         }, {
55                 .start = MXC_INT_UART2,
56                 .end = MXC_INT_UART2,
57                 .flags = IORESOURCE_IRQ,
58         },
59 };
60
61 struct platform_device mxc_uart_device1 = {
62         .name = "imx-uart",
63         .id = 1,
64         .resource = uart1,
65         .num_resources = ARRAY_SIZE(uart1),
66 };
67
68 static struct resource uart2[] = {
69         {
70                 .start = UART3_BASE_ADDR,
71                 .end = UART3_BASE_ADDR + 0x0B5,
72                 .flags = IORESOURCE_MEM,
73         }, {
74                 .start = MXC_INT_UART3,
75                 .end = MXC_INT_UART3,
76                 .flags = IORESOURCE_IRQ,
77         },
78 };
79
80 struct platform_device mxc_uart_device2 = {
81         .name = "imx-uart",
82         .id = 2,
83         .resource = uart2,
84         .num_resources = ARRAY_SIZE(uart2),
85 };
86
87 static struct resource uart3[] = {
88         {
89                 .start = UART4_BASE_ADDR,
90                 .end = UART4_BASE_ADDR + 0x0B5,
91                 .flags = IORESOURCE_MEM,
92         }, {
93                 .start = MXC_INT_UART4,
94                 .end = MXC_INT_UART4,
95                 .flags = IORESOURCE_IRQ,
96         },
97 };
98
99 struct platform_device mxc_uart_device3 = {
100         .name = "imx-uart",
101         .id = 3,
102         .resource = uart3,
103         .num_resources = ARRAY_SIZE(uart3),
104 };
105
106 static struct resource uart4[] = {
107         {
108                 .start = UART5_BASE_ADDR,
109                 .end = UART5_BASE_ADDR + 0x0B5,
110                 .flags = IORESOURCE_MEM,
111         }, {
112                 .start = MXC_INT_UART5,
113                 .end = MXC_INT_UART5,
114                 .flags = IORESOURCE_IRQ,
115         },
116 };
117
118 struct platform_device mxc_uart_device4 = {
119         .name = "imx-uart",
120         .id = 4,
121         .resource = uart4,
122         .num_resources = ARRAY_SIZE(uart4),
123 };
124
125 /* GPIO port description */
126 static struct mxc_gpio_port imx_gpio_ports[] = {
127         [0] = {
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,
132         },
133         [1] = {
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,
138         },
139         [2] = {
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,
144         }
145 };
146
147 int __init mxc_register_gpios(void)
148 {
149         return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
150 }
151
152 static struct resource mxc_w1_master_resources[] = {
153         {
154                 .start = OWIRE_BASE_ADDR,
155                 .end   = OWIRE_BASE_ADDR + SZ_4K - 1,
156                 .flags = IORESOURCE_MEM,
157         },
158 };
159
160 struct platform_device mxc_w1_master_device = {
161         .name = "mxc_w1",
162         .id = 0,
163         .num_resources = ARRAY_SIZE(mxc_w1_master_resources),
164         .resource = mxc_w1_master_resources,
165 };
166
167 static struct resource mxc_nand_resources[] = {
168         {
169                 .start  = NFC_BASE_ADDR,
170                 .end    = NFC_BASE_ADDR + 0xfff,
171                 .flags  = IORESOURCE_MEM
172         }, {
173                 .start  = MXC_INT_NANDFC,
174                 .end    = MXC_INT_NANDFC,
175                 .flags  = IORESOURCE_IRQ
176         },
177 };
178
179 struct platform_device mxc_nand_device = {
180         .name = "mxc_nand",
181         .id = 0,
182         .num_resources = ARRAY_SIZE(mxc_nand_resources),
183         .resource = mxc_nand_resources,
184 };
185
186 static struct resource mxc_i2c0_resources[] = {
187         {
188                 .start = I2C_BASE_ADDR,
189                 .end = I2C_BASE_ADDR + SZ_4K - 1,
190                 .flags = IORESOURCE_MEM,
191         },
192         {
193                 .start = MXC_INT_I2C,
194                 .end = MXC_INT_I2C,
195                 .flags = IORESOURCE_IRQ,
196         },
197 };
198
199 struct platform_device mxc_i2c_device0 = {
200         .name = "imx-i2c",
201         .id = 0,
202         .num_resources = ARRAY_SIZE(mxc_i2c0_resources),
203         .resource = mxc_i2c0_resources,
204 };
205
206 static struct resource mxc_i2c1_resources[] = {
207         {
208                 .start = I2C2_BASE_ADDR,
209                 .end = I2C2_BASE_ADDR + SZ_4K - 1,
210                 .flags = IORESOURCE_MEM,
211         },
212         {
213                 .start = MXC_INT_I2C2,
214                 .end = MXC_INT_I2C2,
215                 .flags = IORESOURCE_IRQ,
216         },
217 };
218
219 struct platform_device mxc_i2c_device1 = {
220         .name = "imx-i2c",
221         .id = 1,
222         .num_resources = ARRAY_SIZE(mxc_i2c1_resources),
223         .resource = mxc_i2c1_resources,
224 };
225
226 static struct resource mxc_i2c2_resources[] = {
227         {
228                 .start = I2C3_BASE_ADDR,
229                 .end = I2C3_BASE_ADDR + SZ_4K - 1,
230                 .flags = IORESOURCE_MEM,
231         },
232         {
233                 .start = MXC_INT_I2C3,
234                 .end = MXC_INT_I2C3,
235                 .flags = IORESOURCE_IRQ,
236         },
237 };
238
239 struct platform_device mxc_i2c_device2 = {
240         .name = "imx-i2c",
241         .id = 2,
242         .num_resources = ARRAY_SIZE(mxc_i2c2_resources),
243         .resource = mxc_i2c2_resources,
244 };