diff mbox

[v3,1/3] ARM: davinci: clk framework support for enable/disable functionality

Message ID 1364204268-15010-1-git-send-email-avinashphilip@ti.com (mailing list archive)
State Accepted
Headers show

Commit Message

avinash philip March 25, 2013, 9:37 a.m. UTC
Davinci clock framework currently not supporting clock enable/disable
functionality on clock nodes. In Davinci platform, EHRPWM module requires
support for clock enable/disable for TBCLK support. Hence this patch
adds support for enabling/disabling clocks depends on the availability
of the functionality.

Signed-off-by: Philip Avinash <avinashphilip@ti.com>
---
Changes since v2:
	- start using "usecount" field in clk structure to
	  enable/disable clocks.

Changes since v1:
	- Add support for clock enable/disable functionality.

 arch/arm/mach-davinci/clock.c |   21 ++++++++++++++-------
 arch/arm/mach-davinci/clock.h |    2 ++
 2 files changed, 16 insertions(+), 7 deletions(-)

Comments

Sekhar Nori April 1, 2013, 11:35 a.m. UTC | #1
On 3/25/2013 3:07 PM, Philip Avinash wrote:
> Davinci clock framework currently not supporting clock enable/disable

This is incorrect. We do support enable disable of PSCs in davinci clock
implementation.

> functionality on clock nodes. In Davinci platform, EHRPWM module requires

s/In Davinci platform/On DA850 SoC/

> support for clock enable/disable for TBCLK support. Hence this patch
> adds support for enabling/disabling clocks depends on the availability
> of the functionality.

I reworded the path description as below. Taking care of above and
making some other minor changes:

    DaVinci clock implementation does not support clock enable/disable
    functionality on non-PSC clock nodes.

    On DA850 SoC, EHRPWM module requires support for enable/disable
    of TBCLK controlled using a system module register.

    This patch adds a method for enabling/disabling non-PSC clocks
    into DaVinci clock implementation.

> 
> Signed-off-by: Philip Avinash <avinashphilip@ti.com>
> ---
> Changes since v2:
> 	- start using "usecount" field in clk structure to
> 	  enable/disable clocks.
> 
> Changes since v1:
> 	- Add support for clock enable/disable functionality.
> 
>  arch/arm/mach-davinci/clock.c |   21 ++++++++++++++-------
>  arch/arm/mach-davinci/clock.h |    2 ++
>  2 files changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
> index d458558..960c7a5 100644
> --- a/arch/arm/mach-davinci/clock.c
> +++ b/arch/arm/mach-davinci/clock.c
> @@ -35,19 +35,26 @@ static void __clk_enable(struct clk *clk)
>  {
>  	if (clk->parent)
>  		__clk_enable(clk->parent);
> -	if (clk->usecount++ == 0 && (clk->flags & CLK_PSC))
> -		davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc,
> -				true, clk->flags);
> +	if (clk->usecount++ == 0) {
> +		if (clk->flags & CLK_PSC)
> +			davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc,
> +					true, clk->flags);

This line break can be aligned to open parenthesis. This is reported by
checkpatch --strict. I fixed this locally.

With these changed, I am queuing this patch for v3.10

