clk: of: helper for determining number of parent clocks
authorMike Turquette <mturquette@linaro.org>
Fri, 9 May 2014 14:58:20 +0000 (15:58 +0100)
committerMark Brown <broonie@linaro.org>
Mon, 12 May 2014 18:06:11 +0000 (19:06 +0100)
Walks the "clocks" array of parent clock phandles and returns the
number.

Signed-off-by: Mike Turquette <mturquette@linaro.org>
(cherry picked from commit f61027426a5bc7093aa8359a411b053a35bb4b68)

Signed-off-by: Jon Medhurst <tixy@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/clk/clk.c
include/linux/clk-provider.h

index 1144e8c7579dddbf5c0a0b0ad3363c7f5d79c57e..fccac4a4138684462b610f25db18950491fe823b 100644 (file)
@@ -2084,6 +2084,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 11860985fecb90d156238d7f719f26540ea006b9..4c544c814d26d1157af16cdd39b4406d78bf9ac8 100644 (file)
@@ -435,6 +435,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);