summaryrefslogtreecommitdiffstats
path: root/bsp/meta-altera/recipes-bsp/u-boot/files/v2019.07/0007-mmc-dwmmc-Enable-small-delay-before-returning-error.patch
blob: 8da5892c7b73868b339ace95ab535dc6641b039e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
From 17366d3b46cf70a8fa4d807519790ef4b1b03772 Mon Sep 17 00:00:00 2001
From: "Ang, Chee Hong" <chee.hong.ang@intel.com>
Date: Wed, 30 Jan 2019 21:47:36 -0800
Subject: [PATCH 07/12] mmc: dwmmc: Enable small delay before returning error

'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 1992d61182..8b9c6a8e60 100644
--- a/drivers/mmc/dw_mmc.c
+++ b/drivers/mmc/dw_mmc.c
@@ -294,8 +294,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;
@@ -344,11 +347,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;
 	}
 
 
@@ -387,6 +392,7 @@ static int dwmci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
 		}
 	}
 
+delay_ret:
 	udelay(100);
 
 	return ret;
-- 
2.21.0