diff mbox series

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

Message ID 1515058844-16007-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, 9:40 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(-)

Comments

Jaehoon Chung Jan. 17, 2018, 10:45 a.m. UTC | #1
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 <sivadur@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;
> +	}

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
>
Siva Durga Prasad Paladugu Jan. 17, 2018, 11:17 a.m. UTC | #2
Hi,

> -----Original Message-----

> From: Jaehoon Chung [mailto:jh80.chung@samsung.com]

> Sent: Wednesday, January 17, 2018 4:16 PM

> To: Siva Durga Prasad Paladugu <sivadur@xilinx.com>; u-

> boot@lists.denx.de

> Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com>

> Subject: Re: [PATCH v2 1/7] mmc: sdhci: Add support for disabling clock

> 

> 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 <sivadur@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; 

> > +	}

> 

> host->clk_disabled is really needs? Where is clk_disabled set to false?


Oh yes, may not be needed, will check and remove.

Thanks,
Siva

> 

> 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

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