[PATCH 1/2] clk: add always enabled clocks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox


[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux