Merge "platform: msm_shared: enable burst mode for DSI 1.3.0 and above"
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 26129fd..575e8e4 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -1513,7 +1513,7 @@
 	if (ret)
 	{
 		dprintf(CRITICAL, "ERROR: Cannot write device info\n");
-		return;
+		ASSERT(0);
 	}
 }
 
@@ -1550,9 +1550,8 @@
 	if (ret)
 	{
 		dprintf(CRITICAL, "ERROR: Cannot read device info\n");
-		return;
+		ASSERT(0);
 	}
-
 }
 
 void write_device_info_flash(device_info *dev)
@@ -1722,8 +1721,10 @@
 		memcpy(info, dev, sizeof(struct device_info));
 
 #if USE_RPMB_FOR_DEVINFO
-		if (is_secure_boot_enable())
-			write_device_info_rpmb((void*) info, PAGE_SIZE);
+		if (is_secure_boot_enable()) {
+			if((write_device_info_rpmb((void*) info, PAGE_SIZE)) < 0)
+				ASSERT(0);
+		}
 		else
 			write_device_info_mmc(info);
 #else
@@ -1750,8 +1751,10 @@
 		info_buf = info;
 
 #if USE_RPMB_FOR_DEVINFO
-		if (is_secure_boot_enable())
-			read_device_info_rpmb((void*) info, PAGE_SIZE);
+		if (is_secure_boot_enable()) {
+			if((read_device_info_rpmb((void*) info, PAGE_SIZE)) < 0)
+				ASSERT(0);
+		}
 		else
 			read_device_info_mmc(info);
 #else
diff --git a/dev/gcdb/display/include/panel_fl10802_fwvga_video.h b/dev/gcdb/display/include/panel_fl10802_fwvga_video.h
index 69e6e9e..8e30f57 100644
--- a/dev/gcdb/display/include/panel_fl10802_fwvga_video.h
+++ b/dev/gcdb/display/include/panel_fl10802_fwvga_video.h
@@ -168,30 +168,66 @@
 };
 
 static char fl10802_fwvga_video_on_cmd15[] = {
-	0x02, 0x00, 0x39, 0xC0,
-	0xC7, 0xA0, 0xFF, 0xFF,
+	0x80, 0x00, 0x39, 0xC0,
+	0xC1, 0x01, 0x00, 0x0C,
+	0x17, 0x20, 0x29, 0x31,
+	0x39, 0x42, 0x4B, 0x53,
+	0x5B, 0x63, 0x6B, 0x74,
+	0x7C, 0x85, 0x8E, 0x97,
+	0xA0, 0xA8, 0xAF, 0xB7,
+	0xBE, 0xC6, 0xCD, 0xD4,
+	0xDB, 0xE2, 0xE9, 0xEF,
+	0xF6, 0xFB, 0xFF, 0x3C,
+	0x4B, 0x1C, 0x27, 0x26,
+	0x2F, 0x1D, 0x08, 0x03,
+	0x00, 0x0A, 0x13, 0x1B,
+	0x24, 0x2B, 0x32, 0x3A,
+	0x42, 0x4A, 0x51, 0x59,
+	0x61, 0x69, 0x71, 0x79,
+	0x81, 0x8A, 0x93, 0x9C,
+	0xA4, 0xAC, 0xB4, 0xBC,
+	0xC4, 0xCB, 0xD3, 0xDB,
+	0xE2, 0xEA, 0xF2, 0xF9,
+	0xFF, 0x2C, 0x34, 0x4F,
+	0x49, 0x3F, 0x23, 0x14,
+	0x3F, 0x03, 0x00, 0x10,
+	0x18, 0x1E, 0x25, 0x2C,
+	0x32, 0x37, 0x3E, 0x45,
+	0x4C, 0x52, 0x59, 0x60,
+	0x65, 0x6D, 0x74, 0x7B,
+	0x82, 0x89, 0x92, 0x9A,
+	0xA2, 0xAA, 0xB2, 0xB9,
+	0xC1, 0xCA, 0xD2, 0xDB,
+	0xE6, 0xF1, 0xFF, 0x20,
+	0x26, 0x1F, 0x19, 0x4E,
+	0x45, 0x24, 0x42, 0x03,
 };
 
 static char fl10802_fwvga_video_on_cmd16[] = {
 	0x02, 0x00, 0x39, 0xC0,
-	0x53, 0x2C, 0xFF, 0xFF,
+	0xC7, 0xA0, 0xFF, 0xFF,
 };
 
 static char fl10802_fwvga_video_on_cmd17[] = {
+	0x02, 0x00, 0x39, 0xC0,
+	0x53, 0x2C, 0xFF, 0xFF,
+};
+
+static char fl10802_fwvga_video_on_cmd18[] = {
 	0x03, 0x00, 0x39, 0xC0,
 	0xC8, 0x10, 0x10, 0xFF,
 };
 
