diff options
author | Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> | 2013-11-09 14:24:19 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-11-11 09:26:59 +0100 |
commit | feb1e38b433a07645e91924df248f6eac93a383e (patch) | |
tree | bb92c01e5f23b18b8308640cfc90a05f9811285c /include/linux/clk.h | |
parent | fa1a406f7245c5482a17014d5b97e8948352e5a5 (diff) | |
download | barebox-feb1e38b433a07645e91924df248f6eac93a383e.tar.gz barebox-feb1e38b433a07645e91924df248f6eac93a383e.tar.xz |
clk: add of_clk_init and CLK_OF_DECLARE macro
This add barebox versions of of_clk_init for parsing and registering
clock providers from DT. Also, a macro CLK_OF_DECLARE is added, that
allows to put init callbacks into its own section that can be linked
in the binary.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/linux/clk.h')
-rw-r--r-- | include/linux/clk.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/clk.h b/include/linux/clk.h index 477840020c..af38c720e8 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -12,6 +12,7 @@ #define __LINUX_CLK_H #include <linux/err.h> +#include <linux/stringify.h> struct device_d; @@ -278,6 +279,11 @@ void clk_dump(int verbose); struct device_node; struct of_phandle_args; +#define CLK_OF_DECLARE(name, compat, fn) \ +const struct of_device_id __clk_of_table_##name \ +__attribute__ ((unused,section (".__clk_of_table_" __stringify(name)))) \ + = { .compatible = compat, .data = (u32)fn } + #if defined(CONFIG_OFTREE) && defined(CONFIG_COMMON_CLK_OF_PROVIDER) int of_clk_add_provider(struct device_node *np, struct clk *(*clk_src_get)(struct of_phandle_args *args, @@ -285,6 +291,8 @@ int of_clk_add_provider(struct device_node *np, void *data); void of_clk_del_provider(struct device_node *np); +typedef int (*of_clk_init_cb_t)(struct device_node *); + struct clk_onecell_data { struct clk **clks; unsigned int clk_num; @@ -295,6 +303,7 @@ struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec, void *data); struct clk *of_clk_get(struct device_node *np, int index); struct clk *of_clk_get_by_name(struct device_node *np, const char *name); struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec); +int of_clk_init(struct device_node *root, const struct of_device_id *matches); #else static inline struct clk *of_clk_get(struct device_node *np, int index) { @@ -305,6 +314,11 @@ static inline struct clk *of_clk_get_by_name(struct device_node *np, { return ERR_PTR(-ENOENT); } +static inline int of_clk_init(struct device_node *root, + const struct of_device_id *matches) +{ + return 0; +} #endif #endif |