修訂 | 6dcf1c28dd4344e73fb3108c037b5b9093852328 (tree) |
---|---|
時間 | 2022-07-27 15:19:08 |
作者 | Pali Rohár <pali@kern...> |
Commiter | Jaehoon Chung |
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>
@@ -504,6 +504,7 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock) | ||
504 | 504 | u32 time_out; |
505 | 505 | u32 value; |
506 | 506 | uint clk; |
507 | + u32 hostver; | |
507 | 508 | |
508 | 509 | if (clock < mmc->cfg->f_min) |
509 | 510 | clock = mmc->cfg->f_min; |
@@ -544,6 +545,14 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock) | ||
544 | 545 | |
545 | 546 | esdhc_clrsetbits32(®s->sysctl, SYSCTL_CLOCK_MASK, clk); |
546 | 547 | |
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(®s->sysctl, SYSCTL_PEREN | SYSCTL_CKEN); | |
553 | + return; | |
554 | + } | |
555 | + | |
547 | 556 | time_out = 20; |
548 | 557 | value = PRSSTAT_SDSTB; |
549 | 558 | while (!(esdhc_read32(®s->prsstat) & value)) { |
@@ -563,6 +572,7 @@ static void esdhc_clock_control(struct fsl_esdhc_priv *priv, bool enable) | ||
563 | 572 | struct fsl_esdhc *regs = priv->esdhc_regs; |
564 | 573 | u32 value; |
565 | 574 | u32 time_out; |
575 | + u32 hostver; | |
566 | 576 | |
567 | 577 | value = esdhc_read32(®s->sysctl); |
568 | 578 |
@@ -573,6 +583,13 @@ static void esdhc_clock_control(struct fsl_esdhc_priv *priv, bool enable) | ||
573 | 583 | |
574 | 584 | esdhc_write32(®s->sysctl, value); |
575 | 585 | |
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 | + | |
576 | 593 | time_out = 20; |
577 | 594 | value = PRSSTAT_SDSTB; |
578 | 595 | while (!(esdhc_read32(®s->prsstat) & value)) { |