Merge "project: msm8996: Enable glink support"
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 91585cb..6ee8802 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -732,12 +732,12 @@
 	if(boot_into_recovery)
 	{
 		ret = boot_verify_image((unsigned char *)bootimg_addr,
-				bootimg_size, "recovery");
+				bootimg_size, "/recovery");
 	}
 	else
 	{
 		ret = boot_verify_image((unsigned char *)bootimg_addr,
-				bootimg_size, "boot");
+				bootimg_size, "/boot");
 	}
 	boot_verify_print_state();
 #else
@@ -1581,6 +1581,8 @@
 #if USE_RPMB_FOR_DEVINFO
 		if (is_secure_boot_enable())
 			write_device_info_rpmb((void*) info, mmc_get_device_blocksize());
+		else
+			write_device_info_mmc(info);
 #else
 		write_device_info_mmc(info);
 #endif
@@ -1600,6 +1602,8 @@
 #if USE_RPMB_FOR_DEVINFO
 		if (is_secure_boot_enable())
 			read_device_info_rpmb((void*) info, mmc_get_device_blocksize());
+		else
+			read_device_info_mmc(info);
 #else
 		read_device_info_mmc(info);
 #endif
diff --git a/arch/arm/rules.mk b/arch/arm/rules.mk
index d822430..a4bf38c 100644
--- a/arch/arm/rules.mk
+++ b/arch/arm/rules.mk
@@ -132,22 +132,22 @@
 
 
 
-$(BUILDDIR)/trustzone-test-system-onesegment.ld: $(LOCAL_DIR)/trustzone-test-system-onesegment.ld
+$(BUILDDIR)/trustzone-test-system-onesegment.ld: $(LOCAL_DIR)/trustzone-test-system-onesegment.ld $(LK_TOP_DIR)/target/$(TARGET)/rules.mk
 	@echo generating $@
 	@$(MKDIR)
 	$(NOECHO)sed "s/%MEMBASE%/$(MEMBASE)/;s/%MEMSIZE%/$(MEMSIZE)/;s/%ROMLITE_PREFLASHED_DATA%/$(ROMLITE_PREFLASHED_DATA)/" < $< > $@
 
-$(BUILDDIR)/trustzone-system-onesegment.ld: $(LOCAL_DIR)/trustzone-system-onesegment.ld
+$(BUILDDIR)/trustzone-system-onesegment.ld: $(LOCAL_DIR)/trustzone-system-onesegment.ld $(LK_TOP_DIR)/target/$(TARGET)/rules.mk
 	@echo generating $@
 	@$(MKDIR)
 	$(NOECHO)sed "s/%MEMBASE%/$(MEMBASE)/;s/%MEMSIZE%/$(MEMSIZE)/" < $< > $@
 
-$(BUILDDIR)/system-onesegment.ld: $(LOCAL_DIR)/system-onesegment.ld
+$(BUILDDIR)/system-onesegment.ld: $(LOCAL_DIR)/system-onesegment.ld $(LK_TOP_DIR)/target/$(TARGET)/rules.mk
 	@echo generating $@
 	@$(MKDIR)
 	$(NOECHO)sed "s/%MEMBASE%/$(MEMBASE)/;s/%MEMSIZE%/$(MEMSIZE)/" < $< > $@
 
-$(BUILDDIR)/system-twosegment.ld: $(LOCAL_DIR)/system-twosegment.ld
+$(BUILDDIR)/system-twosegment.ld: $(LOCAL_DIR)/system-twosegment.ld $(LK_TOP_DIR)/target/$(TARGET)/rules.mk
 	@echo generating $@
 	@$(MKDIR)
 	$(NOECHO)sed "s/%ROMBASE%/$(ROMBASE)/;s/%MEMBASE%/$(MEMBASE)/;s/%MEMSIZE%/$(MEMSIZE)/" < $< > $@
diff --git a/dev/gcdb/display/gcdb_display.c b/dev/gcdb/display/gcdb_display.c
index 7862f9a..fafdae7 100755
--- a/dev/gcdb/display/gcdb_display.c
+++ b/dev/gcdb/display/gcdb_display.c
@@ -415,7 +415,7 @@
 
 	dsi_id_len = strlen(dsi_id);
 	panel_node_len = strlen(panel_node);
-	if (!slave_panel_node || slave_panel_node == 0x0)
+	if (!slave_panel_node || !strcmp(slave_panel_node, ""))
 		slave_panel_node = NO_PANEL_CONFIG;
 	slave_panel_node_len = strlen(slave_panel_node);
 
diff --git a/platform/msm8916/acpuclock.c b/platform/msm8916/acpuclock.c
index 663a6ce..fd365be 100644
--- a/platform/msm8916/acpuclock.c
+++ b/platform/msm8916/acpuclock.c
@@ -440,12 +440,17 @@
 
 	struct clk *qup_clk;
 
-	if((blsp_id != BLSP_ID_1) || (qup_id != QUP_ID_1)) {
+	if((blsp_id != BLSP_ID_1) || ((qup_id != QUP_ID_1) && (qup_id != QUP_ID_3))) {
 		dprintf(CRITICAL, "Incorrect BLSP-%d or QUP-%d configuration\n", blsp_id, qup_id);
 		ASSERT(0);
 	}
 
-	snprintf(clk_name, sizeof(clk_name), "blsp1_qup2_ahb_iface_clk");
+	if (qup_id == QUP_ID_1) {
+		snprintf(clk_name, sizeof(clk_name), "blsp1_qup2_ahb_iface_clk");
+	}
+	else if (qup_id == QUP_ID_3) {
+		snprintf(clk_name, sizeof(clk_name), "blsp1_qup4_ahb_iface_clk");
+	}
 
 	ret = clk_get_set_enable(clk_name, 0 , 1);
 
@@ -454,7 +459,12 @@
 		return;
 	}
 
