]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
clk: move clock common macros out from vendor directories
authorChunyan Zhang <chunyan.zhang@spreadtrum.com>
Thu, 7 Dec 2017 12:57:04 +0000 (20:57 +0800)
committerStephen Boyd <sboyd@codeaurora.org>
Thu, 21 Dec 2017 23:00:38 +0000 (15:00 -0800)
These macros are used by more than one SoC vendor platforms, avoid to
have many copies of these code, this patch moves them to the common
header file which every clock drivers can access to.

Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/sunxi-ng/ccu_common.h
drivers/clk/zte/clk.h
include/linux/clk-provider.h

index 5d684ce77c548e24be2a0fa8f005269dc2f273ad..568cfaed081361d201482fdcd35a6beb1680af6e 100644 (file)
 
 struct device_node;
 
-#define CLK_HW_INIT(_name, _parent, _ops, _flags)                      \
-       &(struct clk_init_data) {                                       \
-               .flags          = _flags,                               \
-               .name           = _name,                                \
-               .parent_names   = (const char *[]) { _parent },         \
-               .num_parents    = 1,                                    \
-               .ops            = _ops,                                 \
-       }
-
-#define CLK_HW_INIT_PARENTS(_name, _parents, _ops, _flags)             \
-       &(struct clk_init_data) {                                       \
-               .flags          = _flags,                               \
-               .name           = _name,                                \
-               .parent_names   = _parents,                             \
-               .num_parents    = ARRAY_SIZE(_parents),                 \
-               .ops            = _ops,                                 \
-       }
-
-#define CLK_FIXED_FACTOR(_struct, _name, _parent,                      \
-                       _div, _mult, _flags)                            \
-       struct clk_fixed_factor _struct = {                             \
-               .div            = _div,                                 \
-               .mult           = _mult,                                \
-               .hw.init        = CLK_HW_INIT(_name,                    \
-                                             _parent,                  \
-                                             &clk_fixed_factor_ops,    \
-                                             _flags),                  \
-       }
-
 struct ccu_common {
        void __iomem    *base;
        u16             reg;
index 4df0f121b56d7cf622cf6ca9103d3200ca7f6c2c..f1041e36bcf135c055ee393a82e5e47e6026b96b 100644 (file)
 
 #define PNAME(x) static const char *x[]
 
-#define CLK_HW_INIT(_name, _parent, _ops, _flags)                      \
-       &(struct clk_init_data) {                                       \
-               .flags          = _flags,                               \
-               .name           = _name,                                \
-               .parent_names   = (const char *[]) { _parent },         \
-               .num_parents    = 1,                                    \
-               .ops            = _ops,                                 \
-       }
-
-#define CLK_HW_INIT_PARENTS(_name, _parents, _ops, _flags)             \
-       &(struct clk_init_data) {                                       \
-               .flags          = _flags,                               \
-               .name           = _name,                                \
-               .parent_names   = _parents,                             \
-               .num_parents    = ARRAY_SIZE(_parents),                 \
-               .ops            = _ops,                                 \
-       }
-
 struct zx_pll_config {
        unsigned long rate;
        u32 cfg0;
index 7c925e6211f12eb91b1236d091eed57180899138..26ea037f88e9b0d43d1a035a3371eea7d8bf12c1 100644 (file)
@@ -806,6 +806,44 @@ extern struct of_device_id __clk_of_table;
        }                                                               \
        OF_DECLARE_1(clk, name, compat, name##_of_clk_init_driver)
 
+#define CLK_HW_INIT(_name, _parent, _ops, _flags)              \
+       (&(struct clk_init_data) {                              \
+               .flags          = _flags,                       \
+               .name           = _name,                        \
+               .parent_names   = (const char *[]) { _parent }, \
+               .num_parents    = 1,                            \
+               .ops            = _ops,                         \
+       })
+
+#define CLK_HW_INIT_PARENTS(_name, _parents, _ops, _flags)     \
+       (&(struct clk_init_data) {                              \
+               .flags          = _flags,                       \
+               .name           = _name,                        \
+               .parent_names   = _parents,                     \
+               .num_parents    = ARRAY_SIZE(_parents),         \
+               .ops            = _ops,                         \
+       })
+
+#define CLK_HW_INIT_NO_PARENT(_name, _ops, _flags)     \
+       (&(struct clk_init_data) {                      \
+               .flags          = _flags,               \
+               .name           = _name,                \
+               .parent_names   = NULL,                 \
+               .num_parents    = 0,                    \
+               .ops            = _ops,                 \
+       })
+
+#define CLK_FIXED_FACTOR(_struct, _name, _parent,                      \
+                       _div, _mult, _flags)                            \
+       struct clk_fixed_factor _struct = {                             \
+               .div            = _div,                                 \
+               .mult           = _mult,                                \
+               .hw.init        = CLK_HW_INIT(_name,                    \
+                                             _parent,                  \
+                                             &clk_fixed_factor_ops,    \
+                                             _flags),                  \
+       }
+
 #ifdef CONFIG_OF
 int of_clk_add_provider(struct device_node *np,
                        struct clk *(*clk_src_get)(struct of_phandle_args *args,