diff mbox

[RESEND,06/12] mmc: sdhci-pxav3: Move I/O clock to private data

Message ID 1413883364-681-7-git-send-email-sebastian.hesselbarth@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sebastian Hesselbarth Oct. 21, 2014, 9:22 a.m. UTC
As we are using references to the I/O clock throughout the driver,
move it to the private data. Also, in preparation for core clock,
rename it to clk_io.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: Chris Ball <chris@printf.net>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: "Antoine Ténart" <antoine.tenart@free-electrons.com>
Cc: linux-mmc@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/mmc/host/sdhci-pxav3.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

Comments

Ulf Hansson Oct. 27, 2014, 1:28 p.m. UTC | #1
On 21 October 2014 11:22, Sebastian Hesselbarth
<sebastian.hesselbarth@gmail.com> wrote:
> As we are using references to the I/O clock throughout the driver,
> move it to the private data. Also, in preparation for core clock,
> rename it to clk_io.
>
> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> ---
> Cc: Chris Ball <chris@printf.net>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Cc: "Antoine Ténart" <antoine.tenart@free-electrons.com>
> Cc: linux-mmc@vger.kernel.org
> Cc: devicetree@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> ---
>  drivers/mmc/host/sdhci-pxav3.c | 24 +++++++++++++-----------
>  1 file changed, 13 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
> index e52bbbb09d88..a34a589670e6 100644
> --- a/drivers/mmc/host/sdhci-pxav3.c
> +++ b/drivers/mmc/host/sdhci-pxav3.c
> @@ -59,6 +59,7 @@
>  #define SDCE_MISC_INT_EN       (1<<1)
>
>  struct sdhci_pxa {
> +       struct clk *clk_io;
>         u8      power_mode;
>  };
>
> @@ -288,9 +289,7 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
>         struct sdhci_host *host = NULL;
>         struct sdhci_pxa *pxa = NULL;
>         const struct of_device_id *match;
> -
>         int ret;
> -       struct clk *clk;
>
>         pxa = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_pxa), GFP_KERNEL);
>         if (!pxa)
> @@ -310,14 +309,14 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
>         pltfm_host = sdhci_priv(host);
>         pltfm_host->priv = pxa;
>
> -       clk = devm_clk_get(dev, NULL);
> -       if (IS_ERR(clk)) {
> +       pxa->clk_io = devm_clk_get(dev, NULL);
> +       if (IS_ERR(pxa->clk_io)) {
>                 dev_err(dev, "failed to get io clock\n");
> -               ret = PTR_ERR(clk);
> +               ret = PTR_ERR(pxa->clk_io);
>                 goto err_clk_get;
>         }
> -       pltfm_host->clk = clk;
> -       clk_prepare_enable(clk);
> +       pltfm_host->clk = pxa->clk_io;

Is the above still needed?

> +       clk_prepare_enable(pxa->clk_io);
>
>         /* enable 1/8V DDR capable */
>         host->mmc->caps |= MMC_CAP_1_8V_DDR;
> @@ -390,7 +389,7 @@ err_add_host:
>         pm_runtime_disable(&pdev->dev);
>  err_of_parse:
>  err_cd_req:
> -       clk_disable_unprepare(clk);
> +       clk_disable_unprepare(pxa->clk_io);
>  err_clk_get:
>  err_mbus_win:
>         sdhci_pltfm_free(pdev);
> @@ -401,12 +400,13 @@ static int sdhci_pxav3_remove(struct platform_device *pdev)
>  {
>         struct sdhci_host *host = platform_get_drvdata(pdev);
>         struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +       struct sdhci_pxa *pxa = pltfm_host->priv;
>
>         pm_runtime_get_sync(&pdev->dev);
>         sdhci_remove_host(host, 1);
>         pm_runtime_disable(&pdev->dev);
>
> -       clk_disable_unprepare(pltfm_host->clk);
> +       clk_disable_unprepare(pxa->clk_io);
>
>         sdhci_pltfm_free(pdev);
>
> @@ -446,13 +446,14 @@ static int sdhci_pxav3_runtime_suspend(struct device *dev)
>  {
>         struct sdhci_host *host = dev_get_drvdata(dev);
>         struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +       struct sdhci_pxa *pxa = pltfm_host->priv;
>         unsigned long flags;
>
>         spin_lock_irqsave(&host->lock, flags);
>         host->runtime_suspended = true;
>         spin_unlock_irqrestore(&host->lock, flags);
>
> -       clk_disable_unprepare(pltfm_host->clk);
> +       clk_disable_unprepare(pxa->clk_io);
>
>         return 0;
>  }
> @@ -461,9 +462,10 @@ static int sdhci_pxav3_runtime_resume(struct device *dev)
>  {
>         struct sdhci_host *host = dev_get_drvdata(dev);
>         struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +       struct sdhci_pxa *pxa = pltfm_host->priv;
>         unsigned long flags;
>
> -       clk_prepare_enable(pltfm_host->clk);
> +       clk_prepare_enable(pxa->clk_io);
>
>         spin_lock_irqsave(&host->lock, flags);
>         host->runtime_suspended = false;
> --
> 2.1.1
>

Kind regards
Uffe
Sebastian Hesselbarth Oct. 27, 2014, 6:15 p.m. UTC | #2
On 10/27/2014 02:28 PM, Ulf Hansson wrote:
> On 21 October 2014 11:22, Sebastian Hesselbarth
> <sebastian.hesselbarth@gmail.com> wrote:
>> As we are using references to the I/O clock throughout the driver,
>> move it to the private data. Also, in preparation for core clock,
>> rename it to clk_io.
>>
>> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
>> ---
>> Cc: Chris Ball <chris@printf.net>
>> Cc: Ulf Hansson <ulf.hansson@linaro.org>
>> Cc: "Antoine Ténart" <antoine.tenart@free-electrons.com>
>> Cc: linux-mmc@vger.kernel.org
>> Cc: devicetree@vger.kernel.org
>> Cc: linux-arm-kernel@lists.infradead.org
>> Cc: linux-kernel@vger.kernel.org
>> ---
>>   drivers/mmc/host/sdhci-pxav3.c | 24 +++++++++++++-----------
>>   1 file changed, 13 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
>> index e52bbbb09d88..a34a589670e6 100644
>> --- a/drivers/mmc/host/sdhci-pxav3.c
>> +++ b/drivers/mmc/host/sdhci-pxav3.c
>> @@ -59,6 +59,7 @@
>>   #define SDCE_MISC_INT_EN       (1<<1)
>>
>>   struct sdhci_pxa {
>> +       struct clk *clk_io;
>>          u8      power_mode;
>>   };
>>
>> @@ -288,9 +289,7 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
>>          struct sdhci_host *host = NULL;
>>          struct sdhci_pxa *pxa = NULL;
>>          const struct of_device_id *match;
>> -
>>          int ret;
>> -       struct clk *clk;
>>
>>          pxa = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_pxa), GFP_KERNEL);
>>          if (!pxa)
>> @@ -310,14 +309,14 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
>>          pltfm_host = sdhci_priv(host);
>>          pltfm_host->priv = pxa;
>>
>> -       clk = devm_clk_get(dev, NULL);
>> -       if (IS_ERR(clk)) {
>> +       pxa->clk_io = devm_clk_get(dev, NULL);
>> +       if (IS_ERR(pxa->clk_io)) {
>>                  dev_err(dev, "failed to get io clock\n");
>> -               ret = PTR_ERR(clk);
>> +               ret = PTR_ERR(pxa->clk_io);
>>                  goto err_clk_get;
>>          }
>> -       pltfm_host->clk = clk;
>> -       clk_prepare_enable(clk);
>> +       pltfm_host->clk = pxa->clk_io;
>
> Is the above still needed?
>
>> +       clk_prepare_enable(pxa->clk_io);

Ulf,

I guess it is. It sets sdhci_pltfm_host's clk field which is used
by sdhci-pltfm.c to e.g. determine sdhci clock rate.

Sebastian
Ulf Hansson Oct. 28, 2014, 9:52 a.m. UTC | #3
On 21 October 2014 11:22, Sebastian Hesselbarth
<sebastian.hesselbarth@gmail.com> wrote:
> As we are using references to the I/O clock throughout the driver,
> move it to the private data. Also, in preparation for core clock,
> rename it to clk_io.
>
> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> ---
> Cc: Chris Ball <chris@printf.net>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Cc: "Antoine Ténart" <antoine.tenart@free-electrons.com>
> Cc: linux-mmc@vger.kernel.org
> Cc: devicetree@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org

Thanks! Applied for next!

Kind regards
Uffe

> ---
>  drivers/mmc/host/sdhci-pxav3.c | 24 +++++++++++++-----------
>  1 file changed, 13 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
> index e52bbbb09d88..a34a589670e6 100644
> --- a/drivers/mmc/host/sdhci-pxav3.c
> +++ b/drivers/mmc/host/sdhci-pxav3.c
> @@ -59,6 +59,7 @@
>  #define SDCE_MISC_INT_EN       (1<<1)
>
>  struct sdhci_pxa {
> +       struct clk *clk_io;
>         u8      power_mode;
>  };
>
> @@ -288,9 +289,7 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
>         struct sdhci_host *host = NULL;
>         struct sdhci_pxa *pxa = NULL;
>         const struct of_device_id *match;
> -
>         int ret;
> -       struct clk *clk;
>
>         pxa = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_pxa), GFP_KERNEL);
>         if (!pxa)
> @@ -310,14 +309,14 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
>         pltfm_host = sdhci_priv(host);
>         pltfm_host->priv = pxa;
>
> -       clk = devm_clk_get(dev, NULL);
> -       if (IS_ERR(clk)) {
> +       pxa->clk_io = devm_clk_get(dev, NULL);
> +       if (IS_ERR(pxa->clk_io)) {
>                 dev_err(dev, "failed to get io clock\n");
> -               ret = PTR_ERR(clk);
> +               ret = PTR_ERR(pxa->clk_io);
>                 goto err_clk_get;
>         }
> -       pltfm_host->clk = clk;
> -       clk_prepare_enable(clk);
> +       pltfm_host->clk = pxa->clk_io;
> +       clk_prepare_enable(pxa->clk_io);
>
>         /* enable 1/8V DDR capable */
>         host->mmc->caps |= MMC_CAP_1_8V_DDR;
> @@ -390,7 +389,7 @@ err_add_host:
>         pm_runtime_disable(&pdev->dev);
>  err_of_parse:
>  err_cd_req:
> -       clk_disable_unprepare(clk);
> +       clk_disable_unprepare(pxa->clk_io);
>  err_clk_get:
>  err_mbus_win:
>         sdhci_pltfm_free(pdev);
> @@ -401,12 +400,13 @@ static int sdhci_pxav3_remove(struct platform_device *pdev)
>  {
>         struct sdhci_host *host = platform_get_drvdata(pdev);
>         struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +       struct sdhci_pxa *pxa = pltfm_host->priv;
>
>         pm_runtime_get_sync(&pdev->dev);
>         sdhci_remove_host(host, 1);
>         pm_runtime_disable(&pdev->dev);
>
> -       clk_disable_unprepare(pltfm_host->clk);
> +       clk_disable_unprepare(pxa->clk_io);
>
>         sdhci_pltfm_free(pdev);
>
> @@ -446,13 +446,14 @@ static int sdhci_pxav3_runtime_suspend(struct device *dev)
>  {
>         struct sdhci_host *host = dev_get_drvdata(dev);
>         struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +       struct sdhci_pxa *pxa = pltfm_host->priv;
>         unsigned long flags;
>
>         spin_lock_irqsave(&host->lock, flags);
>         host->runtime_suspended = true;
>         spin_unlock_irqrestore(&host->lock, flags);
>
> -       clk_disable_unprepare(pltfm_host->clk);
> +       clk_disable_unprepare(pxa->clk_io);
>
>         return 0;
>  }
> @@ -461,9 +462,10 @@ static int sdhci_pxav3_runtime_resume(struct device *dev)
>  {
>         struct sdhci_host *host = dev_get_drvdata(dev);
>         struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +       struct sdhci_pxa *pxa = pltfm_host->priv;
>         unsigned long flags;
>
> -       clk_prepare_enable(pltfm_host->clk);
> +       clk_prepare_enable(pxa->clk_io);
>
>         spin_lock_irqsave(&host->lock, flags);
>         host->runtime_suspended = false;
> --
> 2.1.1
>
diff mbox

Patch

diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index e52bbbb09d88..a34a589670e6 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -59,6 +59,7 @@ 
 #define SDCE_MISC_INT_EN	(1<<1)
 
 struct sdhci_pxa {
+	struct clk *clk_io;
 	u8	power_mode;
 };
 
@@ -288,9 +289,7 @@  static int sdhci_pxav3_probe(struct platform_device *pdev)
 	struct sdhci_host *host = NULL;
 	struct sdhci_pxa *pxa = NULL;
 	const struct of_device_id *match;
-
 	int ret;
-	struct clk *clk;
 
 	pxa = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_pxa), GFP_KERNEL);
 	if (!pxa)
@@ -310,14 +309,14 @@  static int sdhci_pxav3_probe(struct platform_device *pdev)
 	pltfm_host = sdhci_priv(host);
 	pltfm_host->priv = pxa;
 
-	clk = devm_clk_get(dev, NULL);
-	if (IS_ERR(clk)) {
+	pxa->clk_io = devm_clk_get(dev, NULL);
+	if (IS_ERR(pxa->clk_io)) {
 		dev_err(dev, "failed to get io clock\n");
-		ret = PTR_ERR(clk);
+		ret = PTR_ERR(pxa->clk_io);
 		goto err_clk_get;
 	}
-	pltfm_host->clk = clk;
-	clk_prepare_enable(clk);
+	pltfm_host->clk = pxa->clk_io;
+	clk_prepare_enable(pxa->clk_io);
 
 	/* enable 1/8V DDR capable */
 	host->mmc->caps |= MMC_CAP_1_8V_DDR;
@@ -390,7 +389,7 @@  err_add_host:
 	pm_runtime_disable(&pdev->dev);
 err_of_parse:
 err_cd_req:
-	clk_disable_unprepare(clk);
+	clk_disable_unprepare(pxa->clk_io);
 err_clk_get:
 err_mbus_win:
 	sdhci_pltfm_free(pdev);
@@ -401,12 +400,13 @@  static int sdhci_pxav3_remove(struct platform_device *pdev)
 {
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+	struct sdhci_pxa *pxa = pltfm_host->priv;
 
 	pm_runtime_get_sync(&pdev->dev);
 	sdhci_remove_host(host, 1);
 	pm_runtime_disable(&pdev->dev);
 
-	clk_disable_unprepare(pltfm_host->clk);
+	clk_disable_unprepare(pxa->clk_io);
 
 	sdhci_pltfm_free(pdev);
 
@@ -446,13 +446,14 @@  static int sdhci_pxav3_runtime_suspend(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+	struct sdhci_pxa *pxa = pltfm_host->priv;
 	unsigned long flags;
 
 	spin_lock_irqsave(&host->lock, flags);
 	host->runtime_suspended = true;
 	spin_unlock_irqrestore(&host->lock, flags);
 
-	clk_disable_unprepare(pltfm_host->clk);
+	clk_disable_unprepare(pxa->clk_io);
 
 	return 0;
 }
@@ -461,9 +462,10 @@  static int sdhci_pxav3_runtime_resume(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+	struct sdhci_pxa *pxa = pltfm_host->priv;
 	unsigned long flags;
 
-	clk_prepare_enable(pltfm_host->clk);
+	clk_prepare_enable(pxa->clk_io);
 
 	spin_lock_irqsave(&host->lock, flags);
 	host->runtime_suspended = false;