public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v1] mmc: dwmmc: Enable small delay before returning error
@ 2019-02-18  4:16 chee.hong.ang at intel.com
  2019-02-18 11:57 ` Marek Vasut
  0 siblings, 1 reply; 10+ messages in thread
From: chee.hong.ang at intel.com @ 2019-02-18  4:16 UTC (permalink / raw)
  To: u-boot

From: "Ang, Chee Hong" <chee.hong.ang@intel.com>

'SET_BLOCKLEN' may occasionally fail on first attempt.
This patch enable a small delay in dwmci_send_cmd() on
busy, I/O or CRC error to allow the MMC controller recovers
from the failure/error on subsequent retries.

Signed-off-by: Ang, Chee Hong <chee.hong.ang@intel.com>
---
 drivers/mmc/dw_mmc.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
index 7544b84..8dcc518 100644
--- a/drivers/mmc/dw_mmc.c
+++ b/drivers/mmc/dw_mmc.c
@@ -266,8 +266,11 @@ static int dwmci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
 	if (data)
 		flags = dwmci_set_transfer_mode(host, data);
 
-	if ((cmd->resp_type & MMC_RSP_136) && (cmd->resp_type & MMC_RSP_BUSY))
-		return -1;
+	if ((cmd->resp_type & MMC_RSP_136) &&
+	    (cmd->resp_type & MMC_RSP_BUSY)) {
+		ret = -1;
+		goto delay_ret;
+	}
 
 	if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION)
 		flags |= DWMCI_CMD_ABORT_STOP;
@@ -316,11 +319,13 @@ static int dwmci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
 		return -ETIMEDOUT;
 	} else if (mask & DWMCI_INTMSK_RE) {
 		debug("%s: Response Error.\n", __func__);
-		return -EIO;
+		ret = -EIO;
+		goto delay_ret;
 	} else if ((cmd->resp_type & MMC_RSP_CRC) &&
 		   (mask & DWMCI_INTMSK_RCRC)) {
 		debug("%s: Response CRC Error.\n", __func__);
-		return -EIO;
+		ret = -EIO;
+		goto delay_ret;
 	}
 
 
@@ -347,6 +352,7 @@ static int dwmci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
 		}
 	}
 
+delay_ret:
 	udelay(100);
 
 	return ret;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-03-05 10:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-18  4:16 [U-Boot] [PATCH v1] mmc: dwmmc: Enable small delay before returning error chee.hong.ang at intel.com
2019-02-18 11:57 ` Marek Vasut
2019-02-18 14:51   ` Ang, Chee Hong
2019-02-18 20:38     ` Marek Vasut
2019-02-20 13:57       ` Ang, Chee Hong
2019-02-21 10:06         ` Marek Vasut
2019-02-22 15:19           ` Ang, Chee Hong
2019-02-22 16:02             ` Marek Vasut
2019-03-05  7:10               ` Ang, Chee Hong
2019-03-05 10:52                 ` Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox