public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Add PM_RUNTIME related fixes for PL330
@ 2011-12-06 10:45 Tushar Behera
  2011-12-06 10:45 ` [PATCH 1/2] DMA: PL330: Remove pm_runtime_xxx calls from pl330 probe/remove Tushar Behera
  2011-12-06 10:45 ` [PATCH 2/2] ARM: EXYNOS: Add apb_pclk clkdev entry for mdma1 Tushar Behera
  0 siblings, 2 replies; 10+ messages in thread
From: Tushar Behera @ 2011-12-06 10:45 UTC (permalink / raw)
  To: linux-samsung-soc, linux-kernel
  Cc: kgene.kim, vinod.koul, linaro-dev, patches

Hi,

When PM_RUNTIME is enabled, PL330 probe fails because of some
mismatch in pm_runtime calls. This patchset fixes those issues.

This patch is based on Kukjin's for-next branch and tested on
EXYNOS4 based Origen board.

d3d936c "Merge branch 'samsung-fixes-2' into for-next"

Tushar Behera (2):
To Vinod Koul <vinod.koul@intel.com>:
  DMA: PL330: Remove pm_runtime_xxx calls from pl330 probe/remove

To Kukjin Kim <kgene.kim@samsung.com>:
  ARM: EXYNOS: Add apb_pclk clkdev entry for mdma1

 arch/arm/mach-exynos/clock.c |    1 +
 drivers/dma/pl330.c          |   17 ++---------------
 2 files changed, 3 insertions(+), 15 deletions(-)

-- 
1.7.4.1


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

* [PATCH 1/2] DMA: PL330: Remove pm_runtime_xxx calls from pl330 probe/remove
  2011-12-06 10:45 [PATCH 0/2] Add PM_RUNTIME related fixes for PL330 Tushar Behera
@ 2011-12-06 10:45 ` Tushar Behera
  2011-12-08  7:35   ` Vinod Koul
  2011-12-06 10:45 ` [PATCH 2/2] ARM: EXYNOS: Add apb_pclk clkdev entry for mdma1 Tushar Behera
  1 sibling, 1 reply; 10+ messages in thread
From: Tushar Behera @ 2011-12-06 10:45 UTC (permalink / raw)
  To: linux-samsung-soc, linux-kernel
  Cc: kgene.kim, vinod.koul, linaro-dev, patches

amba_probe() now calls pm_runtime_get_noresume() and pm_runtime_enable()
for the devices before the device probe is called. Hence we don't need
to call pm_runtime_get_xxx and pm_runtime_enable() in device probe again.
In the same way, since amba_remove() calls the respective pm_runtime
functions, those functions need not be called from device remove.

This patch fixes following run time error with pl330 driver.

dma-pl330 dma-pl330.0: Unbalanced pm_runtime_enable!
dma-pl330 dma-pl330.0: failed to get runtime pm

Signed-off-by: Giridhar Maruthy <giridhar.maruthy@linaro.org>
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 drivers/dma/pl330.c |   17 ++---------------
 1 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index a626e15..cd07121 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -834,17 +834,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
 
 	amba_set_drvdata(adev, pdmac);
 
-#ifdef CONFIG_PM_RUNTIME
-	/* to use the runtime PM helper functions */
-	pm_runtime_enable(&adev->dev);
-
-	/* enable the power domain */
-	if (pm_runtime_get_sync(&adev->dev)) {
-		dev_err(&adev->dev, "failed to get runtime pm\n");
-		ret = -ENODEV;
-		goto probe_err1;
-	}
-#else
+#ifndef CONFIG_PM_RUNTIME
 	/* enable dma clk */
 	clk_enable(pdmac->clk);
 #endif
@@ -977,10 +967,7 @@ static int __devexit pl330_remove(struct amba_device *adev)
 	res = &adev->res;
 	release_mem_region(res->start, resource_size(res));
 
-#ifdef CONFIG_PM_RUNTIME
-	pm_runtime_put(&adev->dev);
-	pm_runtime_disable(&adev->dev);
-#else
+#ifndef CONFIG_PM_RUNTIME
 	clk_disable(pdmac->clk);
 #endif
 
-- 
1.7.4.1


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

* [PATCH 2/2] ARM: EXYNOS: Add apb_pclk clkdev entry for mdma1
  2011-12-06 10:45 [PATCH 0/2] Add PM_RUNTIME related fixes for PL330 Tushar Behera
  2011-12-06 10:45 ` [PATCH 1/2] DMA: PL330: Remove pm_runtime_xxx calls from pl330 probe/remove Tushar Behera
