All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dma: tegra: enable/disable dma clock
@ 2012-07-18  8:56 ` Laxman Dewangan
  0 siblings, 0 replies; 10+ messages in thread
From: Laxman Dewangan @ 2012-07-18  8:56 UTC (permalink / raw)
  To: vinod.koul-ral2JQCrhuEAvxtiuMwx3w, dan.j.williams-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	swarren-DDmLM1+adcrQT0dZR+AlfA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Laxman Dewangan

Enable the DMA clock when registering DMA driver and
disable clock when removing the DMA driver.

The failure was observed on Tegra20 based system by
Stephen Warren. However, it is working fine on tegra30
based system and probably becasue uboot enable the clock
on Tegra30.

Signed-off-by: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Reported-by: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
---
 drivers/dma/tegra20-apb-dma.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
index d52dbc6..ccfdaf4 100644
--- a/drivers/dma/tegra20-apb-dma.c
+++ b/drivers/dma/tegra20-apb-dma.c
@@ -1255,6 +1255,12 @@ static int __devinit tegra_dma_probe(struct platform_device *pdev)
 		}
 	}
 
+	ret = clk_prepare_enable(tdma->dma_clk);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "clk_prepare_enable failed: %d\n", ret);
+		goto err_pm_disable;
+	}
+
 	/* Reset DMA controller */
 	tegra_periph_reset_assert(tdma->dma_clk);
 	udelay(2);
@@ -1363,6 +1369,7 @@ static int __devexit tegra_dma_remove(struct platform_device *pdev)
 	if (!pm_runtime_status_suspended(&pdev->dev))
 		tegra_dma_runtime_suspend(&pdev->dev);
 
+	clk_disable_unprepare(tdma->dma_clk);
 	return 0;
 }
 
-- 
1.7.1.1

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

* [PATCH] dma: tegra: enable/disable dma clock
@ 2012-07-18  8:56 ` Laxman Dewangan
  0 siblings, 0 replies; 10+ messages in thread
From: Laxman Dewangan @ 2012-07-18  8:56 UTC (permalink / raw)
  To: vinod.koul, dan.j.williams
  Cc: linux-kernel, swarren, linux-tegra, Laxman Dewangan

Enable the DMA clock when registering DMA driver and
disable clock when removing the DMA driver.

The failure was observed on Tegra20 based system by
Stephen Warren. However, it is working fine on tegra30
based system and probably becasue uboot enable the clock
on Tegra30.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reported-by: Stephen Warren <swarren@wwwdotorg.org>
---
 drivers/dma/tegra20-apb-dma.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
index d52dbc6..ccfdaf4 100644
--- a/drivers/dma/tegra20-apb-dma.c
+++ b/drivers/dma/tegra20-apb-dma.c
@@ -1255,6 +1255,12 @@ static int __devinit tegra_dma_probe(struct platform_device *pdev)
 		}
 	}
 
+	ret = clk_prepare_enable(tdma->dma_clk);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "clk_prepare_enable failed: %d\n", ret);
+		goto err_pm_disable;
+	}
+
 	/* Reset DMA controller */
 	tegra_periph_reset_assert(tdma->dma_clk);
 	udelay(2);
@@ -1363,6 +1369,7 @@ static int __devexit tegra_dma_remove(struct platform_device *pdev)
 	if (!pm_runtime_status_suspended(&pdev->dev))
 		tegra_dma_runtime_suspend(&pdev->dev);
 
+	clk_disable_unprepare(tdma->dma_clk);
 	return 0;
 }
 
-- 
1.7.1.1


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

* Re: [PATCH] dma: tegra: enable/disable dma clock
  2012-07-18  8:56 ` Laxman Dewangan
@ 2012-07-20  6:02     ` Vinod Koul
  -1 siblings, 0 replies; 10+ messages in thread
From: Vinod Koul @ 2012-07-20  6:02 UTC (permalink / raw)
  To: Laxman Dewangan
  Cc: dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	swarren-DDmLM1+adcrQT0dZR+AlfA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

