Unnati Gandhi | ea8381d | 2014-02-24 15:58:22 +0530 | [diff] [blame] | 1 | /* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. |
Deepa Dinamani | 7dc3d4b | 2013-02-08 16:40:38 -0800 | [diff] [blame] | 2 | * |
| 3 | * Redistribution and use in source and binary forms, with or without |
| 4 | * modification, are permitted provided that the following conditions are |
| 5 | * met: |
| 6 | * * Redistributions of source code must retain the above copyright |
| 7 | * notice, this list of conditions and the following disclaimer. |
| 8 | * * Redistributions in binary form must reproduce the above |
| 9 | * copyright notice, this list of conditions and the following |
| 10 | * disclaimer in the documentation and/or other materials provided |
| 11 | * with the distribution. |
| 12 | * * Neither the name of The Linux Foundation nor the names of its |
| 13 | * contributors may be used to endorse or promote products derived |
| 14 | * from this software without specific prior written permission. |
| 15 | * |
| 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | */ |
| 28 | |
| 29 | #include <debug.h> |
| 30 | #include <platform/iomap.h> |
Channagoud Kadabi | 25e4d93 | 2013-05-10 17:54:29 -0700 | [diff] [blame] | 31 | #include <platform/irqs.h> |
Deepa Dinamani | 7dc3d4b | 2013-02-08 16:40:38 -0800 | [diff] [blame] | 32 | #include <reg.h> |
| 33 | #include <target.h> |
| 34 | #include <platform.h> |
| 35 | #include <uart_dm.h> |
| 36 | #include <mmc.h> |
Deepa Dinamani | 8ff46f0 | 2013-03-20 17:52:14 -0700 | [diff] [blame] | 37 | #include <platform/gpio.h> |
Deepa Dinamani | 7dc3d4b | 2013-02-08 16:40:38 -0800 | [diff] [blame] | 38 | #include <spmi.h> |
| 39 | #include <board.h> |
Deepa Dinamani | 41803e0 | 2013-03-25 11:44:15 -0700 | [diff] [blame] | 40 | #include <smem.h> |
| 41 | #include <baseband.h> |
Deepa Dinamani | 8ff46f0 | 2013-03-20 17:52:14 -0700 | [diff] [blame] | 42 | #include <dev/keys.h> |
| 43 | #include <pm8x41.h> |
Deepa Dinamani | 98cf8ee | 2013-03-27 15:16:47 -0700 | [diff] [blame] | 44 | #include <hsusb.h> |
richardl | b52d3f5 | 2013-04-12 17:37:28 -0700 | [diff] [blame] | 45 | #include <kernel/thread.h> |
Amol Jadi | f213901 | 2013-08-23 18:44:10 -0700 | [diff] [blame] | 46 | #include <arch/defines.h> |
| 47 | #include <stdlib.h> |
| 48 | #include <scm.h> |
| 49 | #include <partition_parser.h> |
| 50 | #include <platform/clock.h> |
| 51 | #include <platform/timer.h> |
Deepa Dinamani | 7dc3d4b | 2013-02-08 16:40:38 -0800 | [diff] [blame] | 52 | |
| 53 | #define PMIC_ARB_CHANNEL_NUM 0 |
| 54 | #define PMIC_ARB_OWNER_ID 0 |
| 55 | |
Deepa Dinamani | 8ff46f0 | 2013-03-20 17:52:14 -0700 | [diff] [blame] | 56 | #define TLMM_VOL_UP_BTN_GPIO 72 |
| 57 | |
Maria Yu | 00fd382 | 2013-06-26 10:12:54 +0800 | [diff] [blame] | 58 | enum target_subtype { |
| 59 | HW_PLATFORM_SUBTYPE_SKUAA = 1, |
| 60 | HW_PLATFORM_SUBTYPE_SKUF = 2, |
| 61 | HW_PLATFORM_SUBTYPE_SKUAB = 3, |
| 62 | }; |
| 63 | |
Channagoud Kadabi | 25e4d93 | 2013-05-10 17:54:29 -0700 | [diff] [blame] | 64 | static void set_sdc_power_ctrl(void); |
| 65 | |
| 66 | static uint32_t mmc_pwrctl_base[] = |
Deepa Dinamani | 7dc3d4b | 2013-02-08 16:40:38 -0800 | [diff] [blame] | 67 | { MSM_SDC1_BASE, MSM_SDC2_BASE }; |
| 68 | |
Channagoud Kadabi | 25e4d93 | 2013-05-10 17:54:29 -0700 | [diff] [blame] | 69 | static uint32_t mmc_sdhci_base[] = |
| 70 | { MSM_SDC1_SDHCI_BASE, MSM_SDC2_SDHCI_BASE }; |
| 71 | |
| 72 | static uint32_t mmc_sdc_pwrctl_irq[] = |
| 73 | { SDCC1_PWRCTL_IRQ, SDCC2_PWRCTL_IRQ }; |
| 74 | |
| 75 | struct mmc_device *dev; |
| 76 | |
Deepa Dinamani | 7dc3d4b | 2013-02-08 16:40:38 -0800 | [diff] [blame] | 77 | void target_early_init(void) |
| 78 | { |
| 79 | #if WITH_DEBUG_UART |
Deepa Dinamani | d1823b4 | 2013-03-21 11:49:35 -0700 | [diff] [blame] | 80 | uart_dm_init(2, 0, BLSP1_UART1_BASE); |
Deepa Dinamani | 7dc3d4b | 2013-02-08 16:40:38 -0800 | [diff] [blame] | 81 | #endif |
| 82 | } |
| 83 | |
Deepa Dinamani | 8ff46f0 | 2013-03-20 17:52:14 -0700 | [diff] [blame] | 84 | /* Return 1 if vol_up pressed */ |
| 85 | static int target_volume_up() |
| 86 | { |
| 87 | uint8_t status = 0; |
| 88 | |
| 89 | gpio_tlmm_config(TLMM_VOL_UP_BTN_GPIO, 0, GPIO_INPUT, GPIO_PULL_UP, GPIO_2MA, GPIO_ENABLE); |
| 90 | |
richardl | b52d3f5 | 2013-04-12 17:37:28 -0700 | [diff] [blame] | 91 | /* Wait for the configuration to complete.*/ |
| 92 | thread_sleep(1); |
Deepa Dinamani | 8ff46f0 | 2013-03-20 17:52:14 -0700 | [diff] [blame] | 93 | /* Get status of GPIO */ |
| 94 | status = gpio_status(TLMM_VOL_UP_BTN_GPIO); |
| 95 | |
| 96 | /* Active low signal. */ |
| 97 | return !status; |
| 98 | } |
| 99 | |
| 100 | /* Return 1 if vol_down pressed */ |
| 101 | uint32_t target_volume_down() |
| 102 | { |
| 103 | /* Volume down button tied in with PMIC RESIN. */ |
| 104 | return pm8x41_resin_status(); |
| 105 | } |
| 106 | |
Deepa Dinamani | 7dc3d4b | 2013-02-08 16:40:38 -0800 | [diff] [blame] | 107 | static void target_keystatus() |
| 108 | { |
Deepa Dinamani | 8ff46f0 | 2013-03-20 17:52:14 -0700 | [diff] [blame] | 109 | keys_init(); |
| 110 | |
| 111 | if(target_volume_down()) |
| 112 | keys_post_event(KEY_VOLUMEDOWN, 1); |
| 113 | |
| 114 | if(target_volume_up()) |
| 115 | keys_post_event(KEY_VOLUMEUP, 1); |
Deepa Dinamani | 7dc3d4b | 2013-02-08 16:40:38 -0800 | [diff] [blame] | 116 | } |
| 117 | |
Channagoud Kadabi | 25e4d93 | 2013-05-10 17:54:29 -0700 | [diff] [blame] | 118 | void target_sdc_init() |
Deepa Dinamani | 7dc3d4b | 2013-02-08 16:40:38 -0800 | [diff] [blame] | 119 | { |
Channagoud Kadabi | 25e4d93 | 2013-05-10 17:54:29 -0700 | [diff] [blame] | 120 | struct mmc_config_data config; |
Deepa Dinamani | 7dc3d4b | 2013-02-08 16:40:38 -0800 | [diff] [blame] | 121 | |
Channagoud Kadabi | 25e4d93 | 2013-05-10 17:54:29 -0700 | [diff] [blame] | 122 | /* Set drive strength & pull ctrl values */ |
| 123 | set_sdc_power_ctrl(); |
Deepa Dinamani | 8ff46f0 | 2013-03-20 17:52:14 -0700 | [diff] [blame] | 124 | |
Channagoud Kadabi | 25e4d93 | 2013-05-10 17:54:29 -0700 | [diff] [blame] | 125 | config.bus_width = DATA_BUS_WIDTH_8BIT; |
| 126 | config.max_clk_rate = MMC_CLK_200MHZ; |
| 127 | |
| 128 | /* Try slot 1*/ |
| 129 | config.slot = 1; |
| 130 | config.sdhc_base = mmc_sdhci_base[config.slot - 1]; |
| 131 | config.pwrctl_base = mmc_pwrctl_base[config.slot - 1]; |
| 132 | config.pwr_irq = mmc_sdc_pwrctl_irq[config.slot - 1]; |
| 133 | |
| 134 | if (!(dev = mmc_init(&config))) |
Deepa Dinamani | 7dc3d4b | 2013-02-08 16:40:38 -0800 | [diff] [blame] | 135 | { |
Channagoud Kadabi | 25e4d93 | 2013-05-10 17:54:29 -0700 | [diff] [blame] | 136 | /* Try slot 2 */ |
| 137 | config.slot = 2; |
| 138 | config.sdhc_base = mmc_sdhci_base[config.slot - 1]; |
| 139 | config.pwrctl_base = mmc_pwrctl_base[config.slot - 1]; |
| 140 | config.pwr_irq = mmc_sdc_pwrctl_irq[config.slot - 1]; |
Deepa Dinamani | 7dc3d4b | 2013-02-08 16:40:38 -0800 | [diff] [blame] | 141 | |
Channagoud Kadabi | 25e4d93 | 2013-05-10 17:54:29 -0700 | [diff] [blame] | 142 | if (!(dev = mmc_init(&config))) |
Deepa Dinamani | 7dc3d4b | 2013-02-08 16:40:38 -0800 | [diff] [blame] | 143 | { |
| 144 | dprintf(CRITICAL, "mmc init failed!"); |
| 145 | ASSERT(0); |
| 146 | } |
| 147 | } |
Channagoud Kadabi | 25e4d93 | 2013-05-10 17:54:29 -0700 | [diff] [blame] | 148 | |
| 149 | /* MMC initialization is complete, read the partition table info */ |
| 150 | if (partition_read_table()) |
| 151 | { |
| 152 | dprintf(CRITICAL, "Error reading the partition table info\n"); |
| 153 | ASSERT(0); |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | void target_init(void) |
| 158 | { |
| 159 | dprintf(INFO, "target_init()\n"); |
| 160 | |
| 161 | spmi_init(PMIC_ARB_CHANNEL_NUM, PMIC_ARB_OWNER_ID); |
| 162 | |
| 163 | target_keystatus(); |
| 164 | |
| 165 | target_sdc_init(); |
Deepa Dinamani | 7dc3d4b | 2013-02-08 16:40:38 -0800 | [diff] [blame] | 166 | } |
| 167 | |
Aparna Mallavarapu | 2ce9f76 | 2013-07-30 15:29:12 +0530 | [diff] [blame] | 168 | void target_uninit(void) |
| 169 | { |
| 170 | mmc_put_card_to_sleep(dev); |
| 171 | } |
Amol Jadi | f213901 | 2013-08-23 18:44:10 -0700 | [diff] [blame] | 172 | |
| 173 | #define SSD_CE_INSTANCE 1 |
| 174 | |
| 175 | void target_load_ssd_keystore(void) |
| 176 | { |
| 177 | uint64_t ptn; |
| 178 | int index; |
| 179 | uint64_t size; |
| 180 | uint32_t *buffer; |
| 181 | |
| 182 | if (!target_is_ssd_enabled()) |
| 183 | return; |
| 184 | |
| 185 | index = partition_get_index("ssd"); |
| 186 | |
| 187 | ptn = partition_get_offset(index); |
| 188 | if (ptn == 0){ |
| 189 | dprintf(CRITICAL, "Error: ssd partition not found\n"); |
| 190 | return; |
| 191 | } |
| 192 | |
| 193 | size = partition_get_size(index); |
| 194 | if (size == 0) { |
| 195 | dprintf(CRITICAL, "Error: invalid ssd partition size\n"); |
| 196 | return; |
| 197 | } |
| 198 | |
| 199 | buffer = memalign(CACHE_LINE, ROUNDUP(size, CACHE_LINE)); |
| 200 | if (!buffer) { |
| 201 | dprintf(CRITICAL, "Error: allocating memory for ssd buffer\n"); |
| 202 | return; |
| 203 | } |
| 204 | |
| 205 | if (mmc_read(ptn, buffer, size)) { |
| 206 | dprintf(CRITICAL, "Error: cannot read data\n"); |
| 207 | free(buffer); |
| 208 | return; |
| 209 | } |
| 210 | |
| 211 | clock_ce_enable(SSD_CE_INSTANCE); |
| 212 | scm_protect_keystore(buffer, size); |
| 213 | clock_ce_disable(SSD_CE_INSTANCE); |
| 214 | free(buffer); |
| 215 | } |
| 216 | |
Deepa Dinamani | 2b795bb | 2013-03-25 11:31:58 -0700 | [diff] [blame] | 217 | /* Do any target specific intialization needed before entering fastboot mode */ |
| 218 | void target_fastboot_init(void) |
| 219 | { |
| 220 | /* Set the BOOT_DONE flag in PM8110 */ |
| 221 | pm8x41_set_boot_done(); |
Amol Jadi | f213901 | 2013-08-23 18:44:10 -0700 | [diff] [blame] | 222 | |
| 223 | if (target_is_ssd_enabled()) { |
| 224 | clock_ce_enable(SSD_CE_INSTANCE); |
| 225 | target_load_ssd_keystore(); |
| 226 | } |
| 227 | |
Deepa Dinamani | 2b795bb | 2013-03-25 11:31:58 -0700 | [diff] [blame] | 228 | } |
| 229 | |
Deepa Dinamani | 41803e0 | 2013-03-25 11:44:15 -0700 | [diff] [blame] | 230 | /* Detect the target type */ |
| 231 | void target_detect(struct board_data *board) |
| 232 | { |
Maria Yu | ca51ee2 | 2013-06-27 21:45:24 +0800 | [diff] [blame] | 233 | /* |
| 234 | * already fill the board->target on board.c |
| 235 | */ |
| 236 | |
Deepa Dinamani | 41803e0 | 2013-03-25 11:44:15 -0700 | [diff] [blame] | 237 | } |
| 238 | |
| 239 | /* Detect the modem type */ |
| 240 | void target_baseband_detect(struct board_data *board) |
| 241 | { |
| 242 | uint32_t platform; |
| 243 | uint32_t platform_subtype; |
| 244 | |
| 245 | platform = board->platform; |
| 246 | platform_subtype = board->platform_subtype; |
| 247 | |
| 248 | /* |
| 249 | * Look for platform subtype if present, else |
| 250 | * check for platform type to decide on the |
| 251 | * baseband type |
| 252 | */ |
| 253 | switch(platform_subtype) |
| 254 | { |
| 255 | case HW_PLATFORM_SUBTYPE_UNKNOWN: |
| 256 | break; |
Maria Yu | 00fd382 | 2013-06-26 10:12:54 +0800 | [diff] [blame] | 257 | case HW_PLATFORM_SUBTYPE_SKUAA: |
| 258 | break; |
| 259 | case HW_PLATFORM_SUBTYPE_SKUF: |
| 260 | break; |
| 261 | case HW_PLATFORM_SUBTYPE_SKUAB: |
| 262 | break; |
Deepa Dinamani | 41803e0 | 2013-03-25 11:44:15 -0700 | [diff] [blame] | 263 | default: |
| 264 | dprintf(CRITICAL, "Platform Subtype : %u is not supported\n", platform_subtype); |
| 265 | ASSERT(0); |
| 266 | }; |
| 267 | |
| 268 | switch(platform) |
| 269 | { |
| 270 | case MSM8610: |
| 271 | case MSM8110: |
| 272 | case MSM8210: |
| 273 | case MSM8810: |
Deepa Dinamani | 39345cd | 2013-04-08 19:46:53 -0700 | [diff] [blame] | 274 | case MSM8612: |
David Ng | 2de1806 | 2013-04-19 20:22:16 -0700 | [diff] [blame] | 275 | case MSM8212: |
| 276 | case MSM8812: |
Deepa Dinamani | b8534dd | 2013-09-12 11:02:34 -0700 | [diff] [blame] | 277 | case MSM8510: |
| 278 | case MSM8512: |
Deepa Dinamani | 41803e0 | 2013-03-25 11:44:15 -0700 | [diff] [blame] | 279 | board->baseband = BASEBAND_MSM; |
| 280 | break; |
| 281 | default: |
| 282 | dprintf(CRITICAL, "Platform type: %u is not supported\n", platform); |
| 283 | ASSERT(0); |
| 284 | }; |
| 285 | } |
| 286 | |
| 287 | unsigned target_baseband() |
| 288 | { |
| 289 | return board_baseband(); |
| 290 | } |
| 291 | |
Deepa Dinamani | a6d1b75 | 2013-03-25 11:47:20 -0700 | [diff] [blame] | 292 | void target_serialno(unsigned char *buf) |
| 293 | { |
| 294 | uint32_t serialno; |
| 295 | if (target_is_emmc_boot()) { |
| 296 | serialno = mmc_get_psn(); |
| 297 | snprintf((char *)buf, 13, "%x", serialno); |
| 298 | } |
| 299 | } |
| 300 | |
Deepa Dinamani | 5390e10 | 2013-03-25 11:55:31 -0700 | [diff] [blame] | 301 | unsigned check_reboot_mode(void) |
| 302 | { |
| 303 | uint32_t restart_reason = 0; |
| 304 | |
| 305 | /* Read reboot reason and scrub it */ |
| 306 | restart_reason = readl(RESTART_REASON_ADDR); |
| 307 | writel(0x00, RESTART_REASON_ADDR); |
| 308 | |
| 309 | return restart_reason; |
| 310 | } |
| 311 | |
Deepa Dinamani | 172b7e6 | 2013-03-25 11:59:21 -0700 | [diff] [blame] | 312 | void reboot_device(unsigned reboot_reason) |
| 313 | { |
Channagoud Kadabi | 636f9af | 2013-12-12 14:55:47 -0800 | [diff] [blame] | 314 | int ret = 0; |
| 315 | |
Deepa Dinamani | 172b7e6 | 2013-03-25 11:59:21 -0700 | [diff] [blame] | 316 | writel(reboot_reason, RESTART_REASON_ADDR); |
| 317 | |
| 318 | /* Configure PMIC for warm reset */ |
| 319 | pm8x41_reset_configure(PON_PSHOLD_WARM_RESET); |
| 320 | |
Channagoud Kadabi | 636f9af | 2013-12-12 14:55:47 -0800 | [diff] [blame] | 321 | ret = scm_halt_pmic_arbiter(); |
| 322 | if (ret) |
| 323 | dprintf(CRITICAL , "Failed to halt pmic arbiter: %d\n", ret); |
| 324 | |
Deepa Dinamani | 172b7e6 | 2013-03-25 11:59:21 -0700 | [diff] [blame] | 325 | /* Drop PS_HOLD for MSM */ |
| 326 | writel(0x00, MPM2_MPM_PS_HOLD); |
| 327 | |
| 328 | mdelay(5000); |
| 329 | |
| 330 | dprintf(CRITICAL, "Rebooting failed\n"); |
| 331 | } |
| 332 | |
Terence Hampson | afded26 | 2013-06-18 14:48:18 -0400 | [diff] [blame] | 333 | int target_cont_splash_screen() |
| 334 | { |
| 335 | int ret = 0; |
Shuo Yan | b757da8 | 2013-08-09 08:58:24 +0800 | [diff] [blame] | 336 | |
Terence Hampson | afded26 | 2013-06-18 14:48:18 -0400 | [diff] [blame] | 337 | switch(board_hardware_id()) |
| 338 | { |
Terence Hampson | afded26 | 2013-06-18 14:48:18 -0400 | [diff] [blame] | 339 | case HW_PLATFORM_QRD: |
Terence Hampson | 0e2f655 | 2013-07-09 15:45:37 -0400 | [diff] [blame] | 340 | case HW_PLATFORM_MTP: |
| 341 | case HW_PLATFORM_SURF: |
| 342 | dprintf(SPEW, "Target_cont_splash=1\n"); |
| 343 | ret = 1; |
| 344 | break; |
Terence Hampson | afded26 | 2013-06-18 14:48:18 -0400 | [diff] [blame] | 345 | default: |
| 346 | dprintf(SPEW, "Target_cont_splash=0\n"); |
| 347 | ret = 0; |
| 348 | } |
| 349 | return ret; |
| 350 | } |
| 351 | |
Deepa Dinamani | 004eb32 | 2013-03-25 13:20:50 -0700 | [diff] [blame] | 352 | unsigned target_pause_for_battery_charge(void) |
| 353 | { |
| 354 | uint8_t pon_reason = pm8x41_get_pon_reason(); |
Xu Kai | c2e0afc | 2013-07-19 13:26:36 +0800 | [diff] [blame] | 355 | uint8_t is_cold_boot = pm8x41_get_is_cold_boot(); |
| 356 | dprintf(INFO, "%s : pon_reason is %d cold_boot:%d\n", __func__, |
| 357 | pon_reason, is_cold_boot); |
| 358 | /*In case of fastboot reboot, adb reboot or if we see the power key |
| 359 | * pressed we do not want go into charger mode. |
| 360 | * fastboot reboot is warm boot with PON hard reset bit not set |
| 361 | * adb reboot is a cold boot with PON hard reset bit set |
Deepa Dinamani | 004eb32 | 2013-03-25 13:20:50 -0700 | [diff] [blame] | 362 | */ |
Xu Kai | c2e0afc | 2013-07-19 13:26:36 +0800 | [diff] [blame] | 363 | if (is_cold_boot && |
| 364 | (!(pon_reason & HARD_RST)) && |
| 365 | (!(pon_reason & KPDPWR_N)) && |
| 366 | ((pon_reason & USB_CHG) || (pon_reason & DC_CHG))) |
| 367 | return 1; |
| 368 | else |
| 369 | return 0; |
Deepa Dinamani | 004eb32 | 2013-03-25 13:20:50 -0700 | [diff] [blame] | 370 | } |
| 371 | |
Deepa Dinamani | 98cf8ee | 2013-03-27 15:16:47 -0700 | [diff] [blame] | 372 | void target_usb_stop(void) |
| 373 | { |
| 374 | /* Disable VBUS mimicing in the controller. */ |
| 375 | ulpi_write(ULPI_MISC_A_VBUSVLDEXTSEL | ULPI_MISC_A_VBUSVLDEXT, ULPI_MISC_A_CLEAR); |
| 376 | } |
| 377 | |
| 378 | void target_usb_init(void) |
| 379 | { |
| 380 | uint32_t val; |
| 381 | |
| 382 | /* Select and enable external configuration with USB PHY */ |
| 383 | ulpi_write(ULPI_MISC_A_VBUSVLDEXTSEL | ULPI_MISC_A_VBUSVLDEXT, ULPI_MISC_A_SET); |
| 384 | |
| 385 | /* Enable sess_vld */ |
| 386 | val = readl(USB_GENCONFIG_2) | GEN2_SESS_VLD_CTRL_EN; |
| 387 | writel(val, USB_GENCONFIG_2); |
| 388 | |
| 389 | /* Enable external vbus configuration in the LINK */ |
| 390 | val = readl(USB_USBCMD); |
| 391 | val |= SESS_VLD_CTRL; |
| 392 | writel(val, USB_USBCMD); |
| 393 | } |
| 394 | |
| 395 | |
Deepa Dinamani | 7dc3d4b | 2013-02-08 16:40:38 -0800 | [diff] [blame] | 396 | unsigned board_machtype(void) |
| 397 | { |
Deepa Dinamani | 2b795bb | 2013-03-25 11:31:58 -0700 | [diff] [blame] | 398 | return 0; |
Deepa Dinamani | 7dc3d4b | 2013-02-08 16:40:38 -0800 | [diff] [blame] | 399 | } |
Channagoud Kadabi | e1b7526 | 2013-05-08 12:58:39 -0700 | [diff] [blame] | 400 | |
Channagoud Kadabi | 25e4d93 | 2013-05-10 17:54:29 -0700 | [diff] [blame] | 401 | static void set_sdc_power_ctrl() |
Channagoud Kadabi | e1b7526 | 2013-05-08 12:58:39 -0700 | [diff] [blame] | 402 | { |
Channagoud Kadabi | 25e4d93 | 2013-05-10 17:54:29 -0700 | [diff] [blame] | 403 | /* Drive strength configs for sdc pins */ |
| 404 | struct tlmm_cfgs sdc1_hdrv_cfg[] = |
| 405 | { |
| 406 | { SDC1_CLK_HDRV_CTL_OFF, TLMM_CUR_VAL_16MA, TLMM_HDRV_MASK }, |
| 407 | { SDC1_CMD_HDRV_CTL_OFF, TLMM_CUR_VAL_10MA, TLMM_HDRV_MASK }, |
Unnati Gandhi | ea8381d | 2014-02-24 15:58:22 +0530 | [diff] [blame] | 408 | { SDC1_DATA_HDRV_CTL_OFF, TLMM_CUR_VAL_6MA, TLMM_HDRV_MASK }, |
Channagoud Kadabi | 25e4d93 | 2013-05-10 17:54:29 -0700 | [diff] [blame] | 409 | }; |
| 410 | |
| 411 | /* Pull configs for sdc pins */ |
| 412 | struct tlmm_cfgs sdc1_pull_cfg[] = |
| 413 | { |
| 414 | { SDC1_CLK_PULL_CTL_OFF, TLMM_NO_PULL, TLMM_PULL_MASK }, |
| 415 | { SDC1_CMD_PULL_CTL_OFF, TLMM_PULL_UP, TLMM_PULL_MASK }, |
| 416 | { SDC1_DATA_PULL_CTL_OFF, TLMM_PULL_UP, TLMM_PULL_MASK }, |
| 417 | }; |
| 418 | |
| 419 | /* Set the drive strength & pull control values */ |
| 420 | tlmm_set_hdrive_ctrl(sdc1_hdrv_cfg, ARRAY_SIZE(sdc1_hdrv_cfg)); |
| 421 | tlmm_set_pull_ctrl(sdc1_pull_cfg, ARRAY_SIZE(sdc1_pull_cfg)); |
| 422 | } |
| 423 | |
| 424 | struct mmc_device *target_mmc_device() |
| 425 | { |
| 426 | return dev; |
Channagoud Kadabi | e1b7526 | 2013-05-08 12:58:39 -0700 | [diff] [blame] | 427 | } |