ARM: OMAP: clock: Define a function to enable clocks at init
authorRajendra Nayak <rnayak@ti.com>
Fri, 1 Jun 2012 08:32:49 +0000 (14:02 +0530)
committerPaul Walmsley <paul@pwsan.com>
Tue, 13 Nov 2012 02:10:19 +0000 (19:10 -0700)
Platform code can use omap2_clk_enable_init_clocks() to enable a
list of clocks that are needed to be enabled at init.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Mike Turquette <mturquette@ti.com>
[paul@pwsan.com: added kerneldoc to non-trivial new function]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
arch/arm/mach-omap2/clock.c
arch/arm/mach-omap2/clock.h

index c64203e55d1912c89955b7b4f6c45667704ad72f..744e6eb17b2661be30443c226d9d544cc62c5f65 100644 (file)
@@ -580,6 +580,27 @@ int omap2_clk_disable_autoidle_all(void)
        return 0;
 }
 
+/**
+ * omap2_clk_enable_init_clocks - prepare & enable a list of clocks
+ * @clk_names: ptr to an array of strings of clock names to enable
+ * @num_clocks: number of clock names in @clk_names
+ *
+ * Prepare and enable a list of clocks, named by @clk_names.  No
+ * return value. XXX Deprecated; only needed until these clocks are
+ * properly claimed and enabled by the drivers or core code that uses
+ * them.  XXX What code disables & calls clk_put on these clocks?
+ */
+void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks)
+{
+       struct clk *init_clk;
+       int i;
+
+       for (i = 0; i < num_clocks; i++) {
+               init_clk = clk_get(NULL, clk_names[i]);
+               clk_prepare_enable(init_clk);
+       }
+}
+
 const struct clk_hw_omap_ops clkhwops_wait = {
        .find_idlest    = omap2_clk_dflt_find_idlest,
        .find_companion = omap2_clk_dflt_find_companion,
index 20a3be77cb8b55310a047e5a3f3969374e2fd150..e669fc839859f3df5a09fe4dc9922ddefac80c90 100644 (file)
@@ -538,6 +538,7 @@ void omap2_clk_dflt_find_idlest(struct clk_hw_omap *clk,
 void omap2_init_clk_hw_omap_clocks(struct clk *clk);
 int omap2_clk_enable_autoidle_all(void);
 int omap2_clk_disable_autoidle_all(void);
+void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks);
 #else
 int omap2_dflt_clk_enable(struct clk *clk);
 void omap2_dflt_clk_disable(struct clk *clk);