blob: 28caa21cb56eb9c97d56e0cd0c1ca4606a6f3b29 [file] [log] [blame]
Juergen Beisertfc80a5e2008-07-05 10:02:57 +02001/*
2 * Author: MontaVista Software, Inc.
3 * <source@mvista.com>
4 *
5 * Based on the OMAP devices.c
6 *
7 * 2005 (c) MontaVista Software, Inc. This file is licensed under the
8 * terms of the GNU General Public License version 2. This program is
9 * licensed "as is" without any warranty of any kind, whether express
10 * or implied.
11 *
12 * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
13 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
27 * MA 02110-1301, USA.
28 */
29#include <linux/module.h>
30#include <linux/kernel.h>
31#include <linux/init.h>
32#include <linux/platform_device.h>
33#include <linux/gpio.h>
Martin Fuzzey3eb352c2009-11-21 12:14:54 +010034#include <linux/dma-mapping.h>
Juergen Beisertfc80a5e2008-07-05 10:02:57 +020035
Russell King80b02c12009-01-08 10:01:47 +000036#include <mach/irqs.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010037#include <mach/hardware.h>
Holger Schurig058b7a62009-01-26 16:34:51 +010038#include <mach/common.h>
Sascha Hauer1a02be02008-12-19 14:32:07 +010039#include <mach/mmc.h>
Holger Schurig058b7a62009-01-26 16:34:51 +010040
41#include "devices.h"
Juergen Beisertfc80a5e2008-07-05 10:02:57 +020042
Baruch Siach94d35952010-06-21 08:15:59 +030043#ifdef CONFIG_MACH_MX27
44static struct resource mx27_camera_resources[] = {
45 {
46 .start = MX27_CSI_BASE_ADDR,
47 .end = MX27_CSI_BASE_ADDR + 0x1f,
48 .flags = IORESOURCE_MEM,
49 }, {
50 .start = MX27_EMMA_PRP_BASE_ADDR,
51 .end = MX27_EMMA_PRP_BASE_ADDR + 0x1f,
52 .flags = IORESOURCE_MEM,
53 }, {
54 .start = MX27_INT_CSI,
55 .end = MX27_INT_CSI,
56 .flags = IORESOURCE_IRQ,
57 },{
58 .start = MX27_INT_EMMAPRP,
59 .end = MX27_INT_EMMAPRP,
60 .flags = IORESOURCE_IRQ,
61 },
62};
63struct platform_device mx27_camera_device = {
64 .name = "mx2-camera",
65 .id = 0,
66 .num_resources = ARRAY_SIZE(mx27_camera_resources),
67 .resource = mx27_camera_resources,
68 .dev = {
69 .coherent_dma_mask = 0xffffffff,
70 },
71};
72#endif
73
Juergen Beisertfc80a5e2008-07-05 10:02:57 +020074/*
Sascha Hauerf420db82008-12-19 14:32:14 +010075 * SPI master controller
76 *
77 * - i.MX1: 2 channel (slighly different register setting)
78 * - i.MX21: 2 channel
79 * - i.MX27: 3 channel
80 */
Uwe Kleine-König68c94b42010-02-04 22:04:32 +010081#define DEFINE_IMX_SPI_DEVICE(n, baseaddr, irq) \
82 static struct resource mxc_spi_resources ## n[] = { \
83 { \
84 .start = baseaddr, \
85 .end = baseaddr + SZ_4K - 1, \
86 .flags = IORESOURCE_MEM, \
87 }, { \
88 .start = irq, \
89 .end = irq, \
90 .flags = IORESOURCE_IRQ, \
91 }, \
92 }; \
93 \
94 struct platform_device mxc_spi_device ## n = { \
95 .name = "spi_imx", \
96 .id = n, \
97 .num_resources = ARRAY_SIZE(mxc_spi_resources ## n), \
98 .resource = mxc_spi_resources ## n, \
99 }
Sascha Hauerf420db82008-12-19 14:32:14 +0100100
Uwe Kleine-König68c94b42010-02-04 22:04:32 +0100101DEFINE_IMX_SPI_DEVICE(0, MX2x_CSPI1_BASE_ADDR, MX2x_INT_CSPI1);
102DEFINE_IMX_SPI_DEVICE(1, MX2x_CSPI2_BASE_ADDR, MX2x_INT_CSPI2);
Sascha Hauerf420db82008-12-19 14:32:14 +0100103
104#ifdef CONFIG_MACH_MX27
Uwe Kleine-König68c94b42010-02-04 22:04:32 +0100105DEFINE_IMX_SPI_DEVICE(2, MX27_CSPI3_BASE_ADDR, MX27_INT_CSPI3);
Sascha Hauerf420db82008-12-19 14:32:14 +0100106#endif
107
108/*
Juergen Beisertfc80a5e2008-07-05 10:02:57 +0200109 * General Purpose Timer
Sascha Hauerbf50bcc2009-06-23 12:04:36 +0200110 * - i.MX21: 3 timers
111 * - i.MX27: 6 timers
Juergen Beisertfc80a5e2008-07-05 10:02:57 +0200112 */
Uwe Kleine-König2b84a3642010-02-04 14:11:02 +0100113#define DEFINE_IMX_GPT_DEVICE(n, baseaddr, irq) \
114 static struct resource timer ## n ##_resources[] = { \
115 { \
116 .start = baseaddr, \
117 .end = baseaddr + SZ_4K - 1, \
118 .flags = IORESOURCE_MEM, \
119 }, { \
120 .start = irq, \
121 .end = irq, \
122 .flags = IORESOURCE_IRQ, \
123 } \
124 }; \
125 \
126 struct platform_device mxc_gpt ## n = { \
127 .name = "imx_gpt", \
128 .id = n, \
129 .num_resources = ARRAY_SIZE(timer ## n ## _resources), \
130 .resource = timer ## n ## _resources, \
Juergen Beisertfc80a5e2008-07-05 10:02:57 +0200131 }
Juergen Beisertfc80a5e2008-07-05 10:02:57 +0200132
Uwe Kleine-König2b84a3642010-02-04 14:11:02 +0100133/* We use gpt1 as system timer, so do not add a device for this one */
134DEFINE_IMX_GPT_DEVICE(1, MX2x_GPT2_BASE_ADDR, MX2x_INT_GPT2);
135DEFINE_IMX_GPT_DEVICE(2, MX2x_GPT3_BASE_ADDR, MX2x_INT_GPT3);
Juergen Beisertfc80a5e2008-07-05 10:02:57 +0200136
137#ifdef CONFIG_MACH_MX27
Uwe Kleine-König2b84a3642010-02-04 14:11:02 +0100138DEFINE_IMX_GPT_DEVICE(3, MX27_GPT4_BASE_ADDR, MX27_INT_GPT4);
139DEFINE_IMX_GPT_DEVICE(4, MX27_GPT5_BASE_ADDR, MX27_INT_GPT5);
140DEFINE_IMX_GPT_DEVICE(5, MX27_GPT6_BASE_ADDR, MX27_INT_GPT6);
Juergen Beisertfc80a5e2008-07-05 10:02:57 +0200141#endif
142
Wolfram Sang6d38c1c2010-04-29 10:03:18 +0200143/* Watchdog: i.MX1 has seperate driver, i.MX21 and i.MX27 are equal */
Juergen Beisertfc80a5e2008-07-05 10:02:57 +0200144static struct resource mxc_wdt_resources[] = {
145 {
Uwe Kleine-König58152a12010-02-05 11:42:54 +0100146 .start = MX2x_WDOG_BASE_ADDR,
147 .end = MX2x_WDOG_BASE_ADDR + SZ_4K - 1,
148 .flags = IORESOURCE_MEM,
Juergen Beisertfc80a5e2008-07-05 10:02:57 +0200149 },
150};
151
152struct platform_device mxc_wdt = {
Wolfram Sang6d38c1c2010-04-29 10:03:18 +0200153 .name = "imx2-wdt",
Juergen Beisertfc80a5e2008-07-05 10:02:57 +0200154 .id = 0,
155 .num_resources = ARRAY_SIZE(mxc_wdt_resources),
156 .resource = mxc_wdt_resources,
157};
158
Sascha Hauer3d89baa2008-12-01 14:15:38 -0800159static struct resource mxc_w1_master_resources[] = {
160 {
Uwe Kleine-König58152a12010-02-05 11:42:54 +0100161 .start = MX2x_OWIRE_BASE_ADDR,
162 .end = MX2x_OWIRE_BASE_ADDR + SZ_4K - 1,
Sascha Hauer3d89baa2008-12-01 14:15:38 -0800163 .flags = IORESOURCE_MEM,
164 },
165};
166
167struct platform_device mxc_w1_master_device = {
168 .name = "mxc_w1",
169 .id = 0,
170 .num_resources = ARRAY_SIZE(mxc_w1_master_resources),
171 .resource = mxc_w1_master_resources,
172};
173
Uwe Kleine-Königf0d3ab42010-02-05 16:57:59 +0100174#define DEFINE_MXC_NAND_DEVICE(pfx, baseaddr, irq) \
175 static struct resource pfx ## _nand_resources[] = { \
176 { \
177 .start = baseaddr, \
178 .end = baseaddr + SZ_4K - 1, \
179 .flags = IORESOURCE_MEM, \
180 }, { \
181 .start = irq, \
182 .end = irq, \
183 .flags = IORESOURCE_IRQ, \
184 }, \
185 }; \
186 \
187 struct platform_device pfx ## _nand_device = { \
188 .name = "mxc_nand", \
189 .id = 0, \
190 .num_resources = ARRAY_SIZE(pfx ## _nand_resources), \
191 .resource = pfx ## _nand_resources, \
192 }
Sascha Hauer02870972008-09-09 11:30:58 +0200193
Uwe Kleine-Königf0d3ab42010-02-05 16:57:59 +0100194#ifdef CONFIG_MACH_MX21
195DEFINE_MXC_NAND_DEVICE(imx21, MX21_NFC_BASE_ADDR, MX21_INT_NANDFC);
196#endif
197
198#ifdef CONFIG_MACH_MX27
199DEFINE_MXC_NAND_DEVICE(imx27, MX27_NFC_BASE_ADDR, MX27_INT_NANDFC);
200#endif
Sascha Hauer02870972008-09-09 11:30:58 +0200201
Holger Schurige4813552009-01-26 16:34:56 +0100202/*
203 * lcdc:
204 * - i.MX1: the basic controller
205 * - i.MX21: to be checked
206 * - i.MX27: like i.MX1, with slightly variations
207 */
208static struct resource mxc_fb[] = {
209 {
Uwe Kleine-König58152a12010-02-05 11:42:54 +0100210 .start = MX2x_LCDC_BASE_ADDR,
211 .end = MX2x_LCDC_BASE_ADDR + SZ_4K - 1,
Holger Schurige4813552009-01-26 16:34:56 +0100212 .flags = IORESOURCE_MEM,
Sascha Hauerbf50bcc2009-06-23 12:04:36 +0200213 }, {
Uwe Kleine-König58152a12010-02-05 11:42:54 +0100214 .start = MX2x_INT_LCDC,
215 .end = MX2x_INT_LCDC,
Holger Schurige4813552009-01-26 16:34:56 +0100216 .flags = IORESOURCE_IRQ,
217 }
218};
219
220/* mxc lcd driver */
221struct platform_device mxc_fb_device = {
222 .name = "imx-fb",
223 .id = 0,
224 .num_resources = ARRAY_SIZE(mxc_fb),
225 .resource = mxc_fb,
226 .dev = {
Martin Fuzzey3eb352c2009-11-21 12:14:54 +0100227 .coherent_dma_mask = DMA_BIT_MASK(32),
Holger Schurige4813552009-01-26 16:34:56 +0100228 },
229};
230
Sascha Hauer879fea12009-01-26 17:26:02 +0100231#ifdef CONFIG_MACH_MX27
232static struct resource mxc_fec_resources[] = {
233 {
Uwe Kleine-König58152a12010-02-05 11:42:54 +0100234 .start = MX27_FEC_BASE_ADDR,
235 .end = MX27_FEC_BASE_ADDR + SZ_4K - 1,
236 .flags = IORESOURCE_MEM,
Sascha Hauer879fea12009-01-26 17:26:02 +0100237 }, {
Uwe Kleine-König58152a12010-02-05 11:42:54 +0100238 .start = MX27_INT_FEC,
239 .end = MX27_INT_FEC,
240 .flags = IORESOURCE_IRQ,
Sascha Hauer879fea12009-01-26 17:26:02 +0100241 },
242};
243
244struct platform_device mxc_fec_device = {
245 .name = "fec",
246 .id = 0,
247 .num_resources = ARRAY_SIZE(mxc_fec_resources),
248 .resource = mxc_fec_resources,
249};
Holger Schurige4813552009-01-26 16:34:56 +0100250#endif
251
Uwe Kleine-König9309b2b2010-02-04 22:13:52 +0100252#define DEFINE_IMX_I2C_DEVICE(n, baseaddr, irq) \
253 static struct resource mxc_i2c_resources ## n[] = { \
254 { \
255 .start = baseaddr, \
256 .end = baseaddr + SZ_4K - 1, \
257 .flags = IORESOURCE_MEM, \
258 }, { \
259 .start = irq, \
260 .end = irq, \
261 .flags = IORESOURCE_IRQ, \
262 } \
263 }; \
264 \
265 struct platform_device mxc_i2c_device ## n = { \
266 .name = "imx-i2c", \
267 .id = n, \
268 .num_resources = ARRAY_SIZE(mxc_i2c_resources ## n), \
269 .resource = mxc_i2c_resources ## n, \
Sascha Hauerc5d4dbf2009-01-28 13:26:56 +0100270 }
Sascha Hauerc5d4dbf2009-01-28 13:26:56 +0100271
Uwe Kleine-König9309b2b2010-02-04 22:13:52 +0100272DEFINE_IMX_I2C_DEVICE(0, MX2x_I2C_BASE_ADDR, MX2x_INT_I2C);
Sascha Hauerc5d4dbf2009-01-28 13:26:56 +0100273
274#ifdef CONFIG_MACH_MX27
Uwe Kleine-König9309b2b2010-02-04 22:13:52 +0100275DEFINE_IMX_I2C_DEVICE(1, MX27_I2C2_BASE_ADDR, MX27_INT_I2C2);
Sascha Hauerc5d4dbf2009-01-28 13:26:56 +0100276#endif
277
Sascha Hauer824b16e2009-01-16 15:17:46 +0100278static struct resource mxc_pwm_resources[] = {
Sascha Hauerbf50bcc2009-06-23 12:04:36 +0200279 {
Uwe Kleine-König58152a12010-02-05 11:42:54 +0100280 .start = MX2x_PWM_BASE_ADDR,
281 .end = MX2x_PWM_BASE_ADDR + SZ_4K - 1,
282 .flags = IORESOURCE_MEM,
Sascha Hauerbf50bcc2009-06-23 12:04:36 +0200283 }, {
Uwe Kleine-König58152a12010-02-05 11:42:54 +0100284 .start = MX2x_INT_PWM,
285 .end = MX2x_INT_PWM,
286 .flags = IORESOURCE_IRQ,
Sascha Hauer824b16e2009-01-16 15:17:46 +0100287 }
288};
289
290struct platform_device mxc_pwm_device = {
291 .name = "mxc_pwm",
292 .id = 0,
293 .num_resources = ARRAY_SIZE(mxc_pwm_resources),
Sascha Hauerbf50bcc2009-06-23 12:04:36 +0200294 .resource = mxc_pwm_resources,
Sascha Hauer824b16e2009-01-16 15:17:46 +0100295};
296
Uwe Kleine-Königccd0e422010-02-05 10:46:56 +0100297#define DEFINE_MXC_MMC_DEVICE(n, baseaddr, irq, dmareq) \
298 static struct resource mxc_sdhc_resources ## n[] = { \
299 { \
300 .start = baseaddr, \
301 .end = baseaddr + SZ_4K - 1, \
302 .flags = IORESOURCE_MEM, \
303 }, { \
304 .start = irq, \
305 .end = irq, \
306 .flags = IORESOURCE_IRQ, \
307 }, { \
308 .start = dmareq, \
309 .end = dmareq, \
310 .flags = IORESOURCE_DMA, \
311 }, \
312 }; \
313 \
Russell King988addf2010-03-08 20:21:04 +0000314 static u64 mxc_sdhc ## n ## _dmamask = DMA_BIT_MASK(32); \
Uwe Kleine-Königccd0e422010-02-05 10:46:56 +0100315 \
316 struct platform_device mxc_sdhc_device ## n = { \
317 .name = "mxc-mmc", \
318 .id = n, \
319 .dev = { \
320 .dma_mask = &mxc_sdhc ## n ## _dmamask, \
Russell King988addf2010-03-08 20:21:04 +0000321 .coherent_dma_mask = DMA_BIT_MASK(32), \
Uwe Kleine-Königccd0e422010-02-05 10:46:56 +0100322 }, \
323 .num_resources = ARRAY_SIZE(mxc_sdhc_resources ## n), \
324 .resource = mxc_sdhc_resources ## n, \
325 }
Sascha Hauer1a02be02008-12-19 14:32:07 +0100326
Uwe Kleine-Königccd0e422010-02-05 10:46:56 +0100327DEFINE_MXC_MMC_DEVICE(0, MX2x_SDHC1_BASE_ADDR, MX2x_INT_SDHC1, MX2x_DMA_REQ_SDHC1);
328DEFINE_MXC_MMC_DEVICE(1, MX2x_SDHC2_BASE_ADDR, MX2x_INT_SDHC2, MX2x_DMA_REQ_SDHC2);
Sascha Hauer1a02be02008-12-19 14:32:07 +0100329
Sascha Hauerf6d2fa72009-08-13 10:02:30 +0200330#ifdef CONFIG_MACH_MX27
javier Martin627fb3b2009-07-15 15:26:21 +0200331static struct resource otg_resources[] = {
332 {
Uwe Kleine-König58152a12010-02-05 11:42:54 +0100333 .start = MX27_USBOTG_BASE_ADDR,
334 .end = MX27_USBOTG_BASE_ADDR + 0x1ff,
335 .flags = IORESOURCE_MEM,
javier Martin627fb3b2009-07-15 15:26:21 +0200336 }, {
Uwe Kleine-König58152a12010-02-05 11:42:54 +0100337 .start = MX27_INT_USB3,
338 .end = MX27_INT_USB3,
339 .flags = IORESOURCE_IRQ,
javier Martin627fb3b2009-07-15 15:26:21 +0200340 },
341};
342
Martin Fuzzey3eb352c2009-11-21 12:14:54 +0100343static u64 otg_dmamask = DMA_BIT_MASK(32);
javier Martin627fb3b2009-07-15 15:26:21 +0200344
345/* OTG gadget device */
346struct platform_device mxc_otg_udc_device = {
347 .name = "fsl-usb2-udc",
348 .id = -1,
349 .dev = {
350 .dma_mask = &otg_dmamask,
Martin Fuzzey3eb352c2009-11-21 12:14:54 +0100351 .coherent_dma_mask = DMA_BIT_MASK(32),
javier Martin627fb3b2009-07-15 15:26:21 +0200352 },
353 .resource = otg_resources,
354 .num_resources = ARRAY_SIZE(otg_resources),
355};
356
357/* OTG host */
358struct platform_device mxc_otg_host = {
359 .name = "mxc-ehci",
360 .id = 0,
361 .dev = {
Martin Fuzzey3eb352c2009-11-21 12:14:54 +0100362 .coherent_dma_mask = DMA_BIT_MASK(32),
javier Martin627fb3b2009-07-15 15:26:21 +0200363 .dma_mask = &otg_dmamask,
364 },
365 .resource = otg_resources,
366 .num_resources = ARRAY_SIZE(otg_resources),
367};
368
369/* USB host 1 */
370
Martin Fuzzey3eb352c2009-11-21 12:14:54 +0100371static u64 usbh1_dmamask = DMA_BIT_MASK(32);
javier Martin627fb3b2009-07-15 15:26:21 +0200372
373static struct resource mxc_usbh1_resources[] = {
374 {
Uwe Kleine-König58152a12010-02-05 11:42:54 +0100375 .start = MX27_USBOTG_BASE_ADDR + 0x200,
376 .end = MX27_USBOTG_BASE_ADDR + 0x3ff,
javier Martin627fb3b2009-07-15 15:26:21 +0200377 .flags = IORESOURCE_MEM,
378 }, {
Uwe Kleine-König58152a12010-02-05 11:42:54 +0100379 .start = MX27_INT_USB1,
380 .end = MX27_INT_USB1,
javier Martin627fb3b2009-07-15 15:26:21 +0200381 .flags = IORESOURCE_IRQ,
382 },
383};
384
385struct platform_device mxc_usbh1 = {
386 .name = "mxc-ehci",
387 .id = 1,
388 .dev = {
Martin Fuzzey3eb352c2009-11-21 12:14:54 +0100389 .coherent_dma_mask = DMA_BIT_MASK(32),
javier Martin627fb3b2009-07-15 15:26:21 +0200390 .dma_mask = &usbh1_dmamask,
391 },
392 .resource = mxc_usbh1_resources,
393 .num_resources = ARRAY_SIZE(mxc_usbh1_resources),
394};
395
396/* USB host 2 */
Martin Fuzzey3eb352c2009-11-21 12:14:54 +0100397static u64 usbh2_dmamask = DMA_BIT_MASK(32);
javier Martin627fb3b2009-07-15 15:26:21 +0200398
399static struct resource mxc_usbh2_resources[] = {
400 {
Uwe Kleine-König58152a12010-02-05 11:42:54 +0100401 .start = MX27_USBOTG_BASE_ADDR + 0x400,
402 .end = MX27_USBOTG_BASE_ADDR + 0x5ff,
javier Martin627fb3b2009-07-15 15:26:21 +0200403 .flags = IORESOURCE_MEM,
404 }, {
Uwe Kleine-König58152a12010-02-05 11:42:54 +0100405 .start = MX27_INT_USB2,
406 .end = MX27_INT_USB2,
javier Martin627fb3b2009-07-15 15:26:21 +0200407 .flags = IORESOURCE_IRQ,
408 },
409};
410
411struct platform_device mxc_usbh2 = {
412 .name = "mxc-ehci",
413 .id = 2,
414 .dev = {
Martin Fuzzey3eb352c2009-11-21 12:14:54 +0100415 .coherent_dma_mask = DMA_BIT_MASK(32),
javier Martin627fb3b2009-07-15 15:26:21 +0200416 .dma_mask = &usbh2_dmamask,
417 },
418 .resource = mxc_usbh2_resources,
419 .num_resources = ARRAY_SIZE(mxc_usbh2_resources),
420};
Sascha Hauerf6d2fa72009-08-13 10:02:30 +0200421#endif
javier Martin627fb3b2009-07-15 15:26:21 +0200422
Uwe Kleine-König69ddb482010-02-05 12:03:37 +0100423#define DEFINE_IMX_SSI_DMARES(_name, ssin, suffix) \
424 { \
425 .name = _name, \
426 .start = MX2x_DMA_REQ_SSI ## ssin ## _ ## suffix, \
427 .end = MX2x_DMA_REQ_SSI ## ssin ## _ ## suffix, \
428 .flags = IORESOURCE_DMA, \
429 }
Sascha Hauer23291df2009-10-22 14:50:33 +0200430
Uwe Kleine-König69ddb482010-02-05 12:03:37 +0100431#define DEFINE_IMX_SSI_DEVICE(n, ssin, baseaddr, irq) \
432 static struct resource imx_ssi_resources ## n[] = { \
433 { \
434 .start = MX2x_SSI ## ssin ## _BASE_ADDR, \
435 .end = MX2x_SSI ## ssin ## _BASE_ADDR + 0x6f, \
436 .flags = IORESOURCE_MEM, \
437 }, { \
438 .start = MX2x_INT_SSI1, \
439 .end = MX2x_INT_SSI1, \
440 .flags = IORESOURCE_IRQ, \
441 }, \
442 DEFINE_IMX_SSI_DMARES("tx0", ssin, TX0), \
443 DEFINE_IMX_SSI_DMARES("rx0", ssin, RX0), \
444 DEFINE_IMX_SSI_DMARES("tx1", ssin, TX1), \
445 DEFINE_IMX_SSI_DMARES("rx1", ssin, RX1), \
446 }; \
447 \
448 struct platform_device imx_ssi_device ## n = { \
449 .name = "imx-ssi", \
450 .id = n, \
451 .num_resources = ARRAY_SIZE(imx_ssi_resources ## n), \
452 .resource = imx_ssi_resources ## n, \
453 }
Sascha Hauer23291df2009-10-22 14:50:33 +0200454
Uwe Kleine-König69ddb482010-02-05 12:03:37 +0100455DEFINE_IMX_SSI_DEVICE(0, 1, MX2x_SSI1_BASE_ADDR, MX2x_INT_SSI1);
456DEFINE_IMX_SSI_DEVICE(1, 2, MX2x_SSI1_BASE_ADDR, MX2x_INT_SSI1);
Sascha Hauer23291df2009-10-22 14:50:33 +0200457
Juergen Beisertfc80a5e2008-07-05 10:02:57 +0200458/* GPIO port description */
Uwe Kleine-König897359d2010-02-05 17:40:28 +0100459#define DEFINE_MXC_GPIO_PORT_IRQ(SOC, n, _irq) \
460 { \
461 .chip.label = "gpio-" #n, \
462 .irq = _irq, \
463 .base = SOC ## _IO_ADDRESS(MX2x_GPIO_BASE_ADDR + \
464 n * 0x100), \
465 .virtual_irq_start = MXC_GPIO_IRQ_START + n * 32, \
Juergen Beisertfc80a5e2008-07-05 10:02:57 +0200466 }
Uwe Kleine-König897359d2010-02-05 17:40:28 +0100467
468#define DEFINE_MXC_GPIO_PORT(SOC, n) \
469 { \
470 .chip.label = "gpio-" #n, \
471 .base = SOC ## _IO_ADDRESS(MX2x_GPIO_BASE_ADDR + \
472 n * 0x100), \
473 .virtual_irq_start = MXC_GPIO_IRQ_START + n * 32, \
474 }
475
476#define DEFINE_MXC_GPIO_PORTS(SOC, pfx) \
477 static struct mxc_gpio_port pfx ## _gpio_ports[] = { \
478 DEFINE_MXC_GPIO_PORT_IRQ(SOC, 0, SOC ## _INT_GPIO), \
479 DEFINE_MXC_GPIO_PORT(SOC, 1), \
480 DEFINE_MXC_GPIO_PORT(SOC, 2), \
481 DEFINE_MXC_GPIO_PORT(SOC, 3), \
482 DEFINE_MXC_GPIO_PORT(SOC, 4), \
483 DEFINE_MXC_GPIO_PORT(SOC, 5), \
484 }
485
486#ifdef CONFIG_MACH_MX21
487DEFINE_MXC_GPIO_PORTS(MX21, imx21);
488#endif
489
490#ifdef CONFIG_MACH_MX27
491DEFINE_MXC_GPIO_PORTS(MX27, imx27);
492#endif
Juergen Beisertfc80a5e2008-07-05 10:02:57 +0200493
494int __init mxc_register_gpios(void)
495{
Uwe Kleine-König897359d2010-02-05 17:40:28 +0100496#ifdef CONFIG_MACH_MX21
497 if (cpu_is_mx21())
498 return mxc_gpio_init(imx21_gpio_ports, ARRAY_SIZE(imx21_gpio_ports));
499 else
500#endif
501#ifdef CONFIG_MACH_MX27
502 if (cpu_is_mx27())
503 return mxc_gpio_init(imx27_gpio_ports, ARRAY_SIZE(imx27_gpio_ports));
504 else
505#endif
506 return 0;
Juergen Beisertfc80a5e2008-07-05 10:02:57 +0200507}
Martin Fuzzey4e0fa902009-11-21 12:14:58 +0100508
509#ifdef CONFIG_MACH_MX21
510static struct resource mx21_usbhc_resources[] = {
511 {
Wolfram Sange1695302010-05-15 11:25:35 +0100512 .start = MX21_USBOTG_BASE_ADDR,
513 .end = MX21_USBOTG_BASE_ADDR + SZ_8K - 1,
Martin Fuzzey4e0fa902009-11-21 12:14:58 +0100514 .flags = IORESOURCE_MEM,
515 },
516 {
Russell King988addf2010-03-08 20:21:04 +0000517 .start = MX21_INT_USBHOST,
518 .end = MX21_INT_USBHOST,
Martin Fuzzey4e0fa902009-11-21 12:14:58 +0100519 .flags = IORESOURCE_IRQ,
520 },
521};
522
523struct platform_device mx21_usbhc_device = {
524 .name = "imx21-hcd",
525 .id = 0,
526 .dev = {
527 .dma_mask = &mx21_usbhc_device.dev.coherent_dma_mask,
528 .coherent_dma_mask = DMA_BIT_MASK(32),
529 },
530 .num_resources = ARRAY_SIZE(mx21_usbhc_resources),
531 .resource = mx21_usbhc_resources,
532};
533#endif
534
Eric Bénard0896a9e2010-05-19 18:46:06 +0200535static struct resource imx_kpp_resources[] = {
536 {
537 .start = MX2x_KPP_BASE_ADDR,
538 .end = MX2x_KPP_BASE_ADDR + 0xf,
539 .flags = IORESOURCE_MEM
540 }, {
541 .start = MX2x_INT_KPP,
542 .end = MX2x_INT_KPP,
543 .flags = IORESOURCE_IRQ,
544 },
545};
546
547struct platform_device imx_kpp_device = {
548 .name = "imx-keypad",
549 .id = -1,
550 .num_resources = ARRAY_SIZE(imx_kpp_resources),
551 .resource = imx_kpp_resources,
552};