On Wed, 2012-07-18 at 14:26 +0530, Laxman Dewangan wrote:
> Enable the DMA clock when registering DMA driver and
> disable clock when removing the DMA driver.
> 
> The failure was observed on Tegra20 based system by
> Stephen Warren. However, it is working fine on tegra30
> based system and probably becasue uboot enable the clock
> on Tegra30.
Don't know much about the clock subsystem, but shouldn't the clocks be
enabled runtime..... when you actually start using the controller??
> 
> Signed-off-by: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> Reported-by: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
> ---
>  drivers/dma/tegra20-apb-dma.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
> index d52dbc6..ccfdaf4 100644
> --- a/drivers/dma/tegra20-apb-dma.c
> +++ b/drivers/dma/tegra20-apb-dma.c
> @@ -1255,6 +1255,12 @@ static int __devinit tegra_dma_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> +	ret = clk_prepare_enable(tdma->dma_clk);
> +	if (ret < 0) {
> +		dev_err(&pdev->dev, "clk_prepare_enable failed: %d\n", ret);
> +		goto err_pm_disable;
> +	}
> +
>  	/* Reset DMA controller */
>  	tegra_periph_reset_assert(tdma->dma_clk);
>  	udelay(2);
> @@ -1363,6 +1369,7 @@ static int __devexit tegra_dma_remove(struct platform_device *pdev)
>  	if (!pm_runtime_status_suspended(&pdev->dev))
>  		tegra_dma_runtime_suspend(&pdev->dev);
>  
> +	clk_disable_unprepare(tdma->dma_clk);
>  	return 0;
>  }
>  


-- 
~Vinod

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

* Re: [PATCH] dma: tegra: enable/disable dma clock
@ 2012-07-20  6:02     ` Vinod Koul
  0 siblings, 0 replies; 10+ messages in thread
From: Vinod Koul @ 2012-07-20  6:02 UTC (permalink / raw)
  To: Laxman Dewangan; +Cc: dan.j.williams, linux-kernel, swarren, linux-tegra

On Wed, 2012-07-18 at 14:26 +0530, Laxman Dewangan wrote:
> Enable the DMA clock when registering DMA driver and
> disable clock when removing the DMA driver.
> 
> The failure was observed on Tegra20 based system by
> Stephen Warren. However, it is working fine on tegra30
> based system and probably becasue uboot enable the clock
> on Tegra30.
Don't know much about the clock subsystem, but shouldn't the clocks be
enabled runtime..... when you actually start using the controller??
> 
> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
> Reported-by: Stephen Warren <swarren@wwwdotorg.org>
> ---
>  drivers/dma/tegra20-apb-dma.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
> index d52dbc6..ccfdaf4 100644
> --- a/drivers/dma/tegra20-apb-dma.c
> +++ b/drivers/dma/tegra20-apb-dma.c
> @@ -1255,6 +1255,12 @@ static int __devinit tegra_dma_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> +	ret = clk_prepare_enable(tdma->dma_clk);
> +	if (ret < 0) {
> +		dev_err(&pdev->dev, "clk_prepare_enable failed: %d\n", ret);
> +		goto err_pm_disable;
> +	}
> +
>  	/* Reset DMA controller */
>  	tegra_periph_reset_assert(tdma->dma_clk);
>  	udelay(2);
> @@ -1363,6 +1369,7 @@ static int __devexit tegra_dma_remove(struct platform_device *pdev)
>  	if (!pm_runtime_status_suspended(&pdev->dev))
>  		tegra_dma_runtime_suspend(&pdev->dev);
>  
> +	clk_disable_unprepare(tdma->dma_clk);
>  	return 0;
>  }
>  


-- 
~Vinod


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

* Re: [PATCH] dma: tegra: enable/disable dma clock
  2012-07-20  6:02     ` Vinod Koul
