]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
cmd: mmc: Invalidate MMC block cache after init
authorMarek Vasut <marek.vasut@gmail.com>
Thu, 3 Jan 2019 21:09:44 +0000 (22:09 +0100)
committerTom Rini <trini@konsulko.com>
Tue, 15 Jan 2019 20:28:43 +0000 (15:28 -0500)
Make sure the block cache is cleared for the MMC device after it was
reinitialized to avoid having any stale data in the cache, like e.g.
partition tables or such.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
cmd/mmc.c

index ca8f982f53f6e47fe62fc234a29035f74285bf9b..9951315f9119c92f6d9526a07629be9cb1c0c088 100644 (file)
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -108,6 +108,12 @@ static struct mmc *init_mmc_device(int dev, bool force_init)
                mmc->has_init = 0;
        if (mmc_init(mmc))
                return NULL;
+
+#ifdef CONFIG_BLOCK_CACHE
+       struct blk_desc *bd = mmc_get_blk_desc(mmc);
+       blkcache_invalidate(bd->if_type, bd->devnum);
+#endif
+
        return mmc;
 }
 static int do_mmcinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])