[U-Boot] [PATCH 1/2] mmc: Fix timeout values passed to mmc_wait_dat0()

Eugeniu Rosca erosca at de.adit-jv.com
Fri Aug 16 16:17:10 UTC 2019

Hi Sam,

CC: Peng

On Wed, Aug 14, 2019 at 10:52:50PM +0300, Sam Protsenko wrote:
> mmc_wait_dat0() expects timeout argument to be in usec units.

I agree, based on the documentation of wait_dat0() from commit:

> But some
> overlying functions operate on timeout in msec units.

That seems to be also true. The two functions touched in this commit
(mmc_poll_for_busy, __mmc_switch) seem to originate from Linux, where
they clearly accept MS timeout granularity [1-2].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=716bdb8953c7c
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f90d2e4035d45

> Convert timeout
> from msec to usec when passing it to mmc_wait_dat0().

I've reviewed all the callers of mmc_wait_dat0() and I couldn't find any
other occurrences of passing MS values to this function.

I've run 'ext2load mmc 0:1 0x48000000 Image' several times on
H3-Salvator-X w/o noticing any issues.

I agree with the idea of s/timeout/timeout_{us,ms}/ in the second patch
from this series.

> This fixes 'avb' commands on BeagleBoard X15, because next chain was
> failing:
>     get_partition() -> mmc_switch_part() -> __mmc_switch() ->
>     mmc_wait_dat0()
> when passing incorrect timeout from __mmc_switch() to mmc_wait_dat0().
> Fixes: bb98b8c5c06a ("mmc: During a switch, poll on dat0 if available and check the final status")
> Signed-off-by: Sam Protsenko <semen.protsenko at linaro.org>

Reviewed-by: Eugeniu Rosca <rosca.eugeniu at gmail.com>
Tested-by: Eugeniu Rosca <rosca.eugeniu at gmail.com>

Best Regards,

More information about the U-Boot mailing list