aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/clk-private.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-private.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-private.h')
-rw-r--r--include/linux/clk-private.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/include/linux/clk-private.h b/include/linux/clk-private.h
index eb3f84bc532..cc9972d1429 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) \