Merge "target: msm8974: Fix platform subtype"
diff --git a/dev/gcdb/display/oem_panel.c b/dev/gcdb/display/oem_panel.c
index bacea0f..c630fee 100755
--- a/dev/gcdb/display/oem_panel.c
+++ b/dev/gcdb/display/oem_panel.c
@@ -194,8 +194,13 @@
 			return false;
 		}
 		break;
-	case MSM8226:
+	case MSM8826:
 	case MSM8626:
+	case MSM8226:
+	case MSM8926:
+	case MSM8126:
+	case MSM8326:
+	case APQ8026:
 		switch (hw_id) {
 		case HW_PLATFORM_QRD:
 		case HW_PLATFORM_MTP:
@@ -208,6 +213,10 @@
 			return false;
 		}
 		break;
+	default:
+		dprintf(CRITICAL, "GCDB:Display: Platform id:%d not supported\n"
+					, platformid);
+		return false;
 	}
 
 	init_panel_data(panelstruct, pinfo, phy_db);
diff --git a/dev/panel/msm/mipi_truly_video_wvga.c b/dev/panel/msm/mipi_truly_video_wvga.c
index 4e6f416..8a19af8 100644
--- a/dev/panel/msm/mipi_truly_video_wvga.c
+++ b/dev/panel/msm/mipi_truly_video_wvga.c
@@ -74,7 +74,7 @@
 };
 static char disp_on6[12] = {
 	0x07, 0x00, 0x29, 0xC0,
-	0xC2, 0x10, 0x06, 0x06,
+	0xC2, 0x00, 0x06, 0x06,
 	0x01, 0x03, 0x00, 0xFF
 };
 static char disp_on7[32] = {
@@ -129,7 +129,7 @@
 };
 static char disp_on14[8] = {
 	0x03, 0x00, 0x29, 0xC0,
-	0xDE, 0x01, 0x41, 0xFF
+	0xDE, 0x01, 0x51, 0xFF
 };
 static char disp_on15[4] = {
 	0xE6, 0x51, 0x23, 0x80
diff --git a/dev/pmic/pm8x41/include/pm8x41.h b/dev/pmic/pm8x41/include/pm8x41.h
index 45f3bc7..b230549 100644
--- a/dev/pmic/pm8x41/include/pm8x41.h
+++ b/dev/pmic/pm8x41/include/pm8x41.h
@@ -61,6 +61,7 @@
 
 #define PON_PSHOLD_WARM_RESET   0x1
 #define PON_PSHOLD_SHUTDOWN     0x4
+#define PON_PSHOLD_HARD_RESET   0x7
 
 enum PM8X41_VERSIONS
 {
@@ -70,6 +71,7 @@
 
 
 /*Target power on reasons*/
+#define HARD_RST                1
 #define DC_CHG                  8
 #define USB_CHG                 16
 #define PON1                    32
diff --git a/platform/msm8974/include/platform/iomap.h b/platform/msm8974/include/platform/iomap.h
index 799fc86..06c34e6 100644
--- a/platform/msm8974/include/platform/iomap.h
+++ b/platform/msm8974/include/platform/iomap.h
@@ -139,6 +139,17 @@
 #define SDCC1_N                     (CLK_CTL_BASE + 0x4DC) /* n */
 #define SDCC1_D                     (CLK_CTL_BASE + 0x4E0) /* d */
 
+/* SDCC2 */
+#define SDCC2_BCR                   (CLK_CTL_BASE + 0x500) /* block reset */
+#define SDCC2_APPS_CBCR             (CLK_CTL_BASE + 0x504) /* branch control */
+#define SDCC2_AHB_CBCR              (CLK_CTL_BASE + 0x508)
+#define SDCC2_INACTIVITY_TIMER_CBCR (CLK_CTL_BASE + 0x50C)
+#define SDCC2_CMD_RCGR              (CLK_CTL_BASE + 0x510) /* cmd */
+#define SDCC2_CFG_RCGR              (CLK_CTL_BASE + 0x514) /* cfg */
+#define SDCC2_M                     (CLK_CTL_BASE + 0x518) /* m */
+#define SDCC2_N                     (CLK_CTL_BASE + 0x51C) /* n */
+#define SDCC2_D                     (CLK_CTL_BASE + 0x520) /* d */
+
 /* UART */
 #define BLSP1_AHB_CBCR              (CLK_CTL_BASE + 0x5C4)
 #define BLSP2_AHB_CBCR              (CLK_CTL_BASE + 0x944)
diff --git a/platform/msm8974/msm8974-clock.c b/platform/msm8974/msm8974-clock.c
index 6c88589..dbba8c4 100644
--- a/platform/msm8974/msm8974-clock.c
+++ b/platform/msm8974/msm8974-clock.c
@@ -166,6 +166,46 @@
 	},
 };
 