-static char fl10802_fwvga_video_on_cmd18[] = {
+static char fl10802_fwvga_video_on_cmd19[] = {
 	0x02, 0x00, 0x39, 0xC0,
 	0x51, 0xFF, 0xFF, 0xFF,
 };
 
-static char fl10802_fwvga_video_on_cmd19[] = {
+static char fl10802_fwvga_video_on_cmd20[] = {
 	0x11, 0x00, 0x05, 0x80
 };
 
-static char fl10802_fwvga_video_on_cmd20[] = {
+static char fl10802_fwvga_video_on_cmd21[] = {
 	0x29, 0x00, 0x05, 0x80
 };
 
@@ -211,15 +247,16 @@
 	{0x38, fl10802_fwvga_video_on_cmd12, 0x00},
 	{0x1c, fl10802_fwvga_video_on_cmd13, 0x00},
 	{0x28, fl10802_fwvga_video_on_cmd14, 0x00},
-	{0x8, fl10802_fwvga_video_on_cmd15, 0x00},
+	{0x84, fl10802_fwvga_video_on_cmd15, 0x00},
 	{0x8, fl10802_fwvga_video_on_cmd16, 0x00},
 	{0x8, fl10802_fwvga_video_on_cmd17, 0x00},
 	{0x8, fl10802_fwvga_video_on_cmd18, 0x00},
-	{0x4, fl10802_fwvga_video_on_cmd19, 0x78},
-	{0x4, fl10802_fwvga_video_on_cmd20, 0x78}
+	{0x8, fl10802_fwvga_video_on_cmd19, 0x00},
+	{0x4, fl10802_fwvga_video_on_cmd20, 0x78},
+	{0x4, fl10802_fwvga_video_on_cmd21, 0x78}
 };
 
-#define FL10802_FWVGA_VIDEO_ON_COMMAND 21
+#define FL10802_FWVGA_VIDEO_ON_COMMAND 22
 
 
 static char fl10802_fwvga_videooff_cmd0[] = {
diff --git a/dev/gcdb/display/include/panel_otm1906c_1080p_cmd.h b/dev/gcdb/display/include/panel_otm1906c_1080p_cmd.h
index f4f0be7..8b93bb8 100644
--- a/dev/gcdb/display/include/panel_otm1906c_1080p_cmd.h
+++ b/dev/gcdb/display/include/panel_otm1906c_1080p_cmd.h
@@ -498,10 +498,10 @@
 
 static char otm1906c_1080p_cmd_on_cmd85[] = {
 	0x0f, 0x00, 0x29, 0xC0,
-	0xC0, 0x00, 0x70, 0x00,
-	0x1A, 0x16, 0x00, 0x70,
-	0x1A, 0x16, 0x00, 0x70,
-	0x00, 0x1A, 0x16, 0xFF,
+	0xC0, 0x00, 0x71, 0x00,
+	0x0A, 0x0A, 0x00, 0x71,
+	0x0A, 0x0A, 0x00, 0x71,
+	0x00, 0x0A, 0x0A, 0xFF,
 };
 
 static char otm1906c_1080p_cmd_on_cmd86[] = {
@@ -938,7 +938,7 @@
 	0x0b, 0x00, 0x29, 0xC0,
 	0xA7, 0x1D, 0x20, 0x3D,
 	0x00, 0x00, 0xBE, 0x80,
-	0xBE, 0x05, 0xF0, 0xFF,
+	0xBE, 0x05, 0x20, 0xFF,
 };
 
 static char otm1906c_1080p_cmd_on_cmd156[] = {
@@ -1107,7 +1107,7 @@
 
 static char otm1906c_1080p_cmd_on_cmd185[] = {
 	0x09, 0x00, 0x29, 0xC0,
-	0xA4, 0x05, 0xF0, 0x0B,
+	0xA4, 0x05, 0x20, 0x0B,
 	0xE0, 0x00, 0x00, 0x0B,
 	0xE0, 0xFF, 0xFF, 0xFF,
 };
@@ -1134,7 +1134,7 @@
 	0x10, 0x00, 0x29, 0xC0,
 	0xAB, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
-	0x01, 0x00, 0x00, 0x00,
+	0x07, 0x00, 0x00, 0x00,
 	0x00, 0x01, 0x00, 0x00,
 };
 
@@ -1145,7 +1145,7 @@
 
 static char otm1906c_1080p_cmd_on_cmd191[] = {
 	0x0d, 0x00, 0x29, 0xC0,
-	0xAB, 0x00, 0x00, 0x08,
+	0xAB, 0x00, 0x00, 0x68,
 	0x0A, 0x00, 0x00, 0x44,
 	0x04, 0x00, 0x00, 0x00,
 	0x00, 0xFF, 0xFF, 0xFF,
diff --git a/platform/msm8996/platform.c b/platform/msm8996/platform.c
index 6ec83d7..633857a 100644
--- a/platform/msm8996/platform.c
+++ b/platform/msm8996/platform.c
@@ -41,16 +41,16 @@
 #define MSM_IOMAP_SIZE     ((MSM_IOMAP_END - MSM_IOMAP_BASE)/MB)
 #define MSM_SHARED_SIZE    2
 
-/* LK memory - cacheable, write back */
-#define LK_MEMORY         (MMU_MEMORY_TYPE_NORMAL_WRITE_BACK_ALLOCATE | \
+/* LK memory - cacheable, write through */
+#define LK_MEMORY         (MMU_MEMORY_TYPE_NORMAL_WRITE_THROUGH | \
                            MMU_MEMORY_AP_READ_WRITE)
 
 /* Peripherals - non-shared device */
 #define IOMAP_MEMORY      (MMU_MEMORY_TYPE_DEVICE_SHARED | \
                            MMU_MEMORY_AP_READ_WRITE | MMU_MEMORY_XN | MMU_MEMORY_PXN)
 
-/* SCRATCH memory - cacheable, write back */
-#define SCRATCH_MEMORY       (MMU_MEMORY_TYPE_NORMAL_WRITE_BACK_ALLOCATE | \
+/* SCRATCH memory - cacheable, write through */
+#define SCRATCH_MEMORY       (MMU_MEMORY_TYPE_NORMAL_WRITE_THROUGH | \
                            MMU_MEMORY_AP_READ_WRITE | MMU_MEMORY_XN)
 
 /* COMMON memory - cacheable, write through */
diff --git a/platform/msm8996/rules.mk b/platform/msm8996/rules.mk
index 66d6af7..8db37d5 100644
--- a/platform/msm8996/rules.mk
+++ b/platform/msm8996/rules.mk
@@ -4,7 +4,7 @@
 ARM_CPU := cortex-a8
 CPU     := generic
 
-DEFINES += ARM_CPU_CORE_KRYO
+DEFINES += ARM_CPU_CORE_KRAIT
 
 MMC_SLOT         := 1
 
diff --git a/platform/msm_shared/include/mipi_dsi.h b/platform/msm_shared/include/mipi_dsi.h
index c445230..e7c9ace 100644
--- a/platform/msm_shared/include/mipi_dsi.h
+++ b/platform/msm_shared/include/mipi_dsi.h
@@ -279,8 +279,7 @@
 	int rdbk_len);
 int32_t mdss_dsi_auto_pll_config(uint32_t pll_base, uint32_t ctl_base,
 	struct mdss_dsi_pll_config *pd);
