linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jaehoon Chung <jh80.chung@samsung.com>
To: Chander Kashyap <chander.kashyap@linaro.org>
Cc: linux-mmc@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	cjb@laptop.org, ben@simtec.co.uk,
	broonie@opensource.wolfsonmicro.com, kgene.kim@samsung.com,
	girish.shivananjappa@linaro.org, patches@linaro.org
Subject: Re: [PATCH 1/3] mmc: sdhci-s3c: Enable only required bus clock
Date: Fri, 14 Sep 2012 18:55:40 +0900	[thread overview]
Message-ID: <5052FF1C.3060803@samsung.com> (raw)
In-Reply-To: <1347613731-29428-2-git-send-email-chander.kashyap@linaro.org>

Hi Chander,

Could you add the error control for clk_enable()?

On 09/14/2012 06:08 PM, Chander Kashyap wrote:
> In case of multiple bus clock sources, all the clock sources were
> getting enabled. As only one clock source is needed at the time hence
> enable only the required bus clock.
> 
> This patch does as follows:
> 1.	In sdhci_s3c_probe enable only required bus clock source.
> 
> 2.	Handle the disabling of old bus clock and enables the
> 	best clock selected in sdhci_s3c_set_clock().
> 
> Signed-off-by: Chander Kashyap <chander.kashyap@linaro.org>
> ---
>  drivers/mmc/host/sdhci-s3c.c |   12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
> index 00969ba..0cbb4c2 100644
> --- a/drivers/mmc/host/sdhci-s3c.c
> +++ b/drivers/mmc/host/sdhci-s3c.c
> @@ -203,10 +203,12 @@ static void sdhci_s3c_set_clock(struct sdhci_host *host, unsigned int clock)
>  		 best_src, clock, best);
>  
>  	/* select the new clock source */
> -
>  	if (ourhost->cur_clk != best_src) {
>  		struct clk *clk = ourhost->clk_bus[best_src];
>  
> +		clk_enable(clk);
> +		clk_disable(ourhost->clk_bus[ourhost->cur_clk]);
> +
Did you consider the case that set_clock is assigned the sdhci_cmu_set_clock()?

>  		/* turn clock off to card before changing clock source */
>  		writew(0, host->ioaddr + SDHCI_CLOCK_CONTROL);
>  
> @@ -501,8 +503,6 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
>  		 */
>  		sc->cur_clk = ptr;
>  
> -		clk_enable(clk);
> -
>  		dev_info(dev, "clock source %d: %s (%ld Hz)\n",
>  			 ptr, name, clk_get_rate(clk));
>  	}
> @@ -513,6 +513,8 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
>  		goto err_no_busclks;
>  	}
>  
> +	clk_enable(sc->clk_bus[sc->cur_clk]);
> +
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	host->ioaddr = devm_request_and_ioremap(&pdev->dev, res);
>  	if (!host->ioaddr) {
> @@ -621,9 +623,9 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
>  	return 0;
>  
>   err_req_regs:
> +	clk_disable(sc->clk_bus[sc->cur_clk]);
>  	for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
>  		if (sc->clk_bus[ptr]) {
> -			clk_disable(sc->clk_bus[ptr]);
>  			clk_put(sc->clk_bus[ptr]);
>  		}
>  	}
> @@ -658,9 +660,9 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev)
>  
>  	pm_runtime_disable(&pdev->dev);
>  
> +	clk_disable(sc->clk_bus[sc->cur_clk]);
>  	for (ptr = 0; ptr < 3; ptr++) {
>  		if (sc->clk_bus[ptr]) {
> -			clk_disable(sc->clk_bus[ptr]);
>  			clk_put(sc->clk_bus[ptr]);
>  		}
>  	}
> 

  reply	other threads:[~2012-09-14  9:55 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-14  9:08 [PATCH 0/3] mmc: sdhci-s3c: fixes and enhancements Chander Kashyap
2012-09-14  9:08 ` [PATCH 1/3] mmc: sdhci-s3c: Enable only required bus clock Chander Kashyap
2012-09-14  9:55   ` Jaehoon Chung [this message]
2012-09-14 10:46     ` Chander Kashyap
2012-09-14 10:49       ` Jaehoon Chung
2012-09-14  9:55   ` Girish K S
2012-09-19  6:12   ` Chris Ball
2012-09-14  9:08 ` [PATCH 2/3] mmc: sdhci-s3c: Fix crash on module insertion for second time Chander Kashyap
2012-09-14 10:25   ` Jaehoon Chung
2012-09-14 10:46   ` Girish K S
2012-09-19  6:13   ` Chris Ball
2012-09-14  9:08 ` [PATCH 3/3] mmc: sdhci-s3c: Add clk_(enable/disable) in runtime suspend/resume Chander Kashyap
2012-09-19  6:14   ` Chris Ball
2012-09-19  7:43     ` Jaehoon Chung
2012-09-19  8:05       ` Chris Ball
2012-09-19 14:12       ` Chander Kashyap
2012-09-19 14:21         ` Chris Ball
2012-09-19 14:22           ` Chander Kashyap
2012-09-21  5:42   ` [PATCH v2 " Chander Kashyap
2012-09-21  6:49     ` Chris Ball
2012-10-17  9:15   ` [PATCH " Heiko Stübner
2012-10-18  2:04     ` Jaehoon Chung
2012-10-18  7:41       ` Heiko Stübner
2012-10-18  9:36         ` Seungwon Jeon
2012-10-18  9:52           ` Heiko Stübner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5052FF1C.3060803@samsung.com \
    --to=jh80.chung@samsung.com \
    --cc=ben@simtec.co.uk \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=chander.kashyap@linaro.org \
    --cc=cjb@laptop.org \
    --cc=girish.shivananjappa@linaro.org \
    --cc=kgene.kim@samsung.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=patches@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).