Hi Wolfram-san, Thank you for the patch! > From: Wolfram Sang, Sent: Tuesday, March 9, 2021 6:24 PM > > All recent SDHI instances can be reset via the reset controller. If one > is found, use it instead of the open coded reset. This is to get a > future-proof sane reset state. > > Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx> > --- <snip> > @@ -561,9 +563,16 @@ static int renesas_sdhi_prepare_hs400_tuning(struct mmc_host *mmc, struct mmc_io > static void renesas_sdhi_reset(struct tmio_mmc_host *host) > { > struct renesas_sdhi *priv = host_to_priv(host); > + int ret; > u16 val; > > - if (priv->scc_ctl) { > + if (priv->rstc) { > + reset_control_reset(priv->rstc); > + /* Unknown why but without polling reset status, it will hang */ > + read_poll_timeout(reset_control_status, ret, ret == 0, 1, 100, > + false, priv->rstc); > + priv->needs_adjust_hs400 = false; After we did hard reset here, sometimes tmio_mmc_reset_work() cannot recover again with "mmcblk0: recovery failed!" message... So, I investigated this issue and I found a reason. > + } else if (priv->scc_ctl) { > renesas_sdhi_disable_scc(host->mmc); I realized this renesas_sdhi_disable_scc() will set CLK_CTL_SCLKEN. So, the previous code can issue CMD13 after tmio_mmc_reset_work() was called. But, after we applied this patch, the CMD13 failed because the clock was disabled. # In other words, if a controller doesn't have scc, the previous code cannot issue # CMD13 in such a case, I guess. So, before we apply this patch, we have to add ->set_clock() calling in tmio_mmc_reset_work() like below: --- diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index eca767dcabba..a05ccfc7aa0d 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -222,6 +222,7 @@ static void tmio_mmc_reset_work(struct work_struct *work) spin_unlock_irqrestore(&host->lock, flags); tmio_mmc_reset(host); + host->set_clock(host, host->clk_cache); /* Ready for new calls */ host->mrq = NULL; --- Best regards, Yoshihiro Shimoda