-void mdss_dsi_auto_pll_20nm_config(uint32_t pll_base, uint32_t spll_base,
-		struct mdss_dsi_pll_config *pd);
+void mdss_dsi_auto_pll_20nm_config(struct msm_panel_info *pinfo);
 void mdss_dsi_pll_20nm_sw_reset_st_machine(uint32_t pll_base);
 uint32_t mdss_dsi_pll_20nm_lock_status(uint32_t pll_base);
 void mdss_dsi_uniphy_pll_lock_detect_setting(uint32_t pll_base);
diff --git a/platform/msm_shared/include/scm.h b/platform/msm_shared/include/scm.h
index 95f4f46..002847f 100644
--- a/platform/msm_shared/include/scm.h
+++ b/platform/msm_shared/include/scm.h
@@ -463,4 +463,6 @@
 
 int scm_dload_mode(int mode);
 int scm_device_enter_dload();
+int scm_call2_atomic(uint32_t svc, uint32_t cmd, uint32_t arg1, uint32_t arg2);
+uint32_t scm_io_write(uint32_t address, uint32_t val);
 #endif
diff --git a/platform/msm_shared/include/sdhci.h b/platform/msm_shared/include/sdhci.h
index 64fb2b0..77096bc 100644
--- a/platform/msm_shared/include/sdhci.h
+++ b/platform/msm_shared/include/sdhci.h
@@ -291,7 +291,7 @@
 #define SDHCI_READ_MODE                           BIT(4)
 #define SDHCI_SWITCH_CMD                          6
 #define SDHCI_CMD_TIMEOUT                         0xF
