[U-Boot] [PATCH v2] mmc: fsl_esdhc: Avoid infinite loop in esdhc_send_cmd_common()

Ricardo Salveti rsalveti at rsalveti.net
Mon Nov 19 17:44:45 UTC 2018


On Mon, Nov 19, 2018 at 12:42 PM Fabio Estevam <festevam at gmail.com> wrote:
>
> Hi Ricardo,
>
> On Mon, Nov 19, 2018 at 12:25 PM Ricardo Salveti <rsalveti at rsalveti.net> wrote:
>
> > Looking a bit further, this ends up adding a significant boot delay
> > because the mmc driver still tries to send another two additional
> > commands, so it ends executing this timeout logic 3 times in total.
> > Guess this can be improved at
> > http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/mmc/mmc.c;h=d6b9cdc99229d8bfe0c8be3adfd6e5209a11601c;hb=HEAD#l2633
> > by either checking for mmc first or by simply just checking and
> > handling the return code from mmc_send_if_cond, but this could be
> > another patch.
>
> Yes, I think you are right.
>
> Does only adding the error check below avoid the hang in your case?
>
>         /* Test for SD version 2 */
>          err = mmc_send_if_cond(mmc);
>          if (err)
>             return err;

You patch is still required as the hang I was getting was happening in
the while loop itself. Adding this change on top of your patch would
just reduce the delay as the code path would avoid another 2 extra
commands (both returning timeout).

The only issue, as pointed out by Baruch, is that we already had a
check that was ignoring the timeout here before, so I guess the
current behavior is correct/expected.

+1 for your patch as it is a good fix anyway and unblocks the boot
process on my som/board, even if it adds a longer boot delay.

Tested-by: Ricardo Salveti <rsalveti at rsalveti.net>

Thanks,
-- 
Ricardo Salveti de Araujo


More information about the U-Boot mailing list