[U-Boot] [PATCH v2 13/13] mmc: am654_sdhci: Add a platform specific set_control_reg() callback

Faiz Abbas faiz_abbas at ti.com
Tue Feb 5 14:13:01 UTC 2019


From: Faiz Abbas <faiz4000 at gmail.com>

Add a platform specific set_control_reg() callback to help switch to
UHS speed modes.

Signed-off-by: Faiz Abbas <faiz4000 at gmail.com>
Reviewed-by: Tom Rini <trini at konsulko.com>
---
 drivers/mmc/am654_sdhci.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/am654_sdhci.c b/drivers/mmc/am654_sdhci.c
index 123f4c3e8b..583cd37c5f 100644
--- a/drivers/mmc/am654_sdhci.c
+++ b/drivers/mmc/am654_sdhci.c
@@ -76,6 +76,21 @@ struct am654_sdhci_plat {
 	bool dll_on;
 };
 
+static void am654_sdhci_set_control_reg(struct sdhci_host *host)
+{
+	struct mmc *mmc = (struct mmc *)host->mmc;
+	u32 reg;
+
+	if (IS_SD(host->mmc) &&
+	    mmc->signal_voltage == MMC_SIGNAL_VOLTAGE_180) {
+		reg = sdhci_readw(host, SDHCI_HOST_CONTROL2);
+		reg |= SDHCI_CTRL_VDD_180;
+		sdhci_writew(host, reg, SDHCI_HOST_CONTROL2);
+	}
+
+	sdhci_set_uhs_timing(host);
+}
+
 static int am654_sdhci_set_ios_post(struct sdhci_host *host)
 {
 	struct udevice *dev = host->mmc->dev;
@@ -156,7 +171,8 @@ static int am654_sdhci_set_ios_post(struct sdhci_host *host)
 }
 
 const struct sdhci_ops am654_sdhci_ops = {
-	.set_ios_post = &am654_sdhci_set_ios_post,
+	.set_ios_post		= &am654_sdhci_set_ios_post,
+	.set_control_reg	= &am654_sdhci_set_control_reg,
 };
 
 int am654_sdhci_init(struct am654_sdhci_plat *plat)
-- 
2.19.2



More information about the U-Boot mailing list