]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
clk: of: helper for determining number of parent clocks
authorMike Turquette <mturquette@linaro.org>
Tue, 8 Oct 2013 06:12:13 +0000 (23:12 -0700)
committerMike Turquette <mturquette@linaro.org>
Tue, 8 Oct 2013 06:13:33 +0000 (23:13 -0700)
Walks the "clocks" array of parent clock phandles and returns the
number.

Signed-off-by: Mike Turquette <mturquette@linaro.org>
drivers/clk/clk.c
include/linux/clk-provider.h

index 32e2fed6d143c101ab43a3503f7fe54a4cd59610..2cf2ea6b77a1ac307c22d35aed28b12d7a0da75f 100644 (file)
@@ -2202,6 +2202,12 @@ struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec)
        return clk;
 }
 
+int of_clk_get_parent_count(struct device_node *np)
+{
+       return of_count_phandle_with_args(np, "clocks", "#clock-cells");
+}
+EXPORT_SYMBOL_GPL(of_clk_get_parent_count);
+
 const char *of_clk_get_parent_name(struct device_node *np, int index)
 {
        struct of_phandle_args clkspec;
index 73bdb69f0c08150a64ac2cd4cd5bf1cca3c3ac6a..7e59253b86036b5d897a7b8e741c0ea3f5e4fdf4 100644 (file)
@@ -472,6 +472,7 @@ void of_clk_del_provider(struct device_node *np);
 struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec,
                                  void *data);
 struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data);
+int of_clk_get_parent_count(struct device_node *np);
 const char *of_clk_get_parent_name(struct device_node *np, int index);
 
 void of_clk_init(const struct of_device_id *matches);