[U-Boot] [PATCH 1/2] cmd: mmc: Force mmc reinit when no card present

Marek Vasut marek.vasut at gmail.com
Thu Jan 3 21:09:43 UTC 2019


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 at gmail.com>
Cc: Jaehoon Chung <jh80.chung at samsung.com>
---
 cmd/mmc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/cmd/mmc.c b/cmd/mmc.c
index 3920a1836a..ca8f982f53 100644
--- 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))
-- 
2.19.2



More information about the U-Boot mailing list