clk: core: New macro CLK_OF_DECLARE_DRIVER
authorRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Tue, 5 Jul 2016 16:23:25 +0000 (18:23 +0200)
committerStephen Boyd <sboyd@codeaurora.org>
Sat, 13 Aug 2016 01:00:34 +0000 (18:00 -0700)
This will be used by drivers that requires initialization at
of_clk_init() time and also during platform device probing.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
include/linux/clk-provider.h

index a39c0c530778251b6d43920c6ff9de6f05c5e738..f403b8a5f8ca5ab6a56d93e60f2a0ad0bb26b903 100644 (file)
@@ -780,6 +780,18 @@ extern struct of_device_id __clk_of_table;
 
 #define CLK_OF_DECLARE(name, compat, fn) OF_DECLARE_1(clk, name, compat, fn)
 
+/*
+ * Use this macro when you have a driver that requires two initialization
+ * routines, one at of_clk_init(), and one at platform device probe
+ */
+#define CLK_OF_DECLARE_DRIVER(name, compat, fn) \
+       static void name##_of_clk_init_driver(struct device_node *np)   \
+       {                                                               \
+               of_node_clear_flag(np, OF_POPULATED);                   \
+               fn(np);                                                 \
+       }                                                               \
+       OF_DECLARE_1(clk, name, compat, name##_of_clk_init_driver)
+
 #ifdef CONFIG_OF
 int of_clk_add_provider(struct device_node *np,
                        struct clk *(*clk_src_get)(struct of_phandle_args *args,