-#define SDHCI_MAX_CMD_RETRY                       5000000
+#define SDHCI_MAX_CMD_RETRY                       9000000
 #define SDHCI_MAX_TRANS_RETRY                     10000000
 
 #define SDHCI_PREP_CMD(c, f)                      ((((c) & 0xff) << 8) | ((f) & 0xff))
diff --git a/platform/msm_shared/mipi_dsi_autopll_20nm.c b/platform/msm_shared/mipi_dsi_autopll_20nm.c
index e6f326f..890f253 100644
--- a/platform/msm_shared/mipi_dsi_autopll_20nm.c
+++ b/platform/msm_shared/mipi_dsi_autopll_20nm.c
@@ -281,9 +281,16 @@
 }
 
 
-void mdss_dsi_auto_pll_20nm_config(uint32_t pll_base, uint32_t spll_base,
-	struct mdss_dsi_pll_config *pd)
+void mdss_dsi_auto_pll_20nm_config(struct msm_panel_info *pinfo)
 {
+	struct mdss_dsi_pll_config *pd = pinfo->mipi.dsi_pll_config;
+	uint32_t pll_base = pinfo->mipi.pll_base;
+	uint32_t spll_base = pinfo->mipi.spll_base;
+
+	mdss_dsi_phy_sw_reset(pinfo->mipi.ctl_base);
+	if (pinfo->mipi.dual_dsi)
+		mdss_dsi_phy_sw_reset(pinfo->mipi.sctl_base);
+
 	/*
 	 * For 20nm PHY, the DSI PLL which is not powered on to drive a panel
 	 * drains some current in its reset state.
diff --git a/platform/msm_shared/qpic_nand.c b/platform/msm_shared/qpic_nand.c
index 4caa5c8..c39d584 100644
--- a/platform/msm_shared/qpic_nand.c
+++ b/platform/msm_shared/qpic_nand.c
@@ -76,6 +76,7 @@
 	{0x1590ACAD, 0,        0xFFFFFFFF, 0x0,      0x20000000,    0,  2048,   0x00020000,        0x80,   0},
 	{0x9590DC2C, 0x56,     0xFFFFFFFF, 0x0,      0x10000000,    0,  2048,   0x00020000,        0x40,   0},
 	{0x1590aa98, 0x76,     0xFFFFFFFF, 0x0,      0x10000000,    0,  2048,   0x00020000,        0x80,   1},
+	{0x2690A32C, 0x64,     0xFFFFFFFF, 0x0,      0x20000000,    0,  4096,   0x00040000,        0xE0,   1},
 	/* Note: Width flag is 0 for 8 bit Flash and 1 for 16 bit flash   */
 };
 
