diff mbox series

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

Message ID 20180725121031.24277-2-niklas.soderlund+renesas@ragnatech.se (mailing list archive)
State New, archived
Headers show
Series mmc: {tmio,renesas_sdhi}: retune if SCC error detected | expand

Commit Message

Niklas Söderlund July 25, 2018, 12:10 p.m. UTC
From: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>

Checking for SCC error during retuning is unnecessary.

Signed-off-by: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>
[Niklas: fix small style issue]
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

---

* 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(+)

Comments

Wolfram Sang July 25, 2018, 12:21 p.m. UTC | #1
Hi Niklas,

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

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


> +	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
Niklas Söderlund July 25, 2018, 1:36 p.m. UTC | #2
Hi Wolfram,

On 2018-07-25 14:21:07 +0200, Wolfram Sang wrote:
> Hi Niklas,
> 
> > * 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;
> 
> 
> > +	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;

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

Bounced.

> 
> Thanks,
> 
>    Wolfram
Wolfram Sang July 26, 2018, 7:34 a.m. UTC | #3
> 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.
diff mbox series

Patch

diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index 777e32b0e410e850..2e0d2eafd62ebecf 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -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 &&