+static struct rcg_clk sdcc2_apps_clk_src =
+{
+	.cmd_reg      = (uint32_t *) SDCC2_CMD_RCGR,
+	.cfg_reg      = (uint32_t *) SDCC2_CFG_RCGR,
+	.m_reg        = (uint32_t *) SDCC2_M,
+	.n_reg        = (uint32_t *) SDCC2_N,
+	.d_reg        = (uint32_t *) SDCC2_D,
+
+	.set_rate     = clock_lib2_rcg_set_rate_mnd,
+	.freq_tbl     = ftbl_gcc_sdcc1_2_apps_clk,
+	.current_freq = &rcg_dummy_freq,
+
+	.c = {
+		.dbg_name = "sdc2_clk",
+		.ops      = &clk_ops_rcg_mnd,
+	},
+};
+
+static struct branch_clk gcc_sdcc2_apps_clk =
+{
+	.cbcr_reg     = (uint32_t *) SDCC2_APPS_CBCR,
+	.parent       = &sdcc2_apps_clk_src.c,
+
+	.c = {
+		.dbg_name = "gcc_sdcc2_apps_clk",
+		.ops      = &clk_ops_branch,
+	},
+};
+
+static struct branch_clk gcc_sdcc2_ahb_clk =
+{
+	.cbcr_reg     = (uint32_t *) SDCC2_AHB_CBCR,
+	.has_sibling  = 1,
+
+	.c = {
+		.dbg_name = "gcc_sdcc2_ahb_clk",
+		.ops      = &clk_ops_branch,
+	},
+};
+
 /* UART Clocks */
 static struct clk_freq_tbl ftbl_gcc_blsp1_2_uart1_6_apps_clk[] =
 {
@@ -590,6 +630,9 @@
 	CLK_LOOKUP("sdc1_iface_clk", gcc_sdcc1_ahb_clk.c),
 	CLK_LOOKUP("sdc1_core_clk",  gcc_sdcc1_apps_clk.c),
 
+	CLK_LOOKUP("sdc2_iface_clk", gcc_sdcc2_ahb_clk.c),
+	CLK_LOOKUP("sdc2_core_clk",  gcc_sdcc2_apps_clk.c),
+
 	CLK_LOOKUP("uart2_iface_clk", gcc_blsp1_ahb_clk.c),
 	CLK_LOOKUP("uart2_core_clk",  gcc_blsp1_uart2_apps_clk.c),
 
diff --git a/platform/msm_shared/bam.c b/platform/msm_shared/bam.c
index bd7a595..25bf9d0 100644
--- a/platform/msm_shared/bam.c
+++ b/platform/msm_shared/bam.c
@@ -223,6 +223,9 @@
 	/* Initialize FIFO offset for the first read */
 	bam->pipe[pipe_num].fifo.offset = BAM_DESC_SIZE;
 
+	writel(P_ENABLE | readl(BAM_P_CTRLn(bam->pipe[pipe_num].pipe_num, bam->base)),
+		   BAM_P_CTRLn(bam->pipe[pipe_num].pipe_num, bam->base));
+
 	/* Everything is set.
 	 * Flag pipe init done.
 	 */
@@ -243,9 +246,9 @@
 	/* Pipe event threshold register is not relevant in sys modes */
 
 	/* Enable pipe in system mode and set the direction */
-	writel(P_SYS_MODE_MASK | P_ENABLE |
-			(bam->pipe[pipe_num].trans_type << P_DIRECTION_SHIFT),
-			BAM_P_CTRLn(bam->pipe[pipe_num].pipe_num, bam->base));
+	writel(P_SYS_MODE_MASK | bam->pipe[pipe_num].lock_grp <<  P_LOCK_GRP_SHIFT |
+		   (bam->pipe[pipe_num].trans_type << P_DIRECTION_SHIFT),
+		   BAM_P_CTRLn(bam->pipe[pipe_num].pipe_num, bam->base));
 
 	/* Mark the pipe FIFO as uninitialized. */
 	bam->pipe[pipe_num].initialized = 0;
diff --git a/platform/msm_shared/crypto5_eng.c b/platform/msm_shared/crypto5_eng.c
index 669d6ac..ed5c8ad 100644
--- a/platform/msm_shared/crypto5_eng.c
+++ b/platform/msm_shared/crypto5_eng.c
@@ -256,6 +256,7 @@
 	dev->bam.pipe[CRYPTO_READ_PIPE_INDEX].trans_type = BAM2SYS;
 	dev->bam.pipe[CRYPTO_READ_PIPE_INDEX].fifo.size  = params->read_fifo_size;
 	dev->bam.pipe[CRYPTO_READ_PIPE_INDEX].fifo.head  = crypto_allocate_fifo(params->read_fifo_size);
+	dev->bam.pipe[CRYPTO_READ_PIPE_INDEX].lock_grp   = params->pipes.read_pipe_grp;
 
 	/* Set Write pipe params. */
 	dev->bam.pipe[CRYPTO_WRITE_PIPE_INDEX].pipe_num   = params->pipes.write_pipe;
@@ -263,6 +264,7 @@
 	dev->bam.pipe[CRYPTO_WRITE_PIPE_INDEX].trans_type = SYS2BAM;
 	dev->bam.pipe[CRYPTO_WRITE_PIPE_INDEX].fifo.size  = params->write_fifo_size;
 	dev->bam.pipe[CRYPTO_WRITE_PIPE_INDEX].fifo.head  = crypto_allocate_fifo(params->write_fifo_size);
+	dev->bam.pipe[CRYPTO_WRITE_PIPE_INDEX].lock_grp   = params->pipes.write_pipe_grp;
 
 	dev->bam.threshold = CRYPTO_MAX_THRESHOLD;
 
diff --git a/platform/msm_shared/display.c b/platform/msm_shared/display.c
index 026142c..9254a78 100755
--- a/platform/msm_shared/display.c
+++ b/platform/msm_shared/display.c
@@ -283,7 +283,7 @@
 		ret = mdp_dsi_video_off();
 		if (ret)
 			goto msm_display_off_out;
-		ret = mipi_dsi_off();
+		ret = mipi_dsi_off(pinfo);
 		if (ret)
 			goto msm_display_off_out;
 		break;
@@ -292,7 +292,7 @@
 		ret = mdp_dsi_cmd_off();
 		if (ret)
 			goto msm_display_off_out;
-		ret = mipi_dsi_off();
+		ret = mipi_dsi_off(pinfo);
 		if (ret)
 			goto msm_display_off_out;
 		break;
diff --git a/platform/msm_shared/include/bam.h b/platform/msm_shared/include/bam.h
index 099b1b6..ae673ab 100644
--- a/platform/msm_shared/include/bam.h
+++ b/platform/msm_shared/include/bam.h
@@ -81,6 +81,7 @@
 #define P_SYS_MODE_MASK                 (1 << 5)
 /* 1: Producer mode 0: Consumer mode */
 #define P_DIRECTION_SHIFT               3
+#define P_LOCK_GRP_SHIFT                16
 #define P_ENABLE                        (1 << 1)
 
 #define BAM_P_RSTn(n, x)                (0x00001000 + 0x4 + 0x1000 * (n) + (x))
@@ -198,6 +199,7 @@
 	uint8_t spi_num;
 	uint8_t int_mode;
 	uint8_t initialized;
+	uint8_t lock_grp;
 };
 
 /* Structure to define a BAM instance being used
diff --git a/platform/msm_shared/include/crypto5_eng.h b/platform/msm_shared/include/crypto5_eng.h
index 958fa1a..872f46e 100644
--- a/platform/msm_shared/include/crypto5_eng.h
+++ b/platform/msm_shared/include/crypto5_eng.h
@@ -103,6 +103,8 @@
 {
 	uint8_t read_pipe;
 	uint8_t write_pipe;
+	uint8_t read_pipe_grp;
+	uint8_t write_pipe_grp;
 };
 
 struct output_dump
diff --git a/platform/msm_shared/include/mipi_dsi.h b/platform/msm_shared/include/mipi_dsi.h
index 6a00efa..4f90f96 100755
--- a/platform/msm_shared/include/mipi_dsi.h
+++ b/platform/msm_shared/include/mipi_dsi.h
@@ -1000,7 +1000,7 @@
 		unsigned char eof_bllp_pwr,
 		unsigned char interleav);
 int mipi_dsi_on();
-int mipi_dsi_off();
+int mipi_dsi_off(struct msm_panel_info *pinfo);
 int mipi_dsi_cmds_tx(struct mipi_dsi_cmd *cmds, int count);
 int mipi_dsi_cmds_rx(char **rp, int len);
 #endif
diff --git a/platform/msm_shared/include/qpic_nand.h b/platform/msm_shared/include/qpic_nand.h
index abc2bb9..0676301 100644
--- a/platform/msm_shared/include/qpic_nand.h
+++ b/platform/msm_shared/include/qpic_nand.h
@@ -325,6 +325,9 @@
 	unsigned read_pipe;
 	unsigned write_pipe;
 	unsigned cmd_pipe;
+	uint8_t  read_pipe_grp;
+	uint8_t  write_pipe_grp;
+	uint8_t  cmd_pipe_grp;
 };
 
 /* Structure to define the initial nand config */