diff --git a/platform/msm_shared/rpmb/rpmb.c b/platform/msm_shared/rpmb/rpmb.c
index 29d72e3..f6cb3e3 100644
--- a/platform/msm_shared/rpmb/rpmb.c
+++ b/platform/msm_shared/rpmb/rpmb.c
@@ -160,8 +160,6 @@
 	read_req.data   = (uint32_t) info;
 	read_req.len    = sz;
 
-	read_rsp.cmd_id = CLIENT_CMD_READ_LK_DEVICE_STATE;
-
 	/* Read the device info */
 	arch_clean_invalidate_cache_range((addr_t) info, sz);
 	ret = qseecom_send_command(app_handle, (void*) &read_req, sizeof(read_req), (void*) &read_rsp, sizeof(read_rsp));
@@ -170,7 +168,7 @@
 	if (ret < 0 || read_rsp.status < 0)
 	{
 		dprintf(CRITICAL, "Reading device info failed: Error: %d\n", read_rsp.status);
-		return read_rsp.status;
+		return -1;
 	}
 
 	return 0;
@@ -187,8 +185,6 @@
 	write_req.data   = (uint32_t) info;
 	write_req.len    = sz;
 
-	write_rsp.cmd_id = CLIENT_CMD_WRITE_LK_DEVICE_STATE;
-
 	/* Write the device info */
 	arch_clean_invalidate_cache_range((addr_t) info, sz);
 	ret = qseecom_send_command(app_handle, (void *)&write_req, sizeof(write_req), (void *)&write_rsp, sizeof(write_rsp));
@@ -197,7 +193,7 @@
 	if (ret < 0 || write_rsp.status < 0)
 	{
 		dprintf(CRITICAL, "Writing device info failed: Error: %d\n", write_rsp.status);
-		return ret;
+		return -1;
 	}
 
 	return 0;
diff --git a/platform/msm_shared/rpmb/rpmb_emmc.c b/platform/msm_shared/rpmb/rpmb_emmc.c
index 3b00e09..7250505 100644
--- a/platform/msm_shared/rpmb/rpmb_emmc.c
+++ b/platform/msm_shared/rpmb/rpmb_emmc.c
@@ -49,12 +49,12 @@
 
 int rpmb_write_emmc(struct mmc_device *dev,uint32_t *req_buf, uint32_t blk_cnt, uint32_t rel_wr_count, uint32_t *resp_buf, uint32_t *resp_len)
 {
-	uint32_t i, num_trans;
+	uint32_t i, num_trans = 0;
 	int ret = 0;
 	struct mmc_command cmd[3] = {{0},{0},{0}};
 	struct rpmb_frame *result = (struct rpmb_frame *)resp_buf;
 
-	dprintf(INFO, "rpmb write command called with blk_cnt: 0x%x\n", blk_cnt);
+	dprintf(INFO, "rpmb write command called with blk_cnt and rel_wr_count: 0x%x 0x%x\n", blk_cnt, rel_wr_count);
 	if (rel_wr_count == 0x2)
 	{
 		// if reliable write count reported by secure app is 2 then we can
@@ -66,10 +66,9 @@
 	{
 		num_trans = blk_cnt; // rel_rw_count = 1 for emmc 5.0 and below
 	}
-	else
+	else if(rel_wr_count == 0x20)
 	{
-		dprintf(CRITICAL, "Reliable write count > 2 is not supported\n");
-		return -1;
+		num_trans = blk_cnt / 32;
 	}
 
 	for (i = 0; i < num_trans; i++)
@@ -93,10 +92,10 @@
 			cmd[0].rel_write = 0;
 			cmd[0].data.num_blocks = RPMB_MIN_BLK_CNT;
 		}
-		else if(rel_wr_count == 0x2)
+		else if(rel_wr_count == 0x2 || rel_wr_count == 0x20)
 		{
 			cmd[0].rel_write = 1;
-			cmd[0].data.num_blocks = 0x2;
+			cmd[0].data.num_blocks = rel_wr_count;
 		}
 		/* CMD25 Result Register Read Request Packet */
 		cmd[1].write_flag = false;
@@ -142,11 +141,7 @@
 			dprintf(CRITICAL, "%s\n", str_err[result->result[1]]);
 			break;
 		}
