summaryrefslogtreecommitdiffstats
path: root/include/linux/clk.h
diff options
context:
space:
mode:
authorLucas Stach <dev@lynxeye.de>2013-06-30 23:08:43 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-07-02 08:36:09 +0200
commitb0d851d9517e113481b3c32bf90006b3f2d7503e (patch)
tree1c6e9480bc6d784e8bbee3aa661473cefe385c52 /include/linux/clk.h
parent63c521940a3c8ee6403acefa30b92107c8fdea91 (diff)
downloadbarebox-b0d851d9517e113481b3c32bf90006b3f2d7503e.tar.gz
barebox-b0d851d9517e113481b3c32bf90006b3f2d7503e.tar.xz
clk: add clock lookup from devicetree
Taken from the Linuxkernel with some small adjustments for barebox. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/linux/clk.h')
-rw-r--r--include/linux/clk.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 38832ba942..1cb661e35e 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -11,6 +11,8 @@
#ifndef __LINUX_CLK_H
#define __LINUX_CLK_H
+#include <linux/err.h>
+
struct device_d;
/*
@@ -228,4 +230,35 @@ void clk_dump(int verbose);
#endif
+struct device_node;
+struct of_phandle_args;
+
+#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,
+ void *data),
+ void *data);
+void of_clk_del_provider(struct device_node *np);
+
+struct clk_onecell_data {
+ struct clk **clks;
+ unsigned int clk_num;
+};
+struct clk *of_clk_src_onecell_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);
+#else
+static inline struct clk *of_clk_get(struct device_node *np, int index)
+{
+ return ERR_PTR(-ENOENT);
+}
+static inline struct clk *of_clk_get_by_name(struct device_node *np,
+ const char *name)
+{
+ return ERR_PTR(-ENOENT);
+}
+#endif
+
#endif