-	snprintf(clk_name, sizeof(clk_name), "gcc_blsp1_qup2_i2c_apps_clk");
+	if (qup_id == QUP_ID_1) {
+		snprintf(clk_name, sizeof(clk_name), "gcc_blsp1_qup2_i2c_apps_clk");
+	}
+	else if (qup_id == QUP_ID_3) {
+		snprintf(clk_name, sizeof(clk_name), "gcc_blsp1_qup4_i2c_apps_clk");
+	}
 
 	qup_clk = clk_get(clk_name);
 
diff --git a/platform/msm8916/gpio.c b/platform/msm8916/gpio.c
index 2453b33..145b81c 100644
--- a/platform/msm8916/gpio.c
+++ b/platform/msm8916/gpio.c
@@ -81,6 +81,15 @@
 				gpio_tlmm_config(7, 3, GPIO_OUTPUT, GPIO_NO_PULL,
 					GPIO_8MA, GPIO_DISABLE);
 			break;
+			case QUP_ID_3:
+				/* configure I2C SDA gpio */
+				gpio_tlmm_config(14, 2, GPIO_OUTPUT, GPIO_NO_PULL,
+						GPIO_8MA, GPIO_DISABLE);
+
+				/* configure I2C SCL gpio */
+				gpio_tlmm_config(15, 2, GPIO_OUTPUT, GPIO_NO_PULL,
+					GPIO_8MA, GPIO_DISABLE);
+			break;
 			default:
 				dprintf(CRITICAL, "Incorrect QUP id %d\n",qup_id);
 				ASSERT(0);
diff --git a/platform/msm8916/include/platform/iomap.h b/platform/msm8916/include/platform/iomap.h
index 2d9197c..494f6cf 100644
--- a/platform/msm8916/include/platform/iomap.h
+++ b/platform/msm8916/include/platform/iomap.h
@@ -84,6 +84,11 @@
 #define TLMM_BASE_ADDR              0x1000000
 #define GPIO_CONFIG_ADDR(x)         (TLMM_BASE_ADDR + (x)*0x1000)
 #define GPIO_IN_OUT_ADDR(x)         (TLMM_BASE_ADDR + 0x00000004 + (x)*0x1000)
+#define GPIO_OUT_SET_ADDR(x)        (TLMM_BASE_ADDR + 0x200040 + (x/32)*0x04)
+#define GPIO_OUT_CLR_ADDR(x)        (TLMM_BASE_ADDR + 0x200020 + (x/32)*0x04)
+#define GPIO_OUT_VAL(x)             (1 << (x - (x/32)*32))
+#define GPIO_OUT_OE_SET_ADDR(x)     (TLMM_BASE_ADDR + 0x2000C0 + (x/32)*0x04)
+#define GPIO_OUT_OE_VAL(x)          (1 << (x - (x/32)*32))
 
 #define MPM2_MPM_CTRL_BASE          0x004A0000
 #define MPM2_MPM_PS_HOLD            0x004AB000
@@ -105,6 +110,10 @@
 #define GCC_BLSP1_QUP2_CFG_RCGR     (CLK_CTL_BASE + 0x3018)
 #define GCC_BLSP1_QUP2_CMD_RCGR     (CLK_CTL_BASE + 0x3014)
 
+#define GCC_BLSP1_QUP4_APPS_CBCR    (CLK_CTL_BASE + 0x5020)
+#define GCC_BLSP1_QUP4_CFG_RCGR     (CLK_CTL_BASE + 0x5004)
+#define GCC_BLSP1_QUP4_CMD_RCGR     (CLK_CTL_BASE + 0x5000)
+
 /* GPLL */
 #define GPLL0_STATUS                (CLK_CTL_BASE + 0x2101C)
 #define GPLL1_STATUS                (CLK_CTL_BASE + 0x2001C)
diff --git a/platform/msm8916/msm8916-clock.c b/platform/msm8916/msm8916-clock.c
index c2ec604..43df860 100644
--- a/platform/msm8916/msm8916-clock.c
+++ b/platform/msm8916/msm8916-clock.c
@@ -562,6 +562,31 @@
 		.ops      = &clk_ops_branch,
 	},
 };
+
+static struct rcg_clk gcc_blsp1_qup4_i2c_apps_clk_src =
+{
+	.cmd_reg      = (uint32_t *) GCC_BLSP1_QUP4_CMD_RCGR,
+	.cfg_reg      = (uint32_t *) GCC_BLSP1_QUP4_CFG_RCGR,
+	.set_rate     = clock_lib2_rcg_set_rate_hid,
+	.freq_tbl     = ftbl_gcc_blsp1_qup2_i2c_apps_clk_src,
+	.current_freq = &rcg_dummy_freq,
+
+	.c = {
+		.dbg_name = "gcc_blsp1_qup4_i2c_apps_clk_src",
+		.ops      = &clk_ops_rcg,
+	},
+};
+
+static struct branch_clk gcc_blsp1_qup4_i2c_apps_clk = {
+	.cbcr_reg = (uint32_t *) GCC_BLSP1_QUP4_APPS_CBCR,
+	.parent   = &gcc_blsp1_qup4_i2c_apps_clk_src.c,
+
+	.c = {
+		.dbg_name = "gcc_blsp1_qup4_i2c_apps_clk",
+		.ops      = &clk_ops_branch,
+	},
+};
+
 /* Clock lookup table */
 static struct clk_lookup msm_clocks_8916[] =
 {
@@ -593,6 +618,10 @@
 	CLK_LOOKUP("blsp1_qup2_ahb_iface_clk", gcc_blsp1_ahb_clk.c),
 	CLK_LOOKUP("gcc_blsp1_qup2_i2c_apps_clk_src", gcc_blsp1_qup2_i2c_apps_clk_src.c),
 	CLK_LOOKUP("gcc_blsp1_qup2_i2c_apps_clk", gcc_blsp1_qup2_i2c_apps_clk.c),
+
+	CLK_LOOKUP("blsp1_qup4_ahb_iface_clk", gcc_blsp1_ahb_clk.c),
+	CLK_LOOKUP("gcc_blsp1_qup4_i2c_apps_clk_src", gcc_blsp1_qup4_i2c_apps_clk_src.c),
+	CLK_LOOKUP("gcc_blsp1_qup4_i2c_apps_clk", gcc_blsp1_qup4_i2c_apps_clk.c),
 };
 
 void msm8939_clock_override()
