diff options
author | Antony Pavlov <antonynpavlov@gmail.com> | 2012-12-03 00:42:24 +0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-12-03 10:48:07 +0100 |
commit | ac5c16887008fc69b3bfee810f97c429df532021 (patch) | |
tree | 4cbded48c35dc598d4937529243e28c9b1b4d062 /drivers/clk/clk.c | |
parent | 3e689025a5a0e9e9cab038ab2a537a425ca4d5d2 (diff) | |
download | barebox-ac5c16887008fc69b3bfee810f97c429df532021.tar.gz barebox-ac5c16887008fc69b3bfee810f97c429df532021.tar.xz |
clk: add always enabled clocks
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>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/clk/clk.c')
-rw-r--r-- | drivers/clk/clk.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index ea93ff852c..2ff7586edb 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; } |