[U-Boot] [PATCH] MMC HW partition switching must also invalidate the cache

Peng Fan peng.fan at nxp.com
Fri Apr 26 06:45:49 UTC 2019


Hi Jan,

> Subject: [EXT] [U-Boot] [PATCH] MMC HW partition switching must also
> invalidate the cache
> 
Please add a bit more commit information about why and how.

Thanks,
Peng.
> 
> Signed-off-by: Jan Šedivý <jans at zhinst.com>
> ---
> 
>  drivers/mmc/mmc.c |   14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index
> 456c1b4..3d9a68e 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -954,8 +954,13 @@ int mmc_switch_part(struct mmc *mmc, unsigned
> int part_num)
>          * to return to representing the raw device.
>          */
>         if ((ret == 0) || ((ret == -ENODEV) && (part_num == 0))) {
> +               struct blk_desc *desc = mmc_get_blk_desc(mmc);
> +
>                 ret = mmc_set_capacity(mmc, part_num);
> -               mmc_get_blk_desc(mmc)->hwpart = part_num;
> +               if (desc && desc->hwpart != part_num) {
> +                       desc->hwpart = part_num;
> +                       blkcache_invalidate(desc->if_type,
> desc->devnum);
> +               }
>         }
> 
>         return ret;
> @@ -2673,7 +2678,12 @@ retry:
>                 return err;
> 
>         /* The internal partition reset to user partition(0) at every CMD0*/
> -       mmc_get_blk_desc(mmc)->hwpart = 0;
> +       struct blk_desc *desc = mmc_get_blk_desc(mmc);
> +
> +       if (desc && desc->hwpart != 0) {
> +               desc->hwpart = 0;
> +               blkcache_invalidate(desc->if_type, desc->devnum);
> +       }
> 
>         /* Test for SD version 2 */
>         err = mmc_send_if_cond(mmc);
> --
> 1.7.9.5
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.d
> enx.de%2Flistinfo%2Fu-boot&data=02%7C01%7CPeng.Fan%40nxp.com
> %7Cb99d933608be4817e5f408d6bef7d8a5%7C686ea1d3bc2b4c6fa92cd99c5
> c301635%7C0%7C1%7C636906369056326740&sdata=k%2Fo2bgjU1bdl
> pLyk5nv78yrX3P9fqaVmukcbB2nTvF8%3D&reserved=0


More information about the U-Boot mailing list