mmc: fsl_esdhc_imx: check the clock stable status after config the clock rate.
Subsystems (2)
PATCH v3 1/1 mmc: fsl_esdhc_imx: check the clock stable status after config the clock rate.
From: Haibo Chen <[email protected]>
Currently, after config the clock rate, delay 10ms, this is quite a rough method. Check the clock stable status in the present status register is enough.
Tested-by Ji Luo <[email protected]>
Signed-off-by Haibo Chen <[email protected]>
--- drivers/mmc/fsl_esdhc_imx.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/mmc/fsl_esdhc_imx.c +6 -1
@@ -36,6 +36,7 @@#include <dt-structs.h> #include <mapmem.h> #include <dm/ofnode.h> +#include <linux/iopoll.h> #if !CONFIG_IS_ENABLED (BLK )#include "mmc_private.h"
@@ -631,6 +632,8 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock) {struct fsl_esdhc *regs = priv->esdhc_regs;int div =1 ; +u32 tmp; +int ret;#ifdef ARCH_MXC #ifdef CONFIG_MX53 /* For i.MX53 eSDHCv3, SYSCTL.SDCLKFS may not be set to 0. */
@@ -664,7 +667,9 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock)esdhc_clrsetbits32 (®s->sysctl,SYSCTL_CLOCK_MASK , clk); -udelay (10000 ); + ret =readx_poll_timeout (esdhc_read32, ®s->prsstat, tmp, tmp &PRSSTAT_SDSTB ,100 ); +if (ret) +pr_warn ("fsl_esdhc_imx: Internal clock never stabilised.\n" );#ifdef CONFIG_FSL_USDHC esdhc_setbits32 (®s->vendorspec,VENDORSPEC_PEREN |VENDORSPEC_CKEN );
Signature · 1 line
2.17.1
PATCH v3 1/1 mmc: fsl_esdhc_imx: check the clock stable status after config the clock rate.
Quoted 6 lines
From: Haibo Chen <[email protected]>
Currently, after config the clock rate, delay 10ms, this is quite a rough method. Check the clock stable status in the present status register is enough.Tested-by Ji Luo <[email protected]>Signed-off-by Haibo Chen <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================