[RFC PATCH] mmc: zynq_sdhci: Dependable card detect

Stefan Herbrechtsmeier stefan.herbrechtsmeier-oss at weidmueller.com
Tue May 16 16:21:16 CEST 2023


From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier at weidmueller.com>

The card detect logic needs a short card present signal to work
dependable. Without a present card the SDHCI_CARD_STATE_STABLE signal is
not set dependable after a reset. Use the internal fixed card present
signal to initiate the card detect logic.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier at weidmueller.com>

---
On our hardware we get a "Sdhci card detect state not stable" error in
the SPL if no mmc card is present. It is unclear if this patch is the
correct solution, but a short card inserts or a fixed card present
signal leads to a SDHCI_CARD_STATE_STABLE signal with and without card.

 drivers/mmc/zynq_sdhci.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
index e44868aaec..a88feeb367 100644
--- a/drivers/mmc/zynq_sdhci.c
+++ b/drivers/mmc/zynq_sdhci.c
@@ -1075,6 +1075,26 @@ static int sdhci_zynqmp_set_dynamic_config(struct arasan_sdhci_priv *priv,
 		return ret;
 	}
 
+	/* The card detect logic needs a short card present signal to work
+	 * dependable. Without a present card the SDHCI_CARD_STATE_STABLE
+	 * signal is not set dependable after a reset. Use the internal
+	 * fixed card present signal to initiate the card detect logic.
+	 */
+	if (!dev_read_bool(dev, "non-removable")) {
+		ret = zynqmp_pm_set_sd_config(priv->node_id, SD_CONFIG_EMMC_SEL,
+					      1);
+		if (ret) {
+			dev_err(dev, "SD_CONFIG_EMMC_SEL failed\n");
+			return ret;
+		}
+		ret = zynqmp_pm_set_sd_config(priv->node_id, SD_CONFIG_EMMC_SEL,
+					      0);
+		if (ret) {
+			dev_err(dev, "SD_CONFIG_EMMC_SEL failed\n");
+			return ret;
+		}
+	}
+
 	return 0;
 }
 #endif
-- 
2.30.2



More information about the U-Boot mailing list