diff mbox series

[U-Boot,1/7] mmc: sdhci: Add support for disabling clock

Message ID 1515046816-27217-2-git-send-email-sivadur@xilinx.com
State Superseded
Delegated to: Michal Simek
Headers show
Series Add support of SD3.0 UHS modes for ZynqMP | expand

Commit Message

Siva Durga Prasad Paladugu Jan. 4, 2018, 6:20 a.m. UTC
This patch adds support to disable clock if clk_disable
was set and then enable or set clock if the clock was changed
or clock was disabled when clock needs to be enabled.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
---
 drivers/mmc/sdhci.c | 7 ++++++-
 include/sdhci.h     | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index e2ddf5d..2bd721f 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -437,8 +437,13 @@  static int sdhci_set_ios(struct mmc *mmc)
 	if (host->ops && host->ops->set_control_reg)
 		host->ops->set_control_reg(host);
 
-	if (mmc->clock != host->clock)
+	if ((mmc->clock != host->clock || host->clk_disabled) &&
+	    !mmc->clk_disable)
 		sdhci_set_clock(mmc, mmc->clock);
+	if (mmc->clk_disable) {
+		sdhci_set_clock(mmc, 0);
+		host->clk_disabled = true;
+	}
 
 	/* Set bus width */
 	ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
diff --git a/include/sdhci.h b/include/sdhci.h
index 7e84012..4fc4140 100644
--- a/include/sdhci.h
+++ b/include/sdhci.h
@@ -259,6 +259,7 @@  struct sdhci_host {
 	uint	voltages;
 
 	struct mmc_config cfg;
+	bool clk_disabled;
 };
 
 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS