From: avinashphilip@ti.com (Philip Avinash)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 1/3] ARM: davinci: clk framework support for enable/disable functionality
Date: Mon, 25 Mar 2013 15:07:48 +0530 [thread overview]
Message-ID: <1364204268-15010-1-git-send-email-avinashphilip@ti.com> (raw)
In-Reply-To: <1364197789-16783-1-git-send-email-avinashphilip@ti.com>
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(-)
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) */
--
1.7.9.5
next prev parent reply other threads:[~2013-03-25 9:37 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-25 7:49 [PATCH v3 0/3] Platform support for EHRPWM & ECAP devices in DAVINCI Philip Avinash
2013-03-25 7:49 ` Philip Avinash
2013-03-25 7:49 ` [PATCH v3 2/3] arm: davinci: clock node support for ECAP & EHRPWM Philip Avinash
2013-03-25 7:49 ` Philip Avinash
2013-04-02 8:16 ` Sekhar Nori
2013-04-02 8:16 ` Sekhar Nori
2013-03-25 7:49 ` [PATCH v3 3/3] ARM: davinci: da850: add EHRPWM & ECAP DT node Philip Avinash
2013-03-25 7:49 ` Philip Avinash
2013-04-02 8:33 ` Sekhar Nori
2013-04-02 8:33 ` Sekhar Nori
2013-04-08 9:09 ` Philip, Avinash
2013-04-08 9:09 ` Philip, Avinash
2013-04-08 13:09 ` Sekhar Nori
2013-04-08 13:09 ` Sekhar Nori
2013-04-09 8:42 ` Philip, Avinash
2013-04-09 8:42 ` Philip, Avinash
2013-04-09 11:35 ` Sekhar Nori
2013-04-09 11:35 ` Sekhar Nori
2013-04-10 5:30 ` Philip, Avinash
2013-04-10 5:30 ` Philip, Avinash
2013-04-10 5:55 ` Sekhar Nori
2013-04-10 5:55 ` Sekhar Nori
2013-04-10 6:07 ` Philip, Avinash
2013-04-10 6:07 ` Philip, Avinash
2013-03-25 8:14 ` [PATCH v3 0/3] Platform support for EHRPWM & ECAP devices in DAVINCI Sekhar Nori
2013-03-25 8:14 ` Sekhar Nori
2013-03-25 8:30 ` Philip, Avinash
2013-03-25 8:30 ` Philip, Avinash
2013-03-25 9:37 ` Philip Avinash [this message]
2013-04-01 11:35 ` [PATCH v3 1/3] ARM: davinci: clk framework support for enable/disable functionality Sekhar Nori
2013-04-03 3:58 ` Philip, Avinash
2013-04-02 8:35 ` [PATCH v3 0/3] Platform support for EHRPWM & ECAP devices in DAVINCI Sekhar Nori
2013-04-02 8:35 ` Sekhar Nori
2013-04-04 4:39 ` Philip, Avinash
2013-04-04 4:39 ` Philip, Avinash
2013-04-04 5:49 ` Sekhar Nori
2013-04-04 5:49 ` Sekhar Nori
2013-04-04 6:38 ` Philip, Avinash
2013-04-04 6:38 ` Philip, Avinash
2013-04-04 10:10 ` Philip, Avinash
2013-04-04 10:10 ` Philip, Avinash
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1364204268-15010-1-git-send-email-avinashphilip@ti.com \
--to=avinashphilip@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.