public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Gregory CLEMENT <gregory.clement@free-electrons.com>
To: Adrian Hunter <adrian.hunter@intel.com>,
	Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc@vger.kernel.org, "Jason Cooper" <jason@lakedaemon.net>,
	"Andrew Lunn" <andrew@lunn.ch>,
	"Sebastian Hesselbarth" <sebastian.hesselbarth@gmail.com>,
	"Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>,
	linux-arm-kernel@lists.infradead.org,
	"Antoine Tenart" <antoine.tenart@free-electrons.com>,
	"Miquèl Raynal" <miquel.raynal@free-electrons.com>,
	"Nadav Haklai" <nadavh@marvell.com>,
	"Shadi Ammouri" <shadi@marvell.com>,
	"Yehuda Yitschak" <yehuday@marvell.com>,
	"Omri Itach" <omrii@marvell.com>,
	"Hanna Hawa" <hannah@marvell.com>,
	"Igal Liberman" <igall@marvell.com>,
	"Marcin Wojtas" <mw@semihalf.com>,
	Stable <stable@vger.kernel.org>
Subject: Re: [PATCH] mmc: sdhci-xenon: Fix clock resource by adding an optional bus clock
Date: Thu, 28 Sep 2017 17:57:41 +0200	[thread overview]
Message-ID: <87o9puhl3e.fsf@free-electrons.com> (raw)
In-Reply-To: <20170928150520.27616-1-gregory.clement@free-electrons.com> (Gregory CLEMENT's message of "Thu, 28 Sep 2017 17:05:20 +0200")

Hi,
 
 On jeu., sept. 28 2017, Gregory CLEMENT <gregory.clement@free-electrons.com> wrote:

> diff --git a/drivers/mmc/host/sdhci-xenon.c b/drivers/mmc/host/sdhci-xenon.c
> index 2eec2e652c53..845575593b59 100644
> --- a/drivers/mmc/host/sdhci-xenon.c
> +++ b/drivers/mmc/host/sdhci-xenon.c
> @@ -466,6 +466,7 @@ static int xenon_probe(struct platform_device *pdev)
>  {
>  	struct sdhci_pltfm_host *pltfm_host;
>  	struct sdhci_host *host;
> +	struct xenon_priv *priv;
>  	int err;
>  
>  	host = sdhci_pltfm_init(pdev, &sdhci_xenon_pdata,
> @@ -474,6 +475,7 @@ static int xenon_probe(struct platform_device *pdev)
>  		return PTR_ERR(host);
>  
>  	pltfm_host = sdhci_priv(host);
> +	priv = sdhci_pltfm_priv(pltfm_host);
>  
>  	/*
>  	 * Link Xenon specific mmc_host_ops function,
> @@ -491,9 +493,20 @@ static int xenon_probe(struct platform_device *pdev)
>  	if (err)
>  		goto free_pltfm;
>  
> +	priv->axi_clk = devm_clk_get(&pdev->dev, "axi");
> +	if (IS_ERR(priv->axi_clk)) {
> +		err = PTR_ERR(priv->axi_clk);
> +		dev_err(&pdev->dev, "Failed to setup axi clk: %d\n", err);

I should manage the -EPROBE_DEFER case here. So a v2 of this patch is
coming soon.

Sorry to not have seen this before sending the patch.

Gregory

> +		priv->axi_clk = NULL;
> +	} else {
> +		err = clk_prepare_enable(priv->axi_clk);
> +		if (err)
> +			goto err_clk;
> +	}
> +
>  	err = mmc_of_parse(host->mmc);
>  	if (err)
> -		goto err_clk;
> +		goto err_clk_axi;
>  
>  	sdhci_get_of_property(pdev);
>  
> @@ -502,11 +515,11 @@ static int xenon_probe(struct platform_device *pdev)
>  	/* Xenon specific dt parse */
>  	err = xenon_probe_dt(pdev);
>  	if (err)
> -		goto err_clk;
> +		goto err_clk_axi;
>  
>  	err = xenon_sdhc_prepare(host);
>  	if (err)
> -		goto err_clk;
> +		goto err_clk_axi;
>  
>  	pm_runtime_get_noresume(&pdev->dev);
>  	pm_runtime_set_active(&pdev->dev);
> @@ -527,6 +540,9 @@ static int xenon_probe(struct platform_device *pdev)
>  	pm_runtime_disable(&pdev->dev);
>  	pm_runtime_put_noidle(&pdev->dev);
>  	xenon_sdhc_unprepare(host);
> +err_clk_axi:
> +	if (priv->axi_clk)
> +		clk_disable_unprepare(priv->axi_clk);
>  err_clk:
>  	clk_disable_unprepare(pltfm_host->clk);
>  free_pltfm:
> @@ -538,6 +554,7 @@ static int xenon_remove(struct platform_device *pdev)
>  {
>  	struct sdhci_host *host = platform_get_drvdata(pdev);
>  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +	struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host);
>  
>  	pm_runtime_get_sync(&pdev->dev);
>  	pm_runtime_disable(&pdev->dev);
> @@ -546,6 +563,8 @@ static int xenon_remove(struct platform_device *pdev)
>  	sdhci_remove_host(host, 0);
>  
>  	xenon_sdhc_unprepare(host);
> +	if (priv->axi_clk)
> +		clk_disable_unprepare(priv->axi_clk);
>  
>  	clk_disable_unprepare(pltfm_host->clk);
>  
> diff --git a/drivers/mmc/host/sdhci-xenon.h b/drivers/mmc/host/sdhci-xenon.h
> index 2bc0510c0769..9994995c7c56 100644
> --- a/drivers/mmc/host/sdhci-xenon.h
> +++ b/drivers/mmc/host/sdhci-xenon.h
> @@ -83,6 +83,7 @@ struct xenon_priv {
>  	unsigned char	bus_width;
>  	unsigned char	timing;
>  	unsigned int	clock;
> +	struct clk      *axi_clk;
>  
>  	int		phy_type;
>  	/*
> -- 
> 2.14.1
>

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

  reply	other threads:[~2017-09-28 15:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-28 15:05 [PATCH] mmc: sdhci-xenon: Fix clock resource by adding an optional bus clock Gregory CLEMENT
2017-09-28 15:57 ` Gregory CLEMENT [this message]
2017-09-29  2:39 ` Jisheng Zhang
     [not found]   ` <20170929103943.3a6f2509-XW7BGIvHH6X931TTwiNRCw@public.gmane.org>
2017-09-29  9:13     ` Gregory CLEMENT
2017-09-29  9:15       ` Thomas Petazzoni
     [not found]         ` <20170929111550.065e7948-dFHcqWZE4nf+AlalS6MPSg@public.gmane.org>
2017-09-29  9:22           ` Gregory CLEMENT
2017-09-30  2:47 ` Ziji Hu
2017-09-30  2:56   ` Jisheng Zhang

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=87o9puhl3e.fsf@free-electrons.com \
    --to=gregory.clement@free-electrons.com \
    --cc=adrian.hunter@intel.com \
    --cc=andrew@lunn.ch \
    --cc=antoine.tenart@free-electrons.com \
    --cc=hannah@marvell.com \
    --cc=igall@marvell.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=miquel.raynal@free-electrons.com \
    --cc=mw@semihalf.com \
    --cc=nadavh@marvell.com \
    --cc=omrii@marvell.com \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=shadi@marvell.com \
    --cc=stable@vger.kernel.org \
    --cc=thomas.petazzoni@free-electrons.com \
    --cc=ulf.hansson@linaro.org \
    --cc=yehuday@marvell.com \
    /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