diff options
author | Tero Kristo <t-kristo@ti.com> | 2014-10-03 09:57:12 -0400 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2014-11-13 11:26:25 -0500 |
commit | 83501ff0a5032dfbd63ab1ca9d9d25b97ec49fb9 (patch) | |
tree | 97c507d2043017e968449341c666fc05094c430d | |
parent | d539efa37f1f789339699c941e72e320d12d5f28 (diff) |
ARM: OMAP4: clock: add support for determine_rate for omap4 regm4xen DPLL
Similarly to OMAP3 noncore DPLL, the implementation of this DPLL clock
type is wrong. This patch adds basic functionality for determine_rate
for this clock type which will be taken into use in the patches following
later.
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
-rw-r--r-- | arch/arm/mach-omap2/dpll44xx.c | 41 | ||||
-rw-r--r-- | include/linux/clk/ti.h | 4 |
2 files changed, 45 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/dpll44xx.c b/arch/arm/mach-omap2/dpll44xx.c index 4613f1e86988..535822fcf4bb 100644 --- a/arch/arm/mach-omap2/dpll44xx.c +++ b/arch/arm/mach-omap2/dpll44xx.c | |||
@@ -207,3 +207,44 @@ out: | |||
207 | 207 | ||
208 | return dd->last_rounded_rate; | 208 | return dd->last_rounded_rate; |
209 | } | 209 | } |
210 | |||
211 | /** | ||
212 | * omap4_dpll_regm4xen_determine_rate - determine rate for a DPLL | ||
213 | * @hw: pointer to the clock to determine rate for | ||
214 | * @rate: target rate for the DPLL | ||
215 | * @best_parent_rate: pointer for returning best parent rate | ||
216 | * @best_parent_clk: pointer for returning best parent clock | ||
217 | * | ||
218 | * Determines which DPLL mode to use for reaching a desired rate. | ||
219 | * Checks whether the DPLL shall be in bypass or locked mode, and if | ||
220 | * locked, calculates the M,N values for the DPLL via round-rate. | ||
221 | * Returns a positive clock rate with success, negative error value | ||
222 | * in failure. | ||
223 | */ | ||
224 | long omap4_dpll_regm4xen_determine_rate(struct clk_hw *hw, unsigned long rate, | ||
225 | unsigned long *best_parent_rate, | ||
226 | struct clk **best_parent_clk) | ||
227 | { | ||
228 | struct clk_hw_omap *clk = to_clk_hw_omap(hw); | ||
229 | struct dpll_data *dd; | ||
230 | |||
231 | if (!hw || !rate) | ||
232 | return -EINVAL; | ||
233 | |||
234 | dd = clk->dpll_data; | ||
235 | if (!dd) | ||
236 | return -EINVAL; | ||
237 | |||
238 | if (__clk_get_rate(dd->clk_bypass) == rate && | ||
239 | (dd->modes & (1 << DPLL_LOW_POWER_BYPASS))) { | ||
240 | *best_parent_clk = dd->clk_bypass; | ||
241 | } else { | ||
242 | rate = omap4_dpll_regm4xen_round_rate(hw, rate, | ||
243 | best_parent_rate); | ||
244 | *best_parent_clk = dd->clk_ref; | ||
245 | } | ||
246 | |||
247 | *best_parent_rate = rate; | ||
248 | |||
249 | return rate; | ||
250 | } | ||
diff --git a/include/linux/clk/ti.h b/include/linux/clk/ti.h index 6f9fb77ffdd5..abc702a73aca 100644 --- a/include/linux/clk/ti.h +++ b/include/linux/clk/ti.h | |||
@@ -270,6 +270,10 @@ unsigned long omap4_dpll_regm4xen_recalc(struct clk_hw *hw, | |||
270 | long omap4_dpll_regm4xen_round_rate(struct clk_hw *hw, | 270 | long omap4_dpll_regm4xen_round_rate(struct clk_hw *hw, |
271 | unsigned long target_rate, | 271 | unsigned long target_rate, |
272 | unsigned long *parent_rate); | 272 | unsigned long *parent_rate); |
273 | long omap4_dpll_regm4xen_determine_rate(struct clk_hw *hw, | ||
274 | unsigned long rate, | ||
275 | unsigned long *best_parent_rate, | ||
276 | struct clk **best_parent_clk); | ||
273 | u8 omap2_init_dpll_parent(struct clk_hw *hw); | 277 | u8 omap2_init_dpll_parent(struct clk_hw *hw); |
274 | unsigned long omap3_dpll_recalc(struct clk_hw *hw, unsigned long parent_rate); | 278 | unsigned long omap3_dpll_recalc(struct clk_hw *hw, unsigned long parent_rate); |
275 | long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate, | 279 | long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate, |