diff --git a/platform/msm8952/acpuclock.c b/platform/msm8952/acpuclock.c
index f8045e8..bdd1d6d 100644
--- a/platform/msm8952/acpuclock.c
+++ b/platform/msm8952/acpuclock.c
@@ -48,7 +48,7 @@
 		ASSERT(0);
 	}
 
-	ret = clk_get_set_enable("usb_core_clk", 80000000, 1);
+	ret = clk_get_set_enable("usb_core_clk", 133330000, 1);
 	if(ret)
 	{
 		dprintf(CRITICAL, "failed to set usb_core_clk ret = %d\n", ret);
diff --git a/platform/msm8952/msm8952-clock.c b/platform/msm8952/msm8952-clock.c
index 9bbf9f1..b2f467a 100644
--- a/platform/msm8952/msm8952-clock.c
+++ b/platform/msm8952/msm8952-clock.c
@@ -136,7 +136,7 @@
 	F( 50000000,  gpll0,  16,   0,   0),
 	F(100000000,  gpll0,   8,   0,   0),
 	F(177770000,  gpll0, 4.5,   0,   0),
-	F(192000000,  gpll0,   6,   0,   0),
+	F(192000000,  gpll4,   6,   0,   0),
 	F(384000000,  gpll4,   3,   0,   0),
 	F_END
 };
diff --git a/platform/msm8994/platform.c b/platform/msm8994/platform.c
index eaaadc0..12b1039 100644
--- a/platform/msm8994/platform.c
+++ b/platform/msm8994/platform.c
@@ -39,6 +39,9 @@
 
 #define MSM_IOMAP_SIZE ((MSM_IOMAP_END - MSM_IOMAP_BASE)/MB)
 
+#define HLOS_MEMORY_START 0x0
+#define HLOS_MEMORY_SIZE  0x63
+
 /* LK memory - cacheable, write through */
 #define LK_MEMORY         (MMU_MEMORY_TYPE_NORMAL_WRITE_BACK_ALLOCATE | \
                            MMU_MEMORY_AP_READ_WRITE)
@@ -48,14 +51,17 @@
                            MMU_MEMORY_AP_READ_WRITE | MMU_MEMORY_XN)
 
 /* IMEM memory - cacheable, write through */
-#define IMEM_MEMORY       (MMU_MEMORY_TYPE_NORMAL_WRITE_THROUGH | \
+#define COMMON_MEMORY       (MMU_MEMORY_TYPE_NORMAL_WRITE_THROUGH | \
                            MMU_MEMORY_AP_READ_WRITE | MMU_MEMORY_XN)
 
 static mmu_section_t mmu_section_table[] = {
-/*       Physical addr,    Virtual addr,     Size (in MB),    Flags */
-	{    MEMBASE,          MEMBASE,          (MEMSIZE / MB),   LK_MEMORY},
-	{    MSM_IOMAP_BASE,   MSM_IOMAP_BASE,   MSM_IOMAP_SIZE,  IOMAP_MEMORY},
-	{    SYSTEM_IMEM_BASE, SYSTEM_IMEM_BASE, 1,              IMEM_MEMORY},
+/*       Physical addr,     Virtual addr,      Size (in MB),        Flags */
+	{    MEMBASE,           MEMBASE,           (MEMSIZE / MB),      LK_MEMORY},
+	{    MSM_IOMAP_BASE,    MSM_IOMAP_BASE,    MSM_IOMAP_SIZE,      IOMAP_MEMORY},
+	{    SYSTEM_IMEM_BASE,  SYSTEM_IMEM_BASE,  1,                   COMMON_MEMORY},
+	{    MSM_SHARED_BASE,   MSM_SHARED_BASE,   2,                   COMMON_MEMORY},
+	{    HLOS_MEMORY_START, HLOS_MEMORY_START, HLOS_MEMORY_SIZE,    COMMON_MEMORY},
+	{    SCRATCH_ADDR,      SCRATCH_ADDR,      (SCRATCH_SIZE / MB), COMMON_MEMORY},
 };
 
 void platform_early_init(void)