@ 2011-12-06 10:45 ` Tushar Behera
  2011-12-08  7:43   ` Kukjin Kim
  1 sibling, 1 reply; 10+ messages in thread
From: Tushar Behera @ 2011-12-06 10:45 UTC (permalink / raw)
  To: linux-samsung-soc, linux-kernel
  Cc: kgene.kim, vinod.koul, linaro-dev, patches

Amba core assumes the pclk to be named as apb_pclk. During device probe,
it tries to get that clock and enable that. When PM_RUNTIME is enabled,
dma clock is not explicitly enabled in pl330_probe, which causes device
probe to fail. Adding a clkdev entry for apb_pclk for mdma1 fixes the
problem.

This patch fixes following runtime error.

dma-pl330 dma-pl330.2: PERIPH_ID 0x0, PCELL_ID 0x0 !
dma-pl330: probe of dma-pl330.2 failed with error -22

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 arch/arm/mach-exynos/clock.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos/clock.c b/arch/arm/mach-exynos/clock.c
index 28e2842..eb33a7a 100644
--- a/arch/arm/mach-exynos/clock.c
+++ b/arch/arm/mach-exynos/clock.c
@@ -1326,6 +1326,7 @@ static struct clk_lookup exynos4_clk_lookup[] = {
 	CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &clk_sclk_mmc3.clk),
 	CLKDEV_INIT("dma-pl330.0", "apb_pclk", &clk_pdma0),
 	CLKDEV_INIT("dma-pl330.1", "apb_pclk", &clk_pdma1),
+	CLKDEV_INIT("dma-pl330.2", "apb_pclk", &clk_mdma1),
 };
 
 static int xtal_rate;
-- 
1.7.4.1


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

* Re: [PATCH 1/2] DMA: PL330: Remove pm_runtime_xxx calls from pl330 probe/remove
  2011-12-06 10:45 ` [PATCH 1/2] DMA: PL330: Remove pm_runtime_xxx calls from pl330 probe/remove Tushar Behera
@ 2011-12-08  7:35   ` Vinod Koul
  2011-12-08  7:43     ` Kukjin Kim
  0 siblings, 1 reply; 10+ messages in thread
From: Vinod Koul @ 2011-12-08  7:35 UTC (permalink / raw)
  To: Tushar Behera
  Cc: linux-samsung-soc, linux-kernel, kgene.kim, linaro-dev, patches

On Tue, 2011-12-06 at 16:15 +0530, Tushar Behera wrote:
> amba_probe() now calls pm_runtime_get_noresume() and pm_runtime_enable()
> for the devices before the device probe is called. Hence we don't need
> to call pm_runtime_get_xxx and pm_runtime_enable() in device probe again.
> In the same way, since amba_remove() calls the respective pm_runtime
> functions, those functions need not be called from device remove.
> 
> This patch fixes following run time error with pl330 driver.
> 
> dma-pl330 dma-pl330.0: Unbalanced pm_runtime_enable!
> dma-pl330 dma-pl330.0: failed to get runtime pm
> 
> Signed-off-by: Giridhar Maruthy <giridhar.maruthy@linaro.org>
> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
Looks fine to me. Do you want these to go thru slave-dma or samsung
tree.
For latter:
Acked-by: Vinod Koul <vinod.koul@linux.intel.com>

> ---
>  drivers/dma/pl330.c |   17 ++---------------
>  1 files changed, 2 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
> index a626e15..cd07121 100644
> --- a/drivers/dma/pl330.c
> +++ b/drivers/dma/pl330.c
> @@ -834,17 +834,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
>  
>  	amba_set_drvdata(adev, pdmac);
>  
> -#ifdef CONFIG_PM_RUNTIME
> -	/* to use the runtime PM helper functions */
> -	pm_runtime_enable(&adev->dev);
> -
> -	/* enable the power domain */
> -	if (pm_runtime_get_sync(&adev->dev)) {
> -		dev_err(&adev->dev, "failed to get runtime pm\n");
> -		ret = -ENODEV;
> -		goto probe_err1;
> -	}
> -#else
> +#ifndef CONFIG_PM_RUNTIME
>  	/* enable dma clk */
>  	clk_enable(pdmac->clk);
>  #endif
> @@ -977,10 +967,7 @@ static int __devexit pl330_remove(struct amba_device *adev)
>  	res = &adev->res;
>  	release_mem_region(res->start, resource_size(res));
>  
> -#ifdef CONFIG_PM_RUNTIME
> -	pm_runtime_put(&adev->dev);
> -	pm_runtime_disable(&adev->dev);
> -#else
> +#ifndef CONFIG_PM_RUNTIME
>  	clk_disable(pdmac->clk);
>  #endif
>  


-- 
~Vinod


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

* RE: [PATCH 1/2] DMA: PL330: Remove pm_runtime_xxx calls from pl330 probe/remove
  2011-12-08  7:35   ` Vinod Koul
