[U-Boot] [PATCH v2 1/3] mmc: Read sd card detect properties from DT

Michal Simek michal.simek at xilinx.com
Wed Jun 19 12:47:13 UTC 2019


From: T Karthik Reddy <t.karthik.reddy at xilinx.com>

This patch reads card detect properties from device tree &
added mmc capability macros in mmc.h.

Signed-off-by: T Karthik Reddy <t.karthik.reddy at xilinx.com>
Signed-off-by: Michal Simek <michal.simek at xilinx.com>
---

Changes in v2:
 - Moved reading CD devicetree properties functionality from sdhci.c to
   mmc-uclass.c & moved mmc capability macros to mmc.h from sdhci.h.

 drivers/mmc/mmc-uclass.c | 9 +++++++++
 include/mmc.h            | 4 ++++
 2 files changed, 13 insertions(+)

diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index a9c8f335c142..1fba7a8c124d 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -171,6 +171,15 @@ int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg)
 	if (dev_read_bool(dev, "mmc-hs400-1_2v"))
 		cfg->host_caps |= MMC_CAP(MMC_HS_400);
 
+	if (dev_read_bool(dev, "non-removable")) {
+		cfg->host_caps |= MMC_CAP_SD_NONREMOVABLE;
+	} else {
+		if (dev_read_bool(dev, "cd-inverted"))
+			cfg->host_caps |= MMC_CAP_CD_ACTIVE_HIGH;
+		if (dev_read_bool(dev, "broken-cd"))
+			cfg->host_caps |= MMC_CAP_SD_NEEDS_POLL;
+	}
+
 	return 0;
 }
 
diff --git a/include/mmc.h b/include/mmc.h
index 1f30f71d25f8..30d2b1036b69 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -66,6 +66,10 @@
 #define MMC_MODE_HS200		MMC_CAP(MMC_HS_200)
 #define MMC_MODE_HS400		MMC_CAP(MMC_HS_400)
 
+#define MMC_CAP_SD_NONREMOVABLE	BIT(14)
+#define MMC_CAP_SD_NEEDS_POLL	BIT(15)
+#define MMC_CAP_CD_ACTIVE_HIGH  BIT(16)
+
 #define MMC_MODE_8BIT		BIT(30)
 #define MMC_MODE_4BIT		BIT(29)
 #define MMC_MODE_1BIT		BIT(28)
-- 
2.17.1



More information about the U-Boot mailing list