diff mbox series

[U-Boot,v8,11/14] mmc: am654_sdhci: Add a platform specific set_control_reg() callback

Message ID 20190610191344.5617-12-faiz_abbas@ti.com
State Accepted
Commit f605807f3d4686637a2f8b0f24bebabdcdef6898
Delegated to: Tom Rini
Headers show
Series Add Support for eMMC in AM65x-evm | expand

Commit Message

Faiz Abbas June 10, 2019, 7:13 p.m. UTC
Add a platform specific set_control_reg() callback to help switch to
UHS speed modes.

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

Comments

Tom Rini July 19, 2019, 12:04 a.m. UTC | #1
On Tue, Jun 11, 2019 at 12:43:41AM +0530, Faiz Abbas wrote:

> Add a platform specific set_control_reg() callback to help switch to
> UHS speed modes.
> 
> Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/drivers/mmc/am654_sdhci.c b/drivers/mmc/am654_sdhci.c
index b9a7924d4e..fe633aa39a 100644
--- a/drivers/mmc/am654_sdhci.c
+++ b/drivers/mmc/am654_sdhci.c
@@ -75,6 +75,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;
@@ -143,7 +158,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)