platform: msm_shared: Flush the cache only for size of data

Emmc reads can happen for sizes less than 512 Bytes, after enabling
write back caches we need to make sure that we flush the exact size
of data after read operation is performed.

Change-Id: I8e6b664b23811157b5f9ff431a68b9254635b021
diff --git a/platform/msm_shared/sdhci.c b/platform/msm_shared/sdhci.c
index c898a81..54a82db 100644
--- a/platform/msm_shared/sdhci.c
+++ b/platform/msm_shared/sdhci.c
@@ -887,7 +887,14 @@
 
 	/* Invalidate the cache only for read operations */
 	if (cmd->trans_mode == SDHCI_MMC_READ)
-		arch_invalidate_cache_range((addr_t)cmd->data.data_ptr, (cmd->data.num_blocks * SDHCI_MMC_BLK_SZ));
+	{
+		/* Read can be performed on block size < SDHCI_MMC_BLK_SZ, make sure to flush
+		 * the data only for the read size instead
+		 */
+		arch_invalidate_cache_range((addr_t)cmd->data.data_ptr, (cmd->data.blk_sz) ? \
+									(cmd->data.num_blocks * cmd->data.blk_sz) : \
+									(cmd->data.num_blocks * SDHCI_MMC_BLK_SZ));
+	}
 
 	DBG("\n %s: END: cmd:%04d, arg:0x%08x, resp:0x%08x 0x%08x 0x%08x 0x%08x\n",
 				__func__, cmd->cmd_index, cmd->argument, cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3]);