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 /* GPIO port description */
33 static struct mxc_gpio_port imx_gpio_ports[] = {
35 .chip.label = "gpio-0",
36 .base = MX31_IO_ADDRESS(MX31_GPIO1_BASE_ADDR),
37 .irq = MX3x_INT_GPIO1,
38 .virtual_irq_start = MXC_GPIO_IRQ_START,
40 .chip.label = "gpio-1",
41 .base = MX31_IO_ADDRESS(MX31_GPIO2_BASE_ADDR),
42 .irq = MX3x_INT_GPIO2,
43 .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
45 .chip.label = "gpio-2",
46 .base = MX31_IO_ADDRESS(MX31_GPIO3_BASE_ADDR),
47 .irq = MX3x_INT_GPIO3,
48 .virtual_irq_start = MXC_GPIO_IRQ_START + 64,
52 int __init imx3x_register_gpios(void)
54 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
57 #ifdef CONFIG_ARCH_MX31
58 static struct resource mxcsdhc0_resources[] = {
60 .start = MX31_MMC_SDHC1_BASE_ADDR,
61 .end = MX31_MMC_SDHC1_BASE_ADDR + SZ_16K - 1,
62 .flags = IORESOURCE_MEM,
64 .start = MX31_INT_MMC_SDHC1,
65 .end = MX31_INT_MMC_SDHC1,
66 .flags = IORESOURCE_IRQ,
70 static struct resource mxcsdhc1_resources[] = {
72 .start = MX31_MMC_SDHC2_BASE_ADDR,
73 .end = MX31_MMC_SDHC2_BASE_ADDR + SZ_16K - 1,
74 .flags = IORESOURCE_MEM,
76 .start = MX31_INT_MMC_SDHC2,
77 .end = MX31_INT_MMC_SDHC2,
78 .flags = IORESOURCE_IRQ,
82 struct platform_device mxcsdhc_device0 = {
85 .num_resources = ARRAY_SIZE(mxcsdhc0_resources),
86 .resource = mxcsdhc0_resources,
89 struct platform_device mxcsdhc_device1 = {
92 .num_resources = ARRAY_SIZE(mxcsdhc1_resources),
93 .resource = mxcsdhc1_resources,
96 static struct resource rnga_resources[] = {
98 .start = MX3x_RNGA_BASE_ADDR,
99 .end = MX3x_RNGA_BASE_ADDR + 0x28,
100 .flags = IORESOURCE_MEM,
104 struct platform_device mxc_rnga_device = {
108 .resource = rnga_resources,
110 #endif /* CONFIG_ARCH_MX31 */
112 /* i.MX31 Image Processing Unit */
114 /* The resource order is important! */
115 static struct resource mx3_ipu_rsrc[] = {
117 .start = MX3x_IPU_CTRL_BASE_ADDR,
118 .end = MX3x_IPU_CTRL_BASE_ADDR + 0x5F,
119 .flags = IORESOURCE_MEM,
121 .start = MX3x_IPU_CTRL_BASE_ADDR + 0x88,
122 .end = MX3x_IPU_CTRL_BASE_ADDR + 0xB3,
123 .flags = IORESOURCE_MEM,
125 .start = MX3x_INT_IPU_SYN,
126 .end = MX3x_INT_IPU_SYN,
127 .flags = IORESOURCE_IRQ,
129 .start = MX3x_INT_IPU_ERR,
130 .end = MX3x_INT_IPU_ERR,
131 .flags = IORESOURCE_IRQ,
135 struct platform_device mx3_ipu = {
138 .num_resources = ARRAY_SIZE(mx3_ipu_rsrc),
139 .resource = mx3_ipu_rsrc,
142 static struct resource fb_resources[] = {
144 .start = MX3x_IPU_CTRL_BASE_ADDR + 0xB4,
145 .end = MX3x_IPU_CTRL_BASE_ADDR + 0x1BF,
146 .flags = IORESOURCE_MEM,
150 struct platform_device mx3_fb = {
151 .name = "mx3_sdc_fb",
153 .num_resources = ARRAY_SIZE(fb_resources),
154 .resource = fb_resources,
156 .coherent_dma_mask = DMA_BIT_MASK(32),
160 static struct resource camera_resources[] = {
162 .start = MX3x_IPU_CTRL_BASE_ADDR + 0x60,
163 .end = MX3x_IPU_CTRL_BASE_ADDR + 0x87,
164 .flags = IORESOURCE_MEM,
168 struct platform_device mx3_camera = {
169 .name = "mx3-camera",
171 .num_resources = ARRAY_SIZE(camera_resources),
172 .resource = camera_resources,
174 .coherent_dma_mask = DMA_BIT_MASK(32),
178 static struct resource otg_resources[] = {
180 .start = MX31_OTG_BASE_ADDR,
181 .end = MX31_OTG_BASE_ADDR + 0x1ff,
182 .flags = IORESOURCE_MEM,
184 .start = MX31_INT_USB3,
185 .end = MX31_INT_USB3,
186 .flags = IORESOURCE_IRQ,
190 static u64 otg_dmamask = DMA_BIT_MASK(32);
192 /* OTG gadget device */
193 struct platform_device mxc_otg_udc_device = {
194 .name = "fsl-usb2-udc",
197 .dma_mask = &otg_dmamask,
198 .coherent_dma_mask = DMA_BIT_MASK(32),
200 .resource = otg_resources,
201 .num_resources = ARRAY_SIZE(otg_resources),
205 struct platform_device mxc_otg_host = {
209 .coherent_dma_mask = 0xffffffff,
210 .dma_mask = &otg_dmamask,
212 .resource = otg_resources,
213 .num_resources = ARRAY_SIZE(otg_resources),
218 static u64 usbh1_dmamask = ~(u32)0;
220 static struct resource mxc_usbh1_resources[] = {
222 .start = MX31_OTG_BASE_ADDR + 0x200,
223 .end = MX31_OTG_BASE_ADDR + 0x3ff,
224 .flags = IORESOURCE_MEM,
226 .start = MX31_INT_USB1,
227 .end = MX31_INT_USB1,
228 .flags = IORESOURCE_IRQ,
232 struct platform_device mxc_usbh1 = {
236 .coherent_dma_mask = 0xffffffff,
237 .dma_mask = &usbh1_dmamask,
239 .resource = mxc_usbh1_resources,
240 .num_resources = ARRAY_SIZE(mxc_usbh1_resources),
243 #ifdef CONFIG_ARCH_MX31
245 static u64 usbh2_dmamask = ~(u32)0;
247 static struct resource mxc_usbh2_resources[] = {
249 .start = MX31_OTG_BASE_ADDR + 0x400,
250 .end = MX31_OTG_BASE_ADDR + 0x5ff,
251 .flags = IORESOURCE_MEM,
253 .start = MX31_INT_USB2,
254 .end = MX31_INT_USB2,
255 .flags = IORESOURCE_IRQ,
259 struct platform_device mxc_usbh2 = {
263 .coherent_dma_mask = 0xffffffff,
264 .dma_mask = &usbh2_dmamask,
266 .resource = mxc_usbh2_resources,
267 .num_resources = ARRAY_SIZE(mxc_usbh2_resources),
271 static struct resource imx_wdt_resources[] = {
273 .flags = IORESOURCE_MEM,
277 struct platform_device imx_wdt_device0 = {
280 .num_resources = ARRAY_SIZE(imx_wdt_resources),
281 .resource = imx_wdt_resources,
284 static struct resource imx_rtc_resources[] = {
286 .start = MX31_RTC_BASE_ADDR,
287 .end = MX31_RTC_BASE_ADDR + 0x3fff,
288 .flags = IORESOURCE_MEM,
291 .start = MX31_INT_RTC,
292 .flags = IORESOURCE_IRQ,
296 struct platform_device imx_rtc_device0 = {
299 .num_resources = ARRAY_SIZE(imx_rtc_resources),
300 .resource = imx_rtc_resources,
303 static struct resource imx_kpp_resources[] = {
305 .start = MX3x_KPP_BASE_ADDR,
306 .end = MX3x_KPP_BASE_ADDR + 0xf,
307 .flags = IORESOURCE_MEM
309 .start = MX3x_INT_KPP,
311 .flags = IORESOURCE_IRQ,
315 struct platform_device imx_kpp_device = {
316 .name = "imx-keypad",
318 .num_resources = ARRAY_SIZE(imx_kpp_resources),
319 .resource = imx_kpp_resources,
322 static int __init mx3_devices_init(void)
324 #if defined(CONFIG_ARCH_MX31)
326 imx_wdt_resources[0].start = MX31_WDOG_BASE_ADDR;
327 imx_wdt_resources[0].end = MX31_WDOG_BASE_ADDR + 0x3fff;
328 mxc_register_device(&mxc_rnga_device, NULL);
331 #if defined(CONFIG_ARCH_MX35)
333 imx_gpio_ports[0].base = MX35_IO_ADDRESS(MX35_GPIO1_BASE_ADDR),
334 imx_gpio_ports[1].base = MX35_IO_ADDRESS(MX35_GPIO2_BASE_ADDR),
335 imx_gpio_ports[2].base = MX35_IO_ADDRESS(MX35_GPIO3_BASE_ADDR),
336 otg_resources[0].start = MX35_OTG_BASE_ADDR;
337 otg_resources[0].end = MX35_OTG_BASE_ADDR + 0x1ff;
338 otg_resources[1].start = MX35_INT_USBOTG;
339 otg_resources[1].end = MX35_INT_USBOTG;
340 mxc_usbh1_resources[0].start = MX35_OTG_BASE_ADDR + 0x400;
341 mxc_usbh1_resources[0].end = MX35_OTG_BASE_ADDR + 0x5ff;
342 mxc_usbh1_resources[1].start = MX35_INT_USBHS;
343 mxc_usbh1_resources[1].end = MX35_INT_USBHS;
344 imx_wdt_resources[0].start = MX35_WDOG_BASE_ADDR;
345 imx_wdt_resources[0].end = MX35_WDOG_BASE_ADDR + 0x3fff;
352 subsys_initcall(mx3_devices_init);