@ 2011-12-08  7:43     ` Kukjin Kim
  2011-12-08  8:16       ` Vinod Koul
  0 siblings, 1 reply; 10+ messages in thread
From: Kukjin Kim @ 2011-12-08  7:43 UTC (permalink / raw)
  To: 'Vinod Koul', 'Tushar Behera',
	'Boojin Kim'
  Cc: linux-samsung-soc, linux-kernel, linaro-dev, patches

Vinod Koul wrote:
> 
> On Tue, 2011-12-06 at 16:15 +0530, Tushar Behera wrote:
> > amba_probe() now calls pm_runtime_get_noresume() and pm_runtime_enable()
> > for the devices before the device probe is called. Hence we don't need
> > to call pm_runtime_get_xxx and pm_runtime_enable() in device probe again.
> > In the same way, since amba_remove() calls the respective pm_runtime
> > functions, those functions need not be called from device remove.
> >
> > This patch fixes following run time error with pl330 driver.
> >
> > dma-pl330 dma-pl330.0: Unbalanced pm_runtime_enable!
> > dma-pl330 dma-pl330.0: failed to get runtime pm
> >
> > Signed-off-by: Giridhar Maruthy <giridhar.maruthy@linaro.org>
> > Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> Looks fine to me. Do you want these to go thru slave-dma or samsung
> tree.

Hi Vinod,

I think, this patch can be sent to upstream via slave-dma tree and second one via Samsung tree separately and you can add my and Boojin Kim's ack(actually, she replied) on this when you apply.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

> For latter:
> Acked-by: Vinod Koul <vinod.koul@linux.intel.com>
> 
> > ---
> >  drivers/dma/pl330.c |   17 ++---------------
> >  1 files changed, 2 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
> > index a626e15..cd07121 100644
> > --- a/drivers/dma/pl330.c
> > +++ b/drivers/dma/pl330.c
> > @@ -834,17 +834,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
> >
> >  	amba_set_drvdata(adev, pdmac);
> >
> > -#ifdef CONFIG_PM_RUNTIME
> > -	/* to use the runtime PM helper functions */
> > -	pm_runtime_enable(&adev->dev);
> > -
> > -	/* enable the power domain */
> > -	if (pm_runtime_get_sync(&adev->dev)) {
> > -		dev_err(&adev->dev, "failed to get runtime pm\n");
> > -		ret = -ENODEV;
> > -		goto probe_err1;
> > -	}
> > -#else
> > +#ifndef CONFIG_PM_RUNTIME
> >  	/* enable dma clk */
> >  	clk_enable(pdmac->clk);
> >  #endif
> > @@ -977,10 +967,7 @@ static int __devexit pl330_remove(struct amba_device *adev)
> >  	res = &adev->res;
> >  	release_mem_region(res->start, resource_size(res));
> >
> > -#ifdef CONFIG_PM_RUNTIME
> > -	pm_runtime_put(&adev->dev);
> > -	pm_runtime_disable(&adev->dev);
> > -#else
> > +#ifndef CONFIG_PM_RUNTIME
> >  	clk_disable(pdmac->clk);
> >  #endif
> >
> 
> 
> --
> ~Vinod


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

* RE: [PATCH 2/2] ARM: EXYNOS: Add apb_pclk clkdev entry for mdma1
  2011-12-06 10:45 ` [PATCH 2/2] ARM: EXYNOS: Add apb_pclk clkdev entry for mdma1 Tushar Behera
@ 2011-12-08  7:43   ` Kukjin Kim
  0 siblings, 0 replies; 10+ messages in thread
From: Kukjin Kim @ 2011-12-08  7:43 UTC (permalink / raw)
  To: 'Tushar Behera', linux-samsung-soc, linux-kernel
  Cc: vinod.koul, linaro-dev, patches