@ 2012-07-20  6:04       ` Laxman Dewangan
  -1 siblings, 0 replies; 10+ messages in thread
From: Laxman Dewangan @ 2012-07-20  6:04 UTC (permalink / raw)
  To: Vinod Koul
  Cc: dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Stephen Warren,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

On Friday 20 July 2012 11:32 AM, Vinod Koul wrote:
> On Wed, 2012-07-18 at 14:26 +0530, Laxman Dewangan wrote:
>> Enable the DMA clock when registering DMA driver and
>> disable clock when removing the DMA driver.
>>
>> The failure was observed on Tegra20 based system by
>> Stephen Warren. However, it is working fine on tegra30
>> based system and probably becasue uboot enable the clock
>> on Tegra30.
> Don't know much about the clock subsystem, but shouldn't the clocks be
> enabled runtime..... when you actually start using the controller??

Yes, this is the plan and I am going to implement dynamic clock 
management but it will take some time to complete and have testing 
throughly. some of the issue which I am seeing and analyzing on this 
approach is that
  - clock disable can be called from isr context or not?
  - how much complexity will be added in dma driver to implement this?
  - What power benefit we will get on this.
  - Is there any user which generally use dma and always keep dma on 
requested state like UART RX always ready etc.

So keeping that in mind, it will take some time to complete this and 
meanwhile, I want to make it work for Tegra20 based system which is not 
working on current driver.
and hence this is the change.

Thanks,
Laxman

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

* Re: [PATCH] dma: tegra: enable/disable dma clock
@ 2012-07-20  6:04       ` Laxman Dewangan
  0 siblings, 0 replies; 10+ messages in thread
From: Laxman Dewangan @ 2012-07-20  6:04 UTC (permalink / raw)
  To: Vinod Koul; +Cc: dan.j.williams, linux-kernel, Stephen Warren, linux-tegra

On Friday 20 July 2012 11:32 AM, Vinod Koul wrote:
> On Wed, 2012-07-18 at 14:26 +0530, Laxman Dewangan wrote:
>> Enable the DMA clock when registering DMA driver and
>> disable clock when removing the DMA driver.
>>
>> The failure was observed on Tegra20 based system by
>> Stephen Warren. However, it is working fine on tegra30
>> based system and probably becasue uboot enable the clock
>> on Tegra30.
> Don't know much about the clock subsystem, but shouldn't the clocks be
> enabled runtime..... when you actually start using the controller??

Yes, this is the plan and I am going to implement dynamic clock 
management but it will take some time to complete and have testing 
throughly. some of the issue which I am seeing and analyzing on this 
approach is that
  - clock disable can be called from isr context or not?
  - how much complexity will be added in dma driver to implement this?
  - What power benefit we will get on this.
  - Is there any user which generally use dma and always keep dma on 
requested state like UART RX always ready etc.

So keeping that in mind, it will take some time to complete this and 
meanwhile, I want to make it work for Tegra20 based system which is not 
working on current driver.
and hence this is the change.

Thanks,
Laxman


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

* Re: [PATCH] dma: tegra: enable/disable dma clock
  2012-07-20  6:40           ` Vinod Koul
@ 2012-07-20  6:34             ` Laxman Dewangan
  -1 siblings, 0 replies; 10+ messages in thread
From: Laxman Dewangan @ 2012-07-20  6:34 UTC (permalink / raw)
  To: Vinod Koul
  Cc: dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Stephen Warren,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

On Friday 20 July 2012 12:10 PM, Vinod Koul wrote:
> On Fri, 2012-07-20 at 11:34 +0530, Laxman Dewangan wrote:
>> On Friday 20 July 2012 11:32 AM, Vinod Koul wrote:
>>
> for a start you can move these to .alloc_chan_resources
> and .free_chan_resources while doing a  refcount.
> Further optimization can be done by moving this to tx_submit and
> tasklet.
>
Agree. I will send the new patch.

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

* Re: [PATCH] dma: tegra: enable/disable dma clock
@ 2012-07-20  6:34             ` Laxman Dewangan
  0 siblings, 0 replies; 10+ messages in thread
From: Laxman Dewangan @ 2012-07-20  6:34 UTC (permalink / raw)
  To: Vinod Koul; +Cc: dan.j.williams, linux-kernel, Stephen Warren, linux-tegra

On Friday 20 July 2012 12:10 PM, Vinod Koul wrote:
> On Fri, 2012-07-20 at 11:34 +0530, Laxman Dewangan wrote:
>> On Friday 20 July 2012 11:32 AM, Vinod Koul wrote:
>>
> for a start you can move these to .alloc_chan_resources
> and .free_chan_resources while doing a  refcount.
> Further optimization can be done by moving this to tx_submit and
> tasklet.
>
Agree. I will send the new patch.


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

* Re: [PATCH] dma: tegra: enable/disable dma clock
  2012-07-20  6:04       ` Laxman Dewangan
