mmc: Poll for broken card detection case

Message ID 1514867157-18907-1-git-send-email-jun.nie@linaro.org
State New
Headers show
Series
  • mmc: Poll for broken card detection case
Related show

Commit Message

Jun Nie Jan. 2, 2018, 4:25 a.m.
Poll for broken card detection case instead of return
no card detected.

Signed-off-by: Jun Nie <jun.nie@linaro.org>
---
 drivers/mmc/Kconfig | 5 +++++
 drivers/mmc/mmc.c   | 4 ++++
 2 files changed, 9 insertions(+)

Patch

diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index 8fbeaa7..ed194a3 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -10,6 +10,11 @@  config MMC
 	  If you want MMC/SD/SDIO support, you should say Y here and
 	  also to your specific host controller driver.
 
+config MMC_BROKEN_CD
+	bool "Poll for broken card detection case"
+	help
+	  If card  detection feature is broken, just poll to detect.
+
 config DM_MMC
 	bool "Enable MMC controllers using Driver Model"
 	depends on DM
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 38d2e07..13c5bf5 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1650,8 +1650,12 @@  int mmc_start_init(struct mmc *mmc)
 	bool no_card;
 	int err;
 
+#if !defined(CONFIG_MMC_BROKEN_CD)
 	/* we pretend there's no card when init is NULL */
 	no_card = mmc_getcd(mmc) == 0;
+#else
+	no_card = 0;
+#endif
 #if !CONFIG_IS_ENABLED(DM_MMC)
 	no_card = no_card || (mmc->cfg->ops->init == NULL);
 #endif