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

Igor Opaniuk igor.opaniuk at gmail.com
Mon Aug 19 08:57:58 UTC 2019


Hi Sam,
So you finally found it :)

On Wed, Aug 14, 2019 at 10:52 PM Sam Protsenko
<semen.protsenko at linaro.org> wrote:
>
> mmc_wait_dat0() expects timeout argument to be in usec units. But some
> overlying functions operate on timeout in msec units. Convert timeout
> from msec to usec when passing it to mmc_wait_dat0().
>
> 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>
> ---
>  drivers/mmc/mmc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index eecc7d687e..e247730ff2 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -235,7 +235,7 @@ int mmc_poll_for_busy(struct mmc *mmc, int timeout)
>         unsigned int status;
>         int err;
>
> -       err = mmc_wait_dat0(mmc, 1, timeout);
> +       err = mmc_wait_dat0(mmc, 1, timeout * 1000);
>         if (err != -ENOSYS)
>                 return err;
>
> @@ -778,7 +778,7 @@ static int __mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value,
>         start = get_timer(0);
>
>         /* poll dat0 for rdy/buys status */
> -       ret = mmc_wait_dat0(mmc, 1, timeout);
> +       ret = mmc_wait_dat0(mmc, 1, timeout * 1000);
>         if (ret && ret != -ENOSYS)
>                 return ret;
>
> --
> 2.20.1
>

Tested-by: Igor Opaniuk <igor.opaniuk at gmail.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk at gmail.com>

-- 
Best regards - Freundliche GrĂ¼sse - Meilleures salutations

Igor Opaniuk

mailto: igor.opaniuk at gmail.com
skype: igor.opanyuk
+380 (93) 836 40 67
http://ua.linkedin.com/in/iopaniuk


More information about the U-Boot mailing list