Skip to contentSkip to conversation

mmc: {tmio,renesas_sdhi}: retune if SCC error detected

PATCH Superseded Niklas Söderlund 2 participants 5 messages Aug 6, 2018

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover mmc: {tmio,renesas_sdhi}: retune if SCC error detected

Hi,

These patches triggers a retune if a SCC error is detected. They where ported from the renesas BSP. Masaharu-san did all the real work I just ported them to upstream and did small fixups.

These patches where broken out of my retuning series as more work where needed to adapt them to the recent HS400 series picked-up. It's tested on M3-N using both HS200 and HS400 and on H3 ES2.0 using HS200

Masaharu Hayakawa (2):
mmc: renesas_sdhi: skip SCC error check when retuning
mmc: tmio: Fix SCC error detection

 drivers/mmc/host/renesas_sdhi_core.c | 9 +++++++++
 drivers/mmc/host/tmio_mmc_core.c     | 4 ++--
 2 files changed, 11 insertions(+), 2 deletions(-)
Signature · 1 line
2.18.0
#1 lore raw

PATCH v2 1/2 mmc: renesas_sdhi: skip SCC error check when retuning

From: Masaharu Hayakawa <[email protected]>

Checking for SCC error during retuning is unnecessary.

[Niklas: fix small style issue]

---

* Changes since v1
- Use intermediate variable use_4tap to simplify check.

---
 drivers/mmc/host/renesas_sdhi_core.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/mmc/host/renesas_sdhi_core.c +9 -0
index 777e32b0e410e850..66e90f233cefcba5 100644
@@ -443,6 +443,15 @@ static int renesas_sdhi_select_tuning(struct tmio_mmc_host *host)
 static bool renesas_sdhi_check_scc_error(struct tmio_mmc_host *host)
 {
 	struct renesas_sdhi *priv = host_to_priv(host);
+	bool use_4tap = host->pdata->flags & TMIO_MMC_HAVE_4TAP_HS400;
+
+	if (!(host->mmc->ios.timing == MMC_TIMING_UHS_SDR104) &&
+	    !(host->mmc->ios.timing == MMC_TIMING_MMC_HS200) &&
+	    !(host->mmc->ios.timing == MMC_TIMING_MMC_HS400 && !use_4tap))
+		return false;
+
+	if (host->mmc->doing_retune)
+		return false;
 
 	/* Check SCC error */
 	if (sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL) &
Signature · 1 line
2.18.0
#2 lore raw

Re: [PATCH v2 1/2] mmc: renesas_sdhi: skip SCC error check when retuning

drivers/mmc/host/renesas_sdhi_core.c static int renesas_sdhi_select_tuning(struct tmio_mmc_host *host) · line 450

Quoted 2 lines
drivers/mmc/host/renesas_sdhi_core.c +1 -0
+	    !(host->mmc->ios.timing == MMC_TIMING_MMC_HS400 && !use_4tap))

I know this comes from the BSP but I cannot find any documentation why ignoring SCC errors is different depending on using 4/8 taps.

I'll try to get more internal information...

#3 lore raw

PATCH v2 2/2 mmc: tmio: Fix SCC error detection

In reply to Niklas Söderlund

From: Masaharu Hayakawa <[email protected]>

SDR104 and HS200 need to check for SCC error. If SCC error is detected, retuning is necessary.

[Niklas: update commit message]
---
 drivers/mmc/host/tmio_mmc_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/tmio_mmc_core.c +2 -2
index 261b4d62d2b1061f..268c4a3b728c775f 100644
@@ -919,8 +919,8 @@ static void tmio_mmc_finish_request(struct tmio_mmc_host *host)
 	if (mrq->cmd->error || (mrq->data && mrq->data->error))
 		tmio_mmc_abort_dma(host);
 
-	if (host->check_scc_error)
-		host->check_scc_error(host);
+	if (host->check_scc_error && host->check_scc_error(host))
+		mrq->cmd->error = -EILSEQ;
 
 	/* If SET_BLOCK_COUNT, continue with main command */
 	if (host->mrq && !mrq->cmd->error) {
Signature · 1 line
2.18.0
#4 lore raw

Re: [PATCH v2 2/2] mmc: tmio: Fix SCC error detection

Quoted 4 lines · Niklas Söderlund

From: Masaharu Hayakawa <[email protected]>

SDR104 and HS200 need to check for SCC error. If SCC error is detected, retuning is necessary.

Basically good. As of patch 1, we need to clarify HS400 handling. Maybe this commit message needs a tiny update then :)

Quoted 25 lines
[Niklas: update commit message]
---
 drivers/mmc/host/tmio_mmc_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/tmio_mmc_core.c +2 -2
index 261b4d62d2b1061f..268c4a3b728c775f 100644
@@ -919,8 +919,8 @@ static void tmio_mmc_finish_request(struct tmio_mmc_host *host)
 	if (mrq->cmd->error || (mrq->data && mrq->data->error))
 		tmio_mmc_abort_dma(host);
 
-	if (host->check_scc_error)
-		host->check_scc_error(host);
+	if (host->check_scc_error && host->check_scc_error(host))
+		mrq->cmd->error = -EILSEQ;
 
 	/* If SET_BLOCK_COUNT, continue with main command */
 	if (host->mrq && !mrq->cmd->error) {
Signature · 1 line
2.18.0