[U-Boot] [UBOOT v2 01/15] mmc: sdhci: Update host capabilities about host controller

Siva Durga Prasad Paladugu siva.durga.paladugu at xilinx.com
Mon Jan 30 11:38:18 CET 2017


Update host capabilities for driver with host controller
information related to UHS modes incase of SD and HS200
mode incase of eMMC.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur at xilinx.com>
---
Changes from v1:
- None
---
 drivers/mmc/sdhci.c | 28 +++++++++++++++++++++++++++-
 include/mmc.h       |  7 +++++++
 include/sdhci.h     |  5 +++++
 3 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 93cefd8..884b6a6 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -517,7 +517,8 @@ static const struct mmc_ops sdhci_ops = {
 int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
 		u32 f_max, u32 f_min)
 {
-	u32 caps, caps_1;
+	u32 caps;
+	u32 caps_1 = 0;
 
 	caps = sdhci_readl(host, SDHCI_CAPABILITIES);
 
@@ -588,6 +589,31 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
 				SDHCI_CLOCK_MUL_SHIFT;
 	}
 
+	if (!(cfg->voltages & MMC_VDD_165_195))
+		caps_1 &= ~(SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_SDR50 |
+			    SDHCI_SUPPORT_DDR50);
+
+	if (caps_1 & (SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_SDR50 |
+		      SDHCI_SUPPORT_DDR50))
+		cfg->host_caps |= MMC_MODE_UHS_SDR12 | MMC_MODE_UHS_SDR25;
+
+	if (caps_1 & SDHCI_SUPPORT_SDR104) {
+		cfg->host_caps |= MMC_MODE_UHS_SDR104 | MMC_MODE_UHS_SDR50;
+		/*
+		 * SD3.0: SDR104 is supported so (for eMMC) the caps2
+		 * field can be promoted to support HS200.
+		 */
+		cfg->host_caps |= MMC_MODE_HS200;
+	} else if (caps_1 & SDHCI_SUPPORT_SDR50) {
+		cfg->host_caps |= MMC_MODE_UHS_SDR50;
+	}
+
+	if (caps_1 & SDHCI_SUPPORT_DDR50)
+		cfg->host_caps |= MMC_MODE_UHS_DDR50;
+
+	if (caps_1 & SDHCI_USE_SDR50_TUNING)
+		cfg->host_caps |= MMC_MODE_NEEDS_TUNING;
+
 	if (host->host_caps)
 		cfg->host_caps |= host->host_caps;
 
diff --git a/include/mmc.h b/include/mmc.h
index fad12d6..5c94eae 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -58,6 +58,13 @@
 #define MMC_MODE_8BIT		(1 << 3)
 #define MMC_MODE_SPI		(1 << 4)
 #define MMC_MODE_DDR_52MHz	(1 << 5)
+#define MMC_MODE_UHS_SDR12	(1 << 6)
+#define MMC_MODE_UHS_SDR25	(1 << 7)
+#define MMC_MODE_UHS_SDR50	(1 << 8)
+#define MMC_MODE_UHS_SDR104	(1 << 9)
+#define MMC_MODE_UHS_DDR50	(1 << 10)
+#define MMC_MODE_NEEDS_TUNING	(1 << 11)
+#define MMC_MODE_HS200		(1 << 12)
 
 #define SD_DATA_4BIT	0x00040000
 
diff --git a/include/sdhci.h b/include/sdhci.h
index 6a43271..685bcf2 100644
--- a/include/sdhci.h
+++ b/include/sdhci.h
@@ -167,6 +167,11 @@
 #define  SDHCI_CAN_64BIT	BIT(28)
 
 #define SDHCI_CAPABILITIES_1	0x44
+#define  SDHCI_SUPPORT_SDR50	0x00000001
+#define  SDHCI_SUPPORT_SDR104	0x00000002
+#define  SDHCI_SUPPORT_DDR50	0x00000004
+#define  SDHCI_USE_SDR50_TUNING		0x00002000
+#define  SDHCI_SUPPORT_HS400	0x80000000 /* Non-standard */
 #define  SDHCI_CLOCK_MUL_MASK	0x00FF0000
 #define  SDHCI_CLOCK_MUL_SHIFT	16
 
-- 
2.7.4



More information about the U-Boot mailing list