2 * Copyright 2009 Sascha Hauer, <kernel@pengutronix.de>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 * Boston, MA 02110-1301, USA.
19 #include <linux/platform_device.h>
20 #include <linux/dma-mapping.h>
21 #include <linux/gpio.h>
22 #include <mach/mx25.h>
23 #include <mach/irqs.h>
25 static u64 otg_dmamask = DMA_BIT_MASK(32);
27 static struct resource mxc_otg_resources[] = {
29 .start = MX25_OTG_BASE_ADDR,
30 .end = MX25_OTG_BASE_ADDR + 0x1ff,
31 .flags = IORESOURCE_MEM,
35 .flags = IORESOURCE_IRQ,
39 struct platform_device mxc_otg = {
43 .coherent_dma_mask = 0xffffffff,
44 .dma_mask = &otg_dmamask,
46 .resource = mxc_otg_resources,
47 .num_resources = ARRAY_SIZE(mxc_otg_resources),
50 /* OTG gadget device */
51 struct platform_device otg_udc_device = {
52 .name = "fsl-usb2-udc",
55 .dma_mask = &otg_dmamask,
56 .coherent_dma_mask = 0xffffffff,
58 .resource = mxc_otg_resources,
59 .num_resources = ARRAY_SIZE(mxc_otg_resources),
62 static u64 usbh2_dmamask = DMA_BIT_MASK(32);
64 static struct resource mxc_usbh2_resources[] = {
66 .start = MX25_OTG_BASE_ADDR + 0x400,
67 .end = MX25_OTG_BASE_ADDR + 0x5ff,
68 .flags = IORESOURCE_MEM,
72 .flags = IORESOURCE_IRQ,
76 struct platform_device mxc_usbh2 = {
80 .coherent_dma_mask = 0xffffffff,
81 .dma_mask = &usbh2_dmamask,
83 .resource = mxc_usbh2_resources,
84 .num_resources = ARRAY_SIZE(mxc_usbh2_resources),
87 static struct resource mxc_pwm_resources0[] = {
91 .flags = IORESOURCE_MEM,
95 .flags = IORESOURCE_IRQ,
99 struct platform_device mxc_pwm_device0 = {
102 .num_resources = ARRAY_SIZE(mxc_pwm_resources0),
103 .resource = mxc_pwm_resources0,
106 static struct resource mxc_pwm_resources1[] = {
110 .flags = IORESOURCE_MEM,
114 .flags = IORESOURCE_IRQ,
118 struct platform_device mxc_pwm_device1 = {
121 .num_resources = ARRAY_SIZE(mxc_pwm_resources1),
122 .resource = mxc_pwm_resources1,
125 static struct resource mxc_pwm_resources2[] = {
129 .flags = IORESOURCE_MEM,
133 .flags = IORESOURCE_IRQ,
137 struct platform_device mxc_pwm_device2 = {
140 .num_resources = ARRAY_SIZE(mxc_pwm_resources2),
141 .resource = mxc_pwm_resources2,
144 static struct resource mxc_keypad_resources[] = {
148 .flags = IORESOURCE_MEM,
152 .flags = IORESOURCE_IRQ,
156 struct platform_device mxc_keypad_device = {
157 .name = "mxc-keypad",
159 .num_resources = ARRAY_SIZE(mxc_keypad_resources),
160 .resource = mxc_keypad_resources,
163 static struct resource mxc_pwm_resources3[] = {
167 .flags = IORESOURCE_MEM,
171 .flags = IORESOURCE_IRQ,
175 struct platform_device mxc_pwm_device3 = {
178 .num_resources = ARRAY_SIZE(mxc_pwm_resources3),
179 .resource = mxc_pwm_resources3,
182 static struct mxc_gpio_port imx_gpio_ports[] = {
184 .chip.label = "gpio-0",
185 .base = (void __iomem *)MX25_GPIO1_BASE_ADDR_VIRT,
187 .virtual_irq_start = MXC_GPIO_IRQ_START,
189 .chip.label = "gpio-1",
190 .base = (void __iomem *)MX25_GPIO2_BASE_ADDR_VIRT,
192 .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
194 .chip.label = "gpio-2",
195 .base = (void __iomem *)MX25_GPIO3_BASE_ADDR_VIRT,
197 .virtual_irq_start = MXC_GPIO_IRQ_START + 64,
199 .chip.label = "gpio-3",
200 .base = (void __iomem *)MX25_GPIO4_BASE_ADDR_VIRT,
202 .virtual_irq_start = MXC_GPIO_IRQ_START + 96,
206 int __init imx25_register_gpios(void)
208 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
211 static struct resource mx25_rtc_resources[] = {
213 .start = MX25_DRYICE_BASE_ADDR,
214 .end = MX25_DRYICE_BASE_ADDR + 0x40,
215 .flags = IORESOURCE_MEM,
218 .start = MX25_INT_DRYICE,
219 .flags = IORESOURCE_IRQ
223 struct platform_device mx25_rtc_device = {
226 .num_resources = ARRAY_SIZE(mx25_rtc_resources),
227 .resource = mx25_rtc_resources,
230 static struct resource mx25_fb_resources[] = {
232 .start = MX25_LCDC_BASE_ADDR,
233 .end = MX25_LCDC_BASE_ADDR + 0xfff,
234 .flags = IORESOURCE_MEM,
237 .start = MX25_INT_LCDC,
238 .end = MX25_INT_LCDC,
239 .flags = IORESOURCE_IRQ,
243 struct platform_device mx25_fb_device = {
246 .resource = mx25_fb_resources,
247 .num_resources = ARRAY_SIZE(mx25_fb_resources),
249 .coherent_dma_mask = 0xFFFFFFFF,
253 static struct resource mxc_wdt_resources[] = {
255 .start = MX25_WDOG_BASE_ADDR,
256 .end = MX25_WDOG_BASE_ADDR + SZ_16K - 1,
257 .flags = IORESOURCE_MEM,
261 struct platform_device mxc_wdt = {
264 .num_resources = ARRAY_SIZE(mxc_wdt_resources),
265 .resource = mxc_wdt_resources,
268 static struct resource mx25_kpp_resources[] = {
270 .start = MX25_KPP_BASE_ADDR,
271 .end = MX25_KPP_BASE_ADDR + 0xf,
272 .flags = IORESOURCE_MEM,
275 .start = MX25_INT_KPP,
277 .flags = IORESOURCE_IRQ,
281 struct platform_device mx25_kpp_device = {
282 .name = "imx-keypad",
284 .num_resources = ARRAY_SIZE(mx25_kpp_resources),
285 .resource = mx25_kpp_resources,
288 static struct resource mx25_csi_resources[] = {
290 .start = MX25_CSI_BASE_ADDR,
291 .end = MX25_CSI_BASE_ADDR + 0xfff,
292 .flags = IORESOURCE_MEM,
295 .start = MX25_INT_CSI,
296 .flags = IORESOURCE_IRQ
300 struct platform_device mx25_csi_device = {
301 .name = "mx2-camera",
303 .num_resources = ARRAY_SIZE(mx25_csi_resources),
304 .resource = mx25_csi_resources,
306 .coherent_dma_mask = 0xffffffff,