diff --git a/platform/msm_shared/mipi_dsi.c b/platform/msm_shared/mipi_dsi.c
index bbda314..43559eb 100644
--- a/platform/msm_shared/mipi_dsi.c
+++ b/platform/msm_shared/mipi_dsi.c
@@ -1175,7 +1175,7 @@
 	return ret;
 }
 
-int mipi_dsi_off()
+int mipi_dsi_off(struct msm_panel_info *pinfo)
 {
 	if(!target_cont_splash_screen())
 	{
@@ -1189,6 +1189,8 @@
 	}
 
 	writel(0x1115501, DSI_INT_CTRL);
+	if (pinfo->mipi.broadcast)
+		writel(0x1115501, DSI_INT_CTRL + 0x600);
 
 	return NO_ERROR;
 }
diff --git a/platform/msm_shared/mipi_dsi_autopll.c b/platform/msm_shared/mipi_dsi_autopll.c
index e6bac4e..5616956 100755
--- a/platform/msm_shared/mipi_dsi_autopll.c
+++ b/platform/msm_shared/mipi_dsi_autopll.c
@@ -255,8 +255,13 @@
 	}
 
 	/* 6 enable seq for 8226 target */
-	else if (platformid == MSM8226 ||
-		 platformid == MSM8626) {
+	else if (platformid == MSM8826 ||
+		 platformid == MSM8626 ||
+		 platformid == MSM8226 ||
+		 platformid == MSM8926 ||
+		 platformid == MSM8126 ||
+		 platformid == MSM8326 ||
+		 platformid == APQ8026) {
 		if (dsi_pll_enable_seq_m()) {
 		} else if (dsi_pll_enable_seq_d()) {
 		} else if (dsi_pll_enable_seq_d()) {
@@ -267,7 +272,7 @@
 			dprintf(CRITICAL, "Not able to enable the pll\n");
 		}
 	} else {
-		dprintf(CRITICAL, "Target not supported\n");
+		dprintf(CRITICAL, "Target not supported in auto PLL\n");
 	}
 
 }