Thanks,
Sekhar
avinash philip April 3, 2013, 3:58 a.m. UTC | #2
On Mon, Apr 01, 2013 at 17:05:36, Nori, Sekhar wrote:
> On 3/25/2013 3:07 PM, Philip Avinash wrote:
> > Davinci clock framework currently not supporting clock enable/disable
> 
> This is incorrect. We do support enable disable of PSCs in davinci clock
> implementation.
> 
> > functionality on clock nodes. In Davinci platform, EHRPWM module requires
> 
> s/In Davinci platform/On DA850 SoC/
> 
> > support for clock enable/disable for TBCLK support. Hence this patch
> > adds support for enabling/disabling clocks depends on the availability
> > of the functionality.
> 
> I reworded the path description as below. Taking care of above and
> making some other minor changes:
> 
>     DaVinci clock implementation does not support clock enable/disable
>     functionality on non-PSC clock nodes.
> 
>     On DA850 SoC, EHRPWM module requires support for enable/disable
>     of TBCLK controlled using a system module register.
> 
>     This patch adds a method for enabling/disabling non-PSC clocks
>     into DaVinci clock implementation.
> 
> > 
> > Signed-off-by: Philip Avinash <avinashphilip@ti.com>
> > ---
> > Changes since v2:
> > 	- start using "usecount" field in clk structure to
> > 	  enable/disable clocks.
> > 
> > Changes since v1:
> > 	- Add support for clock enable/disable functionality.
> > 
> >  arch/arm/mach-davinci/clock.c |   21 ++++++++++++++-------
> >  arch/arm/mach-davinci/clock.h |    2 ++
> >  2 files changed, 16 insertions(+), 7 deletions(-)
> > 
> > diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
> > index d458558..960c7a5 100644
> > --- a/arch/arm/mach-davinci/clock.c
> > +++ b/arch/arm/mach-davinci/clock.c
> > @@ -35,19 +35,26 @@ static void __clk_enable(struct clk *clk)
> >  {
> >  	if (clk->parent)
> >  		__clk_enable(clk->parent);
> > -	if (clk->usecount++ == 0 && (clk->flags & CLK_PSC))
> > -		davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc,
> > -				true, clk->flags);
> > +	if (clk->usecount++ == 0) {
> > +		if (clk->flags & CLK_PSC)
> > +			davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc,
> > +					true, clk->flags);
> 
> This line break can be aligned to open parenthesis. This is reported by
> checkpatch --strict. I fixed this locally.
> 
> With these changed, I am queuing this patch for v3.10


Thanks for correction and queuing. checkpatch --strict is new to me.

Avinash

> 
> Thanks,
> Sekhar
>
diff mbox

Patch

diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index d458558..960c7a5 100644
--- a/arch/arm/mach-davinci/clock.c
+++ b/arch/arm/mach-davinci/clock.c
@@ -35,19 +35,26 @@  static void __clk_enable(struct clk *clk)
 {
 	if (clk->parent)
 		__clk_enable(clk->parent);
-	if (clk->usecount++ == 0 && (clk->flags & CLK_PSC))
-		davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc,
-				true, clk->flags);
+	if (clk->usecount++ == 0) {
+		if (clk->flags & CLK_PSC)
+			davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc,
+					true, clk->flags);
+		else if (clk->clk_enable)
+			clk->clk_enable(clk);
+	}
 }
 
 static void __clk_disable(struct clk *clk)
 {
 	if (WARN_ON(clk->usecount == 0))
 		return;
-	if (--clk->usecount == 0 && !(clk->flags & CLK_PLL) &&
-	    (clk->flags & CLK_PSC))
-		davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc,
-				false, clk->flags);
+	if (--clk->usecount == 0) {
+		if (!(clk->flags & CLK_PLL) && (clk->flags & CLK_PSC))
+			davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc,
+					false, clk->flags);
+		else if (clk->clk_disable)
+			clk->clk_disable(clk);
+	}
 	if (clk->parent)
 		__clk_disable(clk->parent);
 }
diff --git a/arch/arm/mach-davinci/clock.h b/arch/arm/mach-davinci/clock.h
index 8694b39..1e4e836 100644
--- a/arch/arm/mach-davinci/clock.h
+++ b/arch/arm/mach-davinci/clock.h
@@ -104,6 +104,8 @@  struct clk {
 	int (*set_rate) (struct clk *clk, unsigned long rate);
 	int (*round_rate) (struct clk *clk, unsigned long rate);
 	int (*reset) (struct clk *clk, bool reset);
+	void (*clk_enable) (struct clk *clk);
+	void (*clk_disable) (struct clk *clk);
 };
 
 /* Clock flags: SoC-specific flags start at BIT(16) */