aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>2013-04-30 20:58:28 -0400
committerMike Turquette <mturquette@linaro.org>2013-05-29 01:52:46 -0400
commit0b151debc31df089ddc07a3343031d8f51f988a3 (patch)
treeaef8b8d94cebbfbfce60867d03cad1ab31fdc923 /include
parentf8aa0bd5c9b28f80bf372d0f486737b13ff01910 (diff)
clk: add non CONFIG_OF routines for clk-provider
Some drivers that are shared between architectures have HAVE_CLK selected but don't have OF. To remove compilation errors for drivers that provide clocks on DT with of_clk_add_provider we would have to enclose these calls within #ifdef CONFIG_OF, #endif. This patch adds some stubs for OF related clk-provider functions that either do nothing or return appropriate values if CONFIG_OF is not set. So, definition of these routines will always be available. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/clk-provider.h47
1 files changed, 39 insertions, 8 deletions
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 11860985fecb..265f384f1e01 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -423,6 +423,17 @@ struct of_device_id;
423 423
424typedef void (*of_clk_init_cb_t)(struct device_node *); 424typedef void (*of_clk_init_cb_t)(struct device_node *);
425 425
426struct clk_onecell_data {
427 struct clk **clks;
428 unsigned int clk_num;
429};
430
431#define CLK_OF_DECLARE(name, compat, fn) \
432 static const struct of_device_id __clk_of_table_##name \
433 __used __section(__clk_of_table) \
434 = { .compatible = compat, .data = fn };
435
436#ifdef CONFIG_OF
426int of_clk_add_provider(struct device_node *np, 437int of_clk_add_provider(struct device_node *np,
427 struct clk *(*clk_src_get)(struct of_phandle_args *args, 438 struct clk *(*clk_src_get)(struct of_phandle_args *args,
428 void *data), 439 void *data),
@@ -430,19 +441,39 @@ int of_clk_add_provider(struct device_node *np,
430void of_clk_del_provider(struct device_node *np); 441void of_clk_del_provider(struct device_node *np);
431struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec, 442struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec,
432 void *data); 443 void *data);
433struct clk_onecell_data {
434 struct clk **clks;
435 unsigned int clk_num;
436};
437struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data); 444struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data);
438const char *of_clk_get_parent_name(struct device_node *np, int index); 445const char *of_clk_get_parent_name(struct device_node *np, int index);
439 446
440void of_clk_init(const struct of_device_id *matches); 447void of_clk_init(const struct of_device_id *matches);
441 448
442#define CLK_OF_DECLARE(name, compat, fn) \ 449#else /* !CONFIG_OF */
443 static const struct of_device_id __clk_of_table_##name \
444 __used __section(__clk_of_table) \
445 = { .compatible = compat, .data = fn };
446 450
451static inline int of_clk_add_provider(struct device_node *np,
452 struct clk *(*clk_src_get)(struct of_phandle_args *args,
453 void *data),
454 void *data)
455{
456 return 0;
457}
458#define of_clk_del_provider(np) \
459 { while (0); }
460static inline struct clk *of_clk_src_simple_get(
461 struct of_phandle_args *clkspec, void *data)
462{
463 return ERR_PTR(-ENOENT);
464}
465static inline struct clk *of_clk_src_onecell_get(
466 struct of_phandle_args *clkspec, void *data)
467{
468 return ERR_PTR(-ENOENT);
469}
470static inline const char *of_clk_get_parent_name(struct device_node *np,
471 int index)
472{
473 return NULL;
474}
475#define of_clk_init(matches) \
476 { while (0); }
477#endif /* CONFIG_OF */
447#endif /* CONFIG_COMMON_CLK */ 478#endif /* CONFIG_COMMON_CLK */
448#endif /* CLK_PROVIDER_H */ 479#endif /* CLK_PROVIDER_H */