@@ -95,40 +101,7 @@
 {
 	uint32_t i;
 	uint32_t sections;
-	ram_partition ptn_entry;
 	uint32_t table_size = ARRAY_SIZE(mmu_section_table);
-	uint32_t len = 0;
-
-	ASSERT(smem_ram_ptable_init_v1());
-
-	len = smem_get_ram_ptable_len();
-
-	/* Configure the MMU page entries for SDRAM and IMEM memory read
-	   from the smem ram table*/
-	for(i = 0; i < len; i++)
-	{
-		smem_get_ram_ptable_entry(&ptn_entry, i);
-		if(ptn_entry.type == SYS_MEMORY)
-		{
-			if((ptn_entry.category == SDRAM) ||
-			   (ptn_entry.category == IMEM))
-			{
-				/* Check to ensure that start address is 1MB aligned */
-				ASSERT((ptn_entry.start & (MB-1)) == 0);
-
-				sections = (ptn_entry.size) / MB;
-				while(sections--)
-				{
-					arm_mmu_map_section(ptn_entry.start +
-										sections * MB,
-										ptn_entry.start +
-										sections * MB,
-										(MMU_MEMORY_TYPE_NORMAL_WRITE_BACK_ALLOCATE | \
-										 MMU_MEMORY_AP_READ_WRITE | MMU_MEMORY_XN));
-				}
-			}
-		}
-	}
 
 	/* Configure the MMU page entries for memory read from the
 	   mmu_section_table */
diff --git a/platform/msm_shared/boot_verifier.c b/platform/msm_shared/boot_verifier.c
index 0457ee3..4819eeb 100644
--- a/platform/msm_shared/boot_verifier.c
+++ b/platform/msm_shared/boot_verifier.c
@@ -60,6 +60,7 @@
 
 	ASN1_SEQUENCE(VERIFIED_BOOT_SIG) = {
 		ASN1_SIMPLE(VERIFIED_BOOT_SIG, version, ASN1_INTEGER),
+		ASN1_SIMPLE(VERIFIED_BOOT_SIG, certificate, X509),
 		ASN1_SIMPLE(VERIFIED_BOOT_SIG, algor, X509_ALGOR),
 		ASN1_SIMPLE(VERIFIED_BOOT_SIG, auth_attr, AUTH_ATTR),
 		ASN1_SIMPLE(VERIFIED_BOOT_SIG, sig, ASN1_OCTET_STRING)
@@ -229,7 +230,6 @@
 				"boot_verifier: verification failure due to target name mismatch\n");
 		goto verify_image_with_sig_error;
 	}
-
 	/* Read image size from signature */
 	/* A len = 0xAABBCC (represented by 3 octets) would be stored in
 	   len->data as 0X00CCBBAA and len->length as 3(octets).
diff --git a/platform/msm_shared/crc32.c b/platform/msm_shared/crc32.c
new file mode 100644
index 0000000..88c2dc0
--- /dev/null
+++ b/platform/msm_shared/crc32.c
@@ -0,0 +1,95 @@
+/* Copyright (c) 2015, 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
+ * met:
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *   * Neither the name of The Linux Foundation. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+#include <debug.h>
+
+static
+const uint32_t crc32_table[256] = {
+	0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
+	0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
+	0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
+	0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
+	0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
+	0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
+	0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
+	0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
+	0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
+	0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
+	0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
+	0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
+	0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
+	0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
+	0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
+	0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
+	0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
+	0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
+	0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
+	0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
+	0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
+	0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
+	0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
+	0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
+	0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
+	0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
+	0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
+	0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
+	0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
+	0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
+	0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
+	0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
+	0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
+	0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
+	0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
+	0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
+	0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
+	0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
+	0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
+	0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
+	0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
+	0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
+	0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
+	0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
+	0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
+	0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
+	0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
+	0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
+	0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
+	0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
+	0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
+	0x2d02ef8dL
+};
+
+uint32_t crc32(uint32_t crc, const void *buf, size_t size)
+{
+	const uint8_t *p = buf;
+
+	while (size--)
+		crc = crc32_table[(crc ^ *p++) & 0xff] ^ (crc >> 8);
+	return crc;
+}
diff --git a/platform/msm_shared/dme.c b/platform/msm_shared/dme.c
index e128453..47e94b0 100644
--- a/platform/msm_shared/dme.c
+++ b/platform/msm_shared/dme.c
@@ -38,6 +38,7 @@
 #include <uic.h>
 #include <utp.h>
 #include <ucs.h>
+#include <crc32.h>
 
 int dme_send_linkstartup_req(struct ufs_dev *dev)
 {
@@ -365,8 +366,7 @@
 static uint32_t dme_parse_serial_no(struct ufs_string_desc *desc)
 {
 	uint32_t serial_no=0;
-	uint16_t *ptr;
-	int index=0,len=0;
+	int len=0;
 
 	if(desc->desc_len <= 0)
 	{
@@ -374,14 +374,9 @@
 		return -UFS_FAILURE;
 	}
 
-	ptr = (uint16_t *) desc->serial_num;
 	len = (desc->desc_len-2)/2;
 
-	for(index=0; index<len; index++)
-	{
-		serial_no += *ptr;
-		ptr++;
-	}
+	serial_no = crc32(~0L, desc->serial_num, len);
 
 	return serial_no;
 }
diff --git a/platform/msm_shared/include/boot_verifier.h b/platform/msm_shared/include/boot_verifier.h
index 972086d..efe0c1b 100644
--- a/platform/msm_shared/include/boot_verifier.h
+++ b/platform/msm_shared/include/boot_verifier.h
@@ -59,6 +59,7 @@
 typedef struct verif_boot_sig_st
 {
 	ASN1_INTEGER *version;
+	X509 *certificate;
 	X509_ALGOR *algor;
 	AUTH_ATTR *auth_attr;
 	ASN1_OCTET_STRING *sig;
diff --git a/platform/msm_shared/include/crc32.h b/platform/msm_shared/include/crc32.h
new file mode 100644
index 0000000..51ab576
--- /dev/null
+++ b/platform/msm_shared/include/crc32.h
@@ -0,0 +1,30 @@
+/* Copyright (c) 2015, 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
+ * met:
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *   * Neither the name of The Linux Foundation. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* API to calculate CRC32 */
+uint32_t crc32(uint32_t crc, const void *buf, size_t size);
diff --git a/platform/msm_shared/include/oem_keystore.h b/platform/msm_shared/include/oem_keystore.h
old mode 100644
new mode 100755
index 39d5ae2..7f6e935
--- a/platform/msm_shared/include/oem_keystore.h
+++ b/platform/msm_shared/include/oem_keystore.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2015, 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
@@ -26,58 +26,145 @@
  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  */