Tushar Behera wrote:
> 
> Amba core assumes the pclk to be named as apb_pclk. During device probe,
> it tries to get that clock and enable that. When PM_RUNTIME is enabled,
> dma clock is not explicitly enabled in pl330_probe, which causes device
> probe to fail. Adding a clkdev entry for apb_pclk for mdma1 fixes the
> problem.
> 
> This patch fixes following runtime error.
> 
> dma-pl330 dma-pl330.2: PERIPH_ID 0x0, PCELL_ID 0x0 !
> dma-pl330: probe of dma-pl330.2 failed with error -22
> 
> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> ---
>  arch/arm/mach-exynos/clock.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-exynos/clock.c b/arch/arm/mach-exynos/clock.c
> index 28e2842..eb33a7a 100644
> --- a/arch/arm/mach-exynos/clock.c
> +++ b/arch/arm/mach-exynos/clock.c
> @@ -1326,6 +1326,7 @@ static struct clk_lookup exynos4_clk_lookup[] = {
>  	CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &clk_sclk_mmc3.clk),
>  	CLKDEV_INIT("dma-pl330.0", "apb_pclk", &clk_pdma0),
>  	CLKDEV_INIT("dma-pl330.1", "apb_pclk", &clk_pdma1),
> +	CLKDEV_INIT("dma-pl330.2", "apb_pclk", &clk_mdma1),
>  };
> 
>  static int xtal_rate;
> --
> 1.7.4.1

Looks ok to me, will apply.
Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.


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

* RE: [PATCH 1/2] DMA: PL330: Remove pm_runtime_xxx calls from pl330 probe/remove
  2011-12-08  7:43     ` Kukjin Kim
@ 2011-12-08  8:16       ` Vinod Koul
  2011-12-08 13:32         ` Jassi Brar
  0 siblings, 1 reply; 10+ messages in thread
From: Vinod Koul @ 2011-12-08  8:16 UTC (permalink / raw)
  To: Kukjin Kim
  Cc: 'Tushar Behera', 'Boojin Kim', linux-samsung-soc,
	linux-kernel, linaro-dev, patches

On Thu, 2011-12-08 at 16:43 +0900, Kukjin Kim wrote:
> Vinod Koul wrote:
> > 
> > On Tue, 2011-12-06 at 16:15 +0530, Tushar Behera wrote:
> > > amba_probe() now calls pm_runtime_get_noresume() and pm_runtime_enable()
> > > for the devices before the device probe is called. Hence we don't need
> > > to call pm_runtime_get_xxx and pm_runtime_enable() in device probe again.
> > > In the same way, since amba_remove() calls the respective pm_runtime
> > > functions, those functions need not be called from device remove.
> > >
> > > This patch fixes following run time error with pl330 driver.
> > >
> > > dma-pl330 dma-pl330.0: Unbalanced pm_runtime_enable!
> > > dma-pl330 dma-pl330.0: failed to get runtime pm
> > >
> > > Signed-off-by: Giridhar Maruthy <giridhar.maruthy@linaro.org>
> > > Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> > Looks fine to me. Do you want these to go thru slave-dma or samsung
> > tree.
> 
> Hi Vinod,
> 
> I think, this patch can be sent to upstream via slave-dma tree and
> second one via Samsung tree separately and you can add my and Boojin
> Kim's ack(actually, she replied) on this when you apply.
Okay, I have applied this one only

-- 
~Vinod


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

* Re: [PATCH 1/2] DMA: PL330: Remove pm_runtime_xxx calls from pl330 probe/remove
  2011-12-08  8:16       ` Vinod Koul
@ 2011-12-08 13:32         ` Jassi Brar
  2011-12-09  3:19           ` Tushar Behera
  0 siblings, 1 reply; 10+ messages in thread
From: Jassi Brar @ 2011-12-08 13:32 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Kukjin Kim, linux-samsung-soc, linaro-dev, Boojin Kim, patches,
	linux-kernel

