aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Avinash <avinashphilip@ti.com>2013-03-25 05:37:48 -0400
committerSekhar Nori <nsekhar@ti.com>2013-04-01 07:24:47 -0400
commitc6007ffe842892484027a40b6ac18d29ac11e2ce (patch)
treed24db9aab259a37ae6de4203a420e77bffe45bdf
parent07961ac7c0ee8b546658717034fe692fd12eefa9 (diff)
ARM: davinci: clk framework support for enable/disable functionality
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> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
-rw-r--r--arch/arm/mach-davinci/clock.c21
-rw-r--r--arch/arm/mach-davinci/clock.h2
2 files changed, 16 insertions, 7 deletions
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index d458558ee84a..dc9a470ff9c5 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)
35{ 35{
36 if (clk->parent) 36 if (clk->parent)
37 __clk_enable(clk->parent); 37 __clk_enable(clk->parent);
38 if (clk->usecount++ == 0 && (clk->flags & CLK_PSC)) 38 if (clk->usecount++ == 0) {
39 davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc, 39 if (clk->flags & CLK_PSC)
40 true, clk->flags); 40 davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc,
41 true, clk->flags);
42 else if (clk->clk_enable)
43 clk->clk_enable(clk);
44 }
41} 45}
42 46
43static void __clk_disable(struct clk *clk) 47static void __clk_disable(struct clk *clk)
44{ 48{
45 if (WARN_ON(clk->usecount == 0)) 49 if (WARN_ON(clk->usecount == 0))
46 return; 50 return;
47 if (--clk->usecount == 0 && !(clk->flags & CLK_PLL) && 51 if (--clk->usecount == 0) {
48 (clk->flags & CLK_PSC)) 52 if (!(clk->flags & CLK_PLL) && (clk->flags & CLK_PSC))
49 davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc, 53 davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc,
50 false, clk->flags); 54 false, clk->flags);
55 else if (clk->clk_disable)
56 clk->clk_disable(clk);
57 }
51 if (clk->parent) 58 if (clk->parent)
52 __clk_disable(clk->parent); 59 __clk_disable(clk->parent);
53} 60}
diff --git a/arch/arm/mach-davinci/clock.h b/arch/arm/mach-davinci/clock.h
index 8694b395fc92..1e4e836173a1 100644
--- a/arch/arm/mach-davinci/clock.h
+++ b/arch/arm/mach-davinci/clock.h
@@ -104,6 +104,8 @@ struct clk {
104 int (*set_rate) (struct clk *clk, unsigned long rate); 104 int (*set_rate) (struct clk *clk, unsigned long rate);
105 int (*round_rate) (struct clk *clk, unsigned long rate); 105 int (*round_rate) (struct clk *clk, unsigned long rate);
106 int (*reset) (struct clk *clk, bool reset); 106 int (*reset) (struct clk *clk, bool reset);
107 void (*clk_enable) (struct clk *clk);
108 void (*clk_disable) (struct clk *clk);
107}; 109};
108 110
109/* Clock flags: SoC-specific flags start at BIT(16) */ 111/* Clock flags: SoC-specific flags start at BIT(16) */