Juergen Beisert | fc80a5e | 2008-07-05 10:02:57 +0200 | [diff] [blame] | 1 | /* |
| 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 |
Uwe Kleine-König | 0746949 | 2010-06-14 15:56:58 +0200 | [diff] [blame] | 14 | * Copyright 2008 Sascha Hauer, kernel@pengutronix.de |
| 15 | * Copyright (c) 2008 Paulius Zaleckas <paulius.zaleckas@teltonika.lt> |
| 16 | * Copyright (c) 2008 Darius Augulis <darius.augulis@teltonika.lt> |
Juergen Beisert | fc80a5e | 2008-07-05 10:02:57 +0200 | [diff] [blame] | 17 | * |
| 18 | * This program is free software; you can redistribute it and/or |
| 19 | * modify it under the terms of the GNU General Public License |
| 20 | * as published by the Free Software Foundation; either version 2 |
| 21 | * of the License, or (at your option) any later version. |
| 22 | * This program is distributed in the hope that it will be useful, |
| 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 25 | * GNU General Public License for more details. |
| 26 | * |
| 27 | * You should have received a copy of the GNU General Public License |
| 28 | * along with this program; if not, write to the Free Software |
| 29 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
| 30 | * MA 02110-1301, USA. |
| 31 | */ |
| 32 | #include <linux/module.h> |
| 33 | #include <linux/kernel.h> |
| 34 | #include <linux/init.h> |
| 35 | #include <linux/platform_device.h> |
| 36 | #include <linux/gpio.h> |
Martin Fuzzey | 3eb352c | 2009-11-21 12:14:54 +0100 | [diff] [blame] | 37 | #include <linux/dma-mapping.h> |
Uwe Kleine-König | e9ec2a1 | 2010-06-10 17:34:59 +0200 | [diff] [blame] | 38 | #include <linux/serial.h> |
Juergen Beisert | fc80a5e | 2008-07-05 10:02:57 +0200 | [diff] [blame] | 39 | |
Russell King | 80b02c1 | 2009-01-08 10:01:47 +0000 | [diff] [blame] | 40 | #include <mach/irqs.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 41 | #include <mach/hardware.h> |
Holger Schurig | 058b7a6 | 2009-01-26 16:34:51 +0100 | [diff] [blame] | 42 | #include <mach/common.h> |
Sascha Hauer | 1a02be0 | 2008-12-19 14:32:07 +0100 | [diff] [blame] | 43 | #include <mach/mmc.h> |
Holger Schurig | 058b7a6 | 2009-01-26 16:34:51 +0100 | [diff] [blame] | 44 | |
| 45 | #include "devices.h" |
Juergen Beisert | fc80a5e | 2008-07-05 10:02:57 +0200 | [diff] [blame] | 46 | |
Uwe Kleine-König | 0746949 | 2010-06-14 15:56:58 +0200 | [diff] [blame] | 47 | #if defined(CONFIG_ARCH_MX1) |
| 48 | static struct resource imx1_camera_resources[] = { |
| 49 | { |
| 50 | .start = 0x00224000, |
| 51 | .end = 0x00224010, |
| 52 | .flags = IORESOURCE_MEM, |
| 53 | }, { |
| 54 | .start = MX1_CSI_INT, |
| 55 | .end = MX1_CSI_INT, |
| 56 | .flags = IORESOURCE_IRQ, |
| 57 | }, |
| 58 | }; |
| 59 | |
| 60 | static u64 imx1_camera_dmamask = DMA_BIT_MASK(32); |
| 61 | |
| 62 | struct platform_device imx1_camera_device = { |
| 63 | .name = "mx1-camera", |
| 64 | .id = 0, /* This is used to put cameras on this interface */ |
| 65 | .dev = { |
| 66 | .dma_mask = &imx1_camera_dmamask, |
| 67 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 68 | }, |
| 69 | .resource = imx1_camera_resources, |
| 70 | .num_resources = ARRAY_SIZE(imx1_camera_resources), |
| 71 | }; |
| 72 | |
Uwe Kleine-König | 0746949 | 2010-06-14 15:56:58 +0200 | [diff] [blame] | 73 | static struct resource imx_rtc_resources[] = { |
| 74 | { |
| 75 | .start = 0x00204000, |
| 76 | .end = 0x00204024, |
| 77 | .flags = IORESOURCE_MEM, |
| 78 | }, { |
| 79 | .start = MX1_RTC_INT, |
| 80 | .end = MX1_RTC_INT, |
| 81 | .flags = IORESOURCE_IRQ, |
| 82 | }, { |
| 83 | .start = MX1_RTC_SAMINT, |
| 84 | .end = MX1_RTC_SAMINT, |
| 85 | .flags = IORESOURCE_IRQ, |
| 86 | }, |
| 87 | }; |
| 88 | |
| 89 | struct platform_device imx_rtc_device = { |
| 90 | .name = "rtc-imx", |
| 91 | .id = 0, |
| 92 | .resource = imx_rtc_resources, |
| 93 | .num_resources = ARRAY_SIZE(imx_rtc_resources), |
| 94 | }; |
| 95 | |
| 96 | static struct resource imx_wdt_resources[] = { |
| 97 | { |
| 98 | .start = 0x00201000, |
| 99 | .end = 0x00201008, |
| 100 | .flags = IORESOURCE_MEM, |
| 101 | }, { |
| 102 | .start = MX1_WDT_INT, |
| 103 | .end = MX1_WDT_INT, |
| 104 | .flags = IORESOURCE_IRQ, |
| 105 | }, |
| 106 | }; |
| 107 | |
| 108 | struct platform_device imx_wdt_device = { |
| 109 | .name = "imx-wdt", |
| 110 | .id = 0, |
| 111 | .resource = imx_wdt_resources, |
| 112 | .num_resources = ARRAY_SIZE(imx_wdt_resources), |
| 113 | }; |
| 114 | |
| 115 | static struct resource imx_usb_resources[] = { |
| 116 | { |
| 117 | .start = 0x00212000, |
| 118 | .end = 0x00212148, |
| 119 | .flags = IORESOURCE_MEM, |
| 120 | }, { |
| 121 | .start = MX1_USBD_INT0, |
| 122 | .end = MX1_USBD_INT0, |
| 123 | .flags = IORESOURCE_IRQ, |
| 124 | }, { |
| 125 | .start = MX1_USBD_INT1, |
| 126 | .end = MX1_USBD_INT1, |
| 127 | .flags = IORESOURCE_IRQ, |
| 128 | }, { |
| 129 | .start = MX1_USBD_INT2, |
| 130 | .end = MX1_USBD_INT2, |
| 131 | .flags = IORESOURCE_IRQ, |
| 132 | }, { |
| 133 | .start = MX1_USBD_INT3, |
| 134 | .end = MX1_USBD_INT3, |
| 135 | .flags = IORESOURCE_IRQ, |
| 136 | }, { |
| 137 | .start = MX1_USBD_INT4, |
| 138 | .end = MX1_USBD_INT4, |
| 139 | .flags = IORESOURCE_IRQ, |
| 140 | }, { |
| 141 | .start = MX1_USBD_INT5, |
| 142 | .end = MX1_USBD_INT5, |
| 143 | .flags = IORESOURCE_IRQ, |
| 144 | }, { |
| 145 | .start = MX1_USBD_INT6, |
| 146 | .end = MX1_USBD_INT6, |
| 147 | .flags = IORESOURCE_IRQ, |
| 148 | }, |
| 149 | }; |
| 150 | |
| 151 | struct platform_device imx_usb_device = { |
| 152 | .name = "imx_udc", |
| 153 | .id = 0, |
| 154 | .num_resources = ARRAY_SIZE(imx_usb_resources), |
| 155 | .resource = imx_usb_resources, |
| 156 | }; |
| 157 | |
| 158 | /* GPIO port description */ |
| 159 | static struct mxc_gpio_port imx_gpio_ports[] = { |
| 160 | { |
| 161 | .chip.label = "gpio-0", |
Uwe Kleine-König | cf3a6ab | 2010-10-25 15:54:58 +0200 | [diff] [blame] | 162 | .base = MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR), |
Uwe Kleine-König | 0746949 | 2010-06-14 15:56:58 +0200 | [diff] [blame] | 163 | .irq = MX1_GPIO_INT_PORTA, |
| 164 | .virtual_irq_start = MXC_GPIO_IRQ_START, |
| 165 | }, { |
| 166 | .chip.label = "gpio-1", |
Uwe Kleine-König | cf3a6ab | 2010-10-25 15:54:58 +0200 | [diff] [blame] | 167 | .base = MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x100), |
Uwe Kleine-König | 0746949 | 2010-06-14 15:56:58 +0200 | [diff] [blame] | 168 | .irq = MX1_GPIO_INT_PORTB, |
| 169 | .virtual_irq_start = MXC_GPIO_IRQ_START + 32, |
| 170 | }, { |
| 171 | .chip.label = "gpio-2", |
Uwe Kleine-König | cf3a6ab | 2010-10-25 15:54:58 +0200 | [diff] [blame] | 172 | .base = MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x200), |
Uwe Kleine-König | 0746949 | 2010-06-14 15:56:58 +0200 | [diff] [blame] | 173 | .irq = MX1_GPIO_INT_PORTC, |
| 174 | .virtual_irq_start = MXC_GPIO_IRQ_START + 64, |
| 175 | }, { |
| 176 | .chip.label = "gpio-3", |
Uwe Kleine-König | cf3a6ab | 2010-10-25 15:54:58 +0200 | [diff] [blame] | 177 | .base = MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x300), |
Uwe Kleine-König | 0746949 | 2010-06-14 15:56:58 +0200 | [diff] [blame] | 178 | .irq = MX1_GPIO_INT_PORTD, |
| 179 | .virtual_irq_start = MXC_GPIO_IRQ_START + 96, |
| 180 | } |
| 181 | }; |
| 182 | |
| 183 | int __init imx1_register_gpios(void) |
| 184 | { |
| 185 | return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports)); |
| 186 | } |
| 187 | #endif |
| 188 | |
| 189 | #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27) |
Uwe Kleine-König | 2dcf78c | 2010-06-30 12:16:24 +0200 | [diff] [blame] | 190 | |
Baruch Siach | 94d3595 | 2010-06-21 08:15:59 +0300 | [diff] [blame] | 191 | #ifdef CONFIG_MACH_MX27 |
| 192 | static struct resource mx27_camera_resources[] = { |
| 193 | { |
| 194 | .start = MX27_CSI_BASE_ADDR, |
| 195 | .end = MX27_CSI_BASE_ADDR + 0x1f, |
| 196 | .flags = IORESOURCE_MEM, |
| 197 | }, { |
| 198 | .start = MX27_EMMA_PRP_BASE_ADDR, |
| 199 | .end = MX27_EMMA_PRP_BASE_ADDR + 0x1f, |
| 200 | .flags = IORESOURCE_MEM, |
| 201 | }, { |
| 202 | .start = MX27_INT_CSI, |
| 203 | .end = MX27_INT_CSI, |
| 204 | .flags = IORESOURCE_IRQ, |
| 205 | },{ |
| 206 | .start = MX27_INT_EMMAPRP, |
| 207 | .end = MX27_INT_EMMAPRP, |
| 208 | .flags = IORESOURCE_IRQ, |
| 209 | }, |
| 210 | }; |
| 211 | struct platform_device mx27_camera_device = { |
| 212 | .name = "mx2-camera", |
| 213 | .id = 0, |
| 214 | .num_resources = ARRAY_SIZE(mx27_camera_resources), |
| 215 | .resource = mx27_camera_resources, |
| 216 | .dev = { |
| 217 | .coherent_dma_mask = 0xffffffff, |
| 218 | }, |
| 219 | }; |
| 220 | #endif |
| 221 | |
Juergen Beisert | fc80a5e | 2008-07-05 10:02:57 +0200 | [diff] [blame] | 222 | /* |
Juergen Beisert | fc80a5e | 2008-07-05 10:02:57 +0200 | [diff] [blame] | 223 | * General Purpose Timer |
Sascha Hauer | bf50bcc | 2009-06-23 12:04:36 +0200 | [diff] [blame] | 224 | * - i.MX21: 3 timers |
| 225 | * - i.MX27: 6 timers |
Juergen Beisert | fc80a5e | 2008-07-05 10:02:57 +0200 | [diff] [blame] | 226 | */ |
Uwe Kleine-König | 2b84a364 | 2010-02-04 14:11:02 +0100 | [diff] [blame] | 227 | #define DEFINE_IMX_GPT_DEVICE(n, baseaddr, irq) \ |
| 228 | static struct resource timer ## n ##_resources[] = { \ |
| 229 | { \ |
| 230 | .start = baseaddr, \ |
| 231 | .end = baseaddr + SZ_4K - 1, \ |
| 232 | .flags = IORESOURCE_MEM, \ |
| 233 | }, { \ |
| 234 | .start = irq, \ |
| 235 | .end = irq, \ |
| 236 | .flags = IORESOURCE_IRQ, \ |
| 237 | } \ |
| 238 | }; \ |
| 239 | \ |
| 240 | struct platform_device mxc_gpt ## n = { \ |
| 241 | .name = "imx_gpt", \ |
| 242 | .id = n, \ |
| 243 | .num_resources = ARRAY_SIZE(timer ## n ## _resources), \ |
| 244 | .resource = timer ## n ## _resources, \ |
Juergen Beisert | fc80a5e | 2008-07-05 10:02:57 +0200 | [diff] [blame] | 245 | } |
Juergen Beisert | fc80a5e | 2008-07-05 10:02:57 +0200 | [diff] [blame] | 246 | |
Uwe Kleine-König | 2b84a364 | 2010-02-04 14:11:02 +0100 | [diff] [blame] | 247 | /* We use gpt1 as system timer, so do not add a device for this one */ |
| 248 | DEFINE_IMX_GPT_DEVICE(1, MX2x_GPT2_BASE_ADDR, MX2x_INT_GPT2); |
| 249 | DEFINE_IMX_GPT_DEVICE(2, MX2x_GPT3_BASE_ADDR, MX2x_INT_GPT3); |
Juergen Beisert | fc80a5e | 2008-07-05 10:02:57 +0200 | [diff] [blame] | 250 | |
| 251 | #ifdef CONFIG_MACH_MX27 |
Uwe Kleine-König | 2b84a364 | 2010-02-04 14:11:02 +0100 | [diff] [blame] | 252 | DEFINE_IMX_GPT_DEVICE(3, MX27_GPT4_BASE_ADDR, MX27_INT_GPT4); |
| 253 | DEFINE_IMX_GPT_DEVICE(4, MX27_GPT5_BASE_ADDR, MX27_INT_GPT5); |
| 254 | DEFINE_IMX_GPT_DEVICE(5, MX27_GPT6_BASE_ADDR, MX27_INT_GPT6); |
Juergen Beisert | fc80a5e | 2008-07-05 10:02:57 +0200 | [diff] [blame] | 255 | #endif |
| 256 | |
Wolfram Sang | 6d38c1c | 2010-04-29 10:03:18 +0200 | [diff] [blame] | 257 | /* Watchdog: i.MX1 has seperate driver, i.MX21 and i.MX27 are equal */ |
Juergen Beisert | fc80a5e | 2008-07-05 10:02:57 +0200 | [diff] [blame] | 258 | static struct resource mxc_wdt_resources[] = { |
| 259 | { |
Uwe Kleine-König | 58152a1 | 2010-02-05 11:42:54 +0100 | [diff] [blame] | 260 | .start = MX2x_WDOG_BASE_ADDR, |
| 261 | .end = MX2x_WDOG_BASE_ADDR + SZ_4K - 1, |
| 262 | .flags = IORESOURCE_MEM, |
Juergen Beisert | fc80a5e | 2008-07-05 10:02:57 +0200 | [diff] [blame] | 263 | }, |
| 264 | }; |
| 265 | |
| 266 | struct platform_device mxc_wdt = { |
Wolfram Sang | 6d38c1c | 2010-04-29 10:03:18 +0200 | [diff] [blame] | 267 | .name = "imx2-wdt", |
Juergen Beisert | fc80a5e | 2008-07-05 10:02:57 +0200 | [diff] [blame] | 268 | .id = 0, |
| 269 | .num_resources = ARRAY_SIZE(mxc_wdt_resources), |
| 270 | .resource = mxc_wdt_resources, |
| 271 | }; |
| 272 | |
Holger Schurig | e481355 | 2009-01-26 16:34:56 +0100 | [diff] [blame] | 273 | /* |
| 274 | * lcdc: |
| 275 | * - i.MX1: the basic controller |
| 276 | * - i.MX21: to be checked |
| 277 | * - i.MX27: like i.MX1, with slightly variations |
| 278 | */ |
| 279 | static struct resource mxc_fb[] = { |
| 280 | { |
Uwe Kleine-König | 58152a1 | 2010-02-05 11:42:54 +0100 | [diff] [blame] | 281 | .start = MX2x_LCDC_BASE_ADDR, |
| 282 | .end = MX2x_LCDC_BASE_ADDR + SZ_4K - 1, |
Holger Schurig | e481355 | 2009-01-26 16:34:56 +0100 | [diff] [blame] | 283 | .flags = IORESOURCE_MEM, |
Sascha Hauer | bf50bcc | 2009-06-23 12:04:36 +0200 | [diff] [blame] | 284 | }, { |
Uwe Kleine-König | 58152a1 | 2010-02-05 11:42:54 +0100 | [diff] [blame] | 285 | .start = MX2x_INT_LCDC, |
| 286 | .end = MX2x_INT_LCDC, |
Holger Schurig | e481355 | 2009-01-26 16:34:56 +0100 | [diff] [blame] | 287 | .flags = IORESOURCE_IRQ, |
| 288 | } |
| 289 | }; |
| 290 | |
| 291 | /* mxc lcd driver */ |
| 292 | struct platform_device mxc_fb_device = { |
| 293 | .name = "imx-fb", |
| 294 | .id = 0, |
| 295 | .num_resources = ARRAY_SIZE(mxc_fb), |
| 296 | .resource = mxc_fb, |
| 297 | .dev = { |
Martin Fuzzey | 3eb352c | 2009-11-21 12:14:54 +0100 | [diff] [blame] | 298 | .coherent_dma_mask = DMA_BIT_MASK(32), |
Holger Schurig | e481355 | 2009-01-26 16:34:56 +0100 | [diff] [blame] | 299 | }, |
| 300 | }; |
| 301 | |
Sascha Hauer | 824b16e | 2009-01-16 15:17:46 +0100 | [diff] [blame] | 302 | static struct resource mxc_pwm_resources[] = { |
Sascha Hauer | bf50bcc | 2009-06-23 12:04:36 +0200 | [diff] [blame] | 303 | { |
Uwe Kleine-König | 58152a1 | 2010-02-05 11:42:54 +0100 | [diff] [blame] | 304 | .start = MX2x_PWM_BASE_ADDR, |
| 305 | .end = MX2x_PWM_BASE_ADDR + SZ_4K - 1, |
| 306 | .flags = IORESOURCE_MEM, |
Sascha Hauer | bf50bcc | 2009-06-23 12:04:36 +0200 | [diff] [blame] | 307 | }, { |
Uwe Kleine-König | 58152a1 | 2010-02-05 11:42:54 +0100 | [diff] [blame] | 308 | .start = MX2x_INT_PWM, |
| 309 | .end = MX2x_INT_PWM, |
| 310 | .flags = IORESOURCE_IRQ, |
Sascha Hauer | 824b16e | 2009-01-16 15:17:46 +0100 | [diff] [blame] | 311 | } |
| 312 | }; |
| 313 | |
| 314 | struct platform_device mxc_pwm_device = { |
| 315 | .name = "mxc_pwm", |
| 316 | .id = 0, |
| 317 | .num_resources = ARRAY_SIZE(mxc_pwm_resources), |
Sascha Hauer | bf50bcc | 2009-06-23 12:04:36 +0200 | [diff] [blame] | 318 | .resource = mxc_pwm_resources, |
Sascha Hauer | 824b16e | 2009-01-16 15:17:46 +0100 | [diff] [blame] | 319 | }; |
| 320 | |
Uwe Kleine-König | ccd0e42 | 2010-02-05 10:46:56 +0100 | [diff] [blame] | 321 | #define DEFINE_MXC_MMC_DEVICE(n, baseaddr, irq, dmareq) \ |
| 322 | static struct resource mxc_sdhc_resources ## n[] = { \ |
| 323 | { \ |
| 324 | .start = baseaddr, \ |
| 325 | .end = baseaddr + SZ_4K - 1, \ |
| 326 | .flags = IORESOURCE_MEM, \ |
| 327 | }, { \ |
| 328 | .start = irq, \ |
| 329 | .end = irq, \ |
| 330 | .flags = IORESOURCE_IRQ, \ |
| 331 | }, { \ |
| 332 | .start = dmareq, \ |
| 333 | .end = dmareq, \ |
| 334 | .flags = IORESOURCE_DMA, \ |
| 335 | }, \ |
| 336 | }; \ |
| 337 | \ |
Russell King | 988addf | 2010-03-08 20:21:04 +0000 | [diff] [blame] | 338 | static u64 mxc_sdhc ## n ## _dmamask = DMA_BIT_MASK(32); \ |
Uwe Kleine-König | ccd0e42 | 2010-02-05 10:46:56 +0100 | [diff] [blame] | 339 | \ |
| 340 | struct platform_device mxc_sdhc_device ## n = { \ |
| 341 | .name = "mxc-mmc", \ |
| 342 | .id = n, \ |
| 343 | .dev = { \ |
| 344 | .dma_mask = &mxc_sdhc ## n ## _dmamask, \ |
Russell King | 988addf | 2010-03-08 20:21:04 +0000 | [diff] [blame] | 345 | .coherent_dma_mask = DMA_BIT_MASK(32), \ |
Uwe Kleine-König | ccd0e42 | 2010-02-05 10:46:56 +0100 | [diff] [blame] | 346 | }, \ |
| 347 | .num_resources = ARRAY_SIZE(mxc_sdhc_resources ## n), \ |
| 348 | .resource = mxc_sdhc_resources ## n, \ |
| 349 | } |
Sascha Hauer | 1a02be0 | 2008-12-19 14:32:07 +0100 | [diff] [blame] | 350 | |
Uwe Kleine-König | ccd0e42 | 2010-02-05 10:46:56 +0100 | [diff] [blame] | 351 | DEFINE_MXC_MMC_DEVICE(0, MX2x_SDHC1_BASE_ADDR, MX2x_INT_SDHC1, MX2x_DMA_REQ_SDHC1); |
| 352 | DEFINE_MXC_MMC_DEVICE(1, MX2x_SDHC2_BASE_ADDR, MX2x_INT_SDHC2, MX2x_DMA_REQ_SDHC2); |
Sascha Hauer | 1a02be0 | 2008-12-19 14:32:07 +0100 | [diff] [blame] | 353 | |
Sascha Hauer | f6d2fa7 | 2009-08-13 10:02:30 +0200 | [diff] [blame] | 354 | #ifdef CONFIG_MACH_MX27 |
javier Martin | 627fb3b | 2009-07-15 15:26:21 +0200 | [diff] [blame] | 355 | static struct resource otg_resources[] = { |
| 356 | { |
Uwe Kleine-König | 58152a1 | 2010-02-05 11:42:54 +0100 | [diff] [blame] | 357 | .start = MX27_USBOTG_BASE_ADDR, |
| 358 | .end = MX27_USBOTG_BASE_ADDR + 0x1ff, |
| 359 | .flags = IORESOURCE_MEM, |
javier Martin | 627fb3b | 2009-07-15 15:26:21 +0200 | [diff] [blame] | 360 | }, { |
Uwe Kleine-König | 58152a1 | 2010-02-05 11:42:54 +0100 | [diff] [blame] | 361 | .start = MX27_INT_USB3, |
| 362 | .end = MX27_INT_USB3, |
| 363 | .flags = IORESOURCE_IRQ, |
javier Martin | 627fb3b | 2009-07-15 15:26:21 +0200 | [diff] [blame] | 364 | }, |
| 365 | }; |
| 366 | |
Martin Fuzzey | 3eb352c | 2009-11-21 12:14:54 +0100 | [diff] [blame] | 367 | static u64 otg_dmamask = DMA_BIT_MASK(32); |
javier Martin | 627fb3b | 2009-07-15 15:26:21 +0200 | [diff] [blame] | 368 | |
| 369 | /* OTG gadget device */ |
| 370 | struct platform_device mxc_otg_udc_device = { |
| 371 | .name = "fsl-usb2-udc", |
| 372 | .id = -1, |
| 373 | .dev = { |
| 374 | .dma_mask = &otg_dmamask, |
Martin Fuzzey | 3eb352c | 2009-11-21 12:14:54 +0100 | [diff] [blame] | 375 | .coherent_dma_mask = DMA_BIT_MASK(32), |
javier Martin | 627fb3b | 2009-07-15 15:26:21 +0200 | [diff] [blame] | 376 | }, |
| 377 | .resource = otg_resources, |
| 378 | .num_resources = ARRAY_SIZE(otg_resources), |
| 379 | }; |
| 380 | |
| 381 | /* OTG host */ |
| 382 | struct platform_device mxc_otg_host = { |
| 383 | .name = "mxc-ehci", |
| 384 | .id = 0, |
| 385 | .dev = { |
Martin Fuzzey | 3eb352c | 2009-11-21 12:14:54 +0100 | [diff] [blame] | 386 | .coherent_dma_mask = DMA_BIT_MASK(32), |
javier Martin | 627fb3b | 2009-07-15 15:26:21 +0200 | [diff] [blame] | 387 | .dma_mask = &otg_dmamask, |
| 388 | }, |
| 389 | .resource = otg_resources, |
| 390 | .num_resources = ARRAY_SIZE(otg_resources), |
| 391 | }; |
| 392 | |
| 393 | /* USB host 1 */ |
| 394 | |
Martin Fuzzey | 3eb352c | 2009-11-21 12:14:54 +0100 | [diff] [blame] | 395 | static u64 usbh1_dmamask = DMA_BIT_MASK(32); |
javier Martin | 627fb3b | 2009-07-15 15:26:21 +0200 | [diff] [blame] | 396 | |
| 397 | static struct resource mxc_usbh1_resources[] = { |
| 398 | { |
Uwe Kleine-König | 58152a1 | 2010-02-05 11:42:54 +0100 | [diff] [blame] | 399 | .start = MX27_USBOTG_BASE_ADDR + 0x200, |
| 400 | .end = MX27_USBOTG_BASE_ADDR + 0x3ff, |
javier Martin | 627fb3b | 2009-07-15 15:26:21 +0200 | [diff] [blame] | 401 | .flags = IORESOURCE_MEM, |
| 402 | }, { |
Uwe Kleine-König | 58152a1 | 2010-02-05 11:42:54 +0100 | [diff] [blame] | 403 | .start = MX27_INT_USB1, |
| 404 | .end = MX27_INT_USB1, |
javier Martin | 627fb3b | 2009-07-15 15:26:21 +0200 | [diff] [blame] | 405 | .flags = IORESOURCE_IRQ, |
| 406 | }, |
| 407 | }; |
| 408 | |
| 409 | struct platform_device mxc_usbh1 = { |
| 410 | .name = "mxc-ehci", |
| 411 | .id = 1, |
| 412 | .dev = { |
Martin Fuzzey | 3eb352c | 2009-11-21 12:14:54 +0100 | [diff] [blame] | 413 | .coherent_dma_mask = DMA_BIT_MASK(32), |
javier Martin | 627fb3b | 2009-07-15 15:26:21 +0200 | [diff] [blame] | 414 | .dma_mask = &usbh1_dmamask, |
| 415 | }, |
| 416 | .resource = mxc_usbh1_resources, |
| 417 | .num_resources = ARRAY_SIZE(mxc_usbh1_resources), |
| 418 | }; |
| 419 | |
| 420 | /* USB host 2 */ |
Martin Fuzzey | 3eb352c | 2009-11-21 12:14:54 +0100 | [diff] [blame] | 421 | static u64 usbh2_dmamask = DMA_BIT_MASK(32); |
javier Martin | 627fb3b | 2009-07-15 15:26:21 +0200 | [diff] [blame] | 422 | |
| 423 | static struct resource mxc_usbh2_resources[] = { |
| 424 | { |
Uwe Kleine-König | 58152a1 | 2010-02-05 11:42:54 +0100 | [diff] [blame] | 425 | .start = MX27_USBOTG_BASE_ADDR + 0x400, |
| 426 | .end = MX27_USBOTG_BASE_ADDR + 0x5ff, |
javier Martin | 627fb3b | 2009-07-15 15:26:21 +0200 | [diff] [blame] | 427 | .flags = IORESOURCE_MEM, |
| 428 | }, { |
Uwe Kleine-König | 58152a1 | 2010-02-05 11:42:54 +0100 | [diff] [blame] | 429 | .start = MX27_INT_USB2, |
| 430 | .end = MX27_INT_USB2, |
javier Martin | 627fb3b | 2009-07-15 15:26:21 +0200 | [diff] [blame] | 431 | .flags = IORESOURCE_IRQ, |
| 432 | }, |
| 433 | }; |
| 434 | |
| 435 | struct platform_device mxc_usbh2 = { |
| 436 | .name = "mxc-ehci", |
| 437 | .id = 2, |
| 438 | .dev = { |
Martin Fuzzey | 3eb352c | 2009-11-21 12:14:54 +0100 | [diff] [blame] | 439 | .coherent_dma_mask = DMA_BIT_MASK(32), |
javier Martin | 627fb3b | 2009-07-15 15:26:21 +0200 | [diff] [blame] | 440 | .dma_mask = &usbh2_dmamask, |
| 441 | }, |
| 442 | .resource = mxc_usbh2_resources, |
| 443 | .num_resources = ARRAY_SIZE(mxc_usbh2_resources), |
| 444 | }; |
Sascha Hauer | f6d2fa7 | 2009-08-13 10:02:30 +0200 | [diff] [blame] | 445 | #endif |
javier Martin | 627fb3b | 2009-07-15 15:26:21 +0200 | [diff] [blame] | 446 | |
Juergen Beisert | fc80a5e | 2008-07-05 10:02:57 +0200 | [diff] [blame] | 447 | /* GPIO port description */ |
Uwe Kleine-König | 897359d | 2010-02-05 17:40:28 +0100 | [diff] [blame] | 448 | #define DEFINE_MXC_GPIO_PORT_IRQ(SOC, n, _irq) \ |
| 449 | { \ |
| 450 | .chip.label = "gpio-" #n, \ |
| 451 | .irq = _irq, \ |
| 452 | .base = SOC ## _IO_ADDRESS(MX2x_GPIO_BASE_ADDR + \ |
| 453 | n * 0x100), \ |
| 454 | .virtual_irq_start = MXC_GPIO_IRQ_START + n * 32, \ |
Juergen Beisert | fc80a5e | 2008-07-05 10:02:57 +0200 | [diff] [blame] | 455 | } |
Uwe Kleine-König | 897359d | 2010-02-05 17:40:28 +0100 | [diff] [blame] | 456 | |
| 457 | #define DEFINE_MXC_GPIO_PORT(SOC, n) \ |
| 458 | { \ |
| 459 | .chip.label = "gpio-" #n, \ |
| 460 | .base = SOC ## _IO_ADDRESS(MX2x_GPIO_BASE_ADDR + \ |
| 461 | n * 0x100), \ |
| 462 | .virtual_irq_start = MXC_GPIO_IRQ_START + n * 32, \ |
| 463 | } |
| 464 | |
| 465 | #define DEFINE_MXC_GPIO_PORTS(SOC, pfx) \ |
| 466 | static struct mxc_gpio_port pfx ## _gpio_ports[] = { \ |
| 467 | DEFINE_MXC_GPIO_PORT_IRQ(SOC, 0, SOC ## _INT_GPIO), \ |
| 468 | DEFINE_MXC_GPIO_PORT(SOC, 1), \ |
| 469 | DEFINE_MXC_GPIO_PORT(SOC, 2), \ |
| 470 | DEFINE_MXC_GPIO_PORT(SOC, 3), \ |
| 471 | DEFINE_MXC_GPIO_PORT(SOC, 4), \ |
| 472 | DEFINE_MXC_GPIO_PORT(SOC, 5), \ |
| 473 | } |
| 474 | |
| 475 | #ifdef CONFIG_MACH_MX21 |
| 476 | DEFINE_MXC_GPIO_PORTS(MX21, imx21); |
Uwe Kleine-König | 9a763bf | 2010-06-10 17:11:06 +0200 | [diff] [blame] | 477 | |
| 478 | int __init imx21_register_gpios(void) |
| 479 | { |
| 480 | return mxc_gpio_init(imx21_gpio_ports, ARRAY_SIZE(imx21_gpio_ports)); |
| 481 | } |
Uwe Kleine-König | 897359d | 2010-02-05 17:40:28 +0100 | [diff] [blame] | 482 | #endif |
| 483 | |
| 484 | #ifdef CONFIG_MACH_MX27 |
| 485 | DEFINE_MXC_GPIO_PORTS(MX27, imx27); |
Juergen Beisert | fc80a5e | 2008-07-05 10:02:57 +0200 | [diff] [blame] | 486 | |
Uwe Kleine-König | 9a763bf | 2010-06-10 17:11:06 +0200 | [diff] [blame] | 487 | int __init imx27_register_gpios(void) |
Juergen Beisert | fc80a5e | 2008-07-05 10:02:57 +0200 | [diff] [blame] | 488 | { |
Uwe Kleine-König | 9a763bf | 2010-06-10 17:11:06 +0200 | [diff] [blame] | 489 | return mxc_gpio_init(imx27_gpio_ports, ARRAY_SIZE(imx27_gpio_ports)); |
Juergen Beisert | fc80a5e | 2008-07-05 10:02:57 +0200 | [diff] [blame] | 490 | } |
Uwe Kleine-König | 9a763bf | 2010-06-10 17:11:06 +0200 | [diff] [blame] | 491 | #endif |
Martin Fuzzey | 4e0fa90 | 2009-11-21 12:14:58 +0100 | [diff] [blame] | 492 | |
| 493 | #ifdef CONFIG_MACH_MX21 |
| 494 | static struct resource mx21_usbhc_resources[] = { |
| 495 | { |
Wolfram Sang | e169530 | 2010-05-15 11:25:35 +0100 | [diff] [blame] | 496 | .start = MX21_USBOTG_BASE_ADDR, |
| 497 | .end = MX21_USBOTG_BASE_ADDR + SZ_8K - 1, |
Martin Fuzzey | 4e0fa90 | 2009-11-21 12:14:58 +0100 | [diff] [blame] | 498 | .flags = IORESOURCE_MEM, |
| 499 | }, |
| 500 | { |
Russell King | 988addf | 2010-03-08 20:21:04 +0000 | [diff] [blame] | 501 | .start = MX21_INT_USBHOST, |
| 502 | .end = MX21_INT_USBHOST, |
Martin Fuzzey | 4e0fa90 | 2009-11-21 12:14:58 +0100 | [diff] [blame] | 503 | .flags = IORESOURCE_IRQ, |
| 504 | }, |
| 505 | }; |
| 506 | |
| 507 | struct platform_device mx21_usbhc_device = { |
| 508 | .name = "imx21-hcd", |
| 509 | .id = 0, |
| 510 | .dev = { |
| 511 | .dma_mask = &mx21_usbhc_device.dev.coherent_dma_mask, |
| 512 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 513 | }, |
| 514 | .num_resources = ARRAY_SIZE(mx21_usbhc_resources), |
| 515 | .resource = mx21_usbhc_resources, |
| 516 | }; |
| 517 | #endif |
| 518 | |
Eric Bénard | 0896a9e | 2010-05-19 18:46:06 +0200 | [diff] [blame] | 519 | static struct resource imx_kpp_resources[] = { |
| 520 | { |
| 521 | .start = MX2x_KPP_BASE_ADDR, |
| 522 | .end = MX2x_KPP_BASE_ADDR + 0xf, |
| 523 | .flags = IORESOURCE_MEM |
| 524 | }, { |
| 525 | .start = MX2x_INT_KPP, |
| 526 | .end = MX2x_INT_KPP, |
| 527 | .flags = IORESOURCE_IRQ, |
| 528 | }, |
| 529 | }; |
| 530 | |
| 531 | struct platform_device imx_kpp_device = { |
| 532 | .name = "imx-keypad", |
| 533 | .id = -1, |
| 534 | .num_resources = ARRAY_SIZE(imx_kpp_resources), |
| 535 | .resource = imx_kpp_resources, |
| 536 | }; |
Uwe Kleine-König | 2dcf78c | 2010-06-30 12:16:24 +0200 | [diff] [blame] | 537 | |
Uwe Kleine-König | 0746949 | 2010-06-14 15:56:58 +0200 | [diff] [blame] | 538 | #endif |