Arnaud Patard (Rtp) | 7ac18a3 | 2011-02-17 15:31:28 +0100 | [diff] [blame] | 1 | /* |
| 2 | * based on code from the following |
| 3 | * Copyright 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved. |
| 4 | * Copyright 2009-2010 Pegatron Corporation. All Rights Reserved. |
| 5 | * Copyright 2009-2010 Genesi USA, Inc. All Rights Reserved. |
| 6 | * |
| 7 | * The code contained herein is licensed under the GNU General Public |
| 8 | * License. You may obtain a copy of the GNU General Public License |
| 9 | * Version 2 or later at the following locations: |
| 10 | * |
| 11 | * http://www.opensource.org/licenses/gpl-license.html |
| 12 | * http://www.gnu.org/copyleft/gpl.html |
| 13 | */ |
| 14 | |
| 15 | #include <linux/init.h> |
| 16 | #include <linux/platform_device.h> |
| 17 | #include <linux/i2c.h> |
| 18 | #include <linux/gpio.h> |
| 19 | #include <linux/leds.h> |
| 20 | #include <linux/input.h> |
| 21 | #include <linux/delay.h> |
| 22 | #include <linux/io.h> |
| 23 | #include <linux/fsl_devices.h> |
| 24 | #include <linux/spi/flash.h> |
| 25 | #include <linux/spi/spi.h> |
Arnaud Patard (Rtp) | 2432cff | 2011-02-17 15:31:30 +0100 | [diff] [blame] | 26 | #include <linux/mfd/mc13892.h> |
| 27 | #include <linux/regulator/machine.h> |
| 28 | #include <linux/regulator/consumer.h> |
Arnaud Patard (Rtp) | 7ac18a3 | 2011-02-17 15:31:28 +0100 | [diff] [blame] | 29 | |
| 30 | #include <mach/common.h> |
| 31 | #include <mach/hardware.h> |
| 32 | #include <mach/iomux-mx51.h> |
| 33 | #include <mach/i2c.h> |
| 34 | #include <mach/mxc_ehci.h> |
| 35 | |
Arnaud Patard (Rtp) | 9d72af6 | 2011-02-17 15:31:29 +0100 | [diff] [blame] | 36 | #include <linux/usb/otg.h> |
| 37 | #include <linux/usb/ulpi.h> |
| 38 | #include <mach/ulpi.h> |
| 39 | |
Arnaud Patard (Rtp) | 7ac18a3 | 2011-02-17 15:31:28 +0100 | [diff] [blame] | 40 | #include <asm/irq.h> |
| 41 | #include <asm/setup.h> |
| 42 | #include <asm/mach-types.h> |
| 43 | #include <asm/mach/arch.h> |
| 44 | #include <asm/mach/time.h> |
| 45 | |
| 46 | #include "devices-imx51.h" |
| 47 | #include "devices.h" |
| 48 | #include "efika.h" |
Arnaud Patard (Rtp) | 856e656 | 2011-02-17 15:31:31 +0100 | [diff] [blame] | 49 | #include "cpu_op-mx51.h" |
Arnaud Patard (Rtp) | 7ac18a3 | 2011-02-17 15:31:28 +0100 | [diff] [blame] | 50 | |
Arnaud Patard (Rtp) | 9d72af6 | 2011-02-17 15:31:29 +0100 | [diff] [blame] | 51 | #define MX51_USB_CTRL_1_OFFSET 0x10 |
| 52 | #define MX51_USB_CTRL_UH1_EXT_CLK_EN (1 << 25) |
| 53 | #define MX51_USB_PLL_DIV_19_2_MHZ 0x01 |
| 54 | |
| 55 | #define EFIKAMX_USB_HUB_RESET IMX_GPIO_NR(1, 5) |
| 56 | #define EFIKAMX_USBH1_STP IMX_GPIO_NR(1, 27) |
Arnaud Patard (Rtp) | 7ac18a3 | 2011-02-17 15:31:28 +0100 | [diff] [blame] | 57 | |
| 58 | #define EFIKAMX_SPI_CS0 IMX_GPIO_NR(4, 24) |
| 59 | #define EFIKAMX_SPI_CS1 IMX_GPIO_NR(4, 25) |
| 60 | |
Arnaud Patard (Rtp) | 2432cff | 2011-02-17 15:31:30 +0100 | [diff] [blame] | 61 | #define EFIKAMX_PMIC IMX_GPIO_NR(1, 6) |
| 62 | |
Arnaud Patard (Rtp) | 7ac18a3 | 2011-02-17 15:31:28 +0100 | [diff] [blame] | 63 | static iomux_v3_cfg_t mx51efika_pads[] = { |
| 64 | /* UART1 */ |
| 65 | MX51_PAD_UART1_RXD__UART1_RXD, |
| 66 | MX51_PAD_UART1_TXD__UART1_TXD, |
| 67 | MX51_PAD_UART1_RTS__UART1_RTS, |
| 68 | MX51_PAD_UART1_CTS__UART1_CTS, |
| 69 | |
| 70 | /* SD 1 */ |
| 71 | MX51_PAD_SD1_CMD__SD1_CMD, |
| 72 | MX51_PAD_SD1_CLK__SD1_CLK, |
| 73 | MX51_PAD_SD1_DATA0__SD1_DATA0, |
| 74 | MX51_PAD_SD1_DATA1__SD1_DATA1, |
| 75 | MX51_PAD_SD1_DATA2__SD1_DATA2, |
| 76 | MX51_PAD_SD1_DATA3__SD1_DATA3, |
| 77 | |
| 78 | /* SD 2 */ |
| 79 | MX51_PAD_SD2_CMD__SD2_CMD, |
| 80 | MX51_PAD_SD2_CLK__SD2_CLK, |
| 81 | MX51_PAD_SD2_DATA0__SD2_DATA0, |
| 82 | MX51_PAD_SD2_DATA1__SD2_DATA1, |
| 83 | MX51_PAD_SD2_DATA2__SD2_DATA2, |
| 84 | MX51_PAD_SD2_DATA3__SD2_DATA3, |
| 85 | |
| 86 | /* SD/MMC WP/CD */ |
| 87 | MX51_PAD_GPIO1_0__SD1_CD, |
| 88 | MX51_PAD_GPIO1_1__SD1_WP, |
| 89 | MX51_PAD_GPIO1_7__SD2_WP, |
| 90 | MX51_PAD_GPIO1_8__SD2_CD, |
| 91 | |
| 92 | /* spi */ |
| 93 | MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI, |
| 94 | MX51_PAD_CSPI1_MISO__ECSPI1_MISO, |
| 95 | MX51_PAD_CSPI1_SS0__GPIO4_24, |
| 96 | MX51_PAD_CSPI1_SS1__GPIO4_25, |
| 97 | MX51_PAD_CSPI1_RDY__ECSPI1_RDY, |
| 98 | MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK, |
Arnaud Patard (Rtp) | 2432cff | 2011-02-17 15:31:30 +0100 | [diff] [blame] | 99 | MX51_PAD_GPIO1_6__GPIO1_6, |
Arnaud Patard (Rtp) | 9d72af6 | 2011-02-17 15:31:29 +0100 | [diff] [blame] | 100 | |
| 101 | /* USB HOST1 */ |
| 102 | MX51_PAD_USBH1_CLK__USBH1_CLK, |
| 103 | MX51_PAD_USBH1_DIR__USBH1_DIR, |
| 104 | MX51_PAD_USBH1_NXT__USBH1_NXT, |
| 105 | MX51_PAD_USBH1_DATA0__USBH1_DATA0, |
| 106 | MX51_PAD_USBH1_DATA1__USBH1_DATA1, |
| 107 | MX51_PAD_USBH1_DATA2__USBH1_DATA2, |
| 108 | MX51_PAD_USBH1_DATA3__USBH1_DATA3, |
| 109 | MX51_PAD_USBH1_DATA4__USBH1_DATA4, |
| 110 | MX51_PAD_USBH1_DATA5__USBH1_DATA5, |
| 111 | MX51_PAD_USBH1_DATA6__USBH1_DATA6, |
| 112 | MX51_PAD_USBH1_DATA7__USBH1_DATA7, |
| 113 | |
| 114 | /* USB HUB RESET */ |
| 115 | MX51_PAD_GPIO1_5__GPIO1_5, |
| 116 | |
| 117 | /* WLAN */ |
| 118 | MX51_PAD_EIM_A22__GPIO2_16, |
| 119 | MX51_PAD_EIM_A16__GPIO2_10, |
| 120 | |
| 121 | /* USB PHY RESET */ |
| 122 | MX51_PAD_EIM_D27__GPIO2_9, |
Arnaud Patard (Rtp) | 7ac18a3 | 2011-02-17 15:31:28 +0100 | [diff] [blame] | 123 | }; |
| 124 | |
| 125 | /* Serial ports */ |
| 126 | static const struct imxuart_platform_data uart_pdata = { |
| 127 | .flags = IMXUART_HAVE_RTSCTS, |
| 128 | }; |
| 129 | |
| 130 | /* This function is board specific as the bit mask for the plldiv will also |
| 131 | * be different for other Freescale SoCs, thus a common bitmask is not |
| 132 | * possible and cannot get place in /plat-mxc/ehci.c. |
| 133 | */ |
| 134 | static int initialize_otg_port(struct platform_device *pdev) |
| 135 | { |
| 136 | u32 v; |
| 137 | void __iomem *usb_base; |
| 138 | void __iomem *usbother_base; |
| 139 | usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K); |
| 140 | if (!usb_base) |
| 141 | return -ENOMEM; |
| 142 | usbother_base = (void __iomem *)(usb_base + MX5_USBOTHER_REGS_OFFSET); |
| 143 | |
| 144 | /* Set the PHY clock to 19.2MHz */ |
| 145 | v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET); |
| 146 | v &= ~MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK; |
Arnaud Patard (Rtp) | 9d72af6 | 2011-02-17 15:31:29 +0100 | [diff] [blame] | 147 | v |= MX51_USB_PLL_DIV_19_2_MHZ; |
Arnaud Patard (Rtp) | 7ac18a3 | 2011-02-17 15:31:28 +0100 | [diff] [blame] | 148 | __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET); |
| 149 | iounmap(usb_base); |
| 150 | |
| 151 | mdelay(10); |
| 152 | |
Arnaud Patard (Rtp) | 9d72af6 | 2011-02-17 15:31:29 +0100 | [diff] [blame] | 153 | return mx51_initialize_usb_hw(pdev->id, MXC_EHCI_INTERNAL_PHY); |
Arnaud Patard (Rtp) | 7ac18a3 | 2011-02-17 15:31:28 +0100 | [diff] [blame] | 154 | } |
| 155 | |
| 156 | static struct mxc_usbh_platform_data dr_utmi_config = { |
| 157 | .init = initialize_otg_port, |
| 158 | .portsc = MXC_EHCI_UTMI_16BIT, |
| 159 | }; |
| 160 | |
Arnaud Patard (Rtp) | 9d72af6 | 2011-02-17 15:31:29 +0100 | [diff] [blame] | 161 | static int initialize_usbh1_port(struct platform_device *pdev) |
| 162 | { |
| 163 | iomux_v3_cfg_t usbh1stp = MX51_PAD_USBH1_STP__USBH1_STP; |
| 164 | iomux_v3_cfg_t usbh1gpio = MX51_PAD_USBH1_STP__GPIO1_27; |
| 165 | u32 v; |
| 166 | void __iomem *usb_base; |
| 167 | void __iomem *socregs_base; |
| 168 | |
| 169 | mxc_iomux_v3_setup_pad(usbh1gpio); |
| 170 | gpio_request(EFIKAMX_USBH1_STP, "usbh1_stp"); |
| 171 | gpio_direction_output(EFIKAMX_USBH1_STP, 0); |
| 172 | msleep(1); |
| 173 | gpio_set_value(EFIKAMX_USBH1_STP, 1); |
| 174 | msleep(1); |
| 175 | |
| 176 | usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K); |
| 177 | socregs_base = (void __iomem *)(usb_base + MX5_USBOTHER_REGS_OFFSET); |
| 178 | |
| 179 | /* The clock for the USBH1 ULPI port will come externally */ |
| 180 | /* from the PHY. */ |
| 181 | v = __raw_readl(socregs_base + MX51_USB_CTRL_1_OFFSET); |
| 182 | __raw_writel(v | MX51_USB_CTRL_UH1_EXT_CLK_EN, |
| 183 | socregs_base + MX51_USB_CTRL_1_OFFSET); |
| 184 | |
| 185 | iounmap(usb_base); |
| 186 | |
| 187 | gpio_free(EFIKAMX_USBH1_STP); |
| 188 | mxc_iomux_v3_setup_pad(usbh1stp); |
| 189 | |
| 190 | mdelay(10); |
| 191 | |
| 192 | return mx51_initialize_usb_hw(0, MXC_EHCI_ITC_NO_THRESHOLD); |
| 193 | } |
| 194 | |
| 195 | static struct mxc_usbh_platform_data usbh1_config = { |
| 196 | .init = initialize_usbh1_port, |
| 197 | .portsc = MXC_EHCI_MODE_ULPI, |
| 198 | }; |
| 199 | |
| 200 | static void mx51_efika_hubreset(void) |
| 201 | { |
| 202 | gpio_request(EFIKAMX_USB_HUB_RESET, "usb_hub_rst"); |
| 203 | gpio_direction_output(EFIKAMX_USB_HUB_RESET, 1); |
| 204 | msleep(1); |
| 205 | gpio_set_value(EFIKAMX_USB_HUB_RESET, 0); |
| 206 | msleep(1); |
| 207 | gpio_set_value(EFIKAMX_USB_HUB_RESET, 1); |
| 208 | } |
| 209 | |
| 210 | static void __init mx51_efika_usb(void) |
| 211 | { |
| 212 | mx51_efika_hubreset(); |
| 213 | |
| 214 | /* pulling it low, means no USB at all... */ |
| 215 | gpio_request(EFIKA_USB_PHY_RESET, "usb_phy_reset"); |
| 216 | gpio_direction_output(EFIKA_USB_PHY_RESET, 0); |
| 217 | msleep(1); |
| 218 | gpio_set_value(EFIKA_USB_PHY_RESET, 1); |
| 219 | |
Sascha Hauer | 48f6b09 | 2011-03-02 09:27:42 +0100 | [diff] [blame] | 220 | usbh1_config.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS | |
| 221 | ULPI_OTG_DRVVBUS_EXT | ULPI_OTG_EXTVBUSIND); |
Arnaud Patard (Rtp) | 9d72af6 | 2011-02-17 15:31:29 +0100 | [diff] [blame] | 222 | |
| 223 | mxc_register_device(&mxc_usbdr_host_device, &dr_utmi_config); |
Sascha Hauer | 48f6b09 | 2011-03-02 09:27:42 +0100 | [diff] [blame] | 224 | if (usbh1_config.otg) |
| 225 | mxc_register_device(&mxc_usbh1_device, &usbh1_config); |
Arnaud Patard (Rtp) | 9d72af6 | 2011-02-17 15:31:29 +0100 | [diff] [blame] | 226 | } |
| 227 | |
Arnaud Patard (Rtp) | 7ac18a3 | 2011-02-17 15:31:28 +0100 | [diff] [blame] | 228 | static struct mtd_partition mx51_efika_spi_nor_partitions[] = { |
| 229 | { |
| 230 | .name = "u-boot", |
| 231 | .offset = 0, |
| 232 | .size = SZ_256K, |
| 233 | }, |
| 234 | { |
| 235 | .name = "config", |
| 236 | .offset = MTDPART_OFS_APPEND, |
| 237 | .size = SZ_64K, |
| 238 | }, |
| 239 | }; |
| 240 | |
| 241 | static struct flash_platform_data mx51_efika_spi_flash_data = { |
| 242 | .name = "spi_flash", |
| 243 | .parts = mx51_efika_spi_nor_partitions, |
| 244 | .nr_parts = ARRAY_SIZE(mx51_efika_spi_nor_partitions), |
| 245 | .type = "sst25vf032b", |
| 246 | }; |
| 247 | |
Arnaud Patard (Rtp) | 2432cff | 2011-02-17 15:31:30 +0100 | [diff] [blame] | 248 | static struct regulator_consumer_supply sw1_consumers[] = { |
| 249 | { |
| 250 | .supply = "cpu_vcc", |
| 251 | } |
| 252 | }; |
| 253 | |
| 254 | static struct regulator_consumer_supply vdig_consumers[] = { |
| 255 | /* sgtl5000 */ |
| 256 | REGULATOR_SUPPLY("VDDA", "1-000a"), |
| 257 | REGULATOR_SUPPLY("VDDD", "1-000a"), |
| 258 | }; |
| 259 | |
| 260 | static struct regulator_consumer_supply vvideo_consumers[] = { |
| 261 | /* sgtl5000 */ |
| 262 | REGULATOR_SUPPLY("VDDIO", "1-000a"), |
| 263 | }; |
| 264 | |
| 265 | static struct regulator_consumer_supply vsd_consumers[] = { |
| 266 | REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx.0"), |
| 267 | REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx.1"), |
| 268 | }; |
| 269 | |
| 270 | static struct regulator_consumer_supply pwgt1_consumer[] = { |
| 271 | { |
| 272 | .supply = "pwgt1", |
| 273 | } |
| 274 | }; |
| 275 | |
| 276 | static struct regulator_consumer_supply pwgt2_consumer[] = { |
| 277 | { |
| 278 | .supply = "pwgt2", |
| 279 | } |
| 280 | }; |
| 281 | |
| 282 | static struct regulator_consumer_supply coincell_consumer[] = { |
| 283 | { |
| 284 | .supply = "coincell", |
| 285 | } |
| 286 | }; |
| 287 | |
| 288 | static struct regulator_init_data sw1_init = { |
| 289 | .constraints = { |
| 290 | .name = "SW1", |
| 291 | .min_uV = 600000, |
| 292 | .max_uV = 1375000, |
| 293 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, |
| 294 | .valid_modes_mask = 0, |
| 295 | .always_on = 1, |
| 296 | .boot_on = 1, |
| 297 | .state_mem = { |
| 298 | .uV = 850000, |
| 299 | .mode = REGULATOR_MODE_NORMAL, |
| 300 | .enabled = 1, |
| 301 | }, |
| 302 | }, |
| 303 | .num_consumer_supplies = ARRAY_SIZE(sw1_consumers), |
| 304 | .consumer_supplies = sw1_consumers, |
| 305 | }; |
| 306 | |
| 307 | static struct regulator_init_data sw2_init = { |
| 308 | .constraints = { |
| 309 | .name = "SW2", |
| 310 | .min_uV = 900000, |
| 311 | .max_uV = 1850000, |
| 312 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, |
| 313 | .always_on = 1, |
| 314 | .boot_on = 1, |
| 315 | .state_mem = { |
| 316 | .uV = 950000, |
| 317 | .mode = REGULATOR_MODE_NORMAL, |
| 318 | .enabled = 1, |
| 319 | }, |
| 320 | } |
| 321 | }; |
| 322 | |
| 323 | static struct regulator_init_data sw3_init = { |
| 324 | .constraints = { |
| 325 | .name = "SW3", |
| 326 | .min_uV = 1100000, |
| 327 | .max_uV = 1850000, |
| 328 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, |
| 329 | .always_on = 1, |
| 330 | .boot_on = 1, |
| 331 | } |
| 332 | }; |
| 333 | |
| 334 | static struct regulator_init_data sw4_init = { |
| 335 | .constraints = { |
| 336 | .name = "SW4", |
| 337 | .min_uV = 1100000, |
| 338 | .max_uV = 1850000, |
| 339 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, |
| 340 | .always_on = 1, |
| 341 | .boot_on = 1, |
| 342 | } |
| 343 | }; |
| 344 | |
| 345 | static struct regulator_init_data viohi_init = { |
| 346 | .constraints = { |
| 347 | .name = "VIOHI", |
| 348 | .boot_on = 1, |
| 349 | .always_on = 1, |
| 350 | } |
| 351 | }; |
| 352 | |
| 353 | static struct regulator_init_data vusb_init = { |
| 354 | .constraints = { |
| 355 | .name = "VUSB", |
| 356 | .boot_on = 1, |
| 357 | .always_on = 1, |
| 358 | } |
| 359 | }; |
| 360 | |
| 361 | static struct regulator_init_data swbst_init = { |
| 362 | .constraints = { |
| 363 | .name = "SWBST", |
| 364 | } |
| 365 | }; |
| 366 | |
| 367 | static struct regulator_init_data vdig_init = { |
| 368 | .constraints = { |
| 369 | .name = "VDIG", |
| 370 | .min_uV = 1050000, |
| 371 | .max_uV = 1800000, |
| 372 | .valid_ops_mask = |
| 373 | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, |
| 374 | .boot_on = 1, |
| 375 | .always_on = 1, |
| 376 | }, |
| 377 | .num_consumer_supplies = ARRAY_SIZE(vdig_consumers), |
| 378 | .consumer_supplies = vdig_consumers, |
| 379 | }; |
| 380 | |
| 381 | static struct regulator_init_data vpll_init = { |
| 382 | .constraints = { |
| 383 | .name = "VPLL", |
| 384 | .min_uV = 1050000, |
| 385 | .max_uV = 1800000, |
| 386 | .valid_ops_mask = |
| 387 | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, |
| 388 | .boot_on = 1, |
| 389 | .always_on = 1, |
| 390 | } |
| 391 | }; |
| 392 | |
| 393 | static struct regulator_init_data vusb2_init = { |
| 394 | .constraints = { |
| 395 | .name = "VUSB2", |
| 396 | .min_uV = 2400000, |
| 397 | .max_uV = 2775000, |
| 398 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, |
| 399 | .boot_on = 1, |
| 400 | .always_on = 1, |
| 401 | } |
| 402 | }; |
| 403 | |
| 404 | static struct regulator_init_data vvideo_init = { |
| 405 | .constraints = { |
| 406 | .name = "VVIDEO", |
| 407 | .min_uV = 2775000, |
| 408 | .max_uV = 2775000, |
| 409 | .valid_ops_mask = |
| 410 | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, |
| 411 | .boot_on = 1, |
| 412 | .apply_uV = 1, |
| 413 | }, |
| 414 | .num_consumer_supplies = ARRAY_SIZE(vvideo_consumers), |
| 415 | .consumer_supplies = vvideo_consumers, |
| 416 | }; |
| 417 | |
| 418 | static struct regulator_init_data vaudio_init = { |
| 419 | .constraints = { |
| 420 | .name = "VAUDIO", |
| 421 | .min_uV = 2300000, |
| 422 | .max_uV = 3000000, |
| 423 | .valid_ops_mask = |
| 424 | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, |
| 425 | .boot_on = 1, |
| 426 | } |
| 427 | }; |
| 428 | |
| 429 | static struct regulator_init_data vsd_init = { |
| 430 | .constraints = { |
| 431 | .name = "VSD", |
| 432 | .min_uV = 1800000, |
| 433 | .max_uV = 3150000, |
| 434 | .valid_ops_mask = |
| 435 | REGULATOR_CHANGE_VOLTAGE, |
| 436 | .boot_on = 1, |
| 437 | }, |
| 438 | .num_consumer_supplies = ARRAY_SIZE(vsd_consumers), |
| 439 | .consumer_supplies = vsd_consumers, |
| 440 | }; |
| 441 | |
| 442 | static struct regulator_init_data vcam_init = { |
| 443 | .constraints = { |
| 444 | .name = "VCAM", |
| 445 | .min_uV = 2500000, |
| 446 | .max_uV = 3000000, |
| 447 | .valid_ops_mask = |
| 448 | REGULATOR_CHANGE_VOLTAGE | |
| 449 | REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, |
| 450 | .valid_modes_mask = REGULATOR_MODE_FAST | REGULATOR_MODE_NORMAL, |
| 451 | .boot_on = 1, |
| 452 | } |
| 453 | }; |
| 454 | |
| 455 | static struct regulator_init_data vgen1_init = { |
| 456 | .constraints = { |
| 457 | .name = "VGEN1", |
| 458 | .min_uV = 1200000, |
| 459 | .max_uV = 3150000, |
| 460 | .valid_ops_mask = |
| 461 | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, |
| 462 | .boot_on = 1, |
| 463 | .always_on = 1, |
| 464 | } |
| 465 | }; |
| 466 | |
| 467 | static struct regulator_init_data vgen2_init = { |
| 468 | .constraints = { |
| 469 | .name = "VGEN2", |
| 470 | .min_uV = 1200000, |
| 471 | .max_uV = 3150000, |
| 472 | .valid_ops_mask = |
| 473 | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, |
| 474 | .boot_on = 1, |
| 475 | .always_on = 1, |
| 476 | } |
| 477 | }; |
| 478 | |
| 479 | static struct regulator_init_data vgen3_init = { |
| 480 | .constraints = { |
| 481 | .name = "VGEN3", |
| 482 | .min_uV = 1800000, |
| 483 | .max_uV = 2900000, |
| 484 | .valid_ops_mask = |
| 485 | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, |
| 486 | .boot_on = 1, |
| 487 | .always_on = 1, |
| 488 | } |
| 489 | }; |
| 490 | |
| 491 | static struct regulator_init_data gpo1_init = { |
| 492 | .constraints = { |
| 493 | .name = "GPO1", |
| 494 | } |
| 495 | }; |
| 496 | |
| 497 | static struct regulator_init_data gpo2_init = { |
| 498 | .constraints = { |
| 499 | .name = "GPO2", |
| 500 | } |
| 501 | }; |
| 502 | |
| 503 | static struct regulator_init_data gpo3_init = { |
| 504 | .constraints = { |
| 505 | .name = "GPO3", |
| 506 | } |
| 507 | }; |
| 508 | |
| 509 | static struct regulator_init_data gpo4_init = { |
| 510 | .constraints = { |
| 511 | .name = "GPO4", |
| 512 | } |
| 513 | }; |
| 514 | |
| 515 | static struct regulator_init_data pwgt1_init = { |
| 516 | .constraints = { |
| 517 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 518 | .boot_on = 1, |
| 519 | }, |
| 520 | .num_consumer_supplies = ARRAY_SIZE(pwgt1_consumer), |
| 521 | .consumer_supplies = pwgt1_consumer, |
| 522 | }; |
| 523 | |
| 524 | static struct regulator_init_data pwgt2_init = { |
| 525 | .constraints = { |
| 526 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 527 | .boot_on = 1, |
| 528 | }, |
| 529 | .num_consumer_supplies = ARRAY_SIZE(pwgt2_consumer), |
| 530 | .consumer_supplies = pwgt2_consumer, |
| 531 | }; |
| 532 | |
| 533 | static struct regulator_init_data vcoincell_init = { |
| 534 | .constraints = { |
| 535 | .name = "COINCELL", |
| 536 | .min_uV = 3000000, |
| 537 | .max_uV = 3000000, |
| 538 | .valid_ops_mask = |
| 539 | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, |
| 540 | }, |
| 541 | .num_consumer_supplies = ARRAY_SIZE(coincell_consumer), |
| 542 | .consumer_supplies = coincell_consumer, |
| 543 | }; |
| 544 | |
| 545 | static struct mc13xxx_regulator_init_data mx51_efika_regulators[] = { |
| 546 | { .id = MC13892_SW1, .init_data = &sw1_init }, |
| 547 | { .id = MC13892_SW2, .init_data = &sw2_init }, |
| 548 | { .id = MC13892_SW3, .init_data = &sw3_init }, |
| 549 | { .id = MC13892_SW4, .init_data = &sw4_init }, |
| 550 | { .id = MC13892_SWBST, .init_data = &swbst_init }, |
| 551 | { .id = MC13892_VIOHI, .init_data = &viohi_init }, |
| 552 | { .id = MC13892_VPLL, .init_data = &vpll_init }, |
| 553 | { .id = MC13892_VDIG, .init_data = &vdig_init }, |
| 554 | { .id = MC13892_VSD, .init_data = &vsd_init }, |
| 555 | { .id = MC13892_VUSB2, .init_data = &vusb2_init }, |
| 556 | { .id = MC13892_VVIDEO, .init_data = &vvideo_init }, |
| 557 | { .id = MC13892_VAUDIO, .init_data = &vaudio_init }, |
| 558 | { .id = MC13892_VCAM, .init_data = &vcam_init }, |
| 559 | { .id = MC13892_VGEN1, .init_data = &vgen1_init }, |
| 560 | { .id = MC13892_VGEN2, .init_data = &vgen2_init }, |
| 561 | { .id = MC13892_VGEN3, .init_data = &vgen3_init }, |
| 562 | { .id = MC13892_VUSB, .init_data = &vusb_init }, |
| 563 | { .id = MC13892_GPO1, .init_data = &gpo1_init }, |
| 564 | { .id = MC13892_GPO2, .init_data = &gpo2_init }, |
| 565 | { .id = MC13892_GPO3, .init_data = &gpo3_init }, |
| 566 | { .id = MC13892_GPO4, .init_data = &gpo4_init }, |
| 567 | { .id = MC13892_PWGT1SPI, .init_data = &pwgt1_init }, |
| 568 | { .id = MC13892_PWGT2SPI, .init_data = &pwgt2_init }, |
| 569 | { .id = MC13892_VCOINCELL, .init_data = &vcoincell_init }, |
| 570 | }; |
| 571 | |
| 572 | static struct mc13xxx_platform_data mx51_efika_mc13892_data = { |
| 573 | .flags = MC13XXX_USE_RTC | MC13XXX_USE_REGULATOR, |
Andres Salomon | 251290a | 2011-03-04 08:06:53 -0800 | [diff] [blame] | 574 | .regulators = { |
| 575 | .num_regulators = ARRAY_SIZE(mx51_efika_regulators), |
| 576 | .regulators = mx51_efika_regulators, |
| 577 | }, |
Arnaud Patard (Rtp) | 2432cff | 2011-02-17 15:31:30 +0100 | [diff] [blame] | 578 | }; |
| 579 | |
Arnaud Patard (Rtp) | 7ac18a3 | 2011-02-17 15:31:28 +0100 | [diff] [blame] | 580 | static struct spi_board_info mx51_efika_spi_board_info[] __initdata = { |
| 581 | { |
| 582 | .modalias = "m25p80", |
| 583 | .max_speed_hz = 25000000, |
| 584 | .bus_num = 0, |
| 585 | .chip_select = 1, |
| 586 | .platform_data = &mx51_efika_spi_flash_data, |
| 587 | .irq = -1, |
| 588 | }, |
Arnaud Patard (Rtp) | 2432cff | 2011-02-17 15:31:30 +0100 | [diff] [blame] | 589 | { |
| 590 | .modalias = "mc13892", |
| 591 | .max_speed_hz = 1000000, |
| 592 | .bus_num = 0, |
| 593 | .chip_select = 0, |
| 594 | .platform_data = &mx51_efika_mc13892_data, |
| 595 | .irq = gpio_to_irq(EFIKAMX_PMIC), |
| 596 | }, |
Arnaud Patard (Rtp) | 7ac18a3 | 2011-02-17 15:31:28 +0100 | [diff] [blame] | 597 | }; |
| 598 | |
| 599 | static int mx51_efika_spi_cs[] = { |
| 600 | EFIKAMX_SPI_CS0, |
| 601 | EFIKAMX_SPI_CS1, |
| 602 | }; |
| 603 | |
| 604 | static const struct spi_imx_master mx51_efika_spi_pdata __initconst = { |
| 605 | .chipselect = mx51_efika_spi_cs, |
| 606 | .num_chipselect = ARRAY_SIZE(mx51_efika_spi_cs), |
| 607 | }; |
| 608 | |
| 609 | void __init efika_board_common_init(void) |
| 610 | { |
| 611 | mxc_iomux_v3_setup_multiple_pads(mx51efika_pads, |
| 612 | ARRAY_SIZE(mx51efika_pads)); |
Arnaud Patard (Rtp) | 7ac18a3 | 2011-02-17 15:31:28 +0100 | [diff] [blame] | 613 | imx51_add_imx_uart(0, &uart_pdata); |
Arnaud Patard (Rtp) | 9d72af6 | 2011-02-17 15:31:29 +0100 | [diff] [blame] | 614 | mx51_efika_usb(); |
Arnaud Patard (Rtp) | 7ac18a3 | 2011-02-17 15:31:28 +0100 | [diff] [blame] | 615 | imx51_add_sdhci_esdhc_imx(0, NULL); |
| 616 | |
Arnaud Patard (Rtp) | 2432cff | 2011-02-17 15:31:30 +0100 | [diff] [blame] | 617 | /* FIXME: comes from original code. check this. */ |
| 618 | if (mx51_revision() < IMX_CHIP_REVISION_2_0) |
| 619 | sw2_init.constraints.state_mem.uV = 1100000; |
| 620 | else if (mx51_revision() == IMX_CHIP_REVISION_2_0) { |
| 621 | sw2_init.constraints.state_mem.uV = 1250000; |
| 622 | sw1_init.constraints.state_mem.uV = 1000000; |
| 623 | } |
| 624 | if (machine_is_mx51_efikasb()) |
| 625 | vgen1_init.constraints.max_uV = 1200000; |
| 626 | |
| 627 | gpio_request(EFIKAMX_PMIC, "pmic irq"); |
| 628 | gpio_direction_input(EFIKAMX_PMIC); |
Arnaud Patard (Rtp) | 7ac18a3 | 2011-02-17 15:31:28 +0100 | [diff] [blame] | 629 | spi_register_board_info(mx51_efika_spi_board_info, |
| 630 | ARRAY_SIZE(mx51_efika_spi_board_info)); |
| 631 | imx51_add_ecspi(0, &mx51_efika_spi_pdata); |
Arnaud Patard (Rtp) | 856e656 | 2011-02-17 15:31:31 +0100 | [diff] [blame] | 632 | |
| 633 | #if defined(CONFIG_CPU_FREQ_IMX) |
| 634 | get_cpu_op = mx51_get_cpu_op; |
| 635 | #endif |
Arnaud Patard (Rtp) | 7ac18a3 | 2011-02-17 15:31:28 +0100 | [diff] [blame] | 636 | } |
| 637 | |