@ 2012-07-20  6:40           ` Vinod Koul
  -1 siblings, 0 replies; 10+ messages in thread
From: Vinod Koul @ 2012-07-20  6:40 UTC (permalink / raw)
  To: Laxman Dewangan
  Cc: dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Stephen Warren,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

On Fri, 2012-07-20 at 11:34 +0530, Laxman Dewangan wrote:
> On Friday 20 July 2012 11:32 AM, Vinod Koul wrote:
> > On Wed, 2012-07-18 at 14:26 +0530, Laxman Dewangan wrote:
> >> Enable the DMA clock when registering DMA driver and
> >> disable clock when removing the DMA driver.
> >>
> >> The failure was observed on Tegra20 based system by
> >> Stephen Warren. However, it is working fine on tegra30
> >> based system and probably becasue uboot enable the clock
> >> on Tegra30.
> > Don't know much about the clock subsystem, but shouldn't the clocks be
> > enabled runtime..... when you actually start using the controller??
> 
> Yes, this is the plan and I am going to implement dynamic clock 
> management but it will take some time to complete and have testing 
> throughly. some of the issue which I am seeing and analyzing on this 
> approach is that
>   - clock disable can be called from isr context or not?
>   - how much complexity will be added in dma driver to implement this?
>   - What power benefit we will get on this.
>   - Is there any user which generally use dma and always keep dma on 
> requested state like UART RX always ready etc.
> 
> So keeping that in mind, it will take some time to complete this and 
> meanwhile, I want to make it work for Tegra20 based system which is not 
> working on current driver.
> and hence this is the change.
for a start you can move these to .alloc_chan_resources
and .free_chan_resources while doing a  refcount.
Further optimization can be done by moving this to tx_submit and
tasklet.

-- 
~Vinod

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

* Re: [PATCH] dma: tegra: enable/disable dma clock
@ 2012-07-20  6:40           ` Vinod Koul
  0 siblings, 0 replies; 10+ messages in thread
From: Vinod Koul @ 2012-07-20  6:40 UTC (permalink / raw)
  To: Laxman Dewangan; +Cc: dan.j.williams, linux-kernel, Stephen Warren, linux-tegra

On Fri, 2012-07-20 at 11:34 +0530, Laxman Dewangan wrote:
> On Friday 20 July 2012 11:32 AM, Vinod Koul wrote:
> > On Wed, 2012-07-18 at 14:26 +0530, Laxman Dewangan wrote:
> >> Enable the DMA clock when registering DMA driver and
> >> disable clock when removing the DMA driver.
> >>
> >> The failure was observed on Tegra20 based system by
> >> Stephen Warren. However, it is working fine on tegra30
> >> based system and probably becasue uboot enable the clock
> >> on Tegra30.
> > Don't know much about the clock subsystem, but shouldn't the clocks be
> > enabled runtime..... when you actually start using the controller??
> 
> Yes, this is the plan and I am going to implement dynamic clock 
> management but it will take some time to complete and have testing 
> throughly. some of the issue which I am seeing and analyzing on this 
> approach is that
>   - clock disable can be called from isr context or not?
>   - how much complexity will be added in dma driver to implement this?
>   - What power benefit we will get on this.
>   - Is there any user which generally use dma and always keep dma on 
> requested state like UART RX always ready etc.
> 
> So keeping that in mind, it will take some time to complete this and 
> meanwhile, I want to make it work for Tegra20 based system which is not 
> working on current driver.
> and hence this is the change.
for a start you can move these to .alloc_chan_resources
and .free_chan_resources while doing a  refcount.
Further optimization can be done by moving this to tx_submit and
tasklet.

-- 
~Vinod


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

end of thread, other threads:[~2012-07-20  6:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-18  8:56 [PATCH] dma: tegra: enable/disable dma clock Laxman Dewangan
2012-07-18  8:56 ` Laxman Dewangan
     [not found] ` <1342601769-13852-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-07-20  6:02   ` Vinod Koul
2012-07-20  6:02     ` Vinod Koul
2012-07-20  6:04     ` Laxman Dewangan
2012-07-20  6:04       ` Laxman Dewangan
     [not found]       ` <5008F4D8.9070108-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-07-20  6:40         ` Vinod Koul
2012-07-20  6:40           ` Vinod Koul
2012-07-20  6:34           ` Laxman Dewangan
2012-07-20  6:34             ` Laxman Dewangan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.