On 8 December 2011 13:46, Vinod Koul <vinod.koul@intel.com> wrote:
> On Thu, 2011-12-08 at 16:43 +0900, Kukjin Kim wrote:
>> Vinod Koul wrote:
>> >
>> > On Tue, 2011-12-06 at 16:15 +0530, Tushar Behera wrote:
>> > > amba_probe() now calls pm_runtime_get_noresume() and pm_runtime_enable()
>> > > for the devices before the device probe is called. Hence we don't need
>> > > to call pm_runtime_get_xxx and pm_runtime_enable() in device probe again.
>> > > In the same way, since amba_remove() calls the respective pm_runtime
>> > > functions, those functions need not be called from device remove.
>> > >
>> > > This patch fixes following run time error with pl330 driver.
>> > >
>> > > dma-pl330 dma-pl330.0: Unbalanced pm_runtime_enable!
>> > > dma-pl330 dma-pl330.0: failed to get runtime pm
>> > >
>> > > Signed-off-by: Giridhar Maruthy <giridhar.maruthy@linaro.org>
>> > > Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
>> > Looks fine to me. Do you want these to go thru slave-dma or samsung
>> > tree.
>>
>> Hi Vinod,
>>
>> I think, this patch can be sent to upstream via slave-dma tree and
>> second one via Samsung tree separately and you can add my and Boojin
>> Kim's ack(actually, she replied) on this when you apply.
>
> Okay, I have applied this one only
>
Guys, any reason to keep me, the author of the driver, out of loop ?
I almost lost this patch, had it not for chance.

Also, I noticed
42bc9cf45939c2   'DMA: PL330: Add DMA_CYCLIC capability'
while implements my correction, doesn't carry the ack
 http://www.spinics.net/lists/linux-samsung-soc/msg06386.html

While, unlike some, I am not interested in claiming territory by pissing
around acks, I would sure like to log my acks if I spent personal time
maintaining the code I am supposed to be responsible for.

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

* Re: [PATCH 1/2] DMA: PL330: Remove pm_runtime_xxx calls from pl330 probe/remove
  2011-12-08 13:32         ` Jassi Brar
@ 2011-12-09  3:19           ` Tushar Behera
  2011-12-09  3:51             ` Jassi Brar
  0 siblings, 1 reply; 10+ messages in thread
From: Tushar Behera @ 2011-12-09  3:19 UTC (permalink / raw)
  To: Jassi Brar
  Cc: Vinod Koul, Kukjin Kim, linux-samsung-soc, linaro-dev, Boojin Kim,
	patches, linux-kernel

On 12/08/2011 07:02 PM, Jassi Brar wrote:
> Guys, any reason to keep me, the author of the driver, out of loop ?
> I almost lost this patch, had it not for chance.

Apologies. I didn't realize that I should be adding a cc to you.

Would you please add a valid module author e-mail ID?

-- 
Tushar Behera

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

* Re: [PATCH 1/2] DMA: PL330: Remove pm_runtime_xxx calls from pl330 probe/remove
  2011-12-09  3:19           ` Tushar Behera
@ 2011-12-09  3:51             ` Jassi Brar
  0 siblings, 0 replies; 10+ messages in thread
From: Jassi Brar @ 2011-12-09  3:51 UTC (permalink / raw)
  To: Tushar Behera
  Cc: Vinod Koul, Kukjin Kim, linux-samsung-soc, linaro-dev, Boojin Kim,
	patches, linux-kernel

On 9 December 2011 08:49, Tushar Behera <tushar.behera@linaro.org> wrote:
> On 12/08/2011 07:02 PM, Jassi Brar wrote:
>>
>> Guys, any reason to keep me, the author of the driver, out of loop ?
>> I almost lost this patch, had it not for chance.
>
>
> Apologies. I didn't realize that I should be adding a cc to you.
>
> Would you please add a valid module author e-mail ID?
>
I doubt if someone knows that my samsung id is invalid but doesn't know
which is the valid one ;)
Anyways, I shall update to my private email id.

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

end of thread, other threads:[~2011-12-09  3:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-06 10:45 [PATCH 0/2] Add PM_RUNTIME related fixes for PL330 Tushar Behera
2011-12-06 10:45 ` [PATCH 1/2] DMA: PL330: Remove pm_runtime_xxx calls from pl330 probe/remove Tushar Behera
2011-12-08  7:35   ` Vinod Koul
2011-12-08  7:43     ` Kukjin Kim
2011-12-08  8:16       ` Vinod Koul
2011-12-08 13:32         ` Jassi Brar
2011-12-09  3:19           ` Tushar Behera
2011-12-09  3:51             ` Jassi Brar
2011-12-06 10:45 ` [PATCH 2/2] ARM: EXYNOS: Add apb_pclk clkdev entry for mdma1 Tushar Behera
2011-12-08  7:43   ` Kukjin Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox