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_fec_resources[] = {
213 .start = MX25_FEC_BASE_ADDR,
214 .end = MX25_FEC_BASE_ADDR + 0xfff,
215 .flags = IORESOURCE_MEM,
218 .start = MX25_INT_FEC,
220 .flags = IORESOURCE_IRQ,
224 struct platform_device mx25_fec_device = {
227 .num_resources = ARRAY_SIZE(mx25_fec_resources),
228 .resource = mx25_fec_resources,
231 static struct resource mx25_rtc_resources[] = {
233 .start = MX25_DRYICE_BASE_ADDR,
234 .end = MX25_DRYICE_BASE_ADDR + 0x40,
235 .flags = IORESOURCE_MEM,
238 .start = MX25_INT_DRYICE,
239 .flags = IORESOURCE_IRQ
243 struct platform_device mx25_rtc_device = {
246 .num_resources = ARRAY_SIZE(mx25_rtc_resources),
247 .resource = mx25_rtc_resources,
250 static struct resource mx25_fb_resources[] = {
252 .start = MX25_LCDC_BASE_ADDR,
253 .end = MX25_LCDC_BASE_ADDR + 0xfff,
254 .flags = IORESOURCE_MEM,
257 .start = MX25_INT_LCDC,
258 .end = MX25_INT_LCDC,
259 .flags = IORESOURCE_IRQ,
263 struct platform_device mx25_fb_device = {
266 .resource = mx25_fb_resources,
267 .num_resources = ARRAY_SIZE(mx25_fb_resources),
269 .coherent_dma_mask = 0xFFFFFFFF,
273 static struct resource mxc_wdt_resources[] = {
275 .start = MX25_WDOG_BASE_ADDR,
276 .end = MX25_WDOG_BASE_ADDR + SZ_16K - 1,
277 .flags = IORESOURCE_MEM,
281 struct platform_device mxc_wdt = {
284 .num_resources = ARRAY_SIZE(mxc_wdt_resources),
285 .resource = mxc_wdt_resources,
288 static struct resource mx25_kpp_resources[] = {
290 .start = MX25_KPP_BASE_ADDR,
291 .end = MX25_KPP_BASE_ADDR + 0xf,
292 .flags = IORESOURCE_MEM,
295 .start = MX25_INT_KPP,
297 .flags = IORESOURCE_IRQ,
301 struct platform_device mx25_kpp_device = {
302 .name = "imx-keypad",
304 .num_resources = ARRAY_SIZE(mx25_kpp_resources),
305 .resource = mx25_kpp_resources,
308 static struct resource imx_ssi_resources0[] = {
310 .start = MX25_SSI1_BASE_ADDR,
311 .end = MX25_SSI1_BASE_ADDR + 0x3fff,
312 .flags = IORESOURCE_MEM,
314 .start = MX25_INT_SSI1,
315 .end = MX25_INT_SSI1,
316 .flags = IORESOURCE_IRQ,
320 static struct resource imx_ssi_resources1[] = {
322 .start = MX25_SSI2_BASE_ADDR,
323 .end = MX25_SSI2_BASE_ADDR + 0x3fff,
324 .flags = IORESOURCE_MEM
326 .start = MX25_INT_SSI2,
327 .end = MX25_INT_SSI2,
328 .flags = IORESOURCE_IRQ,
332 struct platform_device imx_ssi_device0 = {
335 .num_resources = ARRAY_SIZE(imx_ssi_resources0),
336 .resource = imx_ssi_resources0,
339 struct platform_device imx_ssi_device1 = {
342 .num_resources = ARRAY_SIZE(imx_ssi_resources1),
343 .resource = imx_ssi_resources1,
346 static struct resource mx25_csi_resources[] = {
348 .start = MX25_CSI_BASE_ADDR,
349 .end = MX25_CSI_BASE_ADDR + 0xfff,
350 .flags = IORESOURCE_MEM,
353 .start = MX25_INT_CSI,
354 .flags = IORESOURCE_IRQ
358 struct platform_device mx25_csi_device = {
359 .name = "mx2-camera",
361 .num_resources = ARRAY_SIZE(mx25_csi_resources),
362 .resource = mx25_csi_resources,
364 .coherent_dma_mask = 0xffffffff,