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)
committer黄涛 <huangtao@rock-chips.com>
Wed, 8 Jan 2014 03:06:18 +0000 (11:06 +0800)
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 6f3401f3f6c5697d70946951d04a40aa4aa9533f..ccd69da597c033a17d2b99b4ed724841da8e0141 100644 (file)
@@ -461,6 +461,7 @@ struct clk_onecell_data {
        unsigned int clk_num;
 };
 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);