Fabio Estevam | aefa1c6 | 2009-06-02 17:24:16 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved. |
Marc Kleine-Budde | d17e1c1 | 2010-08-18 18:20:24 +0200 | [diff] [blame] | 3 | * Copyright (C) 2009 Marc Kleine-Budde, Pengutronix |
Fabio Estevam | aefa1c6 | 2009-06-02 17:24:16 -0700 | [diff] [blame] | 4 | * |
| 5 | * Author: Fabio Estevam <fabio.estevam@freescale.com> |
| 6 | * |
Alex Gershgorin | 25af2d9 | 2012-03-13 17:05:29 +0200 | [diff] [blame] | 7 | * Copyright (C) 2011 Meprolight, Ltd. |
| 8 | * Alex Gershgorin <alexg@meprolight.com> |
| 9 | * |
| 10 | * Modified from i.MX31 3-Stack Development System |
| 11 | * |
Fabio Estevam | aefa1c6 | 2009-06-02 17:24:16 -0700 | [diff] [blame] | 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by |
| 14 | * the Free Software Foundation; either version 2 of the License, or |
| 15 | * (at your option) any later version. |
| 16 | * |
| 17 | * This program is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. |
Fabio Estevam | aefa1c6 | 2009-06-02 17:24:16 -0700 | [diff] [blame] | 21 | */ |
| 22 | |
Uwe Kleine-König | 767c38b | 2010-03-04 16:39:53 +0100 | [diff] [blame] | 23 | /* |
| 24 | * This machine is known as: |
| 25 | * - i.MX35 3-Stack Development System |
| 26 | * - i.MX35 Platform Development Kit (i.MX35 PDK) |
| 27 | */ |
| 28 | |
Fabio Estevam | aefa1c6 | 2009-06-02 17:24:16 -0700 | [diff] [blame] | 29 | #include <linux/types.h> |
| 30 | #include <linux/init.h> |
| 31 | #include <linux/platform_device.h> |
| 32 | #include <linux/memory.h> |
| 33 | #include <linux/gpio.h> |
Fabio Estevam | 130a0dd | 2010-12-22 12:25:30 -0200 | [diff] [blame] | 34 | #include <linux/usb/otg.h> |
Fabio Estevam | aefa1c6 | 2009-06-02 17:24:16 -0700 | [diff] [blame] | 35 | |
Marc Kleine-Budde | d17e1c1 | 2010-08-18 18:20:24 +0200 | [diff] [blame] | 36 | #include <linux/mtd/physmap.h> |
| 37 | |
Fabio Estevam | aefa1c6 | 2009-06-02 17:24:16 -0700 | [diff] [blame] | 38 | #include <asm/mach-types.h> |
| 39 | #include <asm/mach/arch.h> |
| 40 | #include <asm/mach/time.h> |
| 41 | #include <asm/mach/map.h> |
Alex Gershgorin | 25af2d9 | 2012-03-13 17:05:29 +0200 | [diff] [blame] | 42 | #include <asm/memblock.h> |
Fabio Estevam | aefa1c6 | 2009-06-02 17:24:16 -0700 | [diff] [blame] | 43 | |
| 44 | #include <mach/hardware.h> |
| 45 | #include <mach/common.h> |
Fabio Estevam | aefa1c6 | 2009-06-02 17:24:16 -0700 | [diff] [blame] | 46 | #include <mach/iomux-mx35.h> |
Xiao Jiang | 2c6605d | 2010-10-21 16:15:50 +0800 | [diff] [blame] | 47 | #include <mach/irqs.h> |
| 48 | #include <mach/3ds_debugboard.h> |
wu guoxing | 881e09f | 2012-03-14 10:10:54 +0800 | [diff] [blame] | 49 | #include <video/platform_lcd.h> |
Fabio Estevam | aefa1c6 | 2009-06-02 17:24:16 -0700 | [diff] [blame] | 50 | |
Alex Gershgorin | 25af2d9 | 2012-03-13 17:05:29 +0200 | [diff] [blame] | 51 | #include <media/soc_camera.h> |
| 52 | |
Uwe Kleine-König | 6eafde5 | 2010-06-23 11:49:34 +0200 | [diff] [blame] | 53 | #include "devices-imx35.h" |
Fabio Estevam | aefa1c6 | 2009-06-02 17:24:16 -0700 | [diff] [blame] | 54 | |
wu guoxing | 881e09f | 2012-03-14 10:10:54 +0800 | [diff] [blame] | 55 | #define GPIO_MC9S08DZ60_GPS_ENABLE 0 |
| 56 | #define GPIO_MC9S08DZ60_HDD_ENABLE 4 |
| 57 | #define GPIO_MC9S08DZ60_WIFI_ENABLE 5 |
| 58 | #define GPIO_MC9S08DZ60_LCD_ENABLE 6 |
| 59 | #define GPIO_MC9S08DZ60_SPEAKER_ENABLE 8 |
| 60 | |
| 61 | static const struct fb_videomode fb_modedb[] = { |
| 62 | { |
| 63 | /* 800x480 @ 55 Hz */ |
| 64 | .name = "Ceramate-CLAA070VC01", |
| 65 | .refresh = 55, |
| 66 | .xres = 800, |
| 67 | .yres = 480, |
| 68 | .pixclock = 40000, |
| 69 | .left_margin = 40, |
| 70 | .right_margin = 40, |
| 71 | .upper_margin = 5, |
| 72 | .lower_margin = 5, |
| 73 | .hsync_len = 20, |
| 74 | .vsync_len = 10, |
| 75 | .sync = FB_SYNC_OE_ACT_HIGH, |
| 76 | .vmode = FB_VMODE_NONINTERLACED, |
| 77 | .flag = 0, |
| 78 | }, |
| 79 | }; |
| 80 | |
| 81 | static const struct ipu_platform_data mx3_ipu_data __initconst = { |
| 82 | .irq_base = MXC_IPU_IRQ_START, |
| 83 | }; |
| 84 | |
| 85 | static struct mx3fb_platform_data mx3fb_pdata __initdata = { |
| 86 | .name = "Ceramate-CLAA070VC01", |
| 87 | .mode = fb_modedb, |
| 88 | .num_modes = ARRAY_SIZE(fb_modedb), |
| 89 | }; |
| 90 | |
| 91 | static struct i2c_board_info __initdata i2c_devices_3ds[] = { |
| 92 | { |
| 93 | I2C_BOARD_INFO("mc9s08dz60", 0x69), |
| 94 | }, |
| 95 | }; |
| 96 | |
| 97 | static int lcd_power_gpio = -ENXIO; |
| 98 | |
| 99 | static int mc9s08dz60_gpiochip_match(struct gpio_chip *chip, |
Fabio Estevam | eb26e87 | 2012-03-20 00:09:58 -0300 | [diff] [blame] | 100 | const void *data) |
wu guoxing | 881e09f | 2012-03-14 10:10:54 +0800 | [diff] [blame] | 101 | { |
| 102 | return !strcmp(chip->label, data); |
| 103 | } |
| 104 | |
| 105 | static void mx35_3ds_lcd_set_power( |
| 106 | struct plat_lcd_data *pd, unsigned int power) |
| 107 | { |
| 108 | struct gpio_chip *chip; |
| 109 | |
| 110 | if (!gpio_is_valid(lcd_power_gpio)) { |
| 111 | chip = gpiochip_find( |
| 112 | "mc9s08dz60", mc9s08dz60_gpiochip_match); |
| 113 | if (chip) { |
| 114 | lcd_power_gpio = |
| 115 | chip->base + GPIO_MC9S08DZ60_LCD_ENABLE; |
| 116 | if (gpio_request(lcd_power_gpio, "lcd_power") < 0) { |
| 117 | pr_err("error: gpio already requested!\n"); |
| 118 | lcd_power_gpio = -ENXIO; |
| 119 | } |
| 120 | } else { |
| 121 | pr_err("error: didn't find mc9s08dz60 gpio chip\n"); |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | if (gpio_is_valid(lcd_power_gpio)) |
| 126 | gpio_set_value_cansleep(lcd_power_gpio, power); |
| 127 | } |
| 128 | |
| 129 | static struct plat_lcd_data mx35_3ds_lcd_data = { |
| 130 | .set_power = mx35_3ds_lcd_set_power, |
| 131 | }; |
| 132 | |
| 133 | static struct platform_device mx35_3ds_lcd = { |
| 134 | .name = "platform-lcd", |
| 135 | .dev.platform_data = &mx35_3ds_lcd_data, |
| 136 | }; |
| 137 | |
Sascha Hauer | 7cf7381 | 2011-05-11 11:31:54 +0200 | [diff] [blame] | 138 | #define EXPIO_PARENT_INT gpio_to_irq(IMX_GPIO_NR(1, 1)) |
Xiao Jiang | 2c6605d | 2010-10-21 16:15:50 +0800 | [diff] [blame] | 139 | |
Uwe Kleine-König | 6eafde5 | 2010-06-23 11:49:34 +0200 | [diff] [blame] | 140 | static const struct imxuart_platform_data uart_pdata __initconst = { |
Fabio Estevam | aefa1c6 | 2009-06-02 17:24:16 -0700 | [diff] [blame] | 141 | .flags = IMXUART_HAVE_RTSCTS, |
| 142 | }; |
| 143 | |
Marc Kleine-Budde | d17e1c1 | 2010-08-18 18:20:24 +0200 | [diff] [blame] | 144 | static struct physmap_flash_data mx35pdk_flash_data = { |
| 145 | .width = 2, |
| 146 | }; |
| 147 | |
| 148 | static struct resource mx35pdk_flash_resource = { |
| 149 | .start = MX35_CS0_BASE_ADDR, |
| 150 | .end = MX35_CS0_BASE_ADDR + SZ_64M - 1, |
| 151 | .flags = IORESOURCE_MEM, |
| 152 | }; |
| 153 | |
| 154 | static struct platform_device mx35pdk_flash = { |
| 155 | .name = "physmap-flash", |
| 156 | .id = 0, |
| 157 | .dev = { |
| 158 | .platform_data = &mx35pdk_flash_data, |
| 159 | }, |
| 160 | .resource = &mx35pdk_flash_resource, |
| 161 | .num_resources = 1, |
| 162 | }; |
| 163 | |
Marc Kleine-Budde | 81aa172 | 2010-08-18 18:22:59 +0200 | [diff] [blame] | 164 | static const struct mxc_nand_platform_data mx35pdk_nand_board_info __initconst = { |
| 165 | .width = 1, |
| 166 | .hw_ecc = 1, |
| 167 | .flash_bbt = 1, |
| 168 | }; |
| 169 | |
Fabio Estevam | aefa1c6 | 2009-06-02 17:24:16 -0700 | [diff] [blame] | 170 | static struct platform_device *devices[] __initdata = { |
Marc Kleine-Budde | d17e1c1 | 2010-08-18 18:20:24 +0200 | [diff] [blame] | 171 | &mx35pdk_flash, |
Fabio Estevam | aefa1c6 | 2009-06-02 17:24:16 -0700 | [diff] [blame] | 172 | }; |
| 173 | |
Lothar Waßmann | 8f5260c | 2010-10-26 14:28:31 +0200 | [diff] [blame] | 174 | static iomux_v3_cfg_t mx35pdk_pads[] = { |
Fabio Estevam | aefa1c6 | 2009-06-02 17:24:16 -0700 | [diff] [blame] | 175 | /* UART1 */ |
| 176 | MX35_PAD_CTS1__UART1_CTS, |
| 177 | MX35_PAD_RTS1__UART1_RTS, |
| 178 | MX35_PAD_TXD1__UART1_TXD_MUX, |
| 179 | MX35_PAD_RXD1__UART1_RXD_MUX, |
| 180 | /* FEC */ |
| 181 | MX35_PAD_FEC_TX_CLK__FEC_TX_CLK, |
| 182 | MX35_PAD_FEC_RX_CLK__FEC_RX_CLK, |
| 183 | MX35_PAD_FEC_RX_DV__FEC_RX_DV, |
| 184 | MX35_PAD_FEC_COL__FEC_COL, |
| 185 | MX35_PAD_FEC_RDATA0__FEC_RDATA_0, |
| 186 | MX35_PAD_FEC_TDATA0__FEC_TDATA_0, |
| 187 | MX35_PAD_FEC_TX_EN__FEC_TX_EN, |
| 188 | MX35_PAD_FEC_MDC__FEC_MDC, |
| 189 | MX35_PAD_FEC_MDIO__FEC_MDIO, |
| 190 | MX35_PAD_FEC_TX_ERR__FEC_TX_ERR, |
| 191 | MX35_PAD_FEC_RX_ERR__FEC_RX_ERR, |
| 192 | MX35_PAD_FEC_CRS__FEC_CRS, |
| 193 | MX35_PAD_FEC_RDATA1__FEC_RDATA_1, |
| 194 | MX35_PAD_FEC_TDATA1__FEC_TDATA_1, |
| 195 | MX35_PAD_FEC_RDATA2__FEC_RDATA_2, |
| 196 | MX35_PAD_FEC_TDATA2__FEC_TDATA_2, |
| 197 | MX35_PAD_FEC_RDATA3__FEC_RDATA_3, |
| 198 | MX35_PAD_FEC_TDATA3__FEC_TDATA_3, |
Harro Haan | 9c2daf1 | 2009-11-27 11:44:36 +0100 | [diff] [blame] | 199 | /* USBOTG */ |
| 200 | MX35_PAD_USBOTG_PWR__USB_TOP_USBOTG_PWR, |
| 201 | MX35_PAD_USBOTG_OC__USB_TOP_USBOTG_OC, |
Marc Kleine-Budde | ab3d8b5 | 2010-08-18 18:26:42 +0200 | [diff] [blame] | 202 | /* USBH1 */ |
| 203 | MX35_PAD_I2C2_CLK__USB_TOP_USBH2_PWR, |
| 204 | MX35_PAD_I2C2_DAT__USB_TOP_USBH2_OC, |
Shawn Guo | 6207c83 | 2010-10-22 00:23:44 +0800 | [diff] [blame] | 205 | /* SDCARD */ |
| 206 | MX35_PAD_SD1_CMD__ESDHC1_CMD, |
| 207 | MX35_PAD_SD1_CLK__ESDHC1_CLK, |
| 208 | MX35_PAD_SD1_DATA0__ESDHC1_DAT0, |
| 209 | MX35_PAD_SD1_DATA1__ESDHC1_DAT1, |
| 210 | MX35_PAD_SD1_DATA2__ESDHC1_DAT2, |
| 211 | MX35_PAD_SD1_DATA3__ESDHC1_DAT3, |
Fabio Estevam | 352cd9a | 2011-03-01 16:59:44 -0300 | [diff] [blame] | 212 | /* I2C1 */ |
| 213 | MX35_PAD_I2C1_CLK__I2C1_SCL, |
| 214 | MX35_PAD_I2C1_DAT__I2C1_SDA, |
wu guoxing | 881e09f | 2012-03-14 10:10:54 +0800 | [diff] [blame] | 215 | /* Display */ |
| 216 | MX35_PAD_LD0__IPU_DISPB_DAT_0, |
| 217 | MX35_PAD_LD1__IPU_DISPB_DAT_1, |
| 218 | MX35_PAD_LD2__IPU_DISPB_DAT_2, |
| 219 | MX35_PAD_LD3__IPU_DISPB_DAT_3, |
| 220 | MX35_PAD_LD4__IPU_DISPB_DAT_4, |
| 221 | MX35_PAD_LD5__IPU_DISPB_DAT_5, |
| 222 | MX35_PAD_LD6__IPU_DISPB_DAT_6, |
| 223 | MX35_PAD_LD7__IPU_DISPB_DAT_7, |
| 224 | MX35_PAD_LD8__IPU_DISPB_DAT_8, |
| 225 | MX35_PAD_LD9__IPU_DISPB_DAT_9, |
| 226 | MX35_PAD_LD10__IPU_DISPB_DAT_10, |
| 227 | MX35_PAD_LD11__IPU_DISPB_DAT_11, |
| 228 | MX35_PAD_LD12__IPU_DISPB_DAT_12, |
| 229 | MX35_PAD_LD13__IPU_DISPB_DAT_13, |
| 230 | MX35_PAD_LD14__IPU_DISPB_DAT_14, |
| 231 | MX35_PAD_LD15__IPU_DISPB_DAT_15, |
| 232 | MX35_PAD_LD16__IPU_DISPB_DAT_16, |
| 233 | MX35_PAD_LD17__IPU_DISPB_DAT_17, |
| 234 | MX35_PAD_D3_HSYNC__IPU_DISPB_D3_HSYNC, |
| 235 | MX35_PAD_D3_FPSHIFT__IPU_DISPB_D3_CLK, |
| 236 | MX35_PAD_D3_DRDY__IPU_DISPB_D3_DRDY, |
| 237 | MX35_PAD_CONTRAST__IPU_DISPB_CONTR, |
| 238 | MX35_PAD_D3_VSYNC__IPU_DISPB_D3_VSYNC, |
| 239 | MX35_PAD_D3_REV__IPU_DISPB_D3_REV, |
| 240 | MX35_PAD_D3_CLS__IPU_DISPB_D3_CLS, |
Alex Gershgorin | 25af2d9 | 2012-03-13 17:05:29 +0200 | [diff] [blame] | 241 | /* CSI */ |
| 242 | MX35_PAD_TX1__IPU_CSI_D_6, |
| 243 | MX35_PAD_TX0__IPU_CSI_D_7, |
| 244 | MX35_PAD_CSI_D8__IPU_CSI_D_8, |
| 245 | MX35_PAD_CSI_D9__IPU_CSI_D_9, |
| 246 | MX35_PAD_CSI_D10__IPU_CSI_D_10, |
| 247 | MX35_PAD_CSI_D11__IPU_CSI_D_11, |
| 248 | MX35_PAD_CSI_D12__IPU_CSI_D_12, |
| 249 | MX35_PAD_CSI_D13__IPU_CSI_D_13, |
| 250 | MX35_PAD_CSI_D14__IPU_CSI_D_14, |
| 251 | MX35_PAD_CSI_D15__IPU_CSI_D_15, |
| 252 | MX35_PAD_CSI_HSYNC__IPU_CSI_HSYNC, |
| 253 | MX35_PAD_CSI_MCLK__IPU_CSI_MCLK, |
| 254 | MX35_PAD_CSI_PIXCLK__IPU_CSI_PIXCLK, |
| 255 | MX35_PAD_CSI_VSYNC__IPU_CSI_VSYNC, |
| 256 | }; |
| 257 | |
| 258 | /* |
| 259 | * Camera support |
| 260 | */ |
| 261 | static phys_addr_t mx3_camera_base __initdata; |
| 262 | #define MX35_3DS_CAMERA_BUF_SIZE SZ_8M |
| 263 | |
| 264 | static const struct mx3_camera_pdata mx35_3ds_camera_pdata __initconst = { |
| 265 | .flags = MX3_CAMERA_DATAWIDTH_8, |
| 266 | .mclk_10khz = 2000, |
| 267 | }; |
| 268 | |
| 269 | static int __init imx35_3ds_init_camera(void) |
| 270 | { |
| 271 | int dma, ret = -ENOMEM; |
| 272 | struct platform_device *pdev = |
| 273 | imx35_alloc_mx3_camera(&mx35_3ds_camera_pdata); |
| 274 | |
| 275 | if (IS_ERR(pdev)) |
| 276 | return PTR_ERR(pdev); |
| 277 | |
| 278 | if (!mx3_camera_base) |
| 279 | goto err; |
| 280 | |
| 281 | dma = dma_declare_coherent_memory(&pdev->dev, |
| 282 | mx3_camera_base, mx3_camera_base, |
| 283 | MX35_3DS_CAMERA_BUF_SIZE, |
| 284 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); |
| 285 | |
| 286 | if (!(dma & DMA_MEMORY_MAP)) |
| 287 | goto err; |
| 288 | |
| 289 | ret = platform_device_add(pdev); |
| 290 | if (ret) |
| 291 | err: |
| 292 | platform_device_put(pdev); |
| 293 | |
| 294 | return ret; |
| 295 | } |
| 296 | |
| 297 | static const struct ipu_platform_data mx35_3ds_ipu_data __initconst = { |
| 298 | .irq_base = MXC_IPU_IRQ_START, |
| 299 | }; |
| 300 | |
| 301 | static struct i2c_board_info mx35_3ds_i2c_camera = { |
| 302 | I2C_BOARD_INFO("ov2640", 0x30), |
| 303 | }; |
| 304 | |
| 305 | static struct soc_camera_link iclink_ov2640 = { |
| 306 | .bus_id = 0, |
| 307 | .board_info = &mx35_3ds_i2c_camera, |
| 308 | .i2c_adapter_id = 0, |
| 309 | .power = NULL, |
| 310 | }; |
| 311 | |
| 312 | static struct platform_device mx35_3ds_ov2640 = { |
| 313 | .name = "soc-camera-pdrv", |
| 314 | .id = 0, |
| 315 | .dev = { |
| 316 | .platform_data = &iclink_ov2640, |
| 317 | }, |
Harro Haan | 9c2daf1 | 2009-11-27 11:44:36 +0100 | [diff] [blame] | 318 | }; |
| 319 | |
Sascha Hauer | 4bd597b | 2011-01-03 11:30:28 +0100 | [diff] [blame] | 320 | static int mx35_3ds_otg_init(struct platform_device *pdev) |
| 321 | { |
| 322 | return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERNAL_PHY); |
| 323 | } |
| 324 | |
Harro Haan | 9c2daf1 | 2009-11-27 11:44:36 +0100 | [diff] [blame] | 325 | /* OTG config */ |
Uwe Kleine-König | 9e1dde3 | 2010-11-12 16:40:06 +0100 | [diff] [blame] | 326 | static const struct fsl_usb2_platform_data usb_otg_pdata __initconst = { |
Harro Haan | 9c2daf1 | 2009-11-27 11:44:36 +0100 | [diff] [blame] | 327 | .operating_mode = FSL_USB2_DR_DEVICE, |
| 328 | .phy_mode = FSL_USB2_PHY_UTMI_WIDE, |
Fabio Estevam | 1a46cce | 2011-03-02 11:26:49 -0300 | [diff] [blame] | 329 | .workaround = FLS_USB2_WORKAROUND_ENGCM09152, |
| 330 | /* |
| 331 | * ENGCM09152 also requires a hardware change. |
| 332 | * Please check the MX35 Chip Errata document for details. |
| 333 | */ |
Fabio Estevam | aefa1c6 | 2009-06-02 17:24:16 -0700 | [diff] [blame] | 334 | }; |
| 335 | |
Fabio Estevam | 130a0dd | 2010-12-22 12:25:30 -0200 | [diff] [blame] | 336 | static struct mxc_usbh_platform_data otg_pdata __initdata = { |
Sascha Hauer | 4bd597b | 2011-01-03 11:30:28 +0100 | [diff] [blame] | 337 | .init = mx35_3ds_otg_init, |
Fabio Estevam | 130a0dd | 2010-12-22 12:25:30 -0200 | [diff] [blame] | 338 | .portsc = MXC_EHCI_MODE_UTMI, |
Fabio Estevam | 130a0dd | 2010-12-22 12:25:30 -0200 | [diff] [blame] | 339 | }; |
| 340 | |
Sascha Hauer | 4bd597b | 2011-01-03 11:30:28 +0100 | [diff] [blame] | 341 | static int mx35_3ds_usbh_init(struct platform_device *pdev) |
| 342 | { |
| 343 | return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_SINGLE_UNI | |
| 344 | MXC_EHCI_INTERNAL_PHY); |
| 345 | } |
| 346 | |
Marc Kleine-Budde | ab3d8b5 | 2010-08-18 18:26:42 +0200 | [diff] [blame] | 347 | /* USB HOST config */ |
Uwe Kleine-König | 2d58de2 | 2010-11-15 11:57:49 +0100 | [diff] [blame] | 348 | static const struct mxc_usbh_platform_data usb_host_pdata __initconst = { |
Sascha Hauer | 4bd597b | 2011-01-03 11:30:28 +0100 | [diff] [blame] | 349 | .init = mx35_3ds_usbh_init, |
Marc Kleine-Budde | ab3d8b5 | 2010-08-18 18:26:42 +0200 | [diff] [blame] | 350 | .portsc = MXC_EHCI_MODE_SERIAL, |
Marc Kleine-Budde | ab3d8b5 | 2010-08-18 18:26:42 +0200 | [diff] [blame] | 351 | }; |
| 352 | |
Fabio Estevam | 130a0dd | 2010-12-22 12:25:30 -0200 | [diff] [blame] | 353 | static int otg_mode_host; |
| 354 | |
| 355 | static int __init mx35_3ds_otg_mode(char *options) |
| 356 | { |
| 357 | if (!strcmp(options, "host")) |
| 358 | otg_mode_host = 1; |
| 359 | else if (!strcmp(options, "device")) |
| 360 | otg_mode_host = 0; |
| 361 | else |
| 362 | pr_info("otg_mode neither \"host\" nor \"device\". " |
| 363 | "Defaulting to device\n"); |
| 364 | return 0; |
| 365 | } |
| 366 | __setup("otg_mode=", mx35_3ds_otg_mode); |
| 367 | |
Fabio Estevam | 352cd9a | 2011-03-01 16:59:44 -0300 | [diff] [blame] | 368 | static const struct imxi2c_platform_data mx35_3ds_i2c0_data __initconst = { |
| 369 | .bitrate = 100000, |
| 370 | }; |
| 371 | |
Fabio Estevam | aefa1c6 | 2009-06-02 17:24:16 -0700 | [diff] [blame] | 372 | /* |
| 373 | * Board specific initialization. |
| 374 | */ |
Uwe Kleine-König | e134fb2 | 2011-02-11 10:23:19 +0100 | [diff] [blame] | 375 | static void __init mx35_3ds_init(void) |
Fabio Estevam | aefa1c6 | 2009-06-02 17:24:16 -0700 | [diff] [blame] | 376 | { |
wu guoxing | 881e09f | 2012-03-14 10:10:54 +0800 | [diff] [blame] | 377 | struct platform_device *imx35_fb_pdev; |
| 378 | |
Shawn Guo | b78d8e5 | 2011-06-06 00:07:55 +0800 | [diff] [blame] | 379 | imx35_soc_init(); |
| 380 | |
Fabio Estevam | aefa1c6 | 2009-06-02 17:24:16 -0700 | [diff] [blame] | 381 | mxc_iomux_v3_setup_multiple_pads(mx35pdk_pads, ARRAY_SIZE(mx35pdk_pads)); |
| 382 | |
Uwe Kleine-König | 6bd96f3 | 2010-10-06 12:00:18 +0200 | [diff] [blame] | 383 | imx35_add_fec(NULL); |
Uwe Kleine-König | c496fa6 | 2010-11-16 23:24:21 +0100 | [diff] [blame] | 384 | imx35_add_imx2_wdt(NULL); |
Fabio Estevam | aefa1c6 | 2009-06-02 17:24:16 -0700 | [diff] [blame] | 385 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
| 386 | |
Uwe Kleine-König | 6eafde5 | 2010-06-23 11:49:34 +0200 | [diff] [blame] | 387 | imx35_add_imx_uart0(&uart_pdata); |
Harro Haan | 9c2daf1 | 2009-11-27 11:44:36 +0100 | [diff] [blame] | 388 | |
Fabio Estevam | 130a0dd | 2010-12-22 12:25:30 -0200 | [diff] [blame] | 389 | if (otg_mode_host) |
| 390 | imx35_add_mxc_ehci_otg(&otg_pdata); |
Marc Kleine-Budde | 81aa172 | 2010-08-18 18:22:59 +0200 | [diff] [blame] | 391 | |
Uwe Kleine-König | 2d58de2 | 2010-11-15 11:57:49 +0100 | [diff] [blame] | 392 | imx35_add_mxc_ehci_hs(&usb_host_pdata); |
Marc Kleine-Budde | ab3d8b5 | 2010-08-18 18:26:42 +0200 | [diff] [blame] | 393 | |
Fabio Estevam | 130a0dd | 2010-12-22 12:25:30 -0200 | [diff] [blame] | 394 | if (!otg_mode_host) |
| 395 | imx35_add_fsl_usb2_udc(&usb_otg_pdata); |
| 396 | |
Marc Kleine-Budde | 81aa172 | 2010-08-18 18:22:59 +0200 | [diff] [blame] | 397 | imx35_add_mxc_nand(&mx35pdk_nand_board_info); |
Uwe Kleine-König | 124bf94 | 2010-11-19 21:03:33 +0100 | [diff] [blame] | 398 | imx35_add_sdhci_esdhc_imx(0, NULL); |
Xiao Jiang | 2c6605d | 2010-10-21 16:15:50 +0800 | [diff] [blame] | 399 | |
| 400 | if (mxc_expio_init(MX35_CS5_BASE_ADDR, EXPIO_PARENT_INT)) |
| 401 | pr_warn("Init of the debugboard failed, all " |
| 402 | "devices on the debugboard are unusable.\n"); |
Fabio Estevam | 352cd9a | 2011-03-01 16:59:44 -0300 | [diff] [blame] | 403 | imx35_add_imx_i2c0(&mx35_3ds_i2c0_data); |
wu guoxing | 881e09f | 2012-03-14 10:10:54 +0800 | [diff] [blame] | 404 | |
| 405 | i2c_register_board_info( |
| 406 | 0, i2c_devices_3ds, ARRAY_SIZE(i2c_devices_3ds)); |
| 407 | |
Alex Gershgorin | 25af2d9 | 2012-03-13 17:05:29 +0200 | [diff] [blame] | 408 | imx35_add_ipu_core(&mx35_3ds_ipu_data); |
| 409 | platform_device_register(&mx35_3ds_ov2640); |
| 410 | imx35_3ds_init_camera(); |
| 411 | |
wu guoxing | 881e09f | 2012-03-14 10:10:54 +0800 | [diff] [blame] | 412 | imx35_fb_pdev = imx35_add_mx3_sdc_fb(&mx3fb_pdata); |
| 413 | mx35_3ds_lcd.dev.parent = &imx35_fb_pdev->dev; |
| 414 | platform_device_register(&mx35_3ds_lcd); |
Fabio Estevam | aefa1c6 | 2009-06-02 17:24:16 -0700 | [diff] [blame] | 415 | } |
| 416 | |
| 417 | static void __init mx35pdk_timer_init(void) |
| 418 | { |
| 419 | mx35_clocks_init(); |
| 420 | } |
| 421 | |
| 422 | struct sys_timer mx35pdk_timer = { |
| 423 | .init = mx35pdk_timer_init, |
| 424 | }; |
| 425 | |
Alex Gershgorin | 25af2d9 | 2012-03-13 17:05:29 +0200 | [diff] [blame] | 426 | static void __init mx35_3ds_reserve(void) |
| 427 | { |
| 428 | /* reserve MX35_3DS_CAMERA_BUF_SIZE bytes for mx3-camera */ |
| 429 | mx3_camera_base = arm_memblock_steal(MX35_3DS_CAMERA_BUF_SIZE, |
| 430 | MX35_3DS_CAMERA_BUF_SIZE); |
| 431 | } |
| 432 | |
Fabio Estevam | aefa1c6 | 2009-06-02 17:24:16 -0700 | [diff] [blame] | 433 | MACHINE_START(MX35_3DS, "Freescale MX35PDK") |
| 434 | /* Maintainer: Freescale Semiconductor, Inc */ |
Nicolas Pitre | dc8f190 | 2011-07-05 22:38:12 -0400 | [diff] [blame] | 435 | .atag_offset = 0x100, |
Uwe Kleine-König | 97976e2 | 2011-02-07 16:35:20 +0100 | [diff] [blame] | 436 | .map_io = mx35_map_io, |
| 437 | .init_early = imx35_init_early, |
| 438 | .init_irq = mx35_init_irq, |
Sascha Hauer | ffa2ea3 | 2011-09-20 14:31:24 +0200 | [diff] [blame] | 439 | .handle_irq = imx35_handle_irq, |
Uwe Kleine-König | 97976e2 | 2011-02-07 16:35:20 +0100 | [diff] [blame] | 440 | .timer = &mx35pdk_timer, |
Uwe Kleine-König | e134fb2 | 2011-02-11 10:23:19 +0100 | [diff] [blame] | 441 | .init_machine = mx35_3ds_init, |
Alex Gershgorin | 25af2d9 | 2012-03-13 17:05:29 +0200 | [diff] [blame] | 442 | .reserve = mx35_3ds_reserve, |
Russell King | 65ea788 | 2011-11-06 17:12:08 +0000 | [diff] [blame] | 443 | .restart = mxc_restart, |
Fabio Estevam | aefa1c6 | 2009-06-02 17:24:16 -0700 | [diff] [blame] | 444 | MACHINE_END |