]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
cmd: mmc: Force mmc reinit when no card present
authorMarek Vasut <marek.vasut@gmail.com>
Thu, 3 Jan 2019 21:09:43 +0000 (22:09 +0100)
committerTom Rini <trini@konsulko.com>
Tue, 15 Jan 2019 20:28:43 +0000 (15:28 -0500)
In case the card is removed, force-init the MMC to start the internal
machinery which deregisters and invalidate the MMC device.

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

index 3920a1836a594903116841f809676f34ff022061..ca8f982f53f6e47fe62fc234a29035f74285bf9b 100644 (file)
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -101,6 +101,9 @@ static struct mmc *init_mmc_device(int dev, bool force_init)
                return NULL;
        }
 
+       if (!mmc_getcd(mmc))
+               force_init = true;
+
        if (force_init)
                mmc->has_init = 0;
        if (mmc_init(mmc))