-#ifndef _OEM_KEYSTORE_H
-#define _OEM_KEYSTORE_H
+
+#ifndef __OEM_KEYSTORE_H
+#define __OEM_KEYSTORE_H
 const unsigned char OEM_KEYSTORE[] = {
-  0x30, 0x82, 0x02, 0x4e, 0x02, 0x01, 0x00, 0x30, 0x82, 0x01, 0x1f, 0x30,
+  0x30, 0x82, 0x06, 0x4f, 0x02, 0x01, 0x00, 0x30, 0x82, 0x01, 0x1f, 0x30,
   0x82, 0x01, 0x1b, 0x30, 0x0b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
   0x0d, 0x01, 0x01, 0x0b, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01,
-  0x00, 0xd0, 0xc5, 0xd5, 0x6b, 0x1f, 0x64, 0x41, 0xd5, 0xe8, 0x39, 0xd7,
-  0xbf, 0xe0, 0x06, 0x62, 0xf3, 0x5b, 0x50, 0xec, 0xd7, 0x44, 0x46, 0xe9,
-  0xcb, 0x4d, 0x64, 0xc8, 0x71, 0xa6, 0x93, 0x0e, 0x2e, 0x71, 0x19, 0x56,
-  0x22, 0x86, 0xbf, 0x55, 0x4d, 0x46, 0x1c, 0x6a, 0x2b, 0xf2, 0x4a, 0x4e,
-  0xfd, 0x94, 0xba, 0x38, 0x19, 0xf7, 0x84, 0x89, 0x70, 0x3b, 0x9b, 0x1b,
-  0xe0, 0xf0, 0x03, 0x06, 0x86, 0x64, 0xa4, 0x2a, 0x0d, 0x85, 0x1a, 0xd1,
-  0x55, 0x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  0x66, 0xc7, 0x92, 0x32, 0x9b, 0x02, 0x03, 0x01, 0x00, 0x01, 0x30, 0x82,
-  0x01, 0x24, 0x02, 0x01, 0x00, 0x30, 0x0b, 0x06, 0x09, 0x2a, 0x86, 0x48,
-  0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x30, 0x0e, 0x13, 0x08, 0x6b, 0x65,
-  0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x02, 0x02, 0x01, 0x2a, 0x04, 0x82,
-  0x01, 0x00, 0x86, 0xae, 0xa7, 0xb2, 0xa3, 0x13, 0xd4, 0x6e, 0x38, 0xde,
-  0x0b, 0x26, 0x9a, 0x17, 0x4a, 0xda, 0x55, 0x11, 0x8a, 0xeb, 0x4c, 0xc4,
-  0xeb, 0xcf, 0x17, 0xf0, 0x94, 0x3d, 0x5e, 0x26, 0x7c, 0xf2, 0xce, 0x66,
-  0x05, 0x6d, 0xdf, 0xad, 0x4c, 0x90, 0xbc, 0x39, 0xf4, 0x0c, 0x61, 0x31,
-  0xe9, 0xa7, 0x4c, 0x51, 0x2c, 0x6c, 0x47, 0x98, 0x97, 0xbe, 0xe2, 0x78,
-  0xb8, 0x46, 0x97, 0x35, 0x2f, 0xbb, 0x1a, 0xa5, 0x99, 0x97, 0x20, 0x96,
-  0x35, 0x2c, 0xf9, 0xd7, 0x94, 0x84, 0x56, 0x3b, 0xc4, 0xe1, 0x45, 0x6d,
-  0x09, 0x79, 0x2d, 0x0d, 0x9b, 0x46, 0x27, 0x23, 0xb7, 0xcb, 0xb5, 0x6b,
-  0x44, 0x29, 0x0f, 0xd5, 0x38, 0x54, 0x58, 0x20, 0x9e, 0xbe, 0xc6, 0x06,
-  0x9b, 0x3f, 0xe0, 0xea, 0xd5, 0xae, 0x50, 0x64, 0xfb, 0xc2, 0x82, 0xca,
-  0xf5, 0x43, 0x70, 0x91, 0x41, 0xc5, 0x47, 0x36, 0x03, 0xf0, 0xba, 0x08,
-  0x5e, 0xd4, 0xf2,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x86, 0xa7, 0x6e, 0x98, 0x1e,
+  0x4f, 0x93, 0x7b, 0x40, 0xbe, 0xae, 0xba, 0xa7, 0x06, 0xa6, 0x84, 0xce,
+  0x91, 0xa9, 0x6e, 0xea, 0x49, 0x02, 0x03, 0x01, 0x00, 0x01, 0x30, 0x82,
+  0x05, 0x25, 0x02, 0x01, 0x01, 0x30, 0x82, 0x03, 0xfd, 0x30, 0x82, 0x02,
+  0xe5, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0x97, 0x0f, 0x98,
+  0x39, 0x09, 0xaa, 0x89, 0x49, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48,
+  0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x81, 0x94, 0x31,
+  0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53,
+  0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, 0x0a, 0x43,
+  0x61, 0x6c, 0x69, 0x66, 0x6f, 0x72, 0x6e, 0x69, 0x61, 0x31, 0x16, 0x30,
+  0x14, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0c, 0x0d, 0x4d, 0x6f, 0x75, 0x6e,
+  0x74, 0x61, 0x69, 0x6e, 0x20, 0x56, 0x69, 0x65, 0x77, 0x31, 0x10, 0x30,
+  0x0e, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x07, 0x41, 0x6e, 0x64, 0x72,
+  0x6f, 0x69, 0x64, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x0b,
+  0x0c, 0x07, 0x41, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x31, 0x10, 0x30,
+  0x0e, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x07, 0x41, 0x6e, 0x64, 0x72,
+  0x6f, 0x69, 0x64, 0x31, 0x22, 0x30, 0x20, 0x06, 0x09, 0x2a, 0x86, 0x48,
+  0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, 0x13, 0x61, 0x6e, 0x64, 0x72,
+  0x6f, 0x69, 0x64, 0x40, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2e,
+  0x63, 0x6f, 0x6d, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x34, 0x31, 0x31, 0x30,
+  0x36, 0x31, 0x39, 0x30, 0x37, 0x34, 0x30, 0x5a, 0x17, 0x0d, 0x34, 0x32,
+  0x30, 0x33, 0x32, 0x34, 0x31, 0x39, 0x30, 0x37, 0x34, 0x30, 0x5a, 0x30,
+  0x81, 0x94, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
+  0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08,
+  0x0c, 0x0a, 0x43, 0x61, 0x6c, 0x69, 0x66, 0x6f, 0x72, 0x6e, 0x69, 0x61,
+  0x31, 0x16, 0x30, 0x14, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0c, 0x0d, 0x4d,
+  0x6f, 0x75, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x56, 0x69, 0x65, 0x77,
+  0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x07, 0x41,
+  0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03,
+  0x55, 0x04, 0x0b, 0x0c, 0x07, 0x41, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64,
+  0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x07, 0x41,
+  0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x31, 0x22, 0x30, 0x20, 0x06, 0x09,
+  0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, 0x13, 0x61,
+  0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x40, 0x61, 0x6e, 0x64, 0x72, 0x6f,
+  0x69, 0x64, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d,
+  0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05,
+  0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82,
+  0x01, 0x01, 0x00, 0xe8, 0xeb, 0x78, 0x4d, 0x2f, 0x4d, 0x54, 0x91, 0x7a,
+  0x7b, 0xb3, 0x3b, 0xdb, 0xe7, 0x69, 0x67, 0xe4, 0xd1, 0xe4, 0x33, 0x61,
+  0xa6, 0xf4, 0x82, 0xaa, 0x62, 0xeb, 0x10, 0x33, 0x8b, 0xa7, 0x66, 0x0f,
+  0xeb, 0xa0, 0xa0, 0x42, 0x89, 0x99, 0xb3, 0xe2, 0xb8, 0x4e, 0x43, 0xc1,
+  0xfd, 0xb5, 0x8a, 0xc6, 0x7d, 0xba, 0x15, 0x14, 0xbb, 0x47, 0x50, 0x33,
+  0x8e, 0x9d, 0x2b, 0x8a, 0x1c, 0x2b, 0x13, 0x11, 0xad, 0xc9, 0xe6, 0x1b,
+  0x1c, 0x9d, 0x16, 0x7e, 0xa8, 0x7e, 0xcd, 0xce, 0x0c, 0x93, 0x17, 0x3a,
+  0x4b, 0xf6, 0x80, 0xa5, 0xcb, 0xfc, 0x57, 0x5b, 0x10, 0xf7, 0x43, 0x6f,
+  0x1c, 0xdd, 0xbb, 0xcc, 0xf7, 0xca, 0x4f, 0x96, 0xeb, 0xbb, 0x9d, 0x33,
+  0xf7, 0xd6, 0xed, 0x66, 0xda, 0x43, 0x70, 0xce, 0xd2, 0x49, 0xee, 0xfa,
+  0x2c, 0xca, 0x6a, 0x4f, 0xf7, 0x4f, 0x8d, 0x5c, 0xe6, 0xea, 0x17, 0x99,
+  0x0f, 0x35, 0x50, 0xdb, 0x40, 0xcd, 0x11, 0xb3, 0x19, 0xc8, 0x4d, 0x55,
+  0x73, 0x26, 0x5a, 0xe4, 0xc6, 0x3a, 0x48, 0x3a, 0x53, 0xed, 0x08, 0xd9,
+  0x37, 0x7b, 0x2b, 0xcc, 0xaf, 0x50, 0xc5, 0xa1, 0x01, 0x63, 0xcf, 0xa4,
+  0xa2, 0xed, 0x54, 0x7f, 0x6b, 0x00, 0xbe, 0x53, 0xce, 0x36, 0x0d, 0x47,
+  0xdd, 0xa2, 0xcd, 0xd2, 0x9c, 0xcf, 0x70, 0x23, 0x46, 0xc2, 0x37, 0x09,
+  0x38, 0xed, 0xa6, 0x25, 0x40, 0x04, 0x67, 0x97, 0xd1, 0x37, 0x23, 0x45,
+  0x2b, 0x99, 0x07, 0xb2, 0xbd, 0x10, 0xae, 0x7a, 0x1d, 0x5f, 0x8e, 0x14,
+  0xd4, 0xba, 0x23, 0x53, 0x4f, 0x8d, 0xd0, 0xfb, 0x14, 0x84, 0xa1, 0xc8,
+  0x69, 0x6a, 0xa9, 0x97, 0x54, 0x3a, 0x40, 0x14, 0x65, 0x86, 0xa7, 0x6e,
+  0x98, 0x1e, 0x4f, 0x93, 0x7b, 0x40, 0xbe, 0xae, 0xba, 0xa7, 0x06, 0xa6,
+  0x84, 0xce, 0x91, 0xa9, 0x6e, 0xea, 0x49, 0x02, 0x03, 0x01, 0x00, 0x01,
+  0xa3, 0x50, 0x30, 0x4e, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04,
+  0x16, 0x04, 0x14, 0x7e, 0x43, 0x33, 0xf9, 0xbb, 0xa0, 0x0a, 0xdf, 0xe0,
+  0xed, 0xe9, 0x79, 0xe2, 0x8e, 0xd1, 0x92, 0x04, 0x92, 0xb4, 0x0f, 0x30,
+  0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14,
+  0x7e, 0x43, 0x33, 0xf9, 0xbb, 0xa0, 0x0a, 0xdf, 0xe0, 0xed, 0xe9, 0x79,
+  0xe2, 0x8e, 0xd1, 0x92, 0x04, 0x92, 0xb4, 0x0f, 0x30, 0x0c, 0x06, 0x03,
+  0x55, 0x1d, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x0d,
+  0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05,
+  0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x73, 0xb7, 0x35, 0x2b, 0xc3, 0x13,
+  0x98, 0xc5, 0xbc, 0xc7, 0xa1, 0x18, 0x6b, 0x52, 0xf0, 0x19, 0xc5, 0x61,
+  0xd1, 0x4a, 0x44, 0x88, 0x25, 0x0c, 0xc7, 0x38, 0x9e, 0x25, 0x92, 0xce,
+  0x1c, 0xce, 0x55, 0x84, 0x47, 0xe1, 0x66, 0xa3, 0xc5, 0xdb, 0x41, 0x59,
+  0xce, 0x5f, 0xc7, 0x48, 0xb1, 0x34, 0x5f, 0xfe, 0x85, 0x52, 0x95, 0x84,
+  0xfe, 0x80, 0x20, 0xe4, 0x1a, 0xfb, 0xef, 0xac, 0x93, 0xe1, 0xc8, 0x8b,
+  0xb4, 0x6f, 0x8a, 0x83, 0xcf, 0x6e, 0x18, 0xdc, 0xb1, 0x59, 0x59, 0x7b,
+  0xb7, 0x14, 0x10, 0x6a, 0xcb, 0x49, 0x2b, 0xde, 0x1a, 0x8b, 0x90, 0xc9,
+  0xcf, 0xa3, 0xd3, 0xe9, 0xba, 0x24, 0x5f, 0x38, 0x92, 0xcc, 0xc8, 0x97,
+  0x91, 0x86, 0x34, 0xc4, 0xe7, 0xc7, 0x45, 0xd1, 0x3c, 0xef, 0xa0, 0xf2,
+  0xde, 0xa1, 0xe4, 0xb5, 0x9f, 0x9d, 0x5c, 0x9d, 0x81, 0x97, 0xe9, 0x19,
+  0x14, 0x60, 0xf9, 0x61, 0xde, 0xc2, 0x4d, 0x54, 0xd8, 0x79, 0x6f, 0x4e,
+  0x32, 0x1c, 0x79, 0xbd, 0x0d, 0x75, 0xca, 0x09, 0xf1, 0x62, 0x89, 0x00,
+  0x55, 0x9d, 0x72, 0xe1, 0x3b, 0x54, 0x89, 0xb8, 0xc3, 0xeb, 0xc5, 0xfc,
+  0x36, 0x17, 0xfc, 0x0d, 0x8e, 0xcb, 0x3a, 0xf6, 0xf9, 0x04, 0x61, 0x99,
+  0x84, 0xaf, 0xd5, 0xcb, 0xac, 0x80, 0x07, 0x82, 0xd6, 0xdb, 0xc7, 0xe1,
+  0xaa, 0x7e, 0x27, 0x52, 0xe0, 0x52, 0x73, 0xae, 0xe4, 0xa8, 0x7f, 0x16,
+  0xa3, 0xcb, 0x2d, 0x2c, 0x0d, 0x55, 0x0a, 0x78, 0x06, 0xee, 0xdb, 0xf5,
+  0x01, 0x5f, 0xa8, 0xaf, 0x0c, 0xa2, 0x3f, 0x38, 0x6e, 0x3f, 0x3c, 0x36,
+  0xa4, 0x46, 0x66, 0x00, 0xf2, 0xab, 0x3b, 0x93, 0xac, 0x5c, 0x67, 0xe8,
+  0x55, 0xbb, 0x76, 0x6c, 0x80, 0xca, 0xdb, 0x6e, 0x00, 0x90, 0x04, 0x03,
+  0x29, 0xa4, 0xd6, 0x68, 0xa9, 0x77, 0xdf, 0xb3, 0xa7, 0x7f, 0x30, 0x0b,
+  0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x30,
+  0x0e, 0x13, 0x08, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x02,
+  0x02, 0x01, 0x2a, 0x04, 0x82, 0x01, 0x00, 0x4d, 0xc0, 0xf7, 0xf4, 0x94,
+  0xa8, 0x2a, 0x78, 0x27, 0x28, 0xaa, 0x11, 0x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x95, 0x4f, 0xea, 0xc6, 0x90, 0xfe, 0x04, 0xef, 0x3e,
+  0x93, 0x3f, 0x8f, 0xea, 0xa7, 0x3b, 0xbd, 0x92, 0x63, 0xc6, 0xfd, 0xe0,
+  0xbf, 0x62, 0xad, 0x51, 0xee, 0x62, 0x16, 0x29, 0xe1, 0x97, 0xf9, 0xaf,
+  0xbe, 0xb9, 0xa7, 0x31, 0x3e, 0xfc, 0x0a, 0x92, 0x8b, 0xa7, 0x72, 0x15,
+  0xb2, 0xa9, 0xb0, 0x5c, 0xf0, 0x2e, 0x0b, 0xb3, 0xaf, 0x6e, 0x59, 0x95,
+  0xae, 0xaa, 0x10, 0x09, 0x68, 0x0d, 0x0b, 0x64, 0x02, 0x51, 0x26
 };
