linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] mmc: sdhci-bcm2835: Clean up platform allocations if sdhci init fails.
@ 2015-05-29 21:06 Eric Anholt
  2015-05-29 21:06 ` [PATCH v2 2/2] mmc: sdhci-bcm2835: Actually enable the clock Eric Anholt
  2015-06-01  8:05 ` [PATCH v2 1/2] mmc: sdhci-bcm2835: Clean up platform allocations if sdhci init fails Ulf Hansson
  0 siblings, 2 replies; 6+ messages in thread
From: Eric Anholt @ 2015-05-29 21:06 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-rpi-kernel, linux-kernel, Stephen Warren, Lee Jones,
	Ulf Hansson, linux-mmc, Eric Anholt

Signed-off-by: Eric Anholt <eric@anholt.net>
---
 drivers/mmc/host/sdhci-bcm2835.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-bcm2835.c b/drivers/mmc/host/sdhci-bcm2835.c
index 0ef0343..32f4046 100644
--- a/drivers/mmc/host/sdhci-bcm2835.c
+++ b/drivers/mmc/host/sdhci-bcm2835.c
@@ -173,8 +173,11 @@ static int bcm2835_sdhci_probe(struct platform_device *pdev)
 		goto err;
 	}
 
-	return sdhci_add_host(host);
+	ret = sdhci_add_host(host);
+	if (ret)
+		goto err;
 
+	return 0;
 err:
 	sdhci_pltfm_free(pdev);
 	return ret;
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] mmc: sdhci-bcm2835: Actually enable the clock
  2015-05-29 21:06 [PATCH v2 1/2] mmc: sdhci-bcm2835: Clean up platform allocations if sdhci init fails Eric Anholt
@ 2015-05-29 21:06 ` Eric Anholt
  2015-06-01  8:05   ` Ulf Hansson
  2015-06-05  2:59   ` Stephen Warren
  2015-06-01  8:05 ` [PATCH v2 1/2] mmc: sdhci-bcm2835: Clean up platform allocations if sdhci init fails Ulf Hansson
  1 sibling, 2 replies; 6+ messages in thread
From: Eric Anholt @ 2015-05-29 21:06 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-rpi-kernel, linux-kernel, Stephen Warren, Lee Jones,
	Ulf Hansson, linux-mmc, Eric Anholt

We're currently using a fixed frequency clock specified in the DT, so
enabling is a no-op.  However, the RPi firmware-based clocks driver
can actually disable unused clocks, so when switching to use it we
ended up losing our MMC clock once all devices were probed.

Signed-off-by: Eric Anholt <eric@anholt.net>
---

v2: Re-disable our clock on sdhci_add_host() failure.

 drivers/mmc/host/sdhci-bcm2835.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-bcm2835.c b/drivers/mmc/host/sdhci-bcm2835.c
index 32f4046..1c65d46 100644
--- a/drivers/mmc/host/sdhci-bcm2835.c
+++ b/drivers/mmc/host/sdhci-bcm2835.c
@@ -172,12 +172,19 @@ static int bcm2835_sdhci_probe(struct platform_device *pdev)
 		ret = PTR_ERR(pltfm_host->clk);
 		goto err;
 	}
+	ret = clk_prepare_enable(pltfm_host->clk);
+	if (ret) {
+		dev_err(&pdev->dev, "failed to enable host clk\n");
+		goto err;
+	}
 
 	ret = sdhci_add_host(host);
 	if (ret)
-		goto err;
+		goto err_clk;
 
 	return 0;
+err_clk:
+	clk_disable_unprepare(pltfm_host->clk);
 err:
 	sdhci_pltfm_free(pdev);
 	return ret;
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] mmc: sdhci-bcm2835: Clean up platform allocations if sdhci init fails.
  2015-05-29 21:06 [PATCH v2 1/2] mmc: sdhci-bcm2835: Clean up platform allocations if sdhci init fails Eric Anholt
  2015-05-29 21:06 ` [PATCH v2 2/2] mmc: sdhci-bcm2835: Actually enable the clock Eric Anholt
@ 2015-06-01  8:05 ` Ulf Hansson
  1 sibling, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2015-06-01  8:05 UTC (permalink / raw)
  To: Eric Anholt
  Cc: linux-arm-kernel, linux-rpi-kernel, linux-kernel, Stephen Warren,
	Lee Jones, linux-mmc

On 29 May 2015 at 23:06, Eric Anholt <eric@anholt.net> wrote:
> Signed-off-by: Eric Anholt <eric@anholt.net>

Thanks, applied!

Kind regards
Uffe

