aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/clk-provider.h
diff options
context:
space:
mode:
authorRajendra Nayak <rnayak@ti.com>2012-06-29 09:36:32 -0400
committerMike Turquette <mturquette@linaro.org>2012-07-11 18:36:42 -0400
commit357c3f0a6c7613f7230fcaf1eb16190ed2a4b0af (patch)
treeab2067f4d31b734a0e5e01bbcd32fad190e0baea /include/linux/clk-provider.h
parent6d9252bd9a4bb1dadc1f199fd276e3464a251085 (diff)
clk: Add support for rate table based dividers
Some divider clks do not have any obvious relationship between the divider and the value programmed in the register. For instance, say a value of 1 could signify divide by 6 and a value of 2 could signify divide by 4 etc. Also there are dividers where not all values possible based on the bitfield width are valid. For instance a 3 bit wide bitfield can be used to program a value from 0 to 7. However its possible that only 0 to 4 are valid values. All these cases need the platform code to pass a simple table of divider/value tuple, so the framework knows the exact value to be written based on the divider calculation and can also do better error checking. This patch adds support for such rate table based dividers and as part of the support adds a new registration function 'clk_register_divider_table()' and a new macro for static definition 'DEFINE_CLK_DIVIDER_TABLE'. Signed-off-by: Rajendra Nayak <rnayak@ti.com> Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'include/linux/clk-provider.h')
-rw-r--r--include/linux/clk-provider.h12
1 files changed, 12 insertions, 0 deletions
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