From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] clk: add always enabled clocks
Date: Mon, 3 Dec 2012 00:42:24 +0400 [thread overview]
Message-ID: <1354480945-19214-2-git-send-email-antonynpavlov@gmail.com> (raw)
In-Reply-To: <1354480945-19214-1-git-send-email-antonynpavlov@gmail.com>
Current barebox clk framework allow disable any clock
and there is no means to prevent that.
But there are the clocks that can't be disabled
by software at all.
This patch allow registration of a clock immune to clk_disable().
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
drivers/clk/clk.c | 10 ++++++++++
include/linux/clk.h | 3 +++
2 files changed, 13 insertions(+)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index ea93ff8..2ff7586 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -46,6 +46,9 @@ int clk_enable(struct clk *clk)
if (IS_ERR(clk))
return PTR_ERR(clk);
+ if (clk->flags & CLK_ALWAYS_ENABLED)
+ return 0;
+
if (!clk->enable_count) {
ret = clk_parent_enable(clk);
if (ret)
@@ -70,6 +73,9 @@ void clk_disable(struct clk *clk)
if (IS_ERR(clk))
return;
+ if (clk->flags & CLK_ALWAYS_ENABLED)
+ return;
+
if (!clk->enable_count)
return;
@@ -205,6 +211,10 @@ int clk_register(struct clk *clk)
list_add_tail(&clk->list, &clks);
+ if (clk->flags & CLK_ALWAYS_ENABLED) {
+ clk->enable_count = 1;
+ }
+
return 0;
}
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 00588bf..1030b50 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -179,8 +179,11 @@ struct clk {
int num_parents;
struct clk **parents;
+ unsigned long flags;
};
+#define CLK_ALWAYS_ENABLED (1 << 0)
+
struct clk *clk_fixed(const char *name, int rate);
struct clk *clk_divider(const char *name, const char *parent,
void __iomem *reg, u8 shift, u8 width);
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2012-12-02 20:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-02 20:42 [PATCH 0/2] " Antony Pavlov
2012-12-02 20:42 ` Antony Pavlov [this message]
2012-12-02 20:42 ` [PATCH 2/2] commands: clk_dump: denote " Antony Pavlov
2012-12-03 9:49 ` [PATCH 0/2] clk: add " Sascha Hauer
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=1354480945-19214-2-git-send-email-antonynpavlov@gmail.com \
--to=antonynpavlov@gmail.com \
--cc=barebox@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox