[U-Boot] [PATCH] mmd: sdhci: fix non GPIO card detect

Baruch Siach baruch at tkos.co.il
Mon Jul 22 17:08:26 UTC 2019


Some SD cards do not assert the SDHCI_CARD_PRESENT bit. Only the
SDHCI_CARD_DETECT_PIN_LEVEL is enabled. Consider that enough for card
detect indication.

This fixes SD card access from SPL, since DM_GPIO is not available in
SPL code.

Fixes: da18c62b6e6a ("mmc: sdhci: Implement SDHCI card detect")
Cc: T Karthik Reddy <t.karthik.reddy at xilinx.com>
Cc: Michal Simek <michal.simek at xilinx.com>
Signed-off-by: Baruch Siach <baruch at tkos.co.il>
---
 drivers/mmc/sdhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 2779bca93f08..17a28181fcca 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -683,7 +683,7 @@ int sdhci_get_cd(struct udevice *dev)
 	}
 #endif
 	value = !!(sdhci_readl(host, SDHCI_PRESENT_STATE) &
-		   SDHCI_CARD_PRESENT);
+		   (SDHCI_CARD_PRESENT | SDHCI_CARD_DETECT_PIN_LEVEL));
 	if (mmc->cfg->host_caps & MMC_CAP_CD_ACTIVE_HIGH)
 		return !value;
 	else
-- 
2.20.1



More information about the U-Boot mailing list