diff --git a/platform/msm_shared/qpic_nand.c b/platform/msm_shared/qpic_nand.c
index 6a386ce..16a498b 100644
--- a/platform/msm_shared/qpic_nand.c
+++ b/platform/msm_shared/qpic_nand.c
@@ -259,6 +259,7 @@
 	bam.pipe[DATA_PRODUCER_PIPE_INDEX].trans_type = BAM2SYS;
 	bam.pipe[DATA_PRODUCER_PIPE_INDEX].fifo.size = QPIC_BAM_DATA_FIFO_SIZE;
 	bam.pipe[DATA_PRODUCER_PIPE_INDEX].fifo.head = data_desc_fifo;
+	bam.pipe[DATA_PRODUCER_PIPE_INDEX].lock_grp = config->pipes.read_pipe_grp;
 
 	/* Set Write pipe params. */
 	bam.pipe[DATA_CONSUMER_PIPE_INDEX].pipe_num = config->pipes.write_pipe;
@@ -266,6 +267,7 @@
 	bam.pipe[DATA_CONSUMER_PIPE_INDEX].trans_type = SYS2BAM;
 	bam.pipe[DATA_CONSUMER_PIPE_INDEX].fifo.size = QPIC_BAM_DATA_FIFO_SIZE;
 	bam.pipe[DATA_CONSUMER_PIPE_INDEX].fifo.head = data_desc_fifo;
