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.

Change-Id: Iec24f8238d91520bbe9504bb98b2892f31b2280e
diff --git a/platform/msm_shared/sdhci.c b/platform/msm_shared/sdhci.c
index 5ffbb88..c898a81 100644
--- a/platform/msm_shared/sdhci.c
+++ b/platform/msm_shared/sdhci.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
@@ -504,7 +504,13 @@
 				trans_complete = 1;
 				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;
 
 			/*