• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision6dcf1c28dd4344e73fb3108c037b5b9093852328 (tree)
Time2022-07-27 15:19:08
AuthorPali Rohár <pali@kern...>
CommiterJaehoon Chung

Log Message

mmc: fsl_esdhc: Fix 'Internal clock never stabilised.' error

Only newer eSDHC controllers set PRSSTAT_SDSTB flag. So do not wait until
flag PRSSTAT_SDSTB is set on old pre-2.2 controllers. Instead sleep for
fixed amount of time like it was before commit 6f883e501b65 ("mmc:
fsl_esdhc: Add emmc hs200 support").

This change fixes error 'Internal clock never stabilised.' which is printed
on P2020 board at every access to SD card.

Fixes: 6f883e501b65 ("mmc: fsl_esdhc: Add emmc hs200 support")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Change Summary

Incremental Difference

--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -504,6 +504,7 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock)
504504 u32 time_out;
505505 u32 value;
506506 uint clk;
507+ u32 hostver;
507508
508509 if (clock < mmc->cfg->f_min)
509510 clock = mmc->cfg->f_min;
@@ -544,6 +545,14 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock)
544545
545546 esdhc_clrsetbits32(&regs->sysctl, SYSCTL_CLOCK_MASK, clk);
546547
548+ /* Only newer eSDHC controllers set PRSSTAT_SDSTB flag */
549+ hostver = esdhc_read32(&priv->esdhc_regs->hostver);
550+ if (HOSTVER_VENDOR(hostver) <= VENDOR_V_22) {
551+ udelay(10000);
552+ esdhc_setbits32(&regs->sysctl, SYSCTL_PEREN | SYSCTL_CKEN);
553+ return;
554+ }
555+
547556 time_out = 20;
548557 value = PRSSTAT_SDSTB;
549558 while (!(esdhc_read32(&regs->prsstat) & value)) {
@@ -563,6 +572,7 @@ static void esdhc_clock_control(struct fsl_esdhc_priv *priv, bool enable)
563572 struct fsl_esdhc *regs = priv->esdhc_regs;
564573 u32 value;
565574 u32 time_out;
575+ u32 hostver;
566576
567577 value = esdhc_read32(&regs->sysctl);
568578
@@ -573,6 +583,13 @@ static void esdhc_clock_control(struct fsl_esdhc_priv *priv, bool enable)
573583
574584 esdhc_write32(&regs->sysctl, value);
575585
586+ /* Only newer eSDHC controllers set PRSSTAT_SDSTB flag */
587+ hostver = esdhc_read32(&priv->esdhc_regs->hostver);
588+ if (HOSTVER_VENDOR(hostver) <= VENDOR_V_22) {
589+ udelay(10000);
590+ return;
591+ }
592+
576593 time_out = 20;
577594 value = PRSSTAT_SDSTB;
578595 while (!(esdhc_read32(&regs->prsstat) & value)) {