> ---
>  drivers/mmc/host/sdhci-bcm2835.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-bcm2835.c b/drivers/mmc/host/sdhci-bcm2835.c
> index 0ef0343..32f4046 100644
> --- a/drivers/mmc/host/sdhci-bcm2835.c
> +++ b/drivers/mmc/host/sdhci-bcm2835.c
> @@ -173,8 +173,11 @@ static int bcm2835_sdhci_probe(struct platform_device *pdev)
>                 goto err;
>         }
>
> -       return sdhci_add_host(host);
> +       ret = sdhci_add_host(host);
> +       if (ret)
> +               goto err;
>
> +       return 0;
>  err:
>         sdhci_pltfm_free(pdev);
>         return ret;
> --
> 2.1.4
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] mmc: sdhci-bcm2835: Actually enable the clock
  2015-05-29 21:06 ` [PATCH v2 2/2] mmc: sdhci-bcm2835: Actually enable the clock Eric Anholt
@ 2015-06-01  8:05   ` Ulf Hansson
  2015-06-05  2:59   ` Stephen Warren
  1 sibling, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2015-06-01  8:05 UTC (permalink / raw)
  To: Eric Anholt
  Cc: linux-arm-kernel, linux-rpi-kernel, linux-kernel, Stephen Warren,
	Lee Jones, linux-mmc

On 29 May 2015 at 23:06, Eric Anholt <eric@anholt.net> wrote:
> We're currently using a fixed frequency clock specified in the DT, so
> enabling is a no-op.  However, the RPi firmware-based clocks driver
> can actually disable unused clocks, so when switching to use it we
> ended up losing our MMC clock once all devices were probed.
>
> Signed-off-by: Eric Anholt <eric@anholt.net>

Thanks, applied!

Kind regards
Uffe


> ---
>
> v2: Re-disable our clock on sdhci_add_host() failure.
>
>  drivers/mmc/host/sdhci-bcm2835.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-bcm2835.c b/drivers/mmc/host/sdhci-bcm2835.c
> index 32f4046..1c65d46 100644
> --- a/drivers/mmc/host/sdhci-bcm2835.c
> +++ b/drivers/mmc/host/sdhci-bcm2835.c
> @@ -172,12 +172,19 @@ static int bcm2835_sdhci_probe(struct platform_device *pdev)
>                 ret = PTR_ERR(pltfm_host->clk);
>                 goto err;
>         }
> +       ret = clk_prepare_enable(pltfm_host->clk);
> +       if (ret) {
> +               dev_err(&pdev->dev, "failed to enable host clk\n");
> +               goto err;
> +       }
>
>         ret = sdhci_add_host(host);
>         if (ret)
> -               goto err;
> +               goto err_clk;
>
>         return 0;
> +err_clk:
> +       clk_disable_unprepare(pltfm_host->clk);
>  err:
>         sdhci_pltfm_free(pdev);
>         return ret;
> --
> 2.1.4
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] mmc: sdhci-bcm2835: Actually enable the clock
  2015-05-29 21:06 ` [PATCH v2 2/2] mmc: sdhci-bcm2835: Actually enable the clock Eric Anholt
  2015-06-01  8:05   ` Ulf Hansson
@ 2015-06-05  2:59   ` Stephen Warren
  2015-06-05  8:48     ` Ulf Hansson
  1 sibling, 1 reply; 6+ messages in thread
From: Stephen Warren @ 2015-06-05  2:59 UTC (permalink / raw)
  To: Eric Anholt, Ulf Hansson
  Cc: linux-arm-kernel, linux-rpi-kernel, linux-kernel, Lee Jones, linux-mmc

On 05/29/2015 03:06 PM, Eric Anholt wrote:
> We're currently using a fixed frequency clock specified in the DT, so
> enabling is a no-op.  However, the RPi firmware-based clocks driver
> can actually disable unused clocks, so when switching to use it we
> ended up losing our MMC clock once all devices were probed.

> diff --git a/drivers/mmc/host/sdhci-bcm2835.c b/drivers/mmc/host/sdhci-bcm2835.c

> +	ret = clk_prepare_enable(pltfm_host->clk);
> +	if (ret) {
> +		dev_err(&pdev->dev, "failed to enable host clk\n");
> +		goto err;
> +	}

Given that pltfm_host is a "struct sdhci_pltfm_host" i.e. a type
defined/handled by sdhci-pltfm.c , I'm rather surprised that
sdhci-pltfm.c doesn't do this itself. Wouldn't it make sense for it to
do so?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] mmc: sdhci-bcm2835: Actually enable the clock
  2015-06-05  2:59   ` Stephen Warren
@ 2015-06-05  8:48     ` Ulf Hansson
  0 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2015-06-05  8:48 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Eric Anholt, linux-arm-kernel, linux-rpi-kernel, linux-kernel,
	Lee Jones, linux-mmc

On 5 June 2015 at 04:59, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 05/29/2015 03:06 PM, Eric Anholt wrote:
>> We're currently using a fixed frequency clock specified in the DT, so
>> enabling is a no-op.  However, the RPi firmware-based clocks driver
>> can actually disable unused clocks, so when switching to use it we
>> ended up losing our MMC clock once all devices were probed.
>
>> diff --git a/drivers/mmc/host/sdhci-bcm2835.c b/drivers/mmc/host/sdhci-bcm2835.c
>
>> +     ret = clk_prepare_enable(pltfm_host->clk);
>> +     if (ret) {
>> +             dev_err(&pdev->dev, "failed to enable host clk\n");
>> +             goto err;
>> +     }
>
> Given that pltfm_host is a "struct sdhci_pltfm_host" i.e. a type
> defined/handled by sdhci-pltfm.c , I'm rather surprised that
> sdhci-pltfm.c doesn't do this itself. Wouldn't it make sense for it to
> do so?

We could likely move additional clock management into the sdhci-pltfm.
So we would then remove some duplicated code, but we would potentially
also loose some in flexibility. It's worth an effort to look into.

Please go ahead and have a try. :-)

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-06-05  8:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-29 21:06 [PATCH v2 1/2] mmc: sdhci-bcm2835: Clean up platform allocations if sdhci init fails Eric Anholt
2015-05-29 21:06 ` [PATCH v2 2/2] mmc: sdhci-bcm2835: Actually enable the clock Eric Anholt
2015-06-01  8:05   ` Ulf Hansson
2015-06-05  2:59   ` Stephen Warren
2015-06-05  8:48     ` Ulf Hansson
2015-06-01  8:05 ` [PATCH v2 1/2] mmc: sdhci-bcm2835: Clean up platform allocations if sdhci init fails Ulf Hansson

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