diff options
author | Mike Turquette <mturquette@linaro.org> | 2013-10-08 02:12:13 -0400 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2013-10-08 02:13:33 -0400 |
commit | f61027426a5bc7093aa8359a411b053a35bb4b68 (patch) | |
tree | 225758cc8fe637500ff2a9160550aabcc0ddb4ef | |
parent | f8fe36f6083a70270a7305f7740b124ff1e8aea7 (diff) |
clk: of: helper for determining number of parent clocks
Walks the "clocks" array of parent clock phandles and returns the
number.
Signed-off-by: Mike Turquette <mturquette@linaro.org>
-rw-r--r-- | drivers/clk/clk.c | 6 | ||||
-rw-r--r-- | include/linux/clk-provider.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 32e2fed6d143..2cf2ea6b77a1 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
@@ -2202,6 +2202,12 @@ struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec) | |||
2202 | return clk; | 2202 | return clk; |
2203 | } | 2203 | } |
2204 | 2204 | ||
2205 | int of_clk_get_parent_count(struct device_node *np) | ||
2206 | { | ||
2207 | return of_count_phandle_with_args(np, "clocks", "#clock-cells"); | ||
2208 | } | ||
2209 | EXPORT_SYMBOL_GPL(of_clk_get_parent_count); | ||
2210 | |||
2205 | const char *of_clk_get_parent_name(struct device_node *np, int index) | 2211 | const char *of_clk_get_parent_name(struct device_node *np, int index) |
2206 | { | 2212 | { |
2207 | struct of_phandle_args clkspec; | 2213 | struct of_phandle_args clkspec; |
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 73bdb69f0c08..7e59253b8603 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h | |||
@@ -472,6 +472,7 @@ void of_clk_del_provider(struct device_node *np); | |||
472 | struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec, | 472 | struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec, |
473 | void *data); | 473 | void *data); |
474 | struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data); | 474 | struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data); |
475 | int of_clk_get_parent_count(struct device_node *np); | ||
475 | const char *of_clk_get_parent_name(struct device_node *np, int index); | 476 | const char *of_clk_get_parent_name(struct device_node *np, int index); |
476 | 477 | ||
477 | void of_clk_init(const struct of_device_id *matches); | 478 | void of_clk_init(const struct of_device_id *matches); |