From c6007ffe842892484027a40b6ac18d29ac11e2ce Mon Sep 17 00:00:00 2001 From: Philip Avinash Date: Mon, 25 Mar 2013 15:07:48 +0530 Subject: [PATCH] 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 Signed-off-by: Sekhar Nori --- 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 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) { 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 8694b395fc92..1e4e836173a1 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) */ -- 2.39.5