platform: msm_shared: Retry on data timeout error

As per SDHC spec data timeout & data complete can be set together.
For some controllers its observed that data timeout is set on issuing
erase command and after sometime when the actual erase happens data
complete interrupt is set. If data timeout is set, retry and look
for the controller to set data complete interrupt.
And also correct the interger overflow in erase_timeout calculation.

Change-Id: Id82f37c5b25f632793a5e56e7a1932d86d0581e6
diff --git a/platform/msm_shared/sdhci.c b/platform/msm_shared/sdhci.c
index bfab9f1..f114b47 100644
--- a/platform/msm_shared/sdhci.c
+++ b/platform/msm_shared/sdhci.c
@@ -441,7 +441,13 @@
 
 		if (int_status  & SDHCI_INT_STS_CMD_COMPLETE)
 			break;
-		else if (int_status & SDHCI_ERR_INT_STAT_MASK && !host->tuning_in_progress)
+		/*
+		* Some controllers set the data timout first on issuing an erase & take time
+		* to set data complete interrupt. We need to wait hoping the controller would
+		* set data complete
+		*/
+		else if (int_status & SDHCI_ERR_INT_STAT_MASK && !host->tuning_in_progress &&
+				!((REG_READ16(host, SDHCI_ERR_INT_STS_REG) & SDHCI_DAT_TIMEOUT_MASK)))
 			goto err;
 
 		/*