Skip to contentSkip to conversation

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

PATCH Superseded Niklas Söderlund 3 participants 6 messages Jul 25, 2018 – Jul 26, 2018

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

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 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 v3
- Add check for 4TAP for HS400.

* Changes since v2
- Added check for HS400 as it's now merged.
- Added tags from Wolfram.

---
 drivers/mmc/host/renesas_sdhi_core.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/mmc/host/renesas_sdhi_core.c +9 -0
index 777e32b0e410e850..2e0d2eafd62ebecf 100644
@@ -444,6 +444,15 @@ static bool renesas_sdhi_check_scc_error(struct tmio_mmc_host *host)
 {
 	struct renesas_sdhi *priv = host_to_priv(host);
 
+	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 &&
+	      !(host->pdata->flags & TMIO_MMC_HAVE_4TAP_HS400)))
+		return false;
+
+	if (host->mmc->doing_retune)
+		return false;
+
 	/* Check SCC error */
 	if (sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL) &
 	    SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN &&
Signature · 1 line
2.18.0
#2 lore raw

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

Hi Niklas,

Quoted 2 lines

* Changes since v3
- Add check for 4TAP for HS400.

Is it the same in the BSP or where does this info come from?

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

Quoted 4 lines
drivers/mmc/host/renesas_sdhi_core.c +4 -0
+	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 &&
+	      !(host->pdata->flags & TMIO_MMC_HAVE_4TAP_HS400)))

This becomes very hard to read. We need to simplify it.

And can you bounce me your debugging mail from today again? I seem to have lost it :(

Thanks,

Wolfram

#3 lore raw

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

Hi Wolfram,

Quoted 6 lines · Wolfram Sang

Hi Niklas,

Quoted 2 lines

* Changes since v3
- Add check for 4TAP for HS400.

Is it the same in the BSP or where does this info come from?

It comes from the BSP but I had to modify it to fit with the upstream implementation of 4 vs 8 taps. The original code from BSP:

        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 &&
              !host->hs400_use_4tap))
                return false;
Quoted 8 lines

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

Quoted 6 lines
drivers/mmc/host/renesas_sdhi_core.c +4 -0
+	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 &&
+	      !(host->pdata->flags & TMIO_MMC_HAVE_4TAP_HS400)))

This becomes very hard to read. We need to simplify it.

I agree but I could not find a neat way of doing it. How about?

    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;
Quoted 3 lines

And can you bounce me your debugging mail from today again? I seem to have lost it :(

Bounced.

Quoted 4 lines

Thanks,

Wolfram

Signature · 2 lines
Regards,
Niklas S�derlund
#4 lore raw

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

Quoted 9 lines

I agree but I could not find a neat way of doing it. How about?

    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;

Yeah, it's not much but the best I could think of right now, too. But it definately is better.

#5 lore raw

PATCH 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 72ac806e0c762d83..81883bc08524e441 100644
@@ -920,8 +920,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