+	bam.pipe[DATA_CONSUMER_PIPE_INDEX].lock_grp = config->pipes.write_pipe_grp;
 
 	/* Set Cmd pipe params. */
 	bam.pipe[CMD_PIPE_INDEX].pipe_num = config->pipes.cmd_pipe;
@@ -273,6 +275,7 @@
 	bam.pipe[CMD_PIPE_INDEX].trans_type = BAM2SYS;
 	bam.pipe[CMD_PIPE_INDEX].fifo.size = QPIC_BAM_CMD_FIFO_SIZE;
 	bam.pipe[CMD_PIPE_INDEX].fifo.head = cmd_desc_fifo;
+	bam.pipe[CMD_PIPE_INDEX].lock_grp = config->pipes.cmd_pipe_grp;
 
 	/* Programs the threshold for BAM transfer
 	 * When this threshold is reached, BAM signals the peripheral via the pipe_bytes_available
diff --git a/platform/msm_shared/qtimer.c b/platform/msm_shared/qtimer.c
index bf9de81..c8d6bd7 100644
--- a/platform/msm_shared/qtimer.c
+++ b/platform/msm_shared/qtimer.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -93,7 +93,7 @@
 {
 	uint64_t ticks;
 
-	ticks = (msecs * ticks_per_sec) / 1000;
+	ticks = ((uint64_t) msecs * ticks_per_sec) / 1000;
 
 	delay(ticks);
 }
@@ -102,7 +102,7 @@
 {
 	uint64_t ticks;
 
-	ticks = (usecs * ticks_per_sec) / 1000000;
+	ticks = ((uint64_t) usecs * ticks_per_sec) / 1000000;
 
 	delay(ticks);
 }
diff --git a/target/mdm9625/init.c b/target/mdm9625/init.c
index ab9fd90..77f7331 100644
--- a/target/mdm9625/init.c
+++ b/target/mdm9625/init.c
@@ -54,6 +54,11 @@
 #define DATA_PRODUCER_PIPE                            1
 #define CMD_PIPE                                      2
 
+/* NANDc BAM pipe groups */
+#define DATA_PRODUCER_PIPE_GRP                        0
+#define DATA_CONSUMER_PIPE_GRP                        0
+#define CMD_PIPE_GRP                                  1
+
 /* NANDc EE */
 #define QPIC_NAND_EE                                  0
 
@@ -122,6 +127,10 @@
 	config.pipes.write_pipe = DATA_CONSUMER_PIPE;
 	config.pipes.cmd_pipe = CMD_PIPE;
 
+	config.pipes.read_pipe_grp = DATA_PRODUCER_PIPE_GRP;
+	config.pipes.write_pipe_grp = DATA_CONSUMER_PIPE_GRP;
+	config.pipes.cmd_pipe_grp = CMD_PIPE_GRP;
+
 	config.bam_base = MSM_NAND_BAM_BASE;
 	config.nand_base = MSM_NAND_BASE;
 	config.ee = QPIC_NAND_EE;
diff --git a/target/msm8226/init.c b/target/msm8226/init.c
index 4b3b618..d8c7031 100644
--- a/target/msm8226/init.c
+++ b/target/msm8226/init.c
@@ -55,6 +55,8 @@
 #define CRYPTO_ENGINE_FIFO_SIZE            64
 #define CRYPTO_ENGINE_READ_PIPE            3
 #define CRYPTO_ENGINE_WRITE_PIPE           2
+#define CRYPTO_READ_PIPE_LOCK_GRP          0
+#define CRYPTO_WRITE_PIPE_LOCK_GRP         0
 #define CRYPTO_ENGINE_CMD_ARRAY_SIZE       20
 
 #define TLMM_VOL_UP_BTN_GPIO    106
@@ -122,9 +124,11 @@
 	ce_params.bam_base         = MSM_CE1_BAM_BASE;
 
 	/* Set up BAM config. */
