blob: b7d4900b02e49897c3b41e6c2fcdabf087e7c64a [file] [log] [blame]
Sascha Hauere3d13ff2008-07-05 10:02:48 +02001/*
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>
Juergen Beisert07bd1a62008-07-05 10:02:49 +020023#include <linux/gpio.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010024#include <mach/hardware.h>
Russell King80b02c12009-01-08 10:01:47 +000025#include <mach/irqs.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010026#include <mach/imx-uart.h>
Sascha Hauere3d13ff2008-07-05 10:02:48 +020027
Sascha Hauer87bbb192009-01-29 16:00:23 +010028#include "devices.h"
29
Sascha Hauere3d13ff2008-07-05 10:02:48 +020030static 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
Sascha Hauer5cf09422008-09-09 10:19:41 +020042struct platform_device mxc_uart_device0 = {
Sascha Hauere3d13ff2008-07-05 10:02:48 +020043 .name = "imx-uart",
44 .id = 0,
45 .resource = uart0,
46 .num_resources = ARRAY_SIZE(uart0),
47};
48
49static 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
Sascha Hauer5cf09422008-09-09 10:19:41 +020061struct platform_device mxc_uart_device1 = {
Sascha Hauere3d13ff2008-07-05 10:02:48 +020062 .name = "imx-uart",
63 .id = 1,
64 .resource = uart1,
65 .num_resources = ARRAY_SIZE(uart1),
66};
67
68static 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
Sascha Hauer5cf09422008-09-09 10:19:41 +020080struct platform_device mxc_uart_device2 = {
Sascha Hauere3d13ff2008-07-05 10:02:48 +020081 .name = "imx-uart",
82 .id = 2,
83 .resource = uart2,
84 .num_resources = ARRAY_SIZE(uart2),
85};
86
87static 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
Sascha Hauer5cf09422008-09-09 10:19:41 +020099struct platform_device mxc_uart_device3 = {
Sascha Hauere3d13ff2008-07-05 10:02:48 +0200100 .name = "imx-uart",
101 .id = 3,
102 .resource = uart3,
103 .num_resources = ARRAY_SIZE(uart3),
104};
105
106static 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
Sascha Hauer5cf09422008-09-09 10:19:41 +0200118struct platform_device mxc_uart_device4 = {
Sascha Hauere3d13ff2008-07-05 10:02:48 +0200119 .name = "imx-uart",
120 .id = 4,
121 .resource = uart4,
122 .num_resources = ARRAY_SIZE(uart4),
123};
124
Juergen Beisert07bd1a62008-07-05 10:02:49 +0200125/* GPIO port description */
126static 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,
Sascha Hauer9d631b82008-12-18 11:08:55 +0100131 .virtual_irq_start = MXC_GPIO_IRQ_START,
Juergen Beisert07bd1a62008-07-05 10:02:49 +0200132 },
133 [1] = {
134 .chip.label = "gpio-1",
135 .base = IO_ADDRESS(GPIO2_BASE_ADDR),
136 .irq = MXC_INT_GPIO2,
Sascha Hauer9d631b82008-12-18 11:08:55 +0100137 .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
Juergen Beisert07bd1a62008-07-05 10:02:49 +0200138 },
139 [2] = {
140 .chip.label = "gpio-2",
141 .base = IO_ADDRESS(GPIO3_BASE_ADDR),
142 .irq = MXC_INT_GPIO3,
Sascha Hauer9d631b82008-12-18 11:08:55 +0100143 .virtual_irq_start = MXC_GPIO_IRQ_START + 64,
Juergen Beisert07bd1a62008-07-05 10:02:49 +0200144 }
145};
146
147int __init mxc_register_gpios(void)
148{
149 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
150}
Sascha Hauera8405922008-12-01 14:15:39 -0800151
152static 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
160struct 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};
Sascha Hauercb96cf12008-11-11 15:15:39 +0100166
167static 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
179struct 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};
Mark Brown39d1dc02009-01-15 16:14:27 +0000185
186static 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
199struct 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
206static 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
219struct 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
226static 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
239struct 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};
Valentin Longchampca489f82009-02-16 12:47:52 +0100245
246/* i.MX31 Image Processing Unit */
247
248/* The resource order is important! */
249static struct resource mx3_ipu_rsrc[] = {
250 {
251 .start = IPU_CTRL_BASE_ADDR,
252 .end = IPU_CTRL_BASE_ADDR + 0x5F,
253 .flags = IORESOURCE_MEM,
254 }, {
255 .start = IPU_CTRL_BASE_ADDR + 0x88,
256 .end = IPU_CTRL_BASE_ADDR + 0xB3,
257 .flags = IORESOURCE_MEM,
258 }, {
259 .start = MXC_INT_IPU_SYN,
260 .end = MXC_INT_IPU_SYN,
261 .flags = IORESOURCE_IRQ,
262 }, {
263 .start = MXC_INT_IPU_ERR,
264 .end = MXC_INT_IPU_ERR,
265 .flags = IORESOURCE_IRQ,
266 },
267};
268
269struct platform_device mx3_ipu = {
270 .name = "ipu-core",
271 .id = -1,
272 .num_resources = ARRAY_SIZE(mx3_ipu_rsrc),
273 .resource = mx3_ipu_rsrc,
274};
275
276static struct resource fb_resources[] = {
277 {
278 .start = IPU_CTRL_BASE_ADDR + 0xB4,
279 .end = IPU_CTRL_BASE_ADDR + 0x1BF,
280 .flags = IORESOURCE_MEM,
281 },
282};
283
284struct platform_device mx3_fb = {
285 .name = "mx3_sdc_fb",
286 .id = -1,
287 .num_resources = ARRAY_SIZE(fb_resources),
288 .resource = fb_resources,
289 .dev = {
290 .coherent_dma_mask = 0xffffffff,
291 },
292};