-		if (rel_wr_count == 0x1)
-			req_buf = (uint32_t*) ((uint8_t*)req_buf + (RPMB_BLK_SIZE));
-		else if(rel_wr_count == 0x2)
-			req_buf = (uint32_t*) ((uint8_t*)req_buf + (RPMB_BLK_SIZE * 0x2));
-
+		req_buf = (uint32_t*) ((uint8_t*)req_buf + (RPMB_BLK_SIZE * rel_wr_count));
 	}
 	*resp_len = RPMB_MIN_BLK_CNT * RPMB_BLK_SIZE;
 
diff --git a/platform/msm_shared/scm.c b/platform/msm_shared/scm.c
index d32423e..bccdb3d 100644
--- a/platform/msm_shared/scm.c
+++ b/platform/msm_shared/scm.c
@@ -56,7 +56,6 @@
 
 /* SCM interface as per ARM spec present? */
 bool scm_arm_support;
-static uint32_t scm_io_write(uint32_t address, uint32_t val);
 
 bool is_scm_armv8_support()
 {
@@ -65,7 +64,7 @@
 
 static int is_scm_call_available(uint32_t svc_id, uint32_t cmd_id)
 {
-	uint32_t ret;
+	int ret;
 	scmcall_arg scm_arg = {0};
 	scmcall_ret scm_ret = {0};
 
@@ -83,7 +82,7 @@
 
 static int scm_arm_support_available(uint32_t svc_id, uint32_t cmd_id)
 {
-	uint32_t ret;
+	int ret;
 
 	ret = is_scm_call_available(SCM_SVC_INFO, IS_CALL_AVAIL_CMD);
 
@@ -99,7 +98,7 @@
 
 	ret = scm_arm_support_available(SCM_SVC_INFO, IS_CALL_AVAIL_CMD);
 
-	if (ret)
+	if (ret < 0)
 		dprintf(CRITICAL, "Failed to initialize SCM\n");
 }
 
@@ -1275,7 +1274,7 @@
 	return ret;
 }
 
-static uint32_t scm_io_write(uint32_t address, uint32_t val)
+uint32_t scm_io_write(uint32_t address, uint32_t val)
 {
 	uint32_t ret;
 	scmcall_arg scm_arg = {0};
@@ -1294,7 +1293,7 @@
 	return ret;
 }
 
-static int scm_call2_atomic(uint32_t svc, uint32_t cmd, uint32_t arg1, uint32_t arg2)
+int scm_call2_atomic(uint32_t svc, uint32_t cmd, uint32_t arg1, uint32_t arg2)
 {
 	uint32_t ret = 0;
 	scmcall_arg scm_arg = {0};
diff --git a/platform/msm_shared/wdog.c b/platform/msm_shared/wdog.c
index 93a7309..d1f4033 100644
--- a/platform/msm_shared/wdog.c
+++ b/platform/msm_shared/wdog.c
@@ -33,10 +33,12 @@
 #include <reg.h>
 #include <wdog.h>
 #include <target.h>
+#include <scm.h>
+#include <dload_util.h>
 
 void msm_wdog_init()
 {
-	uint32_t rc;
+	uint32_t ret;
 
 	/* Set Bite and Bark times  10s */
 	writel(0x77FD3, APPS_WDOG_BARK_VAL_REG);
@@ -48,8 +50,13 @@
 	/* Enable WDOG */
 	writel((readl(APPS_WDOG_CTL_REG) | 0x1), APPS_WDOG_CTL_REG);
 
-	/* Set dload mode */
-	rc = set_download_mode(NORMAL_DLOAD);
-	if(rc)
-		dprintf(CRITICAL, "set_download_mode failed\n");
+	/* Write to the Boot MISC register to put the device in dload mode*/
+	ret = scm_call2_atomic(SCM_SVC_BOOT, SCM_DLOAD_CMD, SCM_DLOAD_MODE, 0);
+
+	if (ret) {
+		ret = scm_io_write(TCSR_BOOT_MISC_DETECT,SCM_DLOAD_MODE);
+		if(ret) {
+			dprintf(CRITICAL, "Failed to write to boot misc: %d\n", ret);
+		}
+	}
 }
diff --git a/target/fsm9010/init.c b/target/fsm9010/init.c
index e5c50bb..76382aa 100644
--- a/target/fsm9010/init.c
+++ b/target/fsm9010/init.c
@@ -319,7 +319,7 @@
 	uint32_t restart_reason = 0;
 	uint32_t restart_reason_addr;
 
-	restart_reason_addr = RESTART_REASON_ADDR;
+	restart_reason_addr = RESTART_REASON_ADDR_V2;
 
 	/* Read reboot reason and scrub it */
 	restart_reason = readl(restart_reason_addr);
@@ -331,7 +331,7 @@
 void reboot_device(unsigned reboot_reason)
 {
 	/* Write the reboot reason */
-	writel(reboot_reason, RESTART_REASON_ADDR);
+	writel(reboot_reason, RESTART_REASON_ADDR_V2);
 
 	/* Disable Watchdog Debug.
 	 * Required becuase of a H/W bug which causes the system to
diff --git a/target/msm8952/target_display.c b/target/msm8952/target_display.c
index 8773514..abe8937 100644
--- a/target/msm8952/target_display.c
+++ b/target/msm8952/target_display.c
@@ -53,8 +53,12 @@
 
 #define DSC_CMD_PANEL "dsc_cmd_panel"
 #define DSC_VID_PANEL "dsc_vid_panel"
+#define DSC_VID_PANEL_ADV7533_1080P "dsc_vid_panel_adv7533_1080p"
+#define DSC_CMD_PANEL_ADV7533_1080P "dsc_cmd_panel_adv7533_1080p"
 #define DSC_CMD_PANEL_STRING "1:dsi:0:none:1:qcom,mdss_dsi_nt35597_dsc_wqxga_cmd"
 #define DSC_VID_PANEL_STRING "1:dsi:0:none:1:qcom,mdss_dsi_nt35597_dsc_wqxga_video"
+#define DSC_CMD_PANEL_ADV7533_1080P_STRING "1:dsi:0:qcom,mdss_dsi_adv7533_1080p:1:qcom,mdss_dsi_nt35597_dsc_wqxga_cmd:cfg:dual_dsi"
+#define DSC_VID_PANEL_ADV7533_1080P_STRING "1:dsi:0:qcom,mdss_dsi_adv7533_1080p:1:qcom,mdss_dsi_nt35597_dsc_wqxga_video:cfg:dual_dsi"
 
 /*---------------------------------------------------------------------------*/
 /* GPIO configuration                                                        */
@@ -549,6 +553,26 @@
 		buf_size -= prefix_string_len;
 		pbuf += prefix_string_len;
 		strlcpy(pbuf, DSC_VID_PANEL_STRING, buf_size);
+	} else if (!strcmp(oem.panel, DSC_VID_PANEL_ADV7533_1080P)) {
+		if (buf_size < (prefix_string_len +
+			strlen(DSC_VID_PANEL_ADV7533_1080P_STRING))) {
+			dprintf(CRITICAL, "DSC command line argument is greater than buffer size\n");
+			return false;
+		}
+		strlcpy(pbuf, DISPLAY_CMDLINE_PREFIX, buf_size);
+		buf_size -= prefix_string_len;
+		pbuf += prefix_string_len;
+		strlcpy(pbuf, DSC_VID_PANEL_ADV7533_1080P_STRING, buf_size);
+	} else if (!strcmp(oem.panel, DSC_CMD_PANEL_ADV7533_1080P)) {
+		if (buf_size < (prefix_string_len +
+			strlen(DSC_CMD_PANEL_ADV7533_1080P_STRING))) {
+			dprintf(CRITICAL, "DSC command line argument is greater than buffer size\n");
+			return false;
+		}
+		strlcpy(pbuf, DISPLAY_CMDLINE_PREFIX, buf_size);
+		buf_size -= prefix_string_len;
+		pbuf += prefix_string_len;
+		strlcpy(pbuf, DSC_CMD_PANEL_ADV7533_1080P_STRING, buf_size);
 	} else {
 		ret = gcdb_display_cmdline_arg(pbuf, buf_size);
 	}
@@ -570,6 +594,8 @@
 		|| !strcmp(oem.panel, SIM_CMD_PANEL)
 		|| !strcmp(oem.panel, DSC_CMD_PANEL)
 		|| !strcmp(oem.panel, DSC_VID_PANEL)
+		|| !strcmp(oem.panel, DSC_CMD_PANEL_ADV7533_1080P)
+		|| !strcmp(oem.panel, DSC_VID_PANEL_ADV7533_1080P)
 		|| oem.skip) {
 		dprintf(INFO, "Selected panel: %s\nSkip panel configuration\n",
 			oem.panel);
diff --git a/target/msm8994/target_display.c b/target/msm8994/target_display.c
index 8b3b977..96754b7 100644
--- a/target/msm8994/target_display.c
+++ b/target/msm8994/target_display.c
@@ -421,8 +421,7 @@
 		goto clks_disable;
 	}
 
-	mdss_dsi_auto_pll_20nm_config(pinfo->mipi.pll_base,
-		pinfo->mipi.spll_base, pll_data);
+	mdss_dsi_auto_pll_20nm_config(pinfo);
 
 	if (!dsi_pll_20nm_enable_seq(pinfo->mipi.pll_base)) {
 		ret = ERROR;
diff --git a/target/msm8996/init.c b/target/msm8996/init.c
index a627874..e9e8eea 100644
--- a/target/msm8996/init.c
+++ b/target/msm8996/init.c
@@ -248,16 +248,6 @@
 	/* Initialize Glink */
 	rpm_glink_init();
 
-#if ENABLE_WBC
-	/* Look for battery voltage and make sure we have enough to bootup
-	 * Otherwise initiate battery charging
-	 * Charging should happen as early as possible, any other driver
-	 * initialization before this should consider the power impact
-	 */
-	if (board_hardware_id() == HW_PLATFORM_MTP)
-		pm_appsbl_chg_check_weak_battery_status(1);
-#endif
-
 	target_keystatus();
 
 	if (target_use_signed_kernel())
@@ -282,6 +272,16 @@
 	/* Storage initialization is complete, read the partition table info */
 	mmc_read_partition_table(0);
 
+#if ENABLE_WBC
+	/* Look for battery voltage and make sure we have enough to bootup
+	 * Otherwise initiate battery charging
+	 * Charging should happen as early as possible, any other driver
+	 * initialization before this should consider the power impact
+	 */
+	if (board_hardware_id() == HW_PLATFORM_MTP)
+		pm_appsbl_chg_check_weak_battery_status(1);
+#endif
+
 	if (rpmb_init() < 0)
 	{
 		dprintf(CRITICAL, "RPMB init failed\n");