LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Baolin Wang <baolin.wang@linaro.org>,
	ulf.hansson@linaro.org, zhang.lyra@gmail.com,
	orsonzhai@gmail.com, robh+dt@kernel.org, mark.rutland@arm.com,
	arnd@arndb.de, olof@lixom.net
Cc: vincent.guittot@linaro.org, arm@kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 3/9] mmc: sdhci-sprd: Add optional gate clock support
Date: Mon, 3 Jun 2019 15:20:48 +0300	[thread overview]
Message-ID: <2969091b-408d-c505-d406-ce4b4f0679e0@intel.com> (raw)
In-Reply-To: <16b895cf30c235dc656eeed5888069b6266ab5f8.1558346019.git.baolin.wang@linaro.org>

On 20/05/19 1:11 PM, Baolin Wang wrote:
> For the Spreadtrum SC9860 platform, we should enable another gate clock
> '2x_enable' to make the SD host controller work well.
> 
> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci-sprd.c |   35 +++++++++++++++++++++++++++++------
>  1 file changed, 29 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c
> index e741491..31ba7d6 100644
> --- a/drivers/mmc/host/sdhci-sprd.c
> +++ b/drivers/mmc/host/sdhci-sprd.c
> @@ -60,6 +60,7 @@ struct sdhci_sprd_host {
>  	u32 version;
>  	struct clk *clk_sdio;
>  	struct clk *clk_enable;
> +	struct clk *clk_2x_enable;
>  	u32 base_rate;
>  	int flags; /* backup of host attribute */
>  };
> @@ -364,6 +365,10 @@ static int sdhci_sprd_probe(struct platform_device *pdev)
>  	}
>  	sprd_host->clk_enable = clk;
>  
> +	clk = devm_clk_get(&pdev->dev, "2x_enable");
> +	if (!IS_ERR(clk))
> +		sprd_host->clk_2x_enable = clk;
> +
>  	ret = clk_prepare_enable(sprd_host->clk_sdio);
>  	if (ret)
>  		goto pltfm_free;
> @@ -372,6 +377,10 @@ static int sdhci_sprd_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto clk_disable;
>  
> +	ret = clk_prepare_enable(sprd_host->clk_2x_enable);
> +	if (ret)
> +		goto clk_disable2;
> +
>  	sdhci_sprd_init_config(host);
>  	host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
>  	sprd_host->version = ((host->version & SDHCI_VENDOR_VER_MASK) >>
> @@ -408,6 +417,9 @@ static int sdhci_sprd_probe(struct platform_device *pdev)
>  	pm_runtime_disable(&pdev->dev);
>  	pm_runtime_set_suspended(&pdev->dev);
>  
> +	clk_disable_unprepare(sprd_host->clk_2x_enable);
> +
> +clk_disable2:
>  	clk_disable_unprepare(sprd_host->clk_enable);
>  
>  clk_disable:
> @@ -427,6 +439,7 @@ static int sdhci_sprd_remove(struct platform_device *pdev)
>  	mmc_remove_host(mmc);
>  	clk_disable_unprepare(sprd_host->clk_sdio);
>  	clk_disable_unprepare(sprd_host->clk_enable);
> +	clk_disable_unprepare(sprd_host->clk_2x_enable);
>  
>  	mmc_free_host(mmc);
>  
> @@ -449,6 +462,7 @@ static int sdhci_sprd_runtime_suspend(struct device *dev)
>  
>  	clk_disable_unprepare(sprd_host->clk_sdio);
>  	clk_disable_unprepare(sprd_host->clk_enable);
> +	clk_disable_unprepare(sprd_host->clk_2x_enable);
>  
>  	return 0;
>  }
> @@ -459,19 +473,28 @@ static int sdhci_sprd_runtime_resume(struct device *dev)
>  	struct sdhci_sprd_host *sprd_host = TO_SPRD_HOST(host);
>  	int ret;
>  
> -	ret = clk_prepare_enable(sprd_host->clk_enable);
> +	ret = clk_prepare_enable(sprd_host->clk_2x_enable);
>  	if (ret)
>  		return ret;
>  
> +	ret = clk_prepare_enable(sprd_host->clk_enable);
> +	if (ret)
> +		goto clk_2x_disable;
> +
>  	ret = clk_prepare_enable(sprd_host->clk_sdio);
> -	if (ret) {
> -		clk_disable_unprepare(sprd_host->clk_enable);
> -		return ret;
> -	}
> +	if (ret)
> +		goto clk_disable;
>  
>  	sdhci_runtime_resume_host(host);
> -
>  	return 0;
> +
> +clk_disable:
> +	clk_disable_unprepare(sprd_host->clk_enable);
> +
> +clk_2x_disable:
> +	clk_disable_unprepare(sprd_host->clk_2x_enable);
> +
> +	return ret;
>  }
>  #endif
>  
> 


  reply	other threads:[~2019-06-03 12:22 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-20 10:11 [PATCH 0/9] Add SD host controller support for SC9860 platform Baolin Wang
2019-05-20 10:11 ` [PATCH 1/9] mmc: sdhci-sprd: Check the enable clock's return value correctly Baolin Wang
2019-06-03 12:09   ` Adrian Hunter
2019-05-20 10:11 ` [PATCH 2/9] dt-bindings: mmc: sprd: Add another optional clock documentation Baolin Wang
2019-06-03 13:34   ` Ulf Hansson
2019-06-04  2:33     ` Baolin Wang
2019-06-04  6:52       ` Ulf Hansson
2019-05-20 10:11 ` [PATCH 3/9] mmc: sdhci-sprd: Add optional gate clock support Baolin Wang
2019-06-03 12:20   ` Adrian Hunter [this message]
2019-05-20 10:11 ` [PATCH 4/9] mmc: sdhci-sprd: Implement the get_max_timeout_count() interface Baolin Wang
2019-06-03 12:34   ` Adrian Hunter
2019-06-04  8:03     ` Baolin Wang
2019-05-20 10:11 ` [PATCH 5/9] mmc: sdhci-sprd: Add HS400 enhanced strobe mode Baolin Wang
2019-06-03 12:39   ` Adrian Hunter
2019-05-20 10:11 ` [PATCH 6/9] mmc: sdhci-sprd: Enable PHY DLL to make clock stable Baolin Wang
2019-06-03 12:40   ` Adrian Hunter
2019-05-20 10:12 ` [PATCH 7/9] dt-bindings: mmc: sprd: Add PHY DLL delay documentation Baolin Wang
2019-05-20 10:12 ` [PATCH 8/9] mmc: sdhci-sprd: Add PHY DLL delay configuration Baolin Wang
2019-06-03 13:01   ` Adrian Hunter
2019-06-04  2:18     ` Baolin Wang
2019-05-20 10:12 ` [PATCH 9/9] arm64: dts: sprd: Add Spreadtrum SD host controller support Baolin Wang
2019-06-03  8:41 ` [PATCH 0/9] Add SD host controller support for SC9860 platform Baolin Wang
2019-06-04  7:13   ` Ulf Hansson
2019-06-04  7:21     ` Baolin Wang

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=2969091b-408d-c505-d406-ce4b4f0679e0@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=arm@kernel.org \
    --cc=arnd@arndb.de \
    --cc=baolin.wang@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=olof@lixom.net \
    --cc=orsonzhai@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=ulf.hansson@linaro.org \
    --cc=vincent.guittot@linaro.org \
    --cc=zhang.lyra@gmail.com \
    --subject='Re: [PATCH 3/9] mmc: sdhci-sprd: Add optional gate clock support' \
    /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

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