aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/clk-private.h20
-rw-r--r--include/linux/clk-provider.h12
2 files changed, 30 insertions, 2 deletions
diff --git a/include/linux/clk-private.h b/include/linux/clk-private.h
index eb3f84bc5325..cc9972d1429c 100644
--- a/include/linux/clk-private.h
+++ b/include/linux/clk-private.h
@@ -103,9 +103,9 @@ struct clk {
103 DEFINE_CLK(_name, clk_gate_ops, _flags, \ 103 DEFINE_CLK(_name, clk_gate_ops, _flags, \
104 _name##_parent_names, _name##_parents); 104 _name##_parent_names, _name##_parents);
105 105
106#define DEFINE_CLK_DIVIDER(_name, _parent_name, _parent_ptr, \ 106#define _DEFINE_CLK_DIVIDER(_name, _parent_name, _parent_ptr, \
107 _flags, _reg, _shift, _width, \ 107 _flags, _reg, _shift, _width, \
108 _divider_flags, _lock) \ 108 _divider_flags, _table, _lock) \
109 static struct clk _name; \ 109 static struct clk _name; \
110 static const char *_name##_parent_names[] = { \ 110 static const char *_name##_parent_names[] = { \
111 _parent_name, \ 111 _parent_name, \
@@ -121,11 +121,27 @@ struct clk {
121 .shift = _shift, \ 121 .shift = _shift, \
122 .width = _width, \ 122 .width = _width, \
123 .flags = _divider_flags, \ 123 .flags = _divider_flags, \
124 .table = _table, \
124 .lock = _lock, \ 125 .lock = _lock, \
125 }; \ 126 }; \
126 DEFINE_CLK(_name, clk_divider_ops, _flags, \ 127 DEFINE_CLK(_name, clk_divider_ops, _flags, \
127 _name##_parent_names, _name##_parents); 128 _name##_parent_names, _name##_parents);
128 129
130#define DEFINE_CLK_DIVIDER(_name, _parent_name, _parent_ptr, \
131 _flags, _reg, _shift, _width, \
132 _divider_flags, _lock) \
133 _DEFINE_CLK_DIVIDER(_name, _parent_name, _parent_ptr, \
134 _flags, _reg, _shift, _width, \
135 _divider_flags, NULL, _lock)
136
137#define DEFINE_CLK_DIVIDER_TABLE(_name, _parent_name, \
138 _parent_ptr, _flags, _reg, \
139 _shift, _width, _divider_flags, \
140 _table, _lock) \
141 _DEFINE_CLK_DIVIDER(_name, _parent_name, _parent_ptr, \
142 _flags, _reg, _shift, _width, \
143 _divider_flags, _table, _lock) \
144
129#define DEFINE_CLK_MUX(_name, _parent_names, _parents, _flags, \ 145#define DEFINE_CLK_MUX(_name, _parent_names, _parents, _flags, \
130 _reg, _shift, _width, \ 146 _reg, _shift, _width, \
131 _mux_flags, _lock) \ 147 _mux_flags, _lock) \
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 4a0b483986c3..79caee9f1489 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -203,6 +203,11 @@ struct clk *clk_register_gate(struct device *dev, const char *name,
203 void __iomem *reg, u8 bit_idx, 203 void __iomem *reg, u8 bit_idx,
204 u8 clk_gate_flags, spinlock_t *lock); 204 u8 clk_gate_flags, spinlock_t *lock);
205 205
206struct clk_div_table {
207 unsigned int val;
208 unsigned int div;
209};
210
206/** 211/**
207 * struct clk_divider - adjustable divider clock 212 * struct clk_divider - adjustable divider clock
208 * 213 *
@@ -210,6 +215,7 @@ struct clk *clk_register_gate(struct device *dev, const char *name,
210 * @reg: register containing the divider 215 * @reg: register containing the divider
211 * @shift: shift to the divider bit field 216 * @shift: shift to the divider bit field
212 * @width: width of the divider bit field 217 * @width: width of the divider bit field
218 * @table: array of value/divider pairs, last entry should have div = 0
213 * @lock: register lock 219 * @lock: register lock
214 * 220 *
215 * Clock with an adjustable divider affecting its output frequency. Implements 221 * Clock with an adjustable divider affecting its output frequency. Implements
@@ -229,6 +235,7 @@ struct clk_divider {
229 u8 shift; 235 u8 shift;
230 u8 width; 236 u8 width;
231 u8 flags; 237 u8 flags;
238 const struct clk_div_table *table;
232 spinlock_t *lock; 239 spinlock_t *lock;
233}; 240};
234 241
@@ -240,6 +247,11 @@ struct clk *clk_register_divider(struct device *dev, const char *name,
240 const char *parent_name, unsigned long flags, 247 const char *parent_name, unsigned long flags,
241 void __iomem *reg, u8 shift, u8 width, 248 void __iomem *reg, u8 shift, u8 width,
242 u8 clk_divider_flags, spinlock_t *lock); 249 u8 clk_divider_flags, spinlock_t *lock);
250struct clk *clk_register_divider_table(struct device *dev, const char *name,
251 const char *parent_name, unsigned long flags,
252 void __iomem *reg, u8 shift, u8 width,
253 u8 clk_divider_flags, const struct clk_div_table *table,
254 spinlock_t *lock);
243 255
244/** 256/**
245 * struct clk_mux - multiplexer clock 257 * struct clk_mux - multiplexer clock