diff options
author | Paul Walmsley <paul@pwsan.com> | 2012-11-10 21:32:46 -0500 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2012-11-12 21:18:50 -0500 |
commit | 455db9c9b23224f939723e9ded22b7a9a78fb57a (patch) | |
tree | b8ed2f9b4b13d500cbe15b24302f0aa4d81174f5 /arch/arm/mach-omap2/dpll3xxx.c | |
parent | e127539fb355848b5e3f08d97b4df49c83789aa1 (diff) |
ARM: OMAP3+: DPLL: drop !CONFIG_COMMON_CLK sections
Remove all of the code that is compiled when CONFIG_COMMON_CLK=n in the
OMAP3+ DPLL handling code.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Mike Turquette <mturquette@ti.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/dpll3xxx.c')
-rw-r--r-- | arch/arm/mach-omap2/dpll3xxx.c | 231 |
1 files changed, 3 insertions, 228 deletions
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c index f72dedb4eee8..fafb28c0dcbc 100644 --- a/arch/arm/mach-omap2/dpll3xxx.c +++ b/arch/arm/mach-omap2/dpll3xxx.c | |||
@@ -43,11 +43,7 @@ | |||
43 | /* Private functions */ | 43 | /* Private functions */ |
44 | 44 | ||
45 | /* _omap3_dpll_write_clken - write clken_bits arg to a DPLL's enable bits */ | 45 | /* _omap3_dpll_write_clken - write clken_bits arg to a DPLL's enable bits */ |
46 | #ifdef CONFIG_COMMON_CLK | ||
47 | static void _omap3_dpll_write_clken(struct clk_hw_omap *clk, u8 clken_bits) | 46 | static void _omap3_dpll_write_clken(struct clk_hw_omap *clk, u8 clken_bits) |
48 | #else | ||
49 | static void _omap3_dpll_write_clken(struct clk *clk, u8 clken_bits) | ||
50 | #endif | ||
51 | { | 47 | { |
52 | const struct dpll_data *dd; | 48 | const struct dpll_data *dd; |
53 | u32 v; | 49 | u32 v; |
@@ -61,11 +57,7 @@ static void _omap3_dpll_write_clken(struct clk *clk, u8 clken_bits) | |||
61 | } | 57 | } |
62 | 58 | ||
63 | /* _omap3_wait_dpll_status: wait for a DPLL to enter a specific state */ | 59 | /* _omap3_wait_dpll_status: wait for a DPLL to enter a specific state */ |
64 | #ifdef CONFIG_COMMON_CLK | ||
65 | static int _omap3_wait_dpll_status(struct clk_hw_omap *clk, u8 state) | 60 | static int _omap3_wait_dpll_status(struct clk_hw_omap *clk, u8 state) |
66 | #else | ||
67 | static int _omap3_wait_dpll_status(struct clk *clk, u8 state) | ||
68 | #endif | ||
69 | { | 61 | { |
70 | const struct dpll_data *dd; | 62 | const struct dpll_data *dd; |
71 | int i = 0; | 63 | int i = 0; |
@@ -73,11 +65,7 @@ static int _omap3_wait_dpll_status(struct clk *clk, u8 state) | |||
73 | const char *clk_name; | 65 | const char *clk_name; |
74 | 66 | ||
75 | dd = clk->dpll_data; | 67 | dd = clk->dpll_data; |
76 | #ifdef CONFIG_COMMON_CLK | ||
77 | clk_name = __clk_get_name(clk->hw.clk); | 68 | clk_name = __clk_get_name(clk->hw.clk); |
78 | #else | ||
79 | clk_name = __clk_get_name(clk); | ||
80 | #endif | ||
81 | 69 | ||
82 | state <<= __ffs(dd->idlest_mask); | 70 | state <<= __ffs(dd->idlest_mask); |
83 | 71 | ||
@@ -101,11 +89,7 @@ static int _omap3_wait_dpll_status(struct clk *clk, u8 state) | |||
101 | } | 89 | } |
102 | 90 | ||
103 | /* From 3430 TRM ES2 4.7.6.2 */ | 91 | /* From 3430 TRM ES2 4.7.6.2 */ |
104 | #ifdef CONFIG_COMMON_CLK | ||
105 | static u16 _omap3_dpll_compute_freqsel(struct clk_hw_omap *clk, u8 n) | 92 | static u16 _omap3_dpll_compute_freqsel(struct clk_hw_omap *clk, u8 n) |
106 | #else | ||
107 | static u16 _omap3_dpll_compute_freqsel(struct clk *clk, u8 n) | ||
108 | #endif | ||
109 | { | 93 | { |
110 | unsigned long fint; | 94 | unsigned long fint; |
111 | u16 f = 0; | 95 | u16 f = 0; |
@@ -150,22 +134,14 @@ static u16 _omap3_dpll_compute_freqsel(struct clk *clk, u8 n) | |||
150 | * locked successfully, return 0; if the DPLL did not lock in the time | 134 | * locked successfully, return 0; if the DPLL did not lock in the time |
151 | * allotted, or DPLL3 was passed in, return -EINVAL. | 135 | * allotted, or DPLL3 was passed in, return -EINVAL. |
152 | */ | 136 | */ |
153 | #ifdef CONFIG_COMMON_CLK | ||
154 | static int _omap3_noncore_dpll_lock(struct clk_hw_omap *clk) | 137 | static int _omap3_noncore_dpll_lock(struct clk_hw_omap *clk) |
155 | #else | ||
156 | static int _omap3_noncore_dpll_lock(struct clk *clk) | ||
157 | #endif | ||
158 | { | 138 | { |
159 | const struct dpll_data *dd; | 139 | const struct dpll_data *dd; |
160 | u8 ai; | 140 | u8 ai; |
161 | u8 state = 1; | 141 | u8 state = 1; |
162 | int r = 0; | 142 | int r = 0; |
163 | 143 | ||
164 | #ifdef CONFIG_COMMON_CLK | ||
165 | pr_debug("clock: locking DPLL %s\n", __clk_get_name(clk->hw.clk)); | 144 | pr_debug("clock: locking DPLL %s\n", __clk_get_name(clk->hw.clk)); |
166 | #else | ||
167 | pr_debug("clock: locking DPLL %s\n", __clk_get_name(clk)); | ||
168 | #endif | ||
169 | 145 | ||
170 | dd = clk->dpll_data; | 146 | dd = clk->dpll_data; |
171 | state <<= __ffs(dd->idlest_mask); | 147 | state <<= __ffs(dd->idlest_mask); |
@@ -203,11 +179,7 @@ done: | |||
203 | * DPLL3 was passed in, or the DPLL does not support low-power bypass, | 179 | * DPLL3 was passed in, or the DPLL does not support low-power bypass, |
204 | * return -EINVAL. | 180 | * return -EINVAL. |
205 | */ | 181 | */ |
206 | #ifdef CONFIG_COMMON_CLK | ||
207 | static int _omap3_noncore_dpll_bypass(struct clk_hw_omap *clk) | 182 | static int _omap3_noncore_dpll_bypass(struct clk_hw_omap *clk) |
208 | #else | ||
209 | static int _omap3_noncore_dpll_bypass(struct clk *clk) | ||
210 | #endif | ||
211 | { | 183 | { |
212 | int r; | 184 | int r; |
213 | u8 ai; | 185 | u8 ai; |
@@ -216,11 +188,7 @@ static int _omap3_noncore_dpll_bypass(struct clk *clk) | |||
216 | return -EINVAL; | 188 | return -EINVAL; |
217 | 189 | ||
218 | pr_debug("clock: configuring DPLL %s for low-power bypass\n", | 190 | pr_debug("clock: configuring DPLL %s for low-power bypass\n", |
219 | #ifdef CONFIG_COMMON_CLK | ||
220 | __clk_get_name(clk->hw.clk)); | 191 | __clk_get_name(clk->hw.clk)); |
221 | #else | ||
222 | __clk_get_name(clk)); | ||
223 | #endif | ||
224 | 192 | ||
225 | ai = omap3_dpll_autoidle_read(clk); | 193 | ai = omap3_dpll_autoidle_read(clk); |
226 | 194 | ||
@@ -243,22 +211,14 @@ static int _omap3_noncore_dpll_bypass(struct clk *clk) | |||
243 | * code. If DPLL3 was passed in, or the DPLL does not support | 211 | * code. If DPLL3 was passed in, or the DPLL does not support |
244 | * low-power stop, return -EINVAL; otherwise, return 0. | 212 | * low-power stop, return -EINVAL; otherwise, return 0. |
245 | */ | 213 | */ |
246 | #ifdef CONFIG_COMMON_CLK | ||
247 | static int _omap3_noncore_dpll_stop(struct clk_hw_omap *clk) | 214 | static int _omap3_noncore_dpll_stop(struct clk_hw_omap *clk) |
248 | #else | ||
249 | static int _omap3_noncore_dpll_stop(struct clk *clk) | ||
250 | #endif | ||
251 | { | 215 | { |
252 | u8 ai; | 216 | u8 ai; |
253 | 217 | ||
254 | if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP))) | 218 | if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP))) |
255 | return -EINVAL; | 219 | return -EINVAL; |
256 | 220 | ||
257 | #ifdef CONFIG_COMMON_CLK | ||
258 | pr_debug("clock: stopping DPLL %s\n", __clk_get_name(clk->hw.clk)); | 221 | pr_debug("clock: stopping DPLL %s\n", __clk_get_name(clk->hw.clk)); |
259 | #else | ||
260 | pr_debug("clock: stopping DPLL %s\n", __clk_get_name(clk)); | ||
261 | #endif | ||
262 | 222 | ||
263 | ai = omap3_dpll_autoidle_read(clk); | 223 | ai = omap3_dpll_autoidle_read(clk); |
264 | 224 | ||
@@ -282,19 +242,11 @@ static int _omap3_noncore_dpll_stop(struct clk *clk) | |||
282 | * XXX This code is not needed for 3430/AM35xx; can it be optimized | 242 | * XXX This code is not needed for 3430/AM35xx; can it be optimized |
283 | * out in non-multi-OMAP builds for those chips? | 243 | * out in non-multi-OMAP builds for those chips? |
284 | */ | 244 | */ |
285 | #ifdef CONFIG_COMMON_CLK | ||
286 | static void _lookup_dco(struct clk_hw_omap *clk, u8 *dco, u16 m, u8 n) | 245 | static void _lookup_dco(struct clk_hw_omap *clk, u8 *dco, u16 m, u8 n) |
287 | #else | ||
288 | static void _lookup_dco(struct clk *clk, u8 *dco, u16 m, u8 n) | ||
289 | #endif | ||
290 | { | 246 | { |
291 | unsigned long fint, clkinp; /* watch out for overflow */ | 247 | unsigned long fint, clkinp; /* watch out for overflow */ |
292 | 248 | ||
293 | #ifdef CONFIG_COMMON_CLK | ||
294 | clkinp = __clk_get_rate(__clk_get_parent(clk->hw.clk)); | 249 | clkinp = __clk_get_rate(__clk_get_parent(clk->hw.clk)); |
295 | #else | ||
296 | clkinp = __clk_get_rate(__clk_get_parent(clk)); | ||
297 | #endif | ||
298 | fint = (clkinp / n) * m; | 250 | fint = (clkinp / n) * m; |
299 | 251 | ||
300 | if (fint < 1000000000) | 252 | if (fint < 1000000000) |
@@ -315,20 +267,12 @@ static void _lookup_dco(struct clk *clk, u8 *dco, u16 m, u8 n) | |||
315 | * XXX This code is not needed for 3430/AM35xx; can it be optimized | 267 | * XXX This code is not needed for 3430/AM35xx; can it be optimized |
316 | * out in non-multi-OMAP builds for those chips? | 268 | * out in non-multi-OMAP builds for those chips? |
317 | */ | 269 | */ |
318 | #ifdef CONFIG_COMMON_CLK | ||
319 | static void _lookup_sddiv(struct clk_hw_omap *clk, u8 *sd_div, u16 m, u8 n) | 270 | static void _lookup_sddiv(struct clk_hw_omap *clk, u8 *sd_div, u16 m, u8 n) |
320 | #else | ||
321 | static void _lookup_sddiv(struct clk *clk, u8 *sd_div, u16 m, u8 n) | ||
322 | #endif | ||
323 | { | 271 | { |
324 | unsigned long clkinp, sd; /* watch out for overflow */ | 272 | unsigned long clkinp, sd; /* watch out for overflow */ |
325 | int mod1, mod2; | 273 | int mod1, mod2; |
326 | 274 | ||
327 | #ifdef CONFIG_COMMON_CLK | ||
328 | clkinp = __clk_get_rate(__clk_get_parent(clk->hw.clk)); | 275 | clkinp = __clk_get_rate(__clk_get_parent(clk->hw.clk)); |
329 | #else | ||
330 | clkinp = __clk_get_rate(__clk_get_parent(clk)); | ||
331 | #endif | ||
332 | 276 | ||
333 | /* | 277 | /* |
334 | * target sigma-delta to near 250MHz | 278 | * target sigma-delta to near 250MHz |
@@ -355,12 +299,8 @@ static void _lookup_sddiv(struct clk *clk, u8 *sd_div, u16 m, u8 n) | |||
355 | * Program the DPLL with the supplied M, N values, and wait for the DPLL to | 299 | * Program the DPLL with the supplied M, N values, and wait for the DPLL to |
356 | * lock.. Returns -EINVAL upon error, or 0 upon success. | 300 | * lock.. Returns -EINVAL upon error, or 0 upon success. |
357 | */ | 301 | */ |
358 | #ifdef CONFIG_COMMON_CLK | ||
359 | static int omap3_noncore_dpll_program(struct clk_hw_omap *clk, u16 m, u8 n, | 302 | static int omap3_noncore_dpll_program(struct clk_hw_omap *clk, u16 m, u8 n, |
360 | u16 freqsel) | 303 | u16 freqsel) |
361 | #else | ||
362 | static int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel) | ||
363 | #endif | ||
364 | { | 304 | { |
365 | struct dpll_data *dd = clk->dpll_data; | 305 | struct dpll_data *dd = clk->dpll_data; |
366 | u8 dco, sd_div; | 306 | u8 dco, sd_div; |
@@ -417,14 +357,10 @@ static int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel) | |||
417 | * | 357 | * |
418 | * Recalculate and propagate the DPLL rate. | 358 | * Recalculate and propagate the DPLL rate. |
419 | */ | 359 | */ |
420 | #ifdef CONFIG_COMMON_CLK | ||
421 | unsigned long omap3_dpll_recalc(struct clk_hw *hw, unsigned long parent_rate) | 360 | unsigned long omap3_dpll_recalc(struct clk_hw *hw, unsigned long parent_rate) |
422 | { | 361 | { |
423 | struct clk_hw_omap *clk = to_clk_hw_omap(hw); | 362 | struct clk_hw_omap *clk = to_clk_hw_omap(hw); |
424 | #else | 363 | |
425 | unsigned long omap3_dpll_recalc(struct clk *clk) | ||
426 | { | ||
427 | #endif | ||
428 | return omap2_get_dpll_rate(clk); | 364 | return omap2_get_dpll_rate(clk); |
429 | } | 365 | } |
430 | 366 | ||
@@ -444,14 +380,9 @@ unsigned long omap3_dpll_recalc(struct clk *clk) | |||
444 | * support low-power stop, or if the DPLL took too long to enter | 380 | * support low-power stop, or if the DPLL took too long to enter |
445 | * bypass or lock, return -EINVAL; otherwise, return 0. | 381 | * bypass or lock, return -EINVAL; otherwise, return 0. |
446 | */ | 382 | */ |
447 | #ifdef CONFIG_COMMON_CLK | ||
448 | int omap3_noncore_dpll_enable(struct clk_hw *hw) | 383 | int omap3_noncore_dpll_enable(struct clk_hw *hw) |
449 | { | 384 | { |
450 | struct clk_hw_omap *clk = to_clk_hw_omap(hw); | 385 | struct clk_hw_omap *clk = to_clk_hw_omap(hw); |
451 | #else | ||
452 | int omap3_noncore_dpll_enable(struct clk *clk) | ||
453 | { | ||
454 | #endif | ||
455 | int r; | 386 | int r; |
456 | struct dpll_data *dd; | 387 | struct dpll_data *dd; |
457 | struct clk *parent; | 388 | struct clk *parent; |
@@ -460,7 +391,6 @@ int omap3_noncore_dpll_enable(struct clk *clk) | |||
460 | if (!dd) | 391 | if (!dd) |
461 | return -EINVAL; | 392 | return -EINVAL; |
462 | 393 | ||
463 | #ifdef CONFIG_COMMON_CLK | ||
464 | if (clk->clkdm) { | 394 | if (clk->clkdm) { |
465 | r = clkdm_clk_enable(clk->clkdm, hw->clk); | 395 | r = clkdm_clk_enable(clk->clkdm, hw->clk); |
466 | if (r) { | 396 | if (r) { |
@@ -475,11 +405,6 @@ int omap3_noncore_dpll_enable(struct clk *clk) | |||
475 | parent = __clk_get_parent(hw->clk); | 405 | parent = __clk_get_parent(hw->clk); |
476 | 406 | ||
477 | if (__clk_get_rate(hw->clk) == __clk_get_rate(dd->clk_bypass)) { | 407 | if (__clk_get_rate(hw->clk) == __clk_get_rate(dd->clk_bypass)) { |
478 | #else | ||
479 | parent = __clk_get_parent(clk); | ||
480 | |||
481 | if (__clk_get_rate(clk) == __clk_get_rate(dd->clk_bypass)) { | ||
482 | #endif | ||
483 | WARN_ON(parent != dd->clk_bypass); | 408 | WARN_ON(parent != dd->clk_bypass); |
484 | r = _omap3_noncore_dpll_bypass(clk); | 409 | r = _omap3_noncore_dpll_bypass(clk); |
485 | } else { | 410 | } else { |
@@ -487,16 +412,6 @@ int omap3_noncore_dpll_enable(struct clk *clk) | |||
487 | r = _omap3_noncore_dpll_lock(clk); | 412 | r = _omap3_noncore_dpll_lock(clk); |
488 | } | 413 | } |
489 | 414 | ||
490 | #ifndef CONFIG_COMMON_CLK | ||
491 | /* | ||
492 | *FIXME: this is dubious - if clk->rate has changed, what about | ||
493 | * propagating? | ||
494 | */ | ||
495 | if (!r) | ||
496 | clk->rate = (clk->recalc) ? clk->recalc(clk) : | ||
497 | omap2_get_dpll_rate(clk); | ||
498 | #endif | ||
499 | |||
500 | return r; | 415 | return r; |
501 | } | 416 | } |
502 | 417 | ||
@@ -507,7 +422,6 @@ int omap3_noncore_dpll_enable(struct clk *clk) | |||
507 | * Instructs a non-CORE DPLL to enter low-power stop. This function is | 422 | * Instructs a non-CORE DPLL to enter low-power stop. This function is |
508 | * intended for use in struct clkops. No return value. | 423 | * intended for use in struct clkops. No return value. |
509 | */ | 424 | */ |
510 | #ifdef CONFIG_COMMON_CLK | ||
511 | void omap3_noncore_dpll_disable(struct clk_hw *hw) | 425 | void omap3_noncore_dpll_disable(struct clk_hw *hw) |
512 | { | 426 | { |
513 | struct clk_hw_omap *clk = to_clk_hw_omap(hw); | 427 | struct clk_hw_omap *clk = to_clk_hw_omap(hw); |
@@ -515,13 +429,6 @@ void omap3_noncore_dpll_disable(struct clk_hw *hw) | |||
515 | _omap3_noncore_dpll_stop(clk); | 429 | _omap3_noncore_dpll_stop(clk); |
516 | if (clk->clkdm) | 430 | if (clk->clkdm) |
517 | clkdm_clk_disable(clk->clkdm, hw->clk); | 431 | clkdm_clk_disable(clk->clkdm, hw->clk); |
518 | #else | ||
519 | void omap3_noncore_dpll_disable(struct clk *clk) | ||
520 | { | ||
521 | _omap3_noncore_dpll_stop(clk); | ||
522 | if (clk->clkdm) | ||
523 | clkdm_clk_disable(clk->clkdm, clk); | ||
524 | #endif | ||
525 | } | 432 | } |
526 | 433 | ||
527 | 434 | ||
@@ -538,7 +445,6 @@ void omap3_noncore_dpll_disable(struct clk *clk) | |||
538 | * target rate if it hasn't been done already, then program and lock | 445 | * target rate if it hasn't been done already, then program and lock |
539 | * the DPLL. Returns -EINVAL upon error, or 0 upon success. | 446 | * the DPLL. Returns -EINVAL upon error, or 0 upon success. |
540 | */ | 447 | */ |
541 | #ifdef CONFIG_COMMON_CLK | ||
542 | int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate, | 448 | int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate, |
543 | unsigned long parent_rate) | 449 | unsigned long parent_rate) |
544 | { | 450 | { |
@@ -608,85 +514,6 @@ int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate, | |||
608 | 514 | ||
609 | return 0; | 515 | return 0; |
610 | } | 516 | } |
611 | #else | ||
612 | int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate) | ||
613 | { | ||
614 | struct clk *new_parent = NULL; | ||
615 | unsigned long hw_rate, bypass_rate; | ||
616 | u16 freqsel = 0; | ||
617 | struct dpll_data *dd; | ||
618 | int ret; | ||
619 | |||
620 | if (!clk || !rate) | ||
621 | return -EINVAL; | ||
622 | |||
623 | dd = clk->dpll_data; | ||
624 | if (!dd) | ||
625 | return -EINVAL; | ||
626 | |||
627 | hw_rate = (clk->recalc) ? clk->recalc(clk) : omap2_get_dpll_rate(clk); | ||
628 | if (rate == hw_rate) | ||
629 | return 0; | ||
630 | |||
631 | /* | ||
632 | * Ensure both the bypass and ref clocks are enabled prior to | ||
633 | * doing anything; we need the bypass clock running to reprogram | ||
634 | * the DPLL. | ||
635 | */ | ||
636 | omap2_clk_enable(dd->clk_bypass); | ||
637 | omap2_clk_enable(dd->clk_ref); | ||
638 | |||
639 | bypass_rate = __clk_get_rate(dd->clk_bypass); | ||
640 | if (bypass_rate == rate && | ||
641 | (clk->dpll_data->modes & (1 << DPLL_LOW_POWER_BYPASS))) { | ||
642 | pr_debug("clock: %s: set rate: entering bypass.\n", clk->name); | ||
643 | |||
644 | ret = _omap3_noncore_dpll_bypass(clk); | ||
645 | if (!ret) | ||
646 | new_parent = dd->clk_bypass; | ||
647 | } else { | ||
648 | if (dd->last_rounded_rate != rate) | ||
649 | rate = clk->round_rate(clk, rate); | ||
650 | |||
651 | if (dd->last_rounded_rate == 0) | ||
652 | return -EINVAL; | ||
653 | |||
654 | /* No freqsel on OMAP4 and OMAP3630 */ | ||
655 | if (!soc_is_am33xx() && !cpu_is_omap44xx() && !cpu_is_omap3630()) { | ||
656 | freqsel = _omap3_dpll_compute_freqsel(clk, | ||
657 | dd->last_rounded_n); | ||
658 | if (!freqsel) | ||
659 | WARN_ON(1); | ||
660 | } | ||
661 | |||
662 | pr_debug("clock: %s: set rate: locking rate to %lu.\n", | ||
663 | __clk_get_name(clk), rate); | ||
664 | |||
665 | ret = omap3_noncore_dpll_program(clk, dd->last_rounded_m, | ||
666 | dd->last_rounded_n, freqsel); | ||
667 | if (!ret) | ||
668 | new_parent = dd->clk_ref; | ||
669 | } | ||
670 | if (!ret) { | ||
671 | /* | ||
672 | * Switch the parent clock in the hierarchy, and make sure | ||
673 | * that the new parent's usecount is correct. Note: we | ||
674 | * enable the new parent before disabling the old to avoid | ||
675 | * any unnecessary hardware disable->enable transitions. | ||
676 | */ | ||
677 | if (clk->usecount) { | ||
678 | omap2_clk_enable(new_parent); | ||
679 | omap2_clk_disable(clk->parent); | ||
680 | } | ||
681 | clk_reparent(clk, new_parent); | ||
682 | clk->rate = rate; | ||
683 | } | ||
684 | omap2_clk_disable(dd->clk_ref); | ||
685 | omap2_clk_disable(dd->clk_bypass); | ||
686 | |||
687 | return 0; | ||
688 | } | ||
689 | #endif | ||
690 | 517 | ||
691 | /* DPLL autoidle read/set code */ | 518 | /* DPLL autoidle read/set code */ |
692 | 519 | ||
@@ -698,11 +525,7 @@ int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate) | |||
698 | * -EINVAL if passed a null pointer or if the struct clk does not | 525 | * -EINVAL if passed a null pointer or if the struct clk does not |
699 | * appear to refer to a DPLL. | 526 | * appear to refer to a DPLL. |
700 | */ | 527 | */ |
701 | #ifdef CONFIG_COMMON_CLK | ||
702 | u32 omap3_dpll_autoidle_read(struct clk_hw_omap *clk) | 528 | u32 omap3_dpll_autoidle_read(struct clk_hw_omap *clk) |
703 | #else | ||
704 | u32 omap3_dpll_autoidle_read(struct clk *clk) | ||
705 | #endif | ||
706 | { | 529 | { |
707 | const struct dpll_data *dd; | 530 | const struct dpll_data *dd; |
708 | u32 v; | 531 | u32 v; |
@@ -731,11 +554,7 @@ u32 omap3_dpll_autoidle_read(struct clk *clk) | |||
731 | * OMAP3430. The DPLL will enter low-power stop when its downstream | 554 | * OMAP3430. The DPLL will enter low-power stop when its downstream |
732 | * clocks are gated. No return value. | 555 | * clocks are gated. No return value. |
733 | */ | 556 | */ |
734 | #ifdef CONFIG_COMMON_CLK | ||
735 | void omap3_dpll_allow_idle(struct clk_hw_omap *clk) | 557 | void omap3_dpll_allow_idle(struct clk_hw_omap *clk) |
736 | #else | ||
737 | void omap3_dpll_allow_idle(struct clk *clk) | ||
738 | #endif | ||
739 | { | 558 | { |
740 | const struct dpll_data *dd; | 559 | const struct dpll_data *dd; |
741 | u32 v; | 560 | u32 v; |
@@ -745,13 +564,8 @@ void omap3_dpll_allow_idle(struct clk *clk) | |||
745 | 564 | ||
746 | dd = clk->dpll_data; | 565 | dd = clk->dpll_data; |
747 | 566 | ||
748 | if (!dd->autoidle_reg) { | 567 | if (!dd->autoidle_reg) |
749 | #ifndef CONFIG_COMMON_CLK | ||
750 | pr_debug("clock: DPLL %s: autoidle not supported\n", | ||
751 | __clk_get_name(clk)); | ||
752 | #endif | ||
753 | return; | 568 | return; |
754 | } | ||
755 | 569 | ||
756 | /* | 570 | /* |
757 | * REVISIT: CORE DPLL can optionally enter low-power bypass | 571 | * REVISIT: CORE DPLL can optionally enter low-power bypass |
@@ -771,11 +585,7 @@ void omap3_dpll_allow_idle(struct clk *clk) | |||
771 | * | 585 | * |
772 | * Disable DPLL automatic idle control. No return value. | 586 | * Disable DPLL automatic idle control. No return value. |
773 | */ | 587 | */ |
774 | #ifdef CONFIG_COMMON_CLK | ||
775 | void omap3_dpll_deny_idle(struct clk_hw_omap *clk) | 588 | void omap3_dpll_deny_idle(struct clk_hw_omap *clk) |
776 | #else | ||
777 | void omap3_dpll_deny_idle(struct clk *clk) | ||
778 | #endif | ||
779 | { | 589 | { |
780 | const struct dpll_data *dd; | 590 | const struct dpll_data *dd; |
781 | u32 v; | 591 | u32 v; |
@@ -785,13 +595,8 @@ void omap3_dpll_deny_idle(struct clk *clk) | |||
785 | 595 | ||
786 | dd = clk->dpll_data; | 596 | dd = clk->dpll_data; |
787 | 597 | ||
788 | if (!dd->autoidle_reg) { | 598 | if (!dd->autoidle_reg) |
789 | #ifndef CONFIG_COMMON_CLK | ||
790 | pr_debug("clock: DPLL %s: autoidle not supported\n", | ||
791 | __clk_get_name(clk)); | ||
792 | #endif | ||
793 | return; | 599 | return; |
794 | } | ||
795 | 600 | ||
796 | v = __raw_readl(dd->autoidle_reg); | 601 | v = __raw_readl(dd->autoidle_reg); |
797 | v &= ~dd->autoidle_mask; | 602 | v &= ~dd->autoidle_mask; |
@@ -809,7 +614,6 @@ void omap3_dpll_deny_idle(struct clk *clk) | |||
809 | * Using parent clock DPLL data, look up DPLL state. If locked, set our | 614 | * Using parent clock DPLL data, look up DPLL state. If locked, set our |
810 | * rate to the dpll_clk * 2; otherwise, just use dpll_clk. | 615 | * rate to the dpll_clk * 2; otherwise, just use dpll_clk. |
811 | */ | 616 | */ |
812 | #ifdef CONFIG_COMMON_CLK | ||
813 | unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw, | 617 | unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw, |
814 | unsigned long parent_rate) | 618 | unsigned long parent_rate) |
815 | { | 619 | { |
@@ -829,22 +633,7 @@ unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw, | |||
829 | break; | 633 | break; |
830 | pclk = to_clk_hw_omap(hw); | 634 | pclk = to_clk_hw_omap(hw); |
831 | } while (pclk && !pclk->dpll_data); | 635 | } while (pclk && !pclk->dpll_data); |
832 | #else | ||
833 | unsigned long omap3_clkoutx2_recalc(struct clk *clk) | ||
834 | { | ||
835 | const struct dpll_data *dd; | ||
836 | unsigned long rate; | ||
837 | u32 v; | ||
838 | struct clk *pclk; | ||
839 | unsigned long parent_rate; | ||
840 | 636 | ||
841 | /* Walk up the parents of clk, looking for a DPLL */ | ||
842 | pclk = __clk_get_parent(clk); | ||
843 | while (pclk && !pclk->dpll_data) | ||
844 | pclk = __clk_get_parent(pclk); | ||
845 | |||
846 | parent_rate = __clk_get_rate(__clk_get_parent(clk)); | ||
847 | #endif | ||
848 | /* clk does not have a DPLL as a parent? error in the clock data */ | 637 | /* clk does not have a DPLL as a parent? error in the clock data */ |
849 | if (!pclk) { | 638 | if (!pclk) { |
850 | WARN_ON(1); | 639 | WARN_ON(1); |
@@ -865,21 +654,7 @@ unsigned long omap3_clkoutx2_recalc(struct clk *clk) | |||
865 | } | 654 | } |
866 | 655 | ||
867 | /* OMAP3/4 non-CORE DPLL clkops */ | 656 | /* OMAP3/4 non-CORE DPLL clkops */ |
868 | #ifdef CONFIG_COMMON_CLK | ||
869 | const struct clk_hw_omap_ops clkhwops_omap3_dpll = { | 657 | const struct clk_hw_omap_ops clkhwops_omap3_dpll = { |
870 | .allow_idle = omap3_dpll_allow_idle, | 658 | .allow_idle = omap3_dpll_allow_idle, |
871 | .deny_idle = omap3_dpll_deny_idle, | 659 | .deny_idle = omap3_dpll_deny_idle, |
872 | }; | 660 | }; |
873 | #else | ||
874 | const struct clkops clkops_omap3_noncore_dpll_ops = { | ||
875 | .enable = omap3_noncore_dpll_enable, | ||
876 | .disable = omap3_noncore_dpll_disable, | ||
877 | .allow_idle = omap3_dpll_allow_idle, | ||
878 | .deny_idle = omap3_dpll_deny_idle, | ||
879 | }; | ||
880 | |||
881 | const struct clkops clkops_omap3_core_dpll_ops = { | ||
882 | .allow_idle = omap3_dpll_allow_idle, | ||
883 | .deny_idle = omap3_dpll_deny_idle, | ||
884 | }; | ||
885 | #endif | ||