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

Siva Durga Prasad Paladugu siva.durga.paladugu at xilinx.com
Thu Jan 4 09:40:38 UTC 2018


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 at xilinx.com>
---
 drivers/mmc/sdhci.c | 7 ++++++-
 include/sdhci.h     | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

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
-- 
2.7.4



More information about the U-Boot mailing list