Fabio Estevam | 1553a1e | 2008-11-12 15:38:39 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 2 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 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. |
Fabio Estevam | 1553a1e | 2008-11-12 15:38:39 +0100 | [diff] [blame] | 13 | */ |
| 14 | |
Magnus Lilja | a2ef456 | 2010-05-14 17:08:29 +0200 | [diff] [blame] | 15 | #include <linux/delay.h> |
Fabio Estevam | 1553a1e | 2008-11-12 15:38:39 +0100 | [diff] [blame] | 16 | #include <linux/types.h> |
| 17 | #include <linux/init.h> |
| 18 | #include <linux/clk.h> |
| 19 | #include <linux/irq.h> |
Magnus Lilja | 135cad3 | 2009-05-17 20:18:08 +0200 | [diff] [blame] | 20 | #include <linux/gpio.h> |
Magnus Lilja | 2b0c367 | 2009-05-18 18:46:33 +0200 | [diff] [blame] | 21 | #include <linux/platform_device.h> |
Alberto Panizzo | ae7a3f1 | 2010-03-23 19:51:45 +0100 | [diff] [blame] | 22 | #include <linux/mfd/mc13783.h> |
| 23 | #include <linux/spi/spi.h> |
| 24 | #include <linux/regulator/machine.h> |
Fabio Estevam | 1c50e67 | 2010-12-21 16:38:21 -0200 | [diff] [blame] | 25 | #include <linux/usb/otg.h> |
| 26 | #include <linux/usb/ulpi.h> |
Fabio Estevam | 1553a1e | 2008-11-12 15:38:39 +0100 | [diff] [blame] | 27 | |
| 28 | #include <mach/hardware.h> |
| 29 | #include <asm/mach-types.h> |
| 30 | #include <asm/mach/arch.h> |
| 31 | #include <asm/mach/time.h> |
| 32 | #include <asm/memory.h> |
| 33 | #include <asm/mach/map.h> |
| 34 | #include <mach/common.h> |
Fabio Estevam | 1553a1e | 2008-11-12 15:38:39 +0100 | [diff] [blame] | 35 | #include <mach/iomux-mx3.h> |
Jason Wang | c5d38f0 | 2010-06-24 21:11:29 +0800 | [diff] [blame] | 36 | #include <mach/3ds_debugboard.h> |
Fabio Estevam | 1c50e67 | 2010-12-21 16:38:21 -0200 | [diff] [blame] | 37 | #include <mach/ulpi.h> |
Uwe Kleine-König | a2ceeef | 2010-06-16 12:23:11 +0200 | [diff] [blame] | 38 | |
| 39 | #include "devices-imx31.h" |
Fabio Estevam | 1553a1e | 2008-11-12 15:38:39 +0100 | [diff] [blame] | 40 | #include "devices.h" |
| 41 | |
Uwe Kleine-König | b396dc4 | 2010-03-08 16:57:19 +0100 | [diff] [blame] | 42 | /* CPLD IRQ line for external uart, external ethernet etc */ |
| 43 | #define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_1) |
| 44 | |
Uwe Kleine-König | b396dc4 | 2010-03-08 16:57:19 +0100 | [diff] [blame] | 45 | /* |
| 46 | * This file contains the board-specific initialization routines. |
Fabio Estevam | 1553a1e | 2008-11-12 15:38:39 +0100 | [diff] [blame] | 47 | */ |
| 48 | |
Alberto Panizzo | 11a332adf | 2010-03-23 19:46:57 +0100 | [diff] [blame] | 49 | static int mx31_3ds_pins[] = { |
Magnus Lilja | 153fa1d | 2009-05-16 12:43:10 +0200 | [diff] [blame] | 50 | /* UART1 */ |
Valentin Longchamp | 63d97667 | 2009-01-28 15:13:53 +0100 | [diff] [blame] | 51 | MX31_PIN_CTS1__CTS1, |
| 52 | MX31_PIN_RTS1__RTS1, |
| 53 | MX31_PIN_TXD1__TXD1, |
Magnus Lilja | 135cad3 | 2009-05-17 20:18:08 +0200 | [diff] [blame] | 54 | MX31_PIN_RXD1__RXD1, |
| 55 | IOMUX_MODE(MX31_PIN_GPIO1_1, IOMUX_CONFIG_GPIO), |
Alberto Panizzo | a1ac442 | 2010-03-23 19:50:28 +0100 | [diff] [blame] | 56 | /* SPI 1 */ |
| 57 | MX31_PIN_CSPI2_SCLK__SCLK, |
| 58 | MX31_PIN_CSPI2_MOSI__MOSI, |
| 59 | MX31_PIN_CSPI2_MISO__MISO, |
| 60 | MX31_PIN_CSPI2_SPI_RDY__SPI_RDY, |
| 61 | MX31_PIN_CSPI2_SS0__SS0, |
| 62 | MX31_PIN_CSPI2_SS2__SS2, /*CS for MC13783 */ |
Alberto Panizzo | ae7a3f1 | 2010-03-23 19:51:45 +0100 | [diff] [blame] | 63 | /* MC13783 IRQ */ |
| 64 | IOMUX_MODE(MX31_PIN_GPIO1_3, IOMUX_CONFIG_GPIO), |
Magnus Lilja | a2ef456 | 2010-05-14 17:08:29 +0200 | [diff] [blame] | 65 | /* USB OTG reset */ |
| 66 | IOMUX_MODE(MX31_PIN_USB_PWR, IOMUX_CONFIG_GPIO), |
| 67 | /* USB OTG */ |
| 68 | MX31_PIN_USBOTG_DATA0__USBOTG_DATA0, |
| 69 | MX31_PIN_USBOTG_DATA1__USBOTG_DATA1, |
| 70 | MX31_PIN_USBOTG_DATA2__USBOTG_DATA2, |
| 71 | MX31_PIN_USBOTG_DATA3__USBOTG_DATA3, |
| 72 | MX31_PIN_USBOTG_DATA4__USBOTG_DATA4, |
| 73 | MX31_PIN_USBOTG_DATA5__USBOTG_DATA5, |
| 74 | MX31_PIN_USBOTG_DATA6__USBOTG_DATA6, |
| 75 | MX31_PIN_USBOTG_DATA7__USBOTG_DATA7, |
| 76 | MX31_PIN_USBOTG_CLK__USBOTG_CLK, |
| 77 | MX31_PIN_USBOTG_DIR__USBOTG_DIR, |
| 78 | MX31_PIN_USBOTG_NXT__USBOTG_NXT, |
| 79 | MX31_PIN_USBOTG_STP__USBOTG_STP, |
Alberto Panizzo | 54c1f63 | 2010-05-19 11:34:43 +0200 | [diff] [blame] | 80 | /*Keyboard*/ |
| 81 | MX31_PIN_KEY_ROW0_KEY_ROW0, |
| 82 | MX31_PIN_KEY_ROW1_KEY_ROW1, |
| 83 | MX31_PIN_KEY_ROW2_KEY_ROW2, |
| 84 | MX31_PIN_KEY_COL0_KEY_COL0, |
| 85 | MX31_PIN_KEY_COL1_KEY_COL1, |
| 86 | MX31_PIN_KEY_COL2_KEY_COL2, |
| 87 | MX31_PIN_KEY_COL3_KEY_COL3, |
Fabio Estevam | 0d95b75 | 2010-12-21 16:38:22 -0200 | [diff] [blame] | 88 | /* USB Host 2 */ |
| 89 | IOMUX_MODE(MX31_PIN_USBH2_CLK, IOMUX_CONFIG_FUNC), |
| 90 | IOMUX_MODE(MX31_PIN_USBH2_DIR, IOMUX_CONFIG_FUNC), |
| 91 | IOMUX_MODE(MX31_PIN_USBH2_NXT, IOMUX_CONFIG_FUNC), |
| 92 | IOMUX_MODE(MX31_PIN_USBH2_STP, IOMUX_CONFIG_FUNC), |
| 93 | IOMUX_MODE(MX31_PIN_USBH2_DATA0, IOMUX_CONFIG_FUNC), |
| 94 | IOMUX_MODE(MX31_PIN_USBH2_DATA1, IOMUX_CONFIG_FUNC), |
| 95 | IOMUX_MODE(MX31_PIN_PC_VS2, IOMUX_CONFIG_ALT1), |
| 96 | IOMUX_MODE(MX31_PIN_PC_BVD1, IOMUX_CONFIG_ALT1), |
| 97 | IOMUX_MODE(MX31_PIN_PC_BVD2, IOMUX_CONFIG_ALT1), |
| 98 | IOMUX_MODE(MX31_PIN_PC_RST, IOMUX_CONFIG_ALT1), |
| 99 | IOMUX_MODE(MX31_PIN_IOIS16, IOMUX_CONFIG_ALT1), |
| 100 | IOMUX_MODE(MX31_PIN_PC_RW_B, IOMUX_CONFIG_ALT1), |
| 101 | /* USB Host2 reset */ |
| 102 | IOMUX_MODE(MX31_PIN_USB_BYP, IOMUX_CONFIG_GPIO), |
Alberto Panizzo | 54c1f63 | 2010-05-19 11:34:43 +0200 | [diff] [blame] | 103 | }; |
| 104 | |
| 105 | /* |
| 106 | * Matrix keyboard |
| 107 | */ |
| 108 | |
| 109 | static const uint32_t mx31_3ds_keymap[] = { |
| 110 | KEY(0, 0, KEY_UP), |
| 111 | KEY(0, 1, KEY_DOWN), |
| 112 | KEY(1, 0, KEY_RIGHT), |
| 113 | KEY(1, 1, KEY_LEFT), |
| 114 | KEY(1, 2, KEY_ENTER), |
| 115 | KEY(2, 0, KEY_F6), |
| 116 | KEY(2, 1, KEY_F8), |
| 117 | KEY(2, 2, KEY_F9), |
| 118 | KEY(2, 3, KEY_F10), |
| 119 | }; |
| 120 | |
Uwe Kleine-König | d690b4c | 2010-11-16 21:27:33 +0100 | [diff] [blame] | 121 | static const struct matrix_keymap_data mx31_3ds_keymap_data __initconst = { |
Alberto Panizzo | 54c1f63 | 2010-05-19 11:34:43 +0200 | [diff] [blame] | 122 | .keymap = mx31_3ds_keymap, |
| 123 | .keymap_size = ARRAY_SIZE(mx31_3ds_keymap), |
Alberto Panizzo | ae7a3f1 | 2010-03-23 19:51:45 +0100 | [diff] [blame] | 124 | }; |
| 125 | |
| 126 | /* Regulators */ |
| 127 | static struct regulator_init_data pwgtx_init = { |
| 128 | .constraints = { |
| 129 | .boot_on = 1, |
| 130 | .always_on = 1, |
| 131 | }, |
| 132 | }; |
| 133 | |
Fabio Estevam | 0d95b75 | 2010-12-21 16:38:22 -0200 | [diff] [blame] | 134 | static struct regulator_init_data gpo_init = { |
| 135 | .constraints = { |
| 136 | .boot_on = 1, |
| 137 | .always_on = 1, |
| 138 | } |
| 139 | }; |
| 140 | |
Alberto Panizzo | ae7a3f1 | 2010-03-23 19:51:45 +0100 | [diff] [blame] | 141 | static struct mc13783_regulator_init_data mx31_3ds_regulators[] = { |
| 142 | { |
| 143 | .id = MC13783_REGU_PWGT1SPI, /* Power Gate for ARM core. */ |
| 144 | .init_data = &pwgtx_init, |
| 145 | }, { |
| 146 | .id = MC13783_REGU_PWGT2SPI, /* Power Gate for L2 Cache. */ |
| 147 | .init_data = &pwgtx_init, |
Fabio Estevam | 0d95b75 | 2010-12-21 16:38:22 -0200 | [diff] [blame] | 148 | }, { |
| 149 | |
| 150 | .id = MC13783_REGU_GPO1, /* Turn on 1.8V */ |
| 151 | .init_data = &gpo_init, |
| 152 | }, { |
| 153 | .id = MC13783_REGU_GPO3, /* Turn on 3.3V */ |
| 154 | .init_data = &gpo_init, |
Alberto Panizzo | ae7a3f1 | 2010-03-23 19:51:45 +0100 | [diff] [blame] | 155 | }, |
| 156 | }; |
| 157 | |
| 158 | /* MC13783 */ |
| 159 | static struct mc13783_platform_data mc13783_pdata __initdata = { |
| 160 | .regulators = mx31_3ds_regulators, |
| 161 | .num_regulators = ARRAY_SIZE(mx31_3ds_regulators), |
Fabio Estevam | bd02a9e | 2010-10-27 10:31:06 -0700 | [diff] [blame] | 162 | .flags = MC13783_USE_REGULATOR | MC13783_USE_TOUCHSCREEN, |
Alberto Panizzo | a1ac442 | 2010-03-23 19:50:28 +0100 | [diff] [blame] | 163 | }; |
| 164 | |
| 165 | /* SPI */ |
| 166 | static int spi1_internal_chipselect[] = { |
| 167 | MXC_SPI_CS(0), |
| 168 | MXC_SPI_CS(2), |
| 169 | }; |
| 170 | |
Uwe Kleine-König | 06606ff | 2010-06-22 10:09:14 +0200 | [diff] [blame] | 171 | static const struct spi_imx_master spi1_pdata __initconst = { |
Alberto Panizzo | a1ac442 | 2010-03-23 19:50:28 +0100 | [diff] [blame] | 172 | .chipselect = spi1_internal_chipselect, |
| 173 | .num_chipselect = ARRAY_SIZE(spi1_internal_chipselect), |
Valentin Longchamp | 63d97667 | 2009-01-28 15:13:53 +0100 | [diff] [blame] | 174 | }; |
| 175 | |
Alberto Panizzo | ae7a3f1 | 2010-03-23 19:51:45 +0100 | [diff] [blame] | 176 | static struct spi_board_info mx31_3ds_spi_devs[] __initdata = { |
| 177 | { |
| 178 | .modalias = "mc13783", |
| 179 | .max_speed_hz = 1000000, |
| 180 | .bus_num = 1, |
| 181 | .chip_select = 1, /* SS2 */ |
| 182 | .platform_data = &mc13783_pdata, |
| 183 | .irq = IOMUX_TO_IRQ(MX31_PIN_GPIO1_3), |
| 184 | .mode = SPI_CS_HIGH, |
| 185 | }, |
| 186 | }; |
| 187 | |
Alberto Panizzo | a1b67b9 | 2010-03-23 19:49:35 +0100 | [diff] [blame] | 188 | /* |
| 189 | * NAND Flash |
| 190 | */ |
Uwe Kleine-König | a2ceeef | 2010-06-16 12:23:11 +0200 | [diff] [blame] | 191 | static const struct mxc_nand_platform_data |
| 192 | mx31_3ds_nand_board_info __initconst = { |
Alberto Panizzo | a1b67b9 | 2010-03-23 19:49:35 +0100 | [diff] [blame] | 193 | .width = 1, |
| 194 | .hw_ecc = 1, |
| 195 | #ifdef MACH_MX31_3DS_MXC_NAND_USE_BBT |
| 196 | .flash_bbt = 1, |
| 197 | #endif |
| 198 | }; |
| 199 | |
Magnus Lilja | a2ef456 | 2010-05-14 17:08:29 +0200 | [diff] [blame] | 200 | /* |
| 201 | * USB OTG |
| 202 | */ |
| 203 | |
| 204 | #define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \ |
| 205 | PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU) |
| 206 | |
| 207 | #define USBOTG_RST_B IOMUX_TO_GPIO(MX31_PIN_USB_PWR) |
Fabio Estevam | 0d95b75 | 2010-12-21 16:38:22 -0200 | [diff] [blame] | 208 | #define USBH2_RST_B IOMUX_TO_GPIO(MX31_PIN_USB_BYP) |
Magnus Lilja | a2ef456 | 2010-05-14 17:08:29 +0200 | [diff] [blame] | 209 | |
Fabio Estevam | 41f6347 | 2010-06-21 13:33:05 -0700 | [diff] [blame] | 210 | static int mx31_3ds_usbotg_init(void) |
Magnus Lilja | a2ef456 | 2010-05-14 17:08:29 +0200 | [diff] [blame] | 211 | { |
Fabio Estevam | 41f6347 | 2010-06-21 13:33:05 -0700 | [diff] [blame] | 212 | int err; |
| 213 | |
Magnus Lilja | a2ef456 | 2010-05-14 17:08:29 +0200 | [diff] [blame] | 214 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG); |
| 215 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG); |
| 216 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG); |
| 217 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG); |
| 218 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG); |
| 219 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG); |
| 220 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG); |
| 221 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG); |
| 222 | mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG); |
| 223 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG); |
| 224 | mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG); |
| 225 | mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG); |
| 226 | |
Fabio Estevam | 41f6347 | 2010-06-21 13:33:05 -0700 | [diff] [blame] | 227 | err = gpio_request(USBOTG_RST_B, "otgusb-reset"); |
| 228 | if (err) { |
| 229 | pr_err("Failed to request the USB OTG reset gpio\n"); |
| 230 | return err; |
| 231 | } |
| 232 | |
| 233 | err = gpio_direction_output(USBOTG_RST_B, 0); |
| 234 | if (err) { |
| 235 | pr_err("Failed to drive the USB OTG reset gpio\n"); |
| 236 | goto usbotg_free_reset; |
| 237 | } |
| 238 | |
Magnus Lilja | a2ef456 | 2010-05-14 17:08:29 +0200 | [diff] [blame] | 239 | mdelay(1); |
| 240 | gpio_set_value(USBOTG_RST_B, 1); |
Fabio Estevam | 41f6347 | 2010-06-21 13:33:05 -0700 | [diff] [blame] | 241 | return 0; |
| 242 | |
| 243 | usbotg_free_reset: |
| 244 | gpio_free(USBOTG_RST_B); |
| 245 | return err; |
Magnus Lilja | a2ef456 | 2010-05-14 17:08:29 +0200 | [diff] [blame] | 246 | } |
| 247 | |
Fabio Estevam | 0d95b75 | 2010-12-21 16:38:22 -0200 | [diff] [blame] | 248 | static int mx31_3ds_host2_init(struct platform_device *pdev) |
| 249 | { |
| 250 | int err; |
| 251 | |
| 252 | mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG); |
| 253 | mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG); |
| 254 | mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG); |
| 255 | mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG); |
| 256 | mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG); |
| 257 | mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG); |
| 258 | mxc_iomux_set_pad(MX31_PIN_PC_VS2, USB_PAD_CFG); |
| 259 | mxc_iomux_set_pad(MX31_PIN_PC_BVD1, USB_PAD_CFG); |
| 260 | mxc_iomux_set_pad(MX31_PIN_PC_BVD2, USB_PAD_CFG); |
| 261 | mxc_iomux_set_pad(MX31_PIN_PC_RST, USB_PAD_CFG); |
| 262 | mxc_iomux_set_pad(MX31_PIN_IOIS16, USB_PAD_CFG); |
| 263 | mxc_iomux_set_pad(MX31_PIN_PC_RW_B, USB_PAD_CFG); |
| 264 | |
| 265 | err = gpio_request(USBH2_RST_B, "usbh2-reset"); |
| 266 | if (err) { |
| 267 | pr_err("Failed to request the USB Host 2 reset gpio\n"); |
| 268 | return err; |
| 269 | } |
| 270 | |
| 271 | err = gpio_direction_output(USBH2_RST_B, 0); |
| 272 | if (err) { |
| 273 | pr_err("Failed to drive the USB Host 2 reset gpio\n"); |
| 274 | goto usbotg_free_reset; |
| 275 | } |
| 276 | |
| 277 | mdelay(1); |
| 278 | gpio_set_value(USBH2_RST_B, 1); |
| 279 | return 0; |
| 280 | |
| 281 | usbotg_free_reset: |
| 282 | gpio_free(USBH2_RST_B); |
| 283 | return err; |
| 284 | } |
| 285 | |
Fabio Estevam | 1c50e67 | 2010-12-21 16:38:21 -0200 | [diff] [blame] | 286 | #if defined(CONFIG_USB_ULPI) |
| 287 | static struct mxc_usbh_platform_data otg_pdata __initdata = { |
| 288 | .portsc = MXC_EHCI_MODE_ULPI, |
| 289 | .flags = MXC_EHCI_POWER_PINS_ENABLED, |
| 290 | }; |
Fabio Estevam | 0d95b75 | 2010-12-21 16:38:22 -0200 | [diff] [blame] | 291 | |
| 292 | static struct mxc_usbh_platform_data usbh2_pdata __initdata = { |
| 293 | .init = mx31_3ds_host2_init, |
| 294 | .portsc = MXC_EHCI_MODE_ULPI, |
| 295 | .flags = MXC_EHCI_POWER_PINS_ENABLED, |
| 296 | }; |
Fabio Estevam | 1c50e67 | 2010-12-21 16:38:21 -0200 | [diff] [blame] | 297 | #endif |
| 298 | |
Uwe Kleine-König | 9e1dde3 | 2010-11-12 16:40:06 +0100 | [diff] [blame] | 299 | static const struct fsl_usb2_platform_data usbotg_pdata __initconst = { |
Magnus Lilja | a2ef456 | 2010-05-14 17:08:29 +0200 | [diff] [blame] | 300 | .operating_mode = FSL_USB2_DR_DEVICE, |
| 301 | .phy_mode = FSL_USB2_PHY_ULPI, |
| 302 | }; |
| 303 | |
Fabio Estevam | 1c50e67 | 2010-12-21 16:38:21 -0200 | [diff] [blame] | 304 | static int otg_mode_host; |
| 305 | |
| 306 | static int __init mx31_3ds_otg_mode(char *options) |
| 307 | { |
| 308 | if (!strcmp(options, "host")) |
| 309 | otg_mode_host = 1; |
| 310 | else if (!strcmp(options, "device")) |
| 311 | otg_mode_host = 0; |
| 312 | else |
| 313 | pr_info("otg_mode neither \"host\" nor \"device\". " |
| 314 | "Defaulting to device\n"); |
| 315 | return 0; |
| 316 | } |
| 317 | __setup("otg_mode=", mx31_3ds_otg_mode); |
| 318 | |
Uwe Kleine-König | 16cf5c4 | 2010-06-23 11:46:16 +0200 | [diff] [blame] | 319 | static const struct imxuart_platform_data uart_pdata __initconst = { |
Magnus Lilja | 153fa1d | 2009-05-16 12:43:10 +0200 | [diff] [blame] | 320 | .flags = IMXUART_HAVE_RTSCTS, |
| 321 | }; |
Fabio Estevam | 1553a1e | 2008-11-12 15:38:39 +0100 | [diff] [blame] | 322 | |
Magnus Lilja | 135cad3 | 2009-05-17 20:18:08 +0200 | [diff] [blame] | 323 | /* |
Magnus Lilja | 135cad3 | 2009-05-17 20:18:08 +0200 | [diff] [blame] | 324 | * Set up static virtual mappings. |
| 325 | */ |
Alberto Panizzo | 11a332adf | 2010-03-23 19:46:57 +0100 | [diff] [blame] | 326 | static void __init mx31_3ds_map_io(void) |
Magnus Lilja | 135cad3 | 2009-05-17 20:18:08 +0200 | [diff] [blame] | 327 | { |
| 328 | mx31_map_io(); |
Magnus Lilja | 135cad3 | 2009-05-17 20:18:08 +0200 | [diff] [blame] | 329 | } |
| 330 | |
Fabio Estevam | 1553a1e | 2008-11-12 15:38:39 +0100 | [diff] [blame] | 331 | /*! |
Fabio Estevam | 1553a1e | 2008-11-12 15:38:39 +0100 | [diff] [blame] | 332 | * Board specific initialization. |
| 333 | */ |
| 334 | static void __init mxc_board_init(void) |
| 335 | { |
Alberto Panizzo | 11a332adf | 2010-03-23 19:46:57 +0100 | [diff] [blame] | 336 | mxc_iomux_setup_multiple_pins(mx31_3ds_pins, ARRAY_SIZE(mx31_3ds_pins), |
| 337 | "mx31_3ds"); |
Magnus Lilja | 153fa1d | 2009-05-16 12:43:10 +0200 | [diff] [blame] | 338 | |
Uwe Kleine-König | 16cf5c4 | 2010-06-23 11:46:16 +0200 | [diff] [blame] | 339 | imx31_add_imx_uart0(&uart_pdata); |
Uwe Kleine-König | a2ceeef | 2010-06-16 12:23:11 +0200 | [diff] [blame] | 340 | imx31_add_mxc_nand(&mx31_3ds_nand_board_info); |
Alberto Panizzo | ae7a3f1 | 2010-03-23 19:51:45 +0100 | [diff] [blame] | 341 | |
Rogerio Pimentel | 4a74bdd | 2010-10-25 12:55:14 -0200 | [diff] [blame] | 342 | imx31_add_spi_imx1(&spi1_pdata); |
Alberto Panizzo | ae7a3f1 | 2010-03-23 19:51:45 +0100 | [diff] [blame] | 343 | spi_register_board_info(mx31_3ds_spi_devs, |
| 344 | ARRAY_SIZE(mx31_3ds_spi_devs)); |
Magnus Lilja | 135cad3 | 2009-05-17 20:18:08 +0200 | [diff] [blame] | 345 | |
Uwe Kleine-König | d690b4c | 2010-11-16 21:27:33 +0100 | [diff] [blame] | 346 | imx31_add_imx_keypad(&mx31_3ds_keymap_data); |
Alberto Panizzo | 54c1f63 | 2010-05-19 11:34:43 +0200 | [diff] [blame] | 347 | |
Magnus Lilja | a2ef456 | 2010-05-14 17:08:29 +0200 | [diff] [blame] | 348 | mx31_3ds_usbotg_init(); |
Fabio Estevam | 1c50e67 | 2010-12-21 16:38:21 -0200 | [diff] [blame] | 349 | #if defined(CONFIG_USB_ULPI) |
| 350 | if (otg_mode_host) { |
| 351 | otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, |
| 352 | ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); |
| 353 | |
| 354 | imx31_add_mxc_ehci_otg(&otg_pdata); |
| 355 | } |
Fabio Estevam | 0d95b75 | 2010-12-21 16:38:22 -0200 | [diff] [blame] | 356 | usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, |
| 357 | ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); |
| 358 | imx31_add_mxc_ehci_hs(2, &usbh2_pdata); |
Fabio Estevam | 1c50e67 | 2010-12-21 16:38:21 -0200 | [diff] [blame] | 359 | #endif |
| 360 | if (!otg_mode_host) |
| 361 | imx31_add_fsl_usb2_udc(&usbotg_pdata); |
Magnus Lilja | a2ef456 | 2010-05-14 17:08:29 +0200 | [diff] [blame] | 362 | |
Rogerio Pimentel | b8be7b9a | 2010-10-25 12:54:24 -0200 | [diff] [blame] | 363 | if (mxc_expio_init(MX31_CS5_BASE_ADDR, EXPIO_PARENT_INT)) |
| 364 | printk(KERN_WARNING "Init of the debug board failed, all " |
| 365 | "devices on the debug board are unusable.\n"); |
Fabio Estevam | bfdde3a | 2010-12-07 17:14:44 -0200 | [diff] [blame] | 366 | imx31_add_imx2_wdt(NULL); |
Fabio Estevam | 1553a1e | 2008-11-12 15:38:39 +0100 | [diff] [blame] | 367 | } |
| 368 | |
Alberto Panizzo | 11a332adf | 2010-03-23 19:46:57 +0100 | [diff] [blame] | 369 | static void __init mx31_3ds_timer_init(void) |
Fabio Estevam | 1553a1e | 2008-11-12 15:38:39 +0100 | [diff] [blame] | 370 | { |
Sascha Hauer | 30c730f | 2009-02-16 14:36:49 +0100 | [diff] [blame] | 371 | mx31_clocks_init(26000000); |
Fabio Estevam | 1553a1e | 2008-11-12 15:38:39 +0100 | [diff] [blame] | 372 | } |
| 373 | |
Alberto Panizzo | 11a332adf | 2010-03-23 19:46:57 +0100 | [diff] [blame] | 374 | static struct sys_timer mx31_3ds_timer = { |
| 375 | .init = mx31_3ds_timer_init, |
Fabio Estevam | 1553a1e | 2008-11-12 15:38:39 +0100 | [diff] [blame] | 376 | }; |
| 377 | |
| 378 | /* |
| 379 | * The following uses standard kernel macros defined in arch.h in order to |
Alberto Panizzo | 11a332adf | 2010-03-23 19:46:57 +0100 | [diff] [blame] | 380 | * initialize __mach_desc_MX31_3DS data structure. |
Fabio Estevam | 1553a1e | 2008-11-12 15:38:39 +0100 | [diff] [blame] | 381 | */ |
| 382 | MACHINE_START(MX31_3DS, "Freescale MX31PDK (3DS)") |
| 383 | /* Maintainer: Freescale Semiconductor, Inc. */ |
Uwe Kleine-König | 3410123 | 2010-01-29 17:36:05 +0100 | [diff] [blame] | 384 | .boot_params = MX3x_PHYS_OFFSET + 0x100, |
Alberto Panizzo | 11a332adf | 2010-03-23 19:46:57 +0100 | [diff] [blame] | 385 | .map_io = mx31_3ds_map_io, |
Sascha Hauer | c5aa0ad | 2009-05-25 17:36:19 +0200 | [diff] [blame] | 386 | .init_irq = mx31_init_irq, |
Fabio Estevam | 1553a1e | 2008-11-12 15:38:39 +0100 | [diff] [blame] | 387 | .init_machine = mxc_board_init, |
Alberto Panizzo | 11a332adf | 2010-03-23 19:46:57 +0100 | [diff] [blame] | 388 | .timer = &mx31_3ds_timer, |
Fabio Estevam | 1553a1e | 2008-11-12 15:38:39 +0100 | [diff] [blame] | 389 | MACHINE_END |