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/dma-mapping.h>
21 #include <linux/module.h>
22 #include <linux/platform_device.h>
23 #include <linux/serial.h>
24 #include <linux/gpio.h>
25 #include <mach/hardware.h>
26 #include <mach/irqs.h>
27 #include <mach/common.h>
28 #include <mach/mx3_camera.h>
32 #ifdef CONFIG_ARCH_MX31
33 static struct resource mxcsdhc0_resources[] = {
35 .start = MX31_MMC_SDHC1_BASE_ADDR,
36 .end = MX31_MMC_SDHC1_BASE_ADDR + SZ_16K - 1,
37 .flags = IORESOURCE_MEM,
39 .start = MX31_INT_MMC_SDHC1,
40 .end = MX31_INT_MMC_SDHC1,
41 .flags = IORESOURCE_IRQ,
45 static struct resource mxcsdhc1_resources[] = {
47 .start = MX31_MMC_SDHC2_BASE_ADDR,
48 .end = MX31_MMC_SDHC2_BASE_ADDR + SZ_16K - 1,
49 .flags = IORESOURCE_MEM,
51 .start = MX31_INT_MMC_SDHC2,
52 .end = MX31_INT_MMC_SDHC2,
53 .flags = IORESOURCE_IRQ,
57 struct platform_device mxcsdhc_device0 = {
60 .num_resources = ARRAY_SIZE(mxcsdhc0_resources),
61 .resource = mxcsdhc0_resources,
64 struct platform_device mxcsdhc_device1 = {
67 .num_resources = ARRAY_SIZE(mxcsdhc1_resources),
68 .resource = mxcsdhc1_resources,
71 static struct resource rnga_resources[] = {
73 .start = MX3x_RNGA_BASE_ADDR,
74 .end = MX3x_RNGA_BASE_ADDR + 0x28,
75 .flags = IORESOURCE_MEM,
79 struct platform_device mxc_rnga_device = {
83 .resource = rnga_resources,
85 #endif /* CONFIG_ARCH_MX31 */
87 /* i.MX31 Image Processing Unit */
89 /* The resource order is important! */
90 static struct resource mx3_ipu_rsrc[] = {
92 .start = MX3x_IPU_CTRL_BASE_ADDR,
93 .end = MX3x_IPU_CTRL_BASE_ADDR + 0x5F,
94 .flags = IORESOURCE_MEM,
96 .start = MX3x_IPU_CTRL_BASE_ADDR + 0x88,
97 .end = MX3x_IPU_CTRL_BASE_ADDR + 0xB3,
98 .flags = IORESOURCE_MEM,
100 .start = MX3x_INT_IPU_SYN,
101 .end = MX3x_INT_IPU_SYN,
102 .flags = IORESOURCE_IRQ,
104 .start = MX3x_INT_IPU_ERR,
105 .end = MX3x_INT_IPU_ERR,
106 .flags = IORESOURCE_IRQ,
110 struct platform_device mx3_ipu = {
113 .num_resources = ARRAY_SIZE(mx3_ipu_rsrc),
114 .resource = mx3_ipu_rsrc,
117 static struct resource fb_resources[] = {
119 .start = MX3x_IPU_CTRL_BASE_ADDR + 0xB4,
120 .end = MX3x_IPU_CTRL_BASE_ADDR + 0x1BF,
121 .flags = IORESOURCE_MEM,
125 struct platform_device mx3_fb = {
126 .name = "mx3_sdc_fb",
128 .num_resources = ARRAY_SIZE(fb_resources),
129 .resource = fb_resources,
131 .coherent_dma_mask = DMA_BIT_MASK(32),
135 static struct resource camera_resources[] = {
137 .start = MX3x_IPU_CTRL_BASE_ADDR + 0x60,
138 .end = MX3x_IPU_CTRL_BASE_ADDR + 0x87,
139 .flags = IORESOURCE_MEM,
143 struct platform_device mx3_camera = {
144 .name = "mx3-camera",
146 .num_resources = ARRAY_SIZE(camera_resources),
147 .resource = camera_resources,
149 .coherent_dma_mask = DMA_BIT_MASK(32),
153 static struct resource otg_resources[] = {
155 .start = MX31_OTG_BASE_ADDR,
156 .end = MX31_OTG_BASE_ADDR + 0x1ff,
157 .flags = IORESOURCE_MEM,
159 .start = MX31_INT_USB3,
160 .end = MX31_INT_USB3,
161 .flags = IORESOURCE_IRQ,
165 static u64 otg_dmamask = DMA_BIT_MASK(32);
167 /* OTG gadget device */
168 struct platform_device mxc_otg_udc_device = {
169 .name = "fsl-usb2-udc",
172 .dma_mask = &otg_dmamask,
173 .coherent_dma_mask = DMA_BIT_MASK(32),
175 .resource = otg_resources,
176 .num_resources = ARRAY_SIZE(otg_resources),
180 struct platform_device mxc_otg_host = {
184 .coherent_dma_mask = 0xffffffff,
185 .dma_mask = &otg_dmamask,
187 .resource = otg_resources,
188 .num_resources = ARRAY_SIZE(otg_resources),
193 static u64 usbh1_dmamask = ~(u32)0;
195 static struct resource mxc_usbh1_resources[] = {
197 .start = MX31_OTG_BASE_ADDR + 0x200,
198 .end = MX31_OTG_BASE_ADDR + 0x3ff,
199 .flags = IORESOURCE_MEM,
201 .start = MX31_INT_USB1,
202 .end = MX31_INT_USB1,
203 .flags = IORESOURCE_IRQ,
207 struct platform_device mxc_usbh1 = {
211 .coherent_dma_mask = 0xffffffff,
212 .dma_mask = &usbh1_dmamask,
214 .resource = mxc_usbh1_resources,
215 .num_resources = ARRAY_SIZE(mxc_usbh1_resources),
218 #ifdef CONFIG_ARCH_MX31
220 static u64 usbh2_dmamask = ~(u32)0;
222 static struct resource mxc_usbh2_resources[] = {
224 .start = MX31_OTG_BASE_ADDR + 0x400,
225 .end = MX31_OTG_BASE_ADDR + 0x5ff,
226 .flags = IORESOURCE_MEM,
228 .start = MX31_INT_USB2,
229 .end = MX31_INT_USB2,
230 .flags = IORESOURCE_IRQ,
234 struct platform_device mxc_usbh2 = {
238 .coherent_dma_mask = 0xffffffff,
239 .dma_mask = &usbh2_dmamask,
241 .resource = mxc_usbh2_resources,
242 .num_resources = ARRAY_SIZE(mxc_usbh2_resources),
246 static struct resource imx_wdt_resources[] = {
248 .flags = IORESOURCE_MEM,
252 struct platform_device imx_wdt_device0 = {
255 .num_resources = ARRAY_SIZE(imx_wdt_resources),
256 .resource = imx_wdt_resources,
259 static struct resource imx_rtc_resources[] = {
261 .start = MX31_RTC_BASE_ADDR,
262 .end = MX31_RTC_BASE_ADDR + 0x3fff,
263 .flags = IORESOURCE_MEM,
266 .start = MX31_INT_RTC,
267 .flags = IORESOURCE_IRQ,
271 struct platform_device imx_rtc_device0 = {
274 .num_resources = ARRAY_SIZE(imx_rtc_resources),
275 .resource = imx_rtc_resources,
278 static struct resource imx_kpp_resources[] = {
280 .start = MX3x_KPP_BASE_ADDR,
281 .end = MX3x_KPP_BASE_ADDR + 0xf,
282 .flags = IORESOURCE_MEM
284 .start = MX3x_INT_KPP,
286 .flags = IORESOURCE_IRQ,
290 struct platform_device imx_kpp_device = {
291 .name = "imx-keypad",
293 .num_resources = ARRAY_SIZE(imx_kpp_resources),
294 .resource = imx_kpp_resources,
297 static int __init mx3_devices_init(void)
299 #if defined(CONFIG_ARCH_MX31)
301 imx_wdt_resources[0].start = MX31_WDOG_BASE_ADDR;
302 imx_wdt_resources[0].end = MX31_WDOG_BASE_ADDR + 0x3fff;
303 mxc_register_device(&mxc_rnga_device, NULL);
306 #if defined(CONFIG_ARCH_MX35)
308 otg_resources[0].start = MX35_OTG_BASE_ADDR;
309 otg_resources[0].end = MX35_OTG_BASE_ADDR + 0x1ff;
310 otg_resources[1].start = MX35_INT_USBOTG;
311 otg_resources[1].end = MX35_INT_USBOTG;
312 mxc_usbh1_resources[0].start = MX35_OTG_BASE_ADDR + 0x400;
313 mxc_usbh1_resources[0].end = MX35_OTG_BASE_ADDR + 0x5ff;
314 mxc_usbh1_resources[1].start = MX35_INT_USBHS;
315 mxc_usbh1_resources[1].end = MX35_INT_USBHS;
316 imx_wdt_resources[0].start = MX35_WDOG_BASE_ADDR;
317 imx_wdt_resources[0].end = MX35_WDOG_BASE_ADDR + 0x3fff;
324 subsys_initcall(mx3_devices_init);