Message ID | 20201125204953.3344-1-wsa+renesas@sang-engineering.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | mmc: tmio: improve bringing HW to a sane state with MMC_POWER_OFF | expand |
On Wed, 25 Nov 2020 at 21:51, Wolfram Sang <wsa+renesas@sang-engineering.com> wrote: > > Further testing of error cases revealed that downgrade is not enough, so > we need to reset the SCC which is done by calling the custom reset > function. This reset function can distinguish between the various SDHI > variants, so protecting the call with MIN_RCAR2 is enough here. > > Fixes: 24ce2d7b8bea ("mmc: tmio: bring tuning HW to a sane state with MMC_POWER_OFF") > Reported-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> > --- > > I was also evaluating if tmio_mmc_reset() would be better than > host->reset. I finally decided against it. This is the minimal change > that we need and which fixes an actual issue. I can't see why we would > want to terminate DMA because either everything went smooth and DMA > completed or the DMA error has already been handled. I think. Please > speak up if you disagree. I have no strong opinion, but just wanted to highlight that I observed that tmio_mmc_host_runtime_resume() calls tmio_mmc_reset(). No idea what that means for R-Car Gen2+. > > drivers/mmc/host/tmio_mmc_core.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c > index 7f4a28125010..a89547f5d733 100644 > --- a/drivers/mmc/host/tmio_mmc_core.c > +++ b/drivers/mmc/host/tmio_mmc_core.c > @@ -929,9 +929,9 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) > switch (ios->power_mode) { > case MMC_POWER_OFF: > tmio_mmc_power_off(host); > - /* Downgrade ensures a sane state for tuning HW (e.g. SCC) */ > - if (host->mmc->ops->hs400_downgrade) > - host->mmc->ops->hs400_downgrade(host->mmc); > + /* For R-Car Gen2+, we need to reset SDHI specific SCC */ > + if (host->pdata->flags & TMIO_MMC_MIN_RCAR2) > + host->reset(host); > host->set_clock(host, 0); > break; > case MMC_POWER_UP: > -- > 2.28.0 > Kind regards Uffe
Hi Wolfram-san, > From: Wolfram Sang, Sent: Thursday, November 26, 2020 5:50 AM > > Further testing of error cases revealed that downgrade is not enough, so > we need to reset the SCC which is done by calling the custom reset > function. This reset function can distinguish between the various SDHI > variants, so protecting the call with MIN_RCAR2 is enough here. > > Fixes: 24ce2d7b8bea ("mmc: tmio: bring tuning HW to a sane state with MMC_POWER_OFF") > Reported-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Thank you for the patch! I tested on Salvator-XS with R-Car H3 and confirmed that this patch could fix an issue which the SCC hang issue happened when the mmc_hw_reset() was called. So, Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Best regards, Yoshihiro Shimoda
On Wed, 25 Nov 2020 at 21:51, Wolfram Sang <wsa+renesas@sang-engineering.com> wrote: > > Further testing of error cases revealed that downgrade is not enough, so > we need to reset the SCC which is done by calling the custom reset > function. This reset function can distinguish between the various SDHI > variants, so protecting the call with MIN_RCAR2 is enough here. > > Fixes: 24ce2d7b8bea ("mmc: tmio: bring tuning HW to a sane state with MMC_POWER_OFF") > Reported-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Applied for fixes, thanks! Kind regards Uffe > --- > > I was also evaluating if tmio_mmc_reset() would be better than > host->reset. I finally decided against it. This is the minimal change > that we need and which fixes an actual issue. I can't see why we would > want to terminate DMA because either everything went smooth and DMA > completed or the DMA error has already been handled. I think. Please > speak up if you disagree. > > drivers/mmc/host/tmio_mmc_core.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c > index 7f4a28125010..a89547f5d733 100644 > --- a/drivers/mmc/host/tmio_mmc_core.c > +++ b/drivers/mmc/host/tmio_mmc_core.c > @@ -929,9 +929,9 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) > switch (ios->power_mode) { > case MMC_POWER_OFF: > tmio_mmc_power_off(host); > - /* Downgrade ensures a sane state for tuning HW (e.g. SCC) */ > - if (host->mmc->ops->hs400_downgrade) > - host->mmc->ops->hs400_downgrade(host->mmc); > + /* For R-Car Gen2+, we need to reset SDHI specific SCC */ > + if (host->pdata->flags & TMIO_MMC_MIN_RCAR2) > + host->reset(host); > host->set_clock(host, 0); > break; > case MMC_POWER_UP: > -- > 2.28.0 >
diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 7f4a28125010..a89547f5d733 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -929,9 +929,9 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) switch (ios->power_mode) { case MMC_POWER_OFF: tmio_mmc_power_off(host); - /* Downgrade ensures a sane state for tuning HW (e.g. SCC) */ - if (host->mmc->ops->hs400_downgrade) - host->mmc->ops->hs400_downgrade(host->mmc); + /* For R-Car Gen2+, we need to reset SDHI specific SCC */ + if (host->pdata->flags & TMIO_MMC_MIN_RCAR2) + host->reset(host); host->set_clock(host, 0); break; case MMC_POWER_UP:
Further testing of error cases revealed that downgrade is not enough, so we need to reset the SCC which is done by calling the custom reset function. This reset function can distinguish between the various SDHI variants, so protecting the call with MIN_RCAR2 is enough here. Fixes: 24ce2d7b8bea ("mmc: tmio: bring tuning HW to a sane state with MMC_POWER_OFF") Reported-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> --- I was also evaluating if tmio_mmc_reset() would be better than host->reset. I finally decided against it. This is the minimal change that we need and which fixes an actual issue. I can't see why we would want to terminate DMA because either everything went smooth and DMA completed or the DMA error has already been handled. I think. Please speak up if you disagree. drivers/mmc/host/tmio_mmc_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)