blob: e840d194a4d42a1e134c9730b42db2aa5c7b4c73 [file] [log] [blame]
Channagoud Kadabif8ad8e72015-01-06 15:10:13 -08001/* Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
Channagoud Kadabied60a8b2014-06-27 15:35:09 -07002 *
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
Sridhar Parasuram568e7a62015-08-06 13:16:02 -070021 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, nit
22 * PROCUREMENT OF
Channagoud Kadabied60a8b2014-06-27 15:35:09 -070023 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30#include <debug.h>
31#include <platform/iomap.h>
32#include <platform/irqs.h>
33#include <platform/gpio.h>
34#include <reg.h>
35#include <target.h>
36#include <platform.h>
37#include <dload_util.h>
38#include <uart_dm.h>
39#include <mmc.h>
40#include <spmi.h>
41#include <board.h>
42#include <smem.h>
43#include <baseband.h>
Sridhar Parasuramd75ade52015-03-09 15:45:16 -070044#include <regulator.h>
Channagoud Kadabied60a8b2014-06-27 15:35:09 -070045#include <dev/keys.h>
46#include <pm8x41.h>
47#include <crypto5_wrapper.h>
48#include <clock.h>
49#include <partition_parser.h>
50#include <scm.h>
51#include <platform/clock.h>
52#include <platform/gpio.h>
53#include <platform/timer.h>
54#include <stdlib.h>
55#include <ufs.h>
56#include <boot_device.h>
57#include <qmp_phy.h>
Channagoud Kadabi7d308202014-12-22 12:07:04 -080058#include <sdhci_msm.h>
59#include <qusb2_phy.h>
Sridhar Parasuram568e7a62015-08-06 13:16:02 -070060#include <secapp_loader.h>
Channagoud Kadabi2bab29b2015-02-11 13:26:03 -080061#include <rpmb.h>
Sridhar Parasuram9f28f672015-03-17 15:40:47 -070062#include <rpm-glink.h>
Channagoud Kadabibb8f1f92015-04-27 11:14:45 -070063#if ENABLE_WBC
64#include <pm_app_smbchg.h>
65#endif
Channagoud Kadabied60a8b2014-06-27 15:35:09 -070066
Channagoud Kadabi4a870cf2015-01-21 10:39:01 -080067#define CE_INSTANCE 1
Channagoud Kadabi7edb9b42015-08-11 23:45:31 -070068#define CE_EE 0
Channagoud Kadabi4a870cf2015-01-21 10:39:01 -080069#define CE_FIFO_SIZE 64
70#define CE_READ_PIPE 3
71#define CE_WRITE_PIPE 2
72#define CE_READ_PIPE_LOCK_GRP 0
73#define CE_WRITE_PIPE_LOCK_GRP 0
74#define CE_ARRAY_SIZE 20
75
Channagoud Kadabied60a8b2014-06-27 15:35:09 -070076#define PMIC_ARB_CHANNEL_NUM 0
77#define PMIC_ARB_OWNER_ID 0
78
Channagoud Kadabi4021fa92015-11-03 16:35:26 -080079enum
80{
81 FUSION_I2S_MTP = 1,
82 FUSION_SLIMBUS = 2,
83} mtp_subtype;
84
85enum
86{
87 FUSION_I2S_CDP = 2,
88} cdp_subtype;
89
Channagoud Kadabied60a8b2014-06-27 15:35:09 -070090static void set_sdc_power_ctrl(void);
91static uint32_t mmc_pwrctl_base[] =
92 { MSM_SDC1_BASE, MSM_SDC2_BASE };
93
94static uint32_t mmc_sdhci_base[] =
95 { MSM_SDC1_SDHCI_BASE, MSM_SDC2_SDHCI_BASE };
96
97static uint32_t mmc_sdc_pwrctl_irq[] =
98 { SDCC1_PWRCTL_IRQ, SDCC2_PWRCTL_IRQ };
99
100struct mmc_device *dev;
101struct ufs_dev ufs_device;
102
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700103void target_early_init(void)
104{
105#if WITH_DEBUG_UART
Channagoud Kadabi35503c42014-11-14 16:22:43 -0800106 uart_dm_init(8, 0, BLSP2_UART1_BASE);
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700107#endif
108}
109
110/* Return 1 if vol_up pressed */
Amit Blay6a3e88b2015-06-23 22:25:06 +0300111int target_volume_up()
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700112{
lijuang2d2b8a02015-06-05 21:34:15 +0800113 static uint8_t first_time = 0;
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700114 uint8_t status = 0;
115 struct pm8x41_gpio gpio;
116
lijuang2d2b8a02015-06-05 21:34:15 +0800117 if (!first_time) {
118 /* Configure the GPIO */
119 gpio.direction = PM_GPIO_DIR_IN;
120 gpio.function = 0;
121 gpio.pull = PM_GPIO_PULL_UP_30;
122 gpio.vin_sel = 2;
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700123
lijuang2d2b8a02015-06-05 21:34:15 +0800124 pm8x41_gpio_config(2, &gpio);
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700125
lijuang2d2b8a02015-06-05 21:34:15 +0800126 /* Wait for the pmic gpio config to take effect */
127 udelay(10000);
128
129 first_time = 1;
130 }
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700131
132 /* Get status of P_GPIO_5 */
Channagoud Kadabi99d23702015-02-02 20:52:17 -0800133 pm8x41_gpio_get(2, &status);
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700134
135 return !status; /* active low */
136}
137
138/* Return 1 if vol_down pressed */
139uint32_t target_volume_down()
140{
141 return pm8x41_resin_status();
142}
143
144static void target_keystatus()
145{
146 keys_init();
147
148 if(target_volume_down())
149 keys_post_event(KEY_VOLUMEDOWN, 1);
150
151 if(target_volume_up())
152 keys_post_event(KEY_VOLUMEUP, 1);
153}
154
155void target_uninit(void)
156{
157 if (platform_boot_dev_isemmc())
158 {
159 mmc_put_card_to_sleep(dev);
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700160 }
Channagoud Kadabi2bab29b2015-02-11 13:26:03 -0800161
162 if (is_sec_app_loaded())
163 {
Sridhar Parasuram568e7a62015-08-06 13:16:02 -0700164 if (send_milestone_call_to_tz() < 0)
Channagoud Kadabi2bab29b2015-02-11 13:26:03 -0800165 {
166 dprintf(CRITICAL, "Failed to unload App for rpmb\n");
167 ASSERT(0);
168 }
169 }
170
Channagoud Kadabibb8f1f92015-04-27 11:14:45 -0700171#if ENABLE_WBC
Channagoud Kadabi22165612015-07-22 14:04:37 -0700172 if (board_hardware_id() == HW_PLATFORM_MTP)
173 pm_appsbl_set_dcin_suspend(1);
Channagoud Kadabibb8f1f92015-04-27 11:14:45 -0700174#endif
175
Channagoud Kadabi7edb9b42015-08-11 23:45:31 -0700176
177 if (crypto_initialized())
178 {
179 crypto_eng_cleanup();
180 clock_ce_disable(CE_INSTANCE);
181 }
182
Sridhar Parasuram9f28f672015-03-17 15:40:47 -0700183 /* Tear down glink channels */
184 rpm_glink_uninit();
185
Channagoud Kadabi2bab29b2015-02-11 13:26:03 -0800186 if (rpmb_uninit() < 0)
187 {
188 dprintf(CRITICAL, "RPMB uninit failed\n");
189 ASSERT(0);
190 }
191
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700192}
193
194static void set_sdc_power_ctrl()
195{
196 /* Drive strength configs for sdc pins */
197 struct tlmm_cfgs sdc1_hdrv_cfg[] =
198 {
199 { SDC1_CLK_HDRV_CTL_OFF, TLMM_CUR_VAL_16MA, TLMM_HDRV_MASK, SDC1_HDRV_PULL_CTL },
200 { SDC1_CMD_HDRV_CTL_OFF, TLMM_CUR_VAL_10MA, TLMM_HDRV_MASK, SDC1_HDRV_PULL_CTL },
201 { SDC1_DATA_HDRV_CTL_OFF, TLMM_CUR_VAL_10MA, TLMM_HDRV_MASK, SDC1_HDRV_PULL_CTL },
202 };
203
204 /* Pull configs for sdc pins */
205 struct tlmm_cfgs sdc1_pull_cfg[] =
206 {
207 { SDC1_CLK_PULL_CTL_OFF, TLMM_NO_PULL, TLMM_PULL_MASK, SDC1_HDRV_PULL_CTL },
208 { SDC1_CMD_PULL_CTL_OFF, TLMM_PULL_UP, TLMM_PULL_MASK, SDC1_HDRV_PULL_CTL },
209 { SDC1_DATA_PULL_CTL_OFF, TLMM_PULL_UP, TLMM_PULL_MASK, SDC1_HDRV_PULL_CTL },
210 };
211
212 struct tlmm_cfgs sdc1_rclk_cfg[] =
213 {
214 { SDC1_RCLK_PULL_CTL_OFF, TLMM_PULL_DOWN, TLMM_PULL_MASK, SDC1_HDRV_PULL_CTL },
215 };
216
217 /* Set the drive strength & pull control values */
218 tlmm_set_hdrive_ctrl(sdc1_hdrv_cfg, ARRAY_SIZE(sdc1_hdrv_cfg));
219 tlmm_set_pull_ctrl(sdc1_pull_cfg, ARRAY_SIZE(sdc1_pull_cfg));
220 tlmm_set_pull_ctrl(sdc1_rclk_cfg, ARRAY_SIZE(sdc1_rclk_cfg));
221}
222
223void target_sdc_init()
224{
225 struct mmc_config_data config = {0};
226
227 /* Set drive strength & pull ctrl values */
228 set_sdc_power_ctrl();
229
230 config.bus_width = DATA_BUS_WIDTH_8BIT;
231 config.max_clk_rate = MMC_CLK_192MHZ;
Channagoud Kadabi99d23702015-02-02 20:52:17 -0800232 config.hs400_support = 1;
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700233
234 /* Try slot 1*/
235 config.slot = 1;
236 config.sdhc_base = mmc_sdhci_base[config.slot - 1];
237 config.pwrctl_base = mmc_pwrctl_base[config.slot - 1];
238 config.pwr_irq = mmc_sdc_pwrctl_irq[config.slot - 1];
239
240 if (!(dev = mmc_init(&config)))
241 {
242 /* Try slot 2 */
243 config.slot = 2;
244 config.max_clk_rate = MMC_CLK_200MHZ;
245 config.sdhc_base = mmc_sdhci_base[config.slot - 1];
246 config.pwrctl_base = mmc_pwrctl_base[config.slot - 1];
247 config.pwr_irq = mmc_sdc_pwrctl_irq[config.slot - 1];
248
249 if (!(dev = mmc_init(&config)))
250 {
251 dprintf(CRITICAL, "mmc init failed!");
252 ASSERT(0);
253 }
254 }
255}
256
257void *target_mmc_device()
258{
259 if (platform_boot_dev_isemmc())
260 return (void *) dev;
261 else
262 return (void *) &ufs_device;
263}
264
265void target_init(void)
266{
Sridhar Parasuram568e7a62015-08-06 13:16:02 -0700267 int ret = 0;
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700268 dprintf(INFO, "target_init()\n");
269
Sridhar Parasuram1d224322015-06-15 11:03:40 -0700270 pmic_info_populate();
271
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700272 spmi_init(PMIC_ARB_CHANNEL_NUM, PMIC_ARB_OWNER_ID);
273
Channagoud Kadabibb8f1f92015-04-27 11:14:45 -0700274 /* Initialize Glink */
275 rpm_glink_init();
276
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700277 target_keystatus();
278
279 if (target_use_signed_kernel())
280 target_crypto_init_params();
281
282 platform_read_boot_config();
283
Sridhar Parasuram50b9d962015-02-12 11:28:09 -0800284#ifdef MMC_SDHCI_SUPPORT
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700285 if (platform_boot_dev_isemmc())
286 {
287 target_sdc_init();
288 }
Sridhar Parasuram50b9d962015-02-12 11:28:09 -0800289#endif
290#ifdef UFS_SUPPORT
291 if (!platform_boot_dev_isemmc())
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700292 {
293 ufs_device.base = UFS_BASE;
294 ufs_init(&ufs_device);
295 }
Sridhar Parasuram50b9d962015-02-12 11:28:09 -0800296#endif
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700297
298 /* Storage initialization is complete, read the partition table info */
Channagoud Kadabi58a273b2015-02-10 12:56:22 -0800299 mmc_read_partition_table(0);
Channagoud Kadabi2bab29b2015-02-11 13:26:03 -0800300
Channagoud Kadabi1171d8d2015-07-30 19:12:44 -0700301#if ENABLE_WBC
302 /* Look for battery voltage and make sure we have enough to bootup
303 * Otherwise initiate battery charging
304 * Charging should happen as early as possible, any other driver
305 * initialization before this should consider the power impact
306 */
Channagoud Kadabi25fd8ce2015-08-19 14:45:08 -0700307 switch(board_hardware_id())
308 {
309 case HW_PLATFORM_MTP:
310 case HW_PLATFORM_FLUID:
311 pm_appsbl_chg_check_weak_battery_status(1);
312 break;
313 default:
314 /* Charging not supported */
315 break;
316 };
Channagoud Kadabi1171d8d2015-07-30 19:12:44 -0700317#endif
318
Sridhar Parasuram568e7a62015-08-06 13:16:02 -0700319 /* Initialize Qseecom */
320 ret = qseecom_init();
321
322 if (ret < 0)
323 {
324 dprintf(CRITICAL, "Failed to initialize qseecom, error: %d\n", ret);
325 ASSERT(0);
326 }
327
328 /* Start Qseecom */
329 ret = qseecom_tz_init();
330
331 if (ret < 0)
332 {
333 dprintf(CRITICAL, "Failed to start qseecom, error: %d\n", ret);
334 ASSERT(0);
335 }
336
Sridhar Parasuramc61ecc22015-09-22 13:53:31 -0700337 if (rpmb_init() < 0)
338 {
339 dprintf(CRITICAL, "RPMB init failed\n");
340 ASSERT(0);
341 }
342
Sridhar Parasuram568e7a62015-08-06 13:16:02 -0700343 /*
344 * Load the sec app for first time
345 */
346 if (load_sec_app() < 0)
347 {
348 dprintf(CRITICAL, "Failed to load App for verified\n");
349 ASSERT(0);
350 }
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700351}
352
353unsigned board_machtype(void)
354{
355 return LINUX_MACHTYPE_UNKNOWN;
356}
357
358/* Detect the target type */
359void target_detect(struct board_data *board)
360{
361 /* This is filled from board.c */
362}
363
Dhaval Patelb95039c2015-03-16 11:14:06 -0700364static uint8_t splash_override;
365/* Returns 1 if target supports continuous splash screen. */
366int target_cont_splash_screen()
367{
368 uint8_t splash_screen = 0;
Channagoud Kadabi25fd8ce2015-08-19 14:45:08 -0700369 if(!splash_override && !pm_appsbl_charging_in_progress()) {
Dhaval Patelb95039c2015-03-16 11:14:06 -0700370 switch(board_hardware_id())
371 {
372 case HW_PLATFORM_SURF:
373 case HW_PLATFORM_MTP:
374 case HW_PLATFORM_FLUID:
feifanz76fe6482015-09-02 15:25:16 +0800375 case HW_PLATFORM_QRD:
Kuogee Hsiehb976dfc2015-08-28 13:21:30 -0700376 case HW_PLATFORM_LIQUID:
Dhaval Patelb95039c2015-03-16 11:14:06 -0700377 dprintf(SPEW, "Target_cont_splash=1\n");
378 splash_screen = 1;
379 break;
380 default:
381 dprintf(SPEW, "Target_cont_splash=0\n");
382 splash_screen = 0;
383 }
384 }
385 return splash_screen;
386}
387
388void target_force_cont_splash_disable(uint8_t override)
389{
390 splash_override = override;
391}
392
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700393/* Detect the modem type */
394void target_baseband_detect(struct board_data *board)
395{
396 uint32_t platform;
Channagoud Kadabi4021fa92015-11-03 16:35:26 -0800397 uint32_t platform_hardware;
398 uint32_t platform_subtype;
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700399
400 platform = board->platform;
Channagoud Kadabi4021fa92015-11-03 16:35:26 -0800401 platform_hardware = board->platform_hw;
402 platform_subtype = board->platform_subtype;
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700403
Channagoud Kadabi4021fa92015-11-03 16:35:26 -0800404 if (platform_hardware == HW_PLATFORM_SURF)
405 {
406 if (platform_subtype == FUSION_I2S_CDP)
407 board->baseband = BASEBAND_MDM;
408 }
409 else if (platform_hardware == HW_PLATFORM_MTP)
410 {
411 if (platform_subtype == FUSION_I2S_MTP ||
412 platform_subtype == FUSION_SLIMBUS)
413 board->baseband = BASEBAND_MDM;
414 }
415 /*
416 * Special case if MDM is not set look for chip info to decide
417 * platform subtype
418 */
419 if (board->baseband != BASEBAND_MDM)
420 {
421 switch(platform) {
422 case APQ8096:
Channagoud Kadabi99d23702015-02-02 20:52:17 -0800423 board->baseband = BASEBAND_APQ;
Channagoud Kadabi4021fa92015-11-03 16:35:26 -0800424 break;
425 case MSM8996:
426 if (board->platform_version == 0x10000)
427 board->baseband = BASEBAND_APQ;
428 else
429 board->baseband = BASEBAND_MSM;
430 break;
431 default:
432 dprintf(CRITICAL, "Platform type: %u is not supported\n",platform);
433 ASSERT(0);
434 };
435 }
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700436}
Channagoud Kadabi4021fa92015-11-03 16:35:26 -0800437
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700438unsigned target_baseband()
439{
440 return board_baseband();
441}
442
443void target_serialno(unsigned char *buf)
444{
445 unsigned int serialno;
446 if (target_is_emmc_boot()) {
447 serialno = mmc_get_psn();
448 snprintf((char *)buf, 13, "%x", serialno);
449 }
450}
451
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700452int emmc_recovery_init(void)
453{
454 return _emmc_recovery_init();
455}
456
457void target_usb_phy_reset()
458{
459 usb30_qmp_phy_reset();
460 qusb2_phy_reset();
461}
462
463target_usb_iface_t* target_usb30_init()
464{
465 target_usb_iface_t *t_usb_iface;
466
467 t_usb_iface = calloc(1, sizeof(target_usb_iface_t));
468 ASSERT(t_usb_iface);
469
470 t_usb_iface->phy_init = usb30_qmp_phy_init;
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700471 t_usb_iface->phy_reset = target_usb_phy_reset;
472 t_usb_iface->clock_init = clock_usb30_init;
473 t_usb_iface->vbus_override = 1;
474
475 return t_usb_iface;
476}
477
478/* identify the usb controller to be used for the target */
479const char * target_usb_controller()
480{
481 return "dwc";
482}
483
484uint32_t target_override_pll()
485{
Channagoud Kadabi1e5144b2015-04-28 17:15:05 -0700486 if (board_soc_version() >= 0x20000)
487 return 0;
488 else
489 return 1;
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700490}
491
Channagoud Kadabi4a870cf2015-01-21 10:39:01 -0800492crypto_engine_type board_ce_type(void)
493{
Channagoud Kadabi7edb9b42015-08-11 23:45:31 -0700494 return CRYPTO_ENGINE_TYPE_HW;
Channagoud Kadabi4a870cf2015-01-21 10:39:01 -0800495}
496
497/* Set up params for h/w CE. */
498void target_crypto_init_params()
499{
500 struct crypto_init_params ce_params;
501
502 /* Set up base addresses and instance. */
503 ce_params.crypto_instance = CE_INSTANCE;
504 ce_params.crypto_base = MSM_CE_BASE;
505 ce_params.bam_base = MSM_CE_BAM_BASE;
506
507 /* Set up BAM config. */
508 ce_params.bam_ee = CE_EE;
509 ce_params.pipes.read_pipe = CE_READ_PIPE;
510 ce_params.pipes.write_pipe = CE_WRITE_PIPE;
511 ce_params.pipes.read_pipe_grp = CE_READ_PIPE_LOCK_GRP;
512 ce_params.pipes.write_pipe_grp = CE_WRITE_PIPE_LOCK_GRP;
513
514 /* Assign buffer sizes. */
515 ce_params.num_ce = CE_ARRAY_SIZE;
516 ce_params.read_fifo_size = CE_FIFO_SIZE;
517 ce_params.write_fifo_size = CE_FIFO_SIZE;
518
519 /* BAM is initialized by TZ for this platform.
520 * Do not do it again as the initialization address space
521 * is locked.
522 */
523 ce_params.do_bam_init = 0;
524
525 crypto_init_params(&ce_params);
526}
Channagoud Kadabi083290f2015-03-13 14:18:38 -0700527
528unsigned target_pause_for_battery_charge(void)
529{
530 uint8_t pon_reason = pm8x41_get_pon_reason();
531 uint8_t is_cold_boot = pm8x41_get_is_cold_boot();
532 dprintf(INFO, "%s : pon_reason is %d cold_boot:%d\n", __func__,
533 pon_reason, is_cold_boot);
534 /* In case of fastboot reboot,adb reboot or if we see the power key
535 * pressed we do not want go into charger mode.
536 * fastboot reboot is warm boot with PON hard reset bit not set
537 * adb reboot is a cold boot with PON hard reset bit set
538 */
539 if (is_cold_boot &&
540 (!(pon_reason & HARD_RST)) &&
541 (!(pon_reason & KPDPWR_N)) &&
542 ((pon_reason & PON1)))
543 return 1;
544 else
545 return 0;
546}
Channagoud Kadabi23edc0c2015-03-27 18:31:32 -0700547
548int set_download_mode(enum dload_mode mode)
549{
550 int ret = 0;
551 ret = scm_dload_mode(mode);
552
553 return ret;
554}
Channagoud Kadabiffc4b902015-06-25 23:14:27 -0700555
Channagoud Kadabi65b518d2015-08-05 16:17:14 -0700556void pmic_reset_configure(uint8_t reset_type)
Channagoud Kadabiffc4b902015-06-25 23:14:27 -0700557{
Channagoud Kadabi65b518d2015-08-05 16:17:14 -0700558 pm8994_reset_configure(reset_type);
Channagoud Kadabiffc4b902015-06-25 23:14:27 -0700559}
lijuang3606df82015-09-02 21:14:43 +0800560
561uint32_t target_get_pmic()
562{
563 return PMIC_IS_PMI8996;
564}