Deepa Dinamani | 645e9b1 | 2012-12-21 14:23:40 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
| 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 | f6f7174 | 2013-05-23 14:05:05 -0700 | [diff] [blame] | 31 | #include <platform/irqs.h> |
Deepa Dinamani | 645e9b1 | 2012-12-21 14:23:40 -0800 | [diff] [blame] | 32 | #include <reg.h> |
| 33 | #include <target.h> |
| 34 | #include <platform.h> |
Pavel Nedev | 16f4923 | 2013-04-29 16:15:36 +0300 | [diff] [blame] | 35 | #include <dload_util.h> |
Deepa Dinamani | 645e9b1 | 2012-12-21 14:23:40 -0800 | [diff] [blame] | 36 | #include <uart_dm.h> |
Channagoud Kadabi | 3c50c31 | 2013-05-02 17:16:03 -0700 | [diff] [blame] | 37 | #include <mmc_sdhci.h> |
Deepa Dinamani | 7e72977 | 2013-02-25 11:54:05 -0800 | [diff] [blame] | 38 | #include <platform/gpio.h> |
Deepa Dinamani | 645e9b1 | 2012-12-21 14:23:40 -0800 | [diff] [blame] | 39 | #include <spmi.h> |
| 40 | #include <board.h> |
Deepa Dinamani | ff2b9ce | 2013-02-25 11:01:00 -0800 | [diff] [blame] | 41 | #include <smem.h> |
| 42 | #include <baseband.h> |
Deepa Dinamani | 7e72977 | 2013-02-25 11:54:05 -0800 | [diff] [blame] | 43 | #include <dev/keys.h> |
Deepa Dinamani | 058f1cd | 2013-02-25 10:53:01 -0800 | [diff] [blame] | 44 | #include <pm8x41.h> |
Deepa Dinamani | 6bb87d5 | 2013-02-26 14:37:36 -0800 | [diff] [blame] | 45 | #include <crypto5_wrapper.h> |
Amol Jadi | 85e1919 | 2013-02-28 22:45:04 -0800 | [diff] [blame] | 46 | #include <hsusb.h> |
Deepa Dinamani | 645e9b1 | 2012-12-21 14:23:40 -0800 | [diff] [blame] | 47 | |
Deepa Dinamani | 6bb87d5 | 2013-02-26 14:37:36 -0800 | [diff] [blame] | 48 | extern bool target_use_signed_kernel(void); |
Channagoud Kadabi | 3c50c31 | 2013-05-02 17:16:03 -0700 | [diff] [blame] | 49 | static void set_sdc_power_ctrl(void); |
Deepa Dinamani | 6bb87d5 | 2013-02-26 14:37:36 -0800 | [diff] [blame] | 50 | |
| 51 | #define PMIC_ARB_CHANNEL_NUM 0 |
| 52 | #define PMIC_ARB_OWNER_ID 0 |
| 53 | |
| 54 | #define CRYPTO_ENGINE_INSTANCE 1 |
| 55 | #define CRYPTO_ENGINE_EE 1 |
| 56 | #define CRYPTO_ENGINE_FIFO_SIZE 64 |
| 57 | #define CRYPTO_ENGINE_READ_PIPE 3 |
| 58 | #define CRYPTO_ENGINE_WRITE_PIPE 2 |
Deepa Dinamani | bbcf1ca | 2013-07-09 14:10:57 -0700 | [diff] [blame] | 59 | #define CRYPTO_READ_PIPE_LOCK_GRP 0 |
| 60 | #define CRYPTO_WRITE_PIPE_LOCK_GRP 0 |
Deepa Dinamani | 6bb87d5 | 2013-02-26 14:37:36 -0800 | [diff] [blame] | 61 | #define CRYPTO_ENGINE_CMD_ARRAY_SIZE 20 |
Deepa Dinamani | 645e9b1 | 2012-12-21 14:23:40 -0800 | [diff] [blame] | 62 | |
Deepa Dinamani | 7e72977 | 2013-02-25 11:54:05 -0800 | [diff] [blame] | 63 | #define TLMM_VOL_UP_BTN_GPIO 106 |
| 64 | |
Maria Yu | b8fd082 | 2013-06-26 10:10:45 +0800 | [diff] [blame] | 65 | enum target_subtype { |
| 66 | HW_PLATFORM_SUBTYPE_SKUAA = 1, |
| 67 | HW_PLATFORM_SUBTYPE_SKUF = 2, |
| 68 | HW_PLATFORM_SUBTYPE_SKUAB = 3, |
| 69 | }; |
| 70 | |
Channagoud Kadabi | f6f7174 | 2013-05-23 14:05:05 -0700 | [diff] [blame] | 71 | static uint32_t mmc_pwrctl_base[] = |
| 72 | { MSM_SDC1_BASE, MSM_SDC2_BASE, MSM_SDC3_BASE }; |
| 73 | |
Channagoud Kadabi | 3c50c31 | 2013-05-02 17:16:03 -0700 | [diff] [blame] | 74 | static uint32_t mmc_sdhci_base[] = |
| 75 | { MSM_SDC1_SDHCI_BASE, MSM_SDC2_SDHCI_BASE, MSM_SDC3_SDHCI_BASE }; |
| 76 | |
Channagoud Kadabi | f6f7174 | 2013-05-23 14:05:05 -0700 | [diff] [blame] | 77 | static uint32_t mmc_sdc_pwrctl_irq[] = |
| 78 | { SDCC1_PWRCTL_IRQ, SDCC2_PWRCTL_IRQ, SDCC3_PWRCTL_IRQ }; |
| 79 | |
Channagoud Kadabi | 3c50c31 | 2013-05-02 17:16:03 -0700 | [diff] [blame] | 80 | struct mmc_device *dev; |
Deepa Dinamani | 645e9b1 | 2012-12-21 14:23:40 -0800 | [diff] [blame] | 81 | |
| 82 | void target_early_init(void) |
| 83 | { |
| 84 | #if WITH_DEBUG_UART |
Deepa Dinamani | 0a6c48c | 2013-02-04 15:45:01 -0800 | [diff] [blame] | 85 | uart_dm_init(1, 0, BLSP1_UART2_BASE); |
Deepa Dinamani | 645e9b1 | 2012-12-21 14:23:40 -0800 | [diff] [blame] | 86 | #endif |
| 87 | } |
| 88 | |
Deepa Dinamani | 7e72977 | 2013-02-25 11:54:05 -0800 | [diff] [blame] | 89 | /* Return 1 if vol_up pressed */ |
| 90 | static int target_volume_up() |
| 91 | { |
| 92 | uint8_t status = 0; |
| 93 | |
| 94 | gpio_tlmm_config(TLMM_VOL_UP_BTN_GPIO, 0, GPIO_INPUT, GPIO_PULL_UP, GPIO_2MA, GPIO_ENABLE); |
| 95 | |
aiquny | 933017c | 2013-03-02 12:48:52 -0800 | [diff] [blame] | 96 | thread_sleep(10); |
| 97 | |
Deepa Dinamani | 7e72977 | 2013-02-25 11:54:05 -0800 | [diff] [blame] | 98 | /* Get status of GPIO */ |
| 99 | status = gpio_status(TLMM_VOL_UP_BTN_GPIO); |
| 100 | |
| 101 | /* Active low signal. */ |
| 102 | return !status; |
| 103 | } |
| 104 | |
| 105 | /* Return 1 if vol_down pressed */ |
| 106 | uint32_t target_volume_down() |
| 107 | { |
| 108 | /* Volume down button tied in with PMIC RESIN. */ |
| 109 | return pm8x41_resin_status(); |
| 110 | } |
| 111 | |
Deepa Dinamani | 645e9b1 | 2012-12-21 14:23:40 -0800 | [diff] [blame] | 112 | static void target_keystatus() |
| 113 | { |
Deepa Dinamani | 7e72977 | 2013-02-25 11:54:05 -0800 | [diff] [blame] | 114 | keys_init(); |
| 115 | |
| 116 | if(target_volume_down()) |
| 117 | keys_post_event(KEY_VOLUMEDOWN, 1); |
| 118 | |
| 119 | if(target_volume_up()) |
| 120 | keys_post_event(KEY_VOLUMEUP, 1); |
Deepa Dinamani | 645e9b1 | 2012-12-21 14:23:40 -0800 | [diff] [blame] | 121 | } |
| 122 | |
Deepa Dinamani | 6bb87d5 | 2013-02-26 14:37:36 -0800 | [diff] [blame] | 123 | /* Set up params for h/w CRYPTO_ENGINE. */ |
| 124 | void target_crypto_init_params() |
| 125 | { |
| 126 | struct crypto_init_params ce_params; |
| 127 | |
| 128 | /* Set up base addresses and instance. */ |
| 129 | ce_params.crypto_instance = CRYPTO_ENGINE_INSTANCE; |
| 130 | ce_params.crypto_base = MSM_CE1_BASE; |
| 131 | ce_params.bam_base = MSM_CE1_BAM_BASE; |
| 132 | |
| 133 | /* Set up BAM config. */ |
Deepa Dinamani | bbcf1ca | 2013-07-09 14:10:57 -0700 | [diff] [blame] | 134 | ce_params.bam_ee = CRYPTO_ENGINE_EE; |
| 135 | ce_params.pipes.read_pipe = CRYPTO_ENGINE_READ_PIPE; |
| 136 | ce_params.pipes.write_pipe = CRYPTO_ENGINE_WRITE_PIPE; |
| 137 | ce_params.pipes.read_pipe_grp = CRYPTO_READ_PIPE_LOCK_GRP; |
| 138 | ce_params.pipes.write_pipe_grp = CRYPTO_WRITE_PIPE_LOCK_GRP; |
Deepa Dinamani | 6bb87d5 | 2013-02-26 14:37:36 -0800 | [diff] [blame] | 139 | |
| 140 | /* Assign buffer sizes. */ |
| 141 | ce_params.num_ce = CRYPTO_ENGINE_CMD_ARRAY_SIZE; |
| 142 | ce_params.read_fifo_size = CRYPTO_ENGINE_FIFO_SIZE; |
| 143 | ce_params.write_fifo_size = CRYPTO_ENGINE_FIFO_SIZE; |
| 144 | |
| 145 | crypto_init_params(&ce_params); |
| 146 | } |
| 147 | |
Channagoud Kadabi | 3c50c31 | 2013-05-02 17:16:03 -0700 | [diff] [blame] | 148 | void target_sdc_init() |
| 149 | { |
Channagoud Kadabi | f6f7174 | 2013-05-23 14:05:05 -0700 | [diff] [blame] | 150 | struct mmc_config_data config = {0}; |
Channagoud Kadabi | 3c50c31 | 2013-05-02 17:16:03 -0700 | [diff] [blame] | 151 | |
| 152 | /* |
| 153 | * Set drive strength & pull ctrl for emmc |
| 154 | */ |
| 155 | set_sdc_power_ctrl(); |
| 156 | |
Channagoud Kadabi | 3c50c31 | 2013-05-02 17:16:03 -0700 | [diff] [blame] | 157 | config.bus_width = DATA_BUS_WIDTH_8BIT; |
| 158 | config.max_clk_rate = MMC_CLK_200MHZ; |
| 159 | |
| 160 | /* Trying Slot 1*/ |
| 161 | config.slot = 1; |
Channagoud Kadabi | f6f7174 | 2013-05-23 14:05:05 -0700 | [diff] [blame] | 162 | config.sdhc_base = mmc_sdhci_base[config.slot - 1]; |
| 163 | config.pwrctl_base = mmc_pwrctl_base[config.slot - 1]; |
| 164 | config.pwr_irq = mmc_sdc_pwrctl_irq[config.slot - 1]; |
| 165 | |
Channagoud Kadabi | 3c50c31 | 2013-05-02 17:16:03 -0700 | [diff] [blame] | 166 | if (!(dev = mmc_init(&config))) |
| 167 | { |
| 168 | /* Trying Slot 2 next */ |
| 169 | config.slot = 2; |
Channagoud Kadabi | f6f7174 | 2013-05-23 14:05:05 -0700 | [diff] [blame] | 170 | config.sdhc_base = mmc_sdhci_base[config.slot - 1]; |
| 171 | config.pwrctl_base = mmc_pwrctl_base[config.slot - 1]; |
| 172 | config.pwr_irq = mmc_sdc_pwrctl_irq[config.slot - 1]; |
| 173 | |
Channagoud Kadabi | 3c50c31 | 2013-05-02 17:16:03 -0700 | [diff] [blame] | 174 | if (!(dev = mmc_init(&config))) { |
| 175 | dprintf(CRITICAL, "mmc init failed!"); |
| 176 | ASSERT(0); |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | /* |
| 181 | * MMC initialization is complete, read the partition table info |
| 182 | */ |
| 183 | if (partition_read_table()) { |
| 184 | dprintf(CRITICAL, "Error reading the partition table info\n"); |
| 185 | ASSERT(0); |
| 186 | } |
| 187 | } |
| 188 | |
Deepa Dinamani | 645e9b1 | 2012-12-21 14:23:40 -0800 | [diff] [blame] | 189 | void target_init(void) |
| 190 | { |
Deepa Dinamani | 645e9b1 | 2012-12-21 14:23:40 -0800 | [diff] [blame] | 191 | dprintf(INFO, "target_init()\n"); |
| 192 | |
| 193 | spmi_init(PMIC_ARB_CHANNEL_NUM, PMIC_ARB_OWNER_ID); |
| 194 | |
| 195 | target_keystatus(); |
| 196 | |
Ray Zhang | 743e503 | 2013-05-25 23:25:39 +0800 | [diff] [blame] | 197 | /* Display splash screen if enabled */ |
| 198 | #if DISPLAY_SPLASH_SCREEN |
| 199 | dprintf(SPEW, "Display Init: Start\n"); |
| 200 | display_init(); |
| 201 | dprintf(SPEW, "Display Init: Done\n"); |
| 202 | #endif |
| 203 | |
Channagoud Kadabi | 3c50c31 | 2013-05-02 17:16:03 -0700 | [diff] [blame] | 204 | target_sdc_init(); |
Deepa Dinamani | 6bb87d5 | 2013-02-26 14:37:36 -0800 | [diff] [blame] | 205 | |
| 206 | if (target_use_signed_kernel()) |
| 207 | target_crypto_init_params(); |
Deepa Dinamani | 645e9b1 | 2012-12-21 14:23:40 -0800 | [diff] [blame] | 208 | } |
| 209 | |
Deepa Dinamani | 058f1cd | 2013-02-25 10:53:01 -0800 | [diff] [blame] | 210 | /* Do any target specific intialization needed before entering fastboot mode */ |
| 211 | void target_fastboot_init(void) |
| 212 | { |
| 213 | /* Set the BOOT_DONE flag in PM8026 */ |
| 214 | pm8x41_set_boot_done(); |
| 215 | } |
| 216 | |
Deepa Dinamani | ff2b9ce | 2013-02-25 11:01:00 -0800 | [diff] [blame] | 217 | /* Detect the target type */ |
| 218 | void target_detect(struct board_data *board) |
| 219 | { |
Maria Yu | ca51ee2 | 2013-06-27 21:45:24 +0800 | [diff] [blame] | 220 | /* |
| 221 | * already fill the board->target on board.c |
| 222 | */ |
Deepa Dinamani | ff2b9ce | 2013-02-25 11:01:00 -0800 | [diff] [blame] | 223 | } |
| 224 | |
| 225 | /* Detect the modem type */ |
| 226 | void target_baseband_detect(struct board_data *board) |
| 227 | { |
| 228 | uint32_t platform; |
| 229 | uint32_t platform_subtype; |
| 230 | |
| 231 | platform = board->platform; |
| 232 | platform_subtype = board->platform_subtype; |
| 233 | |
| 234 | /* |
| 235 | * Look for platform subtype if present, else |
| 236 | * check for platform type to decide on the |
| 237 | * baseband type |
| 238 | */ |
| 239 | switch(platform_subtype) |
| 240 | { |
| 241 | case HW_PLATFORM_SUBTYPE_UNKNOWN: |
| 242 | break; |
Maria Yu | b8fd082 | 2013-06-26 10:10:45 +0800 | [diff] [blame] | 243 | case HW_PLATFORM_SUBTYPE_SKUAA: |
| 244 | break; |
| 245 | case HW_PLATFORM_SUBTYPE_SKUF: |
| 246 | break; |
| 247 | case HW_PLATFORM_SUBTYPE_SKUAB: |
| 248 | break; |
Deepa Dinamani | ff2b9ce | 2013-02-25 11:01:00 -0800 | [diff] [blame] | 249 | default: |
| 250 | dprintf(CRITICAL, "Platform Subtype : %u is not supported\n", platform_subtype); |
| 251 | ASSERT(0); |
| 252 | }; |
| 253 | |
| 254 | switch(platform) |
| 255 | { |
| 256 | case MSM8826: |
| 257 | case MSM8626: |
| 258 | case MSM8226: |
Deepa Dinamani | 7eeecf6 | 2013-05-21 12:43:26 -0700 | [diff] [blame] | 259 | case MSM8926: |
| 260 | case MSM8126: |
| 261 | case MSM8326: |
Deepa Dinamani | ff2b9ce | 2013-02-25 11:01:00 -0800 | [diff] [blame] | 262 | board->baseband = BASEBAND_MSM; |
| 263 | break; |
Deepa Dinamani | 7eeecf6 | 2013-05-21 12:43:26 -0700 | [diff] [blame] | 264 | case APQ8026: |
| 265 | board->baseband = BASEBAND_APQ; |
| 266 | break; |
Deepa Dinamani | ff2b9ce | 2013-02-25 11:01:00 -0800 | [diff] [blame] | 267 | default: |
| 268 | dprintf(CRITICAL, "Platform type: %u is not supported\n", platform); |
| 269 | ASSERT(0); |
| 270 | }; |
| 271 | } |
| 272 | |
Deepa Dinamani | 645e9b1 | 2012-12-21 14:23:40 -0800 | [diff] [blame] | 273 | void target_serialno(unsigned char *buf) |
| 274 | { |
| 275 | uint32_t serialno; |
| 276 | if (target_is_emmc_boot()) { |
| 277 | serialno = mmc_get_psn(); |
| 278 | snprintf((char *)buf, 13, "%x", serialno); |
| 279 | } |
| 280 | } |
| 281 | |
Deepa Dinamani | 8d2bb22 | 2013-02-26 14:03:04 -0800 | [diff] [blame] | 282 | unsigned check_reboot_mode(void) |
| 283 | { |
| 284 | uint32_t restart_reason = 0; |
| 285 | |
| 286 | /* Read reboot reason and scrub it */ |
| 287 | restart_reason = readl(RESTART_REASON_ADDR); |
| 288 | writel(0x00, RESTART_REASON_ADDR); |
| 289 | |
| 290 | return restart_reason; |
| 291 | } |
| 292 | |
Deepa Dinamani | f7c03c1 | 2013-02-26 14:17:20 -0800 | [diff] [blame] | 293 | void reboot_device(unsigned reboot_reason) |
| 294 | { |
| 295 | writel(reboot_reason, RESTART_REASON_ADDR); |
| 296 | |
| 297 | /* Configure PMIC for warm reset */ |
| 298 | pm8x41_reset_configure(PON_PSHOLD_WARM_RESET); |
| 299 | |
| 300 | /* Drop PS_HOLD for MSM */ |
| 301 | writel(0x00, MPM2_MPM_PS_HOLD); |
| 302 | |
| 303 | mdelay(5000); |
| 304 | |
| 305 | dprintf(CRITICAL, "Rebooting failed\n"); |
| 306 | } |
| 307 | |
Deepa Dinamani | 6bb87d5 | 2013-02-26 14:37:36 -0800 | [diff] [blame] | 308 | crypto_engine_type board_ce_type(void) |
| 309 | { |
| 310 | return CRYPTO_ENGINE_TYPE_HW; |
| 311 | } |
| 312 | |
Deepa Dinamani | 645e9b1 | 2012-12-21 14:23:40 -0800 | [diff] [blame] | 313 | unsigned board_machtype(void) |
| 314 | { |
Deepa Dinamani | 8d6b425 | 2013-03-06 11:16:41 -0800 | [diff] [blame] | 315 | return 0; |
| 316 | } |
| 317 | |
| 318 | void target_usb_stop(void) |
| 319 | { |
| 320 | /* Disable VBUS mimicing in the controller. */ |
| 321 | ulpi_write(ULPI_MISC_A_VBUSVLDEXTSEL | ULPI_MISC_A_VBUSVLDEXT, ULPI_MISC_A_CLEAR); |
Deepa Dinamani | 645e9b1 | 2012-12-21 14:23:40 -0800 | [diff] [blame] | 322 | } |
Amol Jadi | 85e1919 | 2013-02-28 22:45:04 -0800 | [diff] [blame] | 323 | |
Channagoud Kadabi | e3a695a | 2013-06-18 18:35:00 -0700 | [diff] [blame] | 324 | void target_uninit(void) |
| 325 | { |
| 326 | mmc_put_card_to_sleep(dev); |
| 327 | } |
| 328 | |
Amol Jadi | 85e1919 | 2013-02-28 22:45:04 -0800 | [diff] [blame] | 329 | void target_usb_init(void) |
| 330 | { |
| 331 | uint32_t val; |
| 332 | |
| 333 | /* Select and enable external configuration with USB PHY */ |
| 334 | ulpi_write(ULPI_MISC_A_VBUSVLDEXTSEL | ULPI_MISC_A_VBUSVLDEXT, ULPI_MISC_A_SET); |
| 335 | |
| 336 | /* Enable sess_vld */ |
| 337 | val = readl(USB_GENCONFIG_2) | GEN2_SESS_VLD_CTRL_EN; |
| 338 | writel(val, USB_GENCONFIG_2); |
| 339 | |
| 340 | /* Enable external vbus configuration in the LINK */ |
| 341 | val = readl(USB_USBCMD); |
| 342 | val |= SESS_VLD_CTRL; |
| 343 | writel(val, USB_USBCMD); |
| 344 | } |
Deepa Dinamani | cde6457 | 2013-02-25 15:02:25 -0800 | [diff] [blame] | 345 | |
Ray Zhang | 743e503 | 2013-05-25 23:25:39 +0800 | [diff] [blame] | 346 | /* Returns 1 if target supports continuous splash screen. */ |
| 347 | int target_cont_splash_screen() |
| 348 | { |
| 349 | switch(board_hardware_id()) |
| 350 | { |
| 351 | case HW_PLATFORM_MTP: |
| 352 | case HW_PLATFORM_QRD: |
| 353 | case HW_PLATFORM_SURF: |
| 354 | dprintf(SPEW, "Target_cont_splash=1\n"); |
| 355 | return 1; |
| 356 | break; |
| 357 | default: |
| 358 | dprintf(SPEW, "Target_cont_splash=0\n"); |
| 359 | return 0; |
| 360 | } |
| 361 | } |
| 362 | |
Deepa Dinamani | cde6457 | 2013-02-25 15:02:25 -0800 | [diff] [blame] | 363 | unsigned target_pause_for_battery_charge(void) |
| 364 | { |
Ameya Thakur | dac08c6 | 2013-07-22 16:17:55 -0700 | [diff] [blame] | 365 | #if 0 |
Deepa Dinamani | cde6457 | 2013-02-25 15:02:25 -0800 | [diff] [blame] | 366 | uint8_t pon_reason = pm8x41_get_pon_reason(); |
Ameya Thakur | 0604131 | 2013-06-25 13:46:21 -0700 | [diff] [blame] | 367 | uint8_t is_cold_boot = pm8x41_get_is_cold_boot(); |
Ameya Thakur | 531e59a | 2013-07-17 16:53:53 -0700 | [diff] [blame] | 368 | dprintf(INFO, "%s : pon_reason is %d cold_boot:%d\n", __func__, |
| 369 | pon_reason, is_cold_boot); |
Ameya Thakur | a8711dc | 2013-07-19 17:52:51 -0700 | [diff] [blame] | 370 | /* In case of fastboot reboot,adb reboot or if we see the power key |
| 371 | * pressed we do not want go into charger mode. |
Ameya Thakur | 531e59a | 2013-07-17 16:53:53 -0700 | [diff] [blame] | 372 | * fastboot reboot is warm boot with PON hard reset bit not set |
| 373 | * adb reboot is a cold boot with PON hard reset bit set |
| 374 | */ |
Ameya Thakur | a8711dc | 2013-07-19 17:52:51 -0700 | [diff] [blame] | 375 | if (is_cold_boot && |
| 376 | (!(pon_reason & HARD_RST)) && |
| 377 | (!(pon_reason & KPDPWR_N)) && |
Ameya Thakur | 531e59a | 2013-07-17 16:53:53 -0700 | [diff] [blame] | 378 | ((pon_reason & USB_CHG) || (pon_reason & DC_CHG))) |
| 379 | return 1; |
| 380 | else |
Ameya Thakur | dac08c6 | 2013-07-22 16:17:55 -0700 | [diff] [blame] | 381 | #endif |
Ameya Thakur | 531e59a | 2013-07-17 16:53:53 -0700 | [diff] [blame] | 382 | return 0; |
Deepa Dinamani | cde6457 | 2013-02-25 15:02:25 -0800 | [diff] [blame] | 383 | } |
Channagoud Kadabi | da54ca1 | 2013-03-29 11:22:15 -0700 | [diff] [blame] | 384 | |
| 385 | unsigned target_baseband() |
| 386 | { |
| 387 | return board_baseband(); |
| 388 | } |
Stanimir Varbanov | 7f9d7a7 | 2013-04-29 12:05:39 +0300 | [diff] [blame] | 389 | |
| 390 | int emmc_recovery_init(void) |
| 391 | { |
Pavel Nedev | 16f4923 | 2013-04-29 16:15:36 +0300 | [diff] [blame] | 392 | return _emmc_recovery_init(); |
| 393 | } |
| 394 | |
Pavel Nedev | a4c9d3a | 2013-05-15 14:42:34 +0300 | [diff] [blame] | 395 | int set_download_mode(enum dload_mode mode) |
Pavel Nedev | 16f4923 | 2013-04-29 16:15:36 +0300 | [diff] [blame] | 396 | { |
Pavel Nedev | a4c9d3a | 2013-05-15 14:42:34 +0300 | [diff] [blame] | 397 | dload_util_write_cookie(mode == NORMAL_DLOAD ? |
| 398 | DLOAD_MODE_ADDR : EMERGENCY_DLOAD_MODE_ADDR, mode); |
Pavel Nedev | 16f4923 | 2013-04-29 16:15:36 +0300 | [diff] [blame] | 399 | |
| 400 | return 0; |
Stanimir Varbanov | 7f9d7a7 | 2013-04-29 12:05:39 +0300 | [diff] [blame] | 401 | } |
Channagoud Kadabi | 3c50c31 | 2013-05-02 17:16:03 -0700 | [diff] [blame] | 402 | |
| 403 | static void set_sdc_power_ctrl() |
| 404 | { |
| 405 | /* Drive strength configs for sdc pins */ |
| 406 | struct tlmm_cfgs sdc1_hdrv_cfg[] = |
| 407 | { |
| 408 | { SDC1_CLK_HDRV_CTL_OFF, TLMM_CUR_VAL_10MA, TLMM_HDRV_MASK }, |
| 409 | { SDC1_CMD_HDRV_CTL_OFF, TLMM_CUR_VAL_10MA, TLMM_HDRV_MASK }, |
| 410 | { SDC1_DATA_HDRV_CTL_OFF, TLMM_CUR_VAL_10MA, TLMM_HDRV_MASK }, |
| 411 | }; |
| 412 | |
| 413 | /* Pull configs for sdc pins */ |
| 414 | struct tlmm_cfgs sdc1_pull_cfg[] = |
| 415 | { |
| 416 | { SDC1_CLK_PULL_CTL_OFF, TLMM_NO_PULL, TLMM_PULL_MASK }, |
| 417 | { SDC1_CMD_PULL_CTL_OFF, TLMM_PULL_UP, TLMM_PULL_MASK }, |
| 418 | { SDC1_DATA_PULL_CTL_OFF, TLMM_PULL_UP, TLMM_PULL_MASK }, |
| 419 | }; |
| 420 | |
| 421 | /* Set the drive strength & pull control values */ |
| 422 | tlmm_set_hdrive_ctrl(sdc1_hdrv_cfg, ARRAY_SIZE(sdc1_hdrv_cfg)); |
| 423 | tlmm_set_pull_ctrl(sdc1_pull_cfg, ARRAY_SIZE(sdc1_pull_cfg)); |
| 424 | } |
| 425 | |
| 426 | struct mmc_device *target_mmc_device() |
| 427 | { |
| 428 | return dev; |
| 429 | } |