aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTero Kristo <t-kristo@ti.com>2015-03-02 02:57:28 -0500
committerTero Kristo <t-kristo@ti.com>2015-06-02 05:30:58 -0400
commitb138b0283d35bed0cd3353d7e39add8ac493eb37 (patch)
treee748f08276e90652b80e7eb48a6925f1a00b5929
parentf3b19aa5cab65f7e73613aa37f6851ce56b794d1 (diff)
clk: ti: move generic OMAP DPLL implementation under drivers/clk
With the legacy clock data now gone, we can start moving OMAP clock type implementations under clock driver. Start this with moving the generic OMAP DPLL clock type under TI clock driver. Signed-off-by: Tero Kristo <t-kristo@ti.com>
-rw-r--r--arch/arm/mach-omap2/Makefile2
-rw-r--r--drivers/clk/ti/Makefile3
-rw-r--r--drivers/clk/ti/clkt_dpll.c (renamed from arch/arm/mach-omap2/clkt_dpll.c)13
-rw-r--r--drivers/clk/ti/clock.h2
-rw-r--r--include/linux/clk/ti.h1
5 files changed, 11 insertions, 10 deletions
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index ec002bd4af77..fcb5d47f88ca 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -13,7 +13,7 @@ obj-y := id.o io.o control.o mux.o devices.o fb.o serial.o timer.o pm.o \
13hwmod-common = omap_hwmod.o omap_hwmod_reset.o \ 13hwmod-common = omap_hwmod.o omap_hwmod_reset.o \
14 omap_hwmod_common_data.o 14 omap_hwmod_common_data.o
15clock-common = clock.o clock_common_data.o \ 15clock-common = clock.o clock_common_data.o \
16 clkt_dpll.o clkt_clksel.o 16 clkt_clksel.o
17secure-common = omap-smc.o omap-secure.o 17secure-common = omap-smc.o omap-secure.o
18 18
19obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(hwmod-common) 19obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(hwmod-common)
diff --git a/drivers/clk/ti/Makefile b/drivers/clk/ti/Makefile
index 105ffd0f5e79..62dae2ad3c69 100644
--- a/drivers/clk/ti/Makefile
+++ b/drivers/clk/ti/Makefile
@@ -1,6 +1,7 @@
1obj-y += clk.o autoidle.o clockdomain.o 1obj-y += clk.o autoidle.o clockdomain.o
2clk-common = dpll.o composite.o divider.o gate.o \ 2clk-common = dpll.o composite.o divider.o gate.o \
3 fixed-factor.o mux.o apll.o 3 fixed-factor.o mux.o apll.o \
4 clkt_dpll.o
4obj-$(CONFIG_SOC_AM33XX) += $(clk-common) clk-33xx.o 5obj-$(CONFIG_SOC_AM33XX) += $(clk-common) clk-33xx.o
5obj-$(CONFIG_SOC_TI81XX) += $(clk-common) fapll.o clk-816x.o 6obj-$(CONFIG_SOC_TI81XX) += $(clk-common) fapll.o clk-816x.o
6obj-$(CONFIG_ARCH_OMAP2) += $(clk-common) interface.o clk-2xxx.o 7obj-$(CONFIG_ARCH_OMAP2) += $(clk-common) interface.o clk-2xxx.o
diff --git a/arch/arm/mach-omap2/clkt_dpll.c b/drivers/clk/ti/clkt_dpll.c
index 82f0600c35f4..a01fc7f305c1 100644
--- a/arch/arm/mach-omap2/clkt_dpll.c
+++ b/drivers/clk/ti/clkt_dpll.c
@@ -18,6 +18,7 @@
18#include <linux/errno.h> 18#include <linux/errno.h>
19#include <linux/clk-provider.h> 19#include <linux/clk-provider.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/clk/ti.h>
21 22
22#include <asm/div64.h> 23#include <asm/div64.h>
23 24
@@ -211,7 +212,7 @@ u8 omap2_init_dpll_parent(struct clk_hw *hw)
211 if (!dd) 212 if (!dd)
212 return -EINVAL; 213 return -EINVAL;
213 214
214 v = omap2_clk_readl(clk, dd->control_reg); 215 v = ti_clk_ll_ops->clk_readl(dd->control_reg);
215 v &= dd->enable_mask; 216 v &= dd->enable_mask;
216 v >>= __ffs(dd->enable_mask); 217 v >>= __ffs(dd->enable_mask);
217 218
@@ -247,20 +248,20 @@ unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk)
247 return 0; 248 return 0;
248 249
249 /* Return bypass rate if DPLL is bypassed */ 250 /* Return bypass rate if DPLL is bypassed */
250 v = omap2_clk_readl(clk, dd->control_reg); 251 v = ti_clk_ll_ops->clk_readl(dd->control_reg);
251 v &= dd->enable_mask; 252 v &= dd->enable_mask;
252 v >>= __ffs(dd->enable_mask); 253 v >>= __ffs(dd->enable_mask);
253 254
254 if (_omap2_dpll_is_in_bypass(v)) 255 if (_omap2_dpll_is_in_bypass(v))
255 return __clk_get_rate(dd->clk_bypass); 256 return __clk_get_rate(dd->clk_bypass);
256 257
257 v = omap2_clk_readl(clk, dd->mult_div1_reg); 258 v = ti_clk_ll_ops->clk_readl(dd->mult_div1_reg);
258 dpll_mult = v & dd->mult_mask; 259 dpll_mult = v & dd->mult_mask;
259 dpll_mult >>= __ffs(dd->mult_mask); 260 dpll_mult >>= __ffs(dd->mult_mask);
260 dpll_div = v & dd->div1_mask; 261 dpll_div = v & dd->div1_mask;
261 dpll_div >>= __ffs(dd->div1_mask); 262 dpll_div >>= __ffs(dd->div1_mask);
262 263
263 dpll_clk = (long long) __clk_get_rate(dd->clk_ref) * dpll_mult; 264 dpll_clk = (long long)__clk_get_rate(dd->clk_ref) * dpll_mult;
264 do_div(dpll_clk, dpll_div + 1); 265 do_div(dpll_clk, dpll_div + 1);
265 266
266 return dpll_clk; 267 return dpll_clk;
@@ -281,7 +282,7 @@ unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk)
281 * be rounded, or the rounded rate upon success. 282 * be rounded, or the rounded rate upon success.
282 */ 283 */
283long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate, 284long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate,
284 unsigned long *parent_rate) 285 unsigned long *parent_rate)
285{ 286{
286 struct clk_hw_omap *clk = to_clk_hw_omap(hw); 287 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
287 int m, n, r, scaled_max_m; 288 int m, n, r, scaled_max_m;
@@ -310,7 +311,6 @@ long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate,
310 dd->last_rounded_rate = 0; 311 dd->last_rounded_rate = 0;
311 312
312 for (n = dd->min_divider; n <= dd->max_divider; n++) { 313 for (n = dd->min_divider; n <= dd->max_divider; n++) {
313
314 /* Is the (input clk, divider) pair valid for the DPLL? */ 314 /* Is the (input clk, divider) pair valid for the DPLL? */
315 r = _dpll_test_fint(clk, n); 315 r = _dpll_test_fint(clk, n);
316 if (r == DPLL_FINT_UNDERFLOW) 316 if (r == DPLL_FINT_UNDERFLOW)
@@ -367,4 +367,3 @@ long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate,
367 367
368 return dd->last_rounded_rate; 368 return dd->last_rounded_rate;
369} 369}
370
diff --git a/drivers/clk/ti/clock.h b/drivers/clk/ti/clock.h
index 404158d2d7f8..05ed10a81ace 100644
--- a/drivers/clk/ti/clock.h
+++ b/drivers/clk/ti/clock.h
@@ -169,4 +169,6 @@ void ti_clk_patch_legacy_clks(struct ti_clk **patch);
169struct clk *ti_clk_register_clk(struct ti_clk *setup); 169struct clk *ti_clk_register_clk(struct ti_clk *setup);
170int ti_clk_register_legacy_clks(struct ti_clk_alias *clks); 170int ti_clk_register_legacy_clks(struct ti_clk_alias *clks);
171 171
172u8 omap2_init_dpll_parent(struct clk_hw *hw);
173
172#endif 174#endif
diff --git a/include/linux/clk/ti.h b/include/linux/clk/ti.h
index 1a7f86a68f62..886b2e9d2204 100644
--- a/include/linux/clk/ti.h
+++ b/include/linux/clk/ti.h
@@ -286,7 +286,6 @@ long omap4_dpll_regm4xen_determine_rate(struct clk_hw *hw,
286 unsigned long max_rate, 286 unsigned long max_rate,
287 unsigned long *best_parent_rate, 287 unsigned long *best_parent_rate,
288 struct clk_hw **best_parent_clk); 288 struct clk_hw **best_parent_clk);
289u8 omap2_init_dpll_parent(struct clk_hw *hw);
290unsigned long omap3_dpll_recalc(struct clk_hw *hw, unsigned long parent_rate); 289unsigned long omap3_dpll_recalc(struct clk_hw *hw, unsigned long parent_rate);
291long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate, 290long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate,
292 unsigned long *parent_rate); 291 unsigned long *parent_rate);