-	ce_params.bam_ee           = CRYPTO_ENGINE_EE;
-	ce_params.pipes.read_pipe  = CRYPTO_ENGINE_READ_PIPE;
-	ce_params.pipes.write_pipe = CRYPTO_ENGINE_WRITE_PIPE;
+	ce_params.bam_ee               = CRYPTO_ENGINE_EE;
+	ce_params.pipes.read_pipe      = CRYPTO_ENGINE_READ_PIPE;
+	ce_params.pipes.write_pipe     = CRYPTO_ENGINE_WRITE_PIPE;
+	ce_params.pipes.read_pipe_grp  = CRYPTO_READ_PIPE_LOCK_GRP;
+	ce_params.pipes.write_pipe_grp = CRYPTO_WRITE_PIPE_LOCK_GRP;
 
 	/* Assign buffer sizes. */
 	ce_params.num_ce           = CRYPTO_ENGINE_CMD_ARRAY_SIZE;
@@ -350,9 +354,18 @@
 {
 	uint8_t pon_reason = pm8x41_get_pon_reason();
 	uint8_t is_cold_boot = pm8x41_get_is_cold_boot();
-	if (is_cold_boot && ((pon_reason == USB_CHG) || (pon_reason == DC_CHG)))
-		 return 1;
-	return 0;
+	dprintf(INFO, "%s : pon_reason is %d cold_boot:%d\n", __func__,
+			pon_reason, is_cold_boot);
+	/*In case of fastboot reboot or adb reboot we do not want go into
+	 * charger mode.
+	 * fastboot reboot is warm boot with PON hard reset bit not set
+	 * adb reboot is a cold boot with PON hard reset bit set
+	 */
+	if (is_cold_boot && (!(pon_reason & HARD_RST)) &&
+			((pon_reason & USB_CHG) || (pon_reason & DC_CHG)))
+		return 1;
+	else
+		return 0;
 }
 
 unsigned target_baseband()
diff --git a/target/msm8974/init.c b/target/msm8974/init.c
index b789b22..84111f8 100644
--- a/target/msm8974/init.c
+++ b/target/msm8974/init.c
@@ -70,6 +70,8 @@
 #define CE_FIFO_SIZE            64
 #define CE_READ_PIPE            3
 #define CE_WRITE_PIPE           2
+#define CE_READ_PIPE_LOCK_GRP   0
+#define CE_WRITE_PIPE_LOCK_GRP  0
 #define CE_ARRAY_SIZE           20
 
 #ifdef SSD_ENABLE
@@ -77,6 +79,8 @@
 #define SSD_PARTITION_SIZE      8192
 #endif
 
+#define FASTBOOT_MODE           0x77665500
+
 #define BOARD_SOC_VERSION1(soc_rev) (soc_rev >= 0x10000 && soc_rev < 0x20000)
 
 #if MMC_SDHCI_SUPPORT
@@ -174,9 +178,11 @@
 	ce_params.bam_base         = MSM_CE2_BAM_BASE;
 
 	/* Set up BAM config. */
-	ce_params.bam_ee           = CE_EE;
-	ce_params.pipes.read_pipe  = CE_READ_PIPE;
-	ce_params.pipes.write_pipe = CE_WRITE_PIPE;
+	ce_params.bam_ee               = CE_EE;
+	ce_params.pipes.read_pipe      = CE_READ_PIPE;
+	ce_params.pipes.write_pipe     = CE_WRITE_PIPE;
+	ce_params.pipes.read_pipe_grp  = CE_READ_PIPE_LOCK_GRP;
+	ce_params.pipes.write_pipe_grp = CE_WRITE_PIPE_LOCK_GRP;
 
 	/* Assign buffer sizes. */
 	ce_params.num_ce           = CE_ARRAY_SIZE;
@@ -487,6 +493,7 @@
 void reboot_device(unsigned reboot_reason)
 {
 	uint32_t soc_ver = 0;
+	uint8_t reset_type = 0;
 
 	soc_ver = board_soc_version();
 
@@ -496,11 +503,16 @@
 	else
 		writel(reboot_reason, RESTART_REASON_ADDR_V2);
 
+	if(reboot_reason == FASTBOOT_MODE)
+		reset_type = PON_PSHOLD_WARM_RESET;
+	else
+		reset_type = PON_PSHOLD_HARD_RESET;
+
 	/* Configure PMIC for warm reset */
 	if (target_is_8974() && (pmic_ver == PM8X41_VERSION_V2))
-		pm8x41_v2_reset_configure(PON_PSHOLD_WARM_RESET);
+		pm8x41_v2_reset_configure(reset_type);
 	else
-		pm8x41_reset_configure(PON_PSHOLD_WARM_RESET);
+		pm8x41_reset_configure(reset_type);
 
 	/* Disable Watchdog Debug.
 	 * Required becuase of a H/W bug which causes the system to