[RFC 3/3] clk: Add "is_enabled" callback for gated clocks
Alexander Shiyan
shc_work at mail.ru
Fri Mar 15 02:35:40 EDT 2013
Signed-off-by: Alexander Shiyan <shc_work at mail.ru>
---
drivers/clk/clk-gate.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/drivers/clk/clk-gate.c b/drivers/clk/clk-gate.c
index 2dca11c..580720b 100644
--- a/drivers/clk/clk-gate.c
+++ b/drivers/clk/clk-gate.c
@@ -48,9 +48,17 @@ static void clk_gate_disable(struct clk *clk)
writel(val, g->reg);
}
+static int clk_gate_is_enabled(struct clk *clk)
+{
+ struct clk_gate *g = container_of(clk, struct clk_gate, clk);
+
+ return !!(readl(g->reg) & (1 << g->shift));
+}
+
struct clk_ops clk_gate_ops = {
.enable = clk_gate_enable,
.disable = clk_gate_disable,
+ .is_enabled = clk_gate_is_enabled,
};
struct clk *clk_gate(const char *name, const char *parent, void __iomem *reg,
--
1.7.3.4
More information about the barebox
mailing list