+
 #endif
diff --git a/platform/msm_shared/rules.mk b/platform/msm_shared/rules.mk
index 1b8c4b6..22427ac 100644
--- a/platform/msm_shared/rules.mk
+++ b/platform/msm_shared/rules.mk
@@ -15,7 +15,8 @@
 	$(LOCAL_DIR)/partition_parser.o \
 	$(LOCAL_DIR)/hsusb.o \
 	$(LOCAL_DIR)/boot_stats.o \
-	$(LOCAL_DIR)/qgic_common.o
+	$(LOCAL_DIR)/qgic_common.o \
+	$(LOCAL_DIR)/crc32.o
 
 ifeq ($(ENABLE_QGIC3), 1)
 OBJS += $(LOCAL_DIR)/qgic_v3.o
diff --git a/platform/msm_shared/smem.h b/platform/msm_shared/smem.h
index fab80bb..24a206b 100644
--- a/platform/msm_shared/smem.h
+++ b/platform/msm_shared/smem.h
@@ -407,9 +407,12 @@
 	MSM8629  = 269,
 	MSM8229  = 270,
 	APQ8029  = 271,
+	APQ8056  = 274,
 	MSM8609  = 275,
 	FSM9916  = 276,
+	APQ8076  = 277,
 	MSM8976  = 278,
