aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/clk-private.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-05-03 06:06:14 -0400
committerMike Turquette <mturquette@linaro.org>2012-05-08 17:13:25 -0400
commitf0948f59dbc8e725a96ba16da666e8f5cdd43ba8 (patch)
tree9343cecfdb735b4b9c327edea65e71801b5c3efe /include/linux/clk-private.h
parent31df9db99549cd29bbe5e32da4492970e6f97191 (diff)
clk: add a fixed factor clock
Having fixed factors/dividers in hardware is a common pattern, so add a basic clock type doing this. It basically describes a fixed factor clock using a nominator and a denominator. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Viresh Kumar <viresh.kumar@st.com> Tested-by: Shawn Guo <shawn.guo@linaro.org> [mturquette@linaro.org: constify parent_names in static init macro] [mturquette@linaro.org: copy/paste bug from mux in static init macro] [mturquette@linaro.org: fix error handling in clk_register_fixed_factor] [mturquette@linaro.org: improve division accuracy; thanks to Saravana] 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, 20 insertions, 0 deletions
diff --git a/include/linux/clk-private.h b/include/linux/clk-private.h
index b258532162b8..eb3f84bc5325 100644
--- a/include/linux/clk-private.h
+++ b/include/linux/clk-private.h
@@ -143,6 +143,26 @@ struct clk {
143 DEFINE_CLK(_name, clk_mux_ops, _flags, _parent_names, \ 143 DEFINE_CLK(_name, clk_mux_ops, _flags, _parent_names, \
144 _parents); 144 _parents);
145 145
146#define DEFINE_CLK_FIXED_FACTOR(_name, _parent_name, \
147 _parent_ptr, _flags, \
148 _mult, _div) \
149 static struct clk _name; \
150 static const char *_name##_parent_names[] = { \
151 _parent_name, \
152 }; \
153 static struct clk *_name##_parents[] = { \
154 _parent_ptr, \
155 }; \
156 static struct clk_fixed_factor _name##_hw = { \
157 .hw = { \
158 .clk = &_name, \
159 }, \
160 .mult = _mult, \
161 .div = _div, \
162 }; \
163 DEFINE_CLK(_name, clk_fixed_factor_ops, _flags, \
164 _name##_parent_names, _name##_parents);
165
146/** 166/**
147 * __clk_init - initialize the data structures in a struct clk 167 * __clk_init - initialize the data structures in a struct clk
148 * @dev: device initializing this clk, placeholder for now 168 * @dev: device initializing this clk, placeholder for now