diff options
Diffstat (limited to 'include/linux/clk-private.h')
-rw-r--r-- | include/linux/clk-private.h | 59 |
1 files changed, 20 insertions, 39 deletions
diff --git a/include/linux/clk-private.h b/include/linux/clk-private.h index e7032fdd45eb..eeae7a3cfc45 100644 --- a/include/linux/clk-private.h +++ b/include/linux/clk-private.h | |||
@@ -55,6 +55,18 @@ struct clk { | |||
55 | * alternative macro for static initialization | 55 | * alternative macro for static initialization |
56 | */ | 56 | */ |
57 | 57 | ||
58 | #define DEFINE_CLK(_name, _ops, _flags, _parent_names, \ | ||
59 | _parents) \ | ||
60 | static struct clk _name = { \ | ||
61 | .name = #_name, \ | ||
62 | .ops = &_ops, \ | ||
63 | .hw = &_name##_hw.hw, \ | ||
64 | .parent_names = _parent_names, \ | ||
65 | .num_parents = ARRAY_SIZE(_parent_names), \ | ||
66 | .parents = _parents, \ | ||
67 | .flags = _flags, \ | ||
68 | } | ||
69 | |||
58 | #define DEFINE_CLK_FIXED_RATE(_name, _flags, _rate, \ | 70 | #define DEFINE_CLK_FIXED_RATE(_name, _flags, _rate, \ |
59 | _fixed_rate_flags) \ | 71 | _fixed_rate_flags) \ |
60 | static struct clk _name; \ | 72 | static struct clk _name; \ |
@@ -66,15 +78,8 @@ struct clk { | |||
66 | .fixed_rate = _rate, \ | 78 | .fixed_rate = _rate, \ |
67 | .flags = _fixed_rate_flags, \ | 79 | .flags = _fixed_rate_flags, \ |
68 | }; \ | 80 | }; \ |
69 | static struct clk _name = { \ | 81 | DEFINE_CLK(_name, clk_fixed_rate_ops, _flags, \ |
70 | .name = #_name, \ | 82 | _name##_parent_names, NULL); |
71 | .ops = &clk_fixed_rate_ops, \ | ||
72 | .hw = &_name##_hw.hw, \ | ||
73 | .parent_names = _name##_parent_names, \ | ||
74 | .num_parents = \ | ||
75 | ARRAY_SIZE(_name##_parent_names), \ | ||
76 | .flags = _flags, \ | ||
77 | }; | ||
78 | 83 | ||
79 | #define DEFINE_CLK_GATE(_name, _parent_name, _parent_ptr, \ | 84 | #define DEFINE_CLK_GATE(_name, _parent_name, _parent_ptr, \ |
80 | _flags, _reg, _bit_idx, \ | 85 | _flags, _reg, _bit_idx, \ |
@@ -95,16 +100,8 @@ struct clk { | |||
95 | .flags = _gate_flags, \ | 100 | .flags = _gate_flags, \ |
96 | .lock = _lock, \ | 101 | .lock = _lock, \ |
97 | }; \ | 102 | }; \ |
98 | static struct clk _name = { \ | 103 | DEFINE_CLK(_name, clk_gate_ops, _flags, \ |
99 | .name = #_name, \ | 104 | _name##_parent_names, _name##_parents); |
100 | .ops = &clk_gate_ops, \ | ||
101 | .hw = &_name##_hw.hw, \ | ||
102 | .parent_names = _name##_parent_names, \ | ||
103 | .num_parents = \ | ||
104 | ARRAY_SIZE(_name##_parent_names), \ | ||
105 | .parents = _name##_parents, \ | ||
106 | .flags = _flags, \ | ||
107 | }; | ||
108 | 105 | ||
109 | #define DEFINE_CLK_DIVIDER(_name, _parent_name, _parent_ptr, \ | 106 | #define DEFINE_CLK_DIVIDER(_name, _parent_name, _parent_ptr, \ |
110 | _flags, _reg, _shift, _width, \ | 107 | _flags, _reg, _shift, _width, \ |
@@ -126,16 +123,8 @@ struct clk { | |||
126 | .flags = _divider_flags, \ | 123 | .flags = _divider_flags, \ |
127 | .lock = _lock, \ | 124 | .lock = _lock, \ |
128 | }; \ | 125 | }; \ |
129 | static struct clk _name = { \ | 126 | DEFINE_CLK(_name, clk_divider_ops, _flags, \ |
130 | .name = #_name, \ | 127 | _name##_parent_names, _name##_parents); |
131 | .ops = &clk_divider_ops, \ | ||
132 | .hw = &_name##_hw.hw, \ | ||
133 | .parent_names = _name##_parent_names, \ | ||
134 | .num_parents = \ | ||
135 | ARRAY_SIZE(_name##_parent_names), \ | ||
136 | .parents = _name##_parents, \ | ||
137 | .flags = _flags, \ | ||
138 | }; | ||
139 | 128 | ||
140 | #define DEFINE_CLK_MUX(_name, _parent_names, _parents, _flags, \ | 129 | #define DEFINE_CLK_MUX(_name, _parent_names, _parents, _flags, \ |
141 | _reg, _shift, _width, \ | 130 | _reg, _shift, _width, \ |
@@ -151,16 +140,8 @@ struct clk { | |||
151 | .flags = _mux_flags, \ | 140 | .flags = _mux_flags, \ |
152 | .lock = _lock, \ | 141 | .lock = _lock, \ |
153 | }; \ | 142 | }; \ |
154 | static struct clk _name = { \ | 143 | DEFINE_CLK(_name, clk_mux_ops, _flags, _parent_names, \ |
155 | .name = #_name, \ | 144 | _parents); |
156 | .ops = &clk_mux_ops, \ | ||
157 | .hw = &_name##_hw.hw, \ | ||
158 | .parent_names = _parent_names, \ | ||
159 | .num_parents = \ | ||
160 | ARRAY_SIZE(_parent_names), \ | ||
161 | .parents = _parents, \ | ||
162 | .flags = _flags, \ | ||
163 | }; | ||
164 | 145 | ||
165 | /** | 146 | /** |
166 | * __clk_init - initialize the data structures in a struct clk | 147 | * __clk_init - initialize the data structures in a struct clk |