+	APQ8052  = 289,
 };
 
 enum platform {
diff --git a/target/msm8952/init.c b/target/msm8952/init.c
index 1abc52e..3567f5a 100644
--- a/target/msm8952/init.c
+++ b/target/msm8952/init.c
@@ -66,6 +66,7 @@
 #define TLMM_VOL_UP_BTN_GPIO    85
 
 #define FASTBOOT_MODE           0x77665500
+#define RECOVERY_MODE           0x77665502
 #define PON_SOFT_RB_SPARE       0x88F
 
 #define CE1_INSTANCE            1
@@ -134,7 +135,7 @@
 	/* Try slot 1*/
 	config.slot          = 1;
 	config.bus_width     = DATA_BUS_WIDTH_8BIT;
-	config.max_clk_rate  = MMC_CLK_177MHZ;
+	config.max_clk_rate  = MMC_CLK_192MHZ;
 	config.sdhc_base     = mmc_sdhci_base[config.slot - 1];
 	config.pwrctl_base   = mmc_pwrctl_base[config.slot - 1];
 	config.pwr_irq       = mmc_sdc_pwrctl_irq[config.slot - 1];
@@ -274,6 +275,11 @@
 	case MSM8976:
 		board->baseband = BASEBAND_MSM;
 		break;
+	case APQ8052:
+	case APQ8056:
+	case APQ8076:
+		board->baseband = BASEBAND_APQ;
+		break;
 	default:
 		dprintf(CRITICAL, "Platform type: %u is not supported\n",platform);
 		ASSERT(0);
@@ -342,7 +348,7 @@
 	/* For Reboot-bootloader and Dload cases do a warm reset
 	 * For Reboot cases do a hard reset
 	 */
-	if((reboot_reason == FASTBOOT_MODE) || (reboot_reason == DLOAD))
+	if((reboot_reason == FASTBOOT_MODE) || (reboot_reason == DLOAD) || (reboot_reason == RECOVERY_MODE))
 		reset_type = PON_PSHOLD_WARM_RESET;
 	else
 		reset_type = PON_PSHOLD_HARD_RESET;
diff --git a/target/msm8994/meminfo.c b/target/msm8994/meminfo.c
index cb8c726..b0eec92 100644
--- a/target/msm8994/meminfo.c
+++ b/target/msm8994/meminfo.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-2015, 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
@@ -84,5 +84,5 @@
 
 unsigned target_get_max_flash_size(void)
 {
-	return (512 * 1024 * 1024);
+	return SCRATCH_SIZE;
 }
diff --git a/target/msm8994/rules.mk b/target/msm8994/rules.mk
index 9c02201..16fd384 100644
--- a/target/msm8994/rules.mk
+++ b/target/msm8994/rules.mk
@@ -12,6 +12,8 @@
 
 SCRATCH_ADDR := 0x10000000
 
+SCRATCH_SIZE := 0x20000000
+
 DEFINES += DISPLAY_SPLASH_SCREEN=1
 DEFINES += DISPLAY_TYPE_MIPI=1
 DEFINES += DISPLAY_TYPE_DSI6G=1
@@ -34,7 +36,8 @@
 	TAGS_ADDR=$(TAGS_ADDR) \
 	KERNEL_ADDR=$(KERNEL_ADDR) \
 	RAMDISK_ADDR=$(RAMDISK_ADDR) \
-	SCRATCH_ADDR=$(SCRATCH_ADDR)
+	SCRATCH_ADDR=$(SCRATCH_ADDR) \
+	SCRATCH_SIZE=$(SCRATCH_SIZE)
 
 
 OBJS += \