]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
sh: Introduce clk_always_enable() function
authorMagnus Damm <damm@igel.co.jp>
Thu, 17 Jul 2008 10:09:51 +0000 (19:09 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Mon, 28 Jul 2008 09:10:36 +0000 (18:10 +0900)
Add SuperH specific funcion clk_always_enable(), useful to enable MSTPCR
bits in processor or board specific code.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
include/asm-sh/clock.h

index 252f15540ddb61ce4f50811a0dad0c56e9ed7a77..720dfab7b15e5b5605714a3511436fd27103e6d9 100644 (file)
@@ -5,6 +5,7 @@
 #include <linux/list.h>
 #include <linux/seq_file.h>
 #include <linux/clk.h>
+#include <linux/err.h>
 
 struct clk;
 
@@ -47,6 +48,22 @@ void clk_recalc_rate(struct clk *);
 int clk_register(struct clk *);
 void clk_unregister(struct clk *);
 
+static inline int clk_always_enable(const char *id)
+{
+       struct clk *clk;
+       int ret;
+
+       clk = clk_get(NULL, id);
+       if (IS_ERR(clk))
+               return PTR_ERR(clk);
+
+       ret = clk_enable(clk);
+       if (ret)
+               clk_put(clk);
+
+       return ret;
+}
+
 /* the exported API, in addition to clk_set_rate */
 /**
  * clk_set_rate_ex - set the clock rate for a clock source, with additional parameter