From: Jaehoon Chung Date: Wed, 17 Jan 2018 19:45:41 +0900 Subject: [U-Boot] [PATCH v2 1/7] mmc: sdhci: Add support for disabling clock In-Reply-To: <1515058844-16007-2-git-send-email-sivadur@xilinx.com> References: <1515058844-16007-1-git-send-email-sivadur@xilinx.com> <1515058844-16007-2-git-send-email-sivadur@xilinx.com> Message-ID: <4ec3d643-2c17-4959-652c-ade5ecab72ca@samsung.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi, On 01/04/2018 06:40 PM, Siva Durga Prasad Paladugu wrote: > 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 > --- > 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; > + } host->clk_disabled is really needs? Where is clk_disabled set to false? Best Regards, Jaehoon Chung > > /* 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 >