[U-Boot] [PULL] Please pull u-boot-imx

Fabio Estevam
2018-11-19T01:35:33Z

Hi Ricardo,

On Sun, Nov 18, 2018 at 5:44 PM Ricardo Salveti <rsalveti@rsalveti.net> wrote:

> Also tried with ARM's pre-built toolchain (same version), and got the
> same hang. Looking a bit further, it basically looks up while waiting
> the first mmc command to complete:
>
> has_emmc -> mmc_get_op_cond -> mmc_send_if_cond (testing for SD
> version 2) -> mmc_send_cmd -> esdhc_send_cmd_common -> while
> (!(esdhc_read32(&regs->irqstat) & flags))

Does the change below help?

--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -396,6 +396,7 @@ static int esdhc_send_cmd_common(struct
fsl_esdhc_priv *priv, struct mmc *mmc,
uint irqstat;
u32 flags = IRQSTAT_CC | IRQSTAT_CTOE;
struct fsl_esdhc *regs = priv->esdhc_regs;
+ unsigned long start;

#ifdef CONFIG_SYS_FSL_ERRATUM_ESDHC111
if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION)
@@ -453,8 +454,11 @@ static int esdhc_send_cmd_common(struct
fsl_esdhc_priv *priv, struct mmc *mmc,
flags = IRQSTAT_BRR;

/* Wait for the command to complete */
- while (!(esdhc_read32(&regs->irqstat) & flags))
- ;
+ start = get_timer(0);
+ while (!(esdhc_read32(&regs->irqstat) & flags)) {
+ if (get_timer(start) > 1000)
+ return -ETIMEDOUT;
+ }

irqstat = esdhc_read32(&regs->irqstat);