Merge "lk: msm: image_verify: Save boot hash regardless of signature decryption"
diff --git a/platform/msm8610/include/platform/iomap.h b/platform/msm8610/include/platform/iomap.h
index b9b28f9..ce0eb26 100644
--- a/platform/msm8610/include/platform/iomap.h
+++ b/platform/msm8610/include/platform/iomap.h
@@ -195,7 +195,7 @@
 #define INT_CTRL                    0x10C
 #define CMD_MODE_DMA_SW_TRIGGER     0x08C
 
-#define EOT_PACKET_CTRL             0x0CC
+#define EOT_PACKET_CTRL             0x0C8
 #define MISR_CMD_CTRL               0x09C
 #define MISR_VIDEO_CTRL             0x0A0
 #define VIDEO_MODE_CTRL             0x00C
diff --git a/platform/msm_shared/mipi_dsi.c b/platform/msm_shared/mipi_dsi.c
index d67061f..18bb1c4 100644
--- a/platform/msm_shared/mipi_dsi.c
+++ b/platform/msm_shared/mipi_dsi.c
@@ -1209,8 +1209,8 @@
 	       ctl_base + CTRL);
 	writel(0x10000000, ctl_base + COMMAND_MODE_DMA_CTRL);
 	writel(0x10000000, ctl_base + MISR_CMD_CTRL);
+	writel(0x1, ctl_base + EOT_PACKET_CTRL);
 #endif
-
 	return 0;
 }
 
diff --git a/platform/msm_shared/mmc_wrapper.c b/platform/msm_shared/mmc_wrapper.c
index 29eeaee..d9c9ff2 100644
--- a/platform/msm_shared/mmc_wrapper.c
+++ b/platform/msm_shared/mmc_wrapper.c
@@ -275,32 +275,31 @@
 static uint32_t mmc_zero_out(struct mmc_device* dev, uint32_t blk_addr, uint32_t num_blks)
 {
 	uint32_t *out;
-	uint32_t block_size;
-	int i;
+	uint32_t block_size = mmc_get_device_blocksize();
+	uint32_t erase_size = (block_size * num_blks);
+	uint32_t scratch_size = target_get_max_flash_size();
 
 	dprintf(INFO, "erasing 0x%x:0x%x\n", blk_addr, num_blks);
-	block_size = mmc_get_device_blocksize();
 
-	/* Assume there are at least block_size bytes available in the heap */
-	out = memalign(CACHE_LINE, ROUNDUP(block_size, CACHE_LINE));
-
-	if (!out)
+	if (erase_size <= scratch_size)
 	{
-		dprintf(CRITICAL, "Error allocating memory\n");
+		/* Use scratch address if the unaligned blocks */
+		out = (uint32_t *) target_get_scratch_address();
+	}
+	else
+	{
+		dprintf(CRITICAL, "Erase Fail: Erase size: %u is bigger than scratch region:%u\n", scratch_size);
 		return 1;
 	}
-	memset((void *)out, 0, ROUNDUP(block_size, CACHE_LINE));
 
-	for (i = 0; i < num_blks; i++)
+	memset((void *)out, 0, erase_size);
+
+	if (mmc_sdhci_write(dev, out, blk_addr, num_blks))
 	{
-		if (mmc_sdhci_write(dev, out, blk_addr + i, 1))
-		{
-			dprintf(CRITICAL, "failed to erase the partition: %x\n", blk_addr);
-			free(out);
-			return 1;
-		}
+		dprintf(CRITICAL, "failed to erase the partition: %x\n", blk_addr);
+		return 1;
 	}
-	free(out);
+
 	return 0;
 }