diff options
Diffstat (limited to 'arch/arm/mach-omap2/dpll3xxx.c')
-rw-r--r-- | arch/arm/mach-omap2/dpll3xxx.c | 183 |
1 files changed, 90 insertions, 93 deletions
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c index eacf51f2bc27..fafb28c0dcbc 100644 --- a/arch/arm/mach-omap2/dpll3xxx.c +++ b/arch/arm/mach-omap2/dpll3xxx.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/clkdev.h> | 29 | #include <linux/clkdev.h> |
30 | 30 | ||
31 | #include "soc.h" | 31 | #include "soc.h" |
32 | #include "clockdomain.h" | ||
32 | #include "clock.h" | 33 | #include "clock.h" |
33 | #include "cm2xxx_3xxx.h" | 34 | #include "cm2xxx_3xxx.h" |
34 | #include "cm-regbits-34xx.h" | 35 | #include "cm-regbits-34xx.h" |
@@ -42,7 +43,7 @@ | |||
42 | /* Private functions */ | 43 | /* Private functions */ |
43 | 44 | ||
44 | /* _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 */ |
45 | static void _omap3_dpll_write_clken(struct clk *clk, u8 clken_bits) | 46 | static void _omap3_dpll_write_clken(struct clk_hw_omap *clk, u8 clken_bits) |
46 | { | 47 | { |
47 | const struct dpll_data *dd; | 48 | const struct dpll_data *dd; |
48 | u32 v; | 49 | u32 v; |
@@ -56,7 +57,7 @@ static void _omap3_dpll_write_clken(struct clk *clk, u8 clken_bits) | |||
56 | } | 57 | } |
57 | 58 | ||
58 | /* _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 */ |
59 | static int _omap3_wait_dpll_status(struct clk *clk, u8 state) | 60 | static int _omap3_wait_dpll_status(struct clk_hw_omap *clk, u8 state) |
60 | { | 61 | { |
61 | const struct dpll_data *dd; | 62 | const struct dpll_data *dd; |
62 | int i = 0; | 63 | int i = 0; |
@@ -64,7 +65,7 @@ static int _omap3_wait_dpll_status(struct clk *clk, u8 state) | |||
64 | const char *clk_name; | 65 | const char *clk_name; |
65 | 66 | ||
66 | dd = clk->dpll_data; | 67 | dd = clk->dpll_data; |
67 | clk_name = __clk_get_name(clk); | 68 | clk_name = __clk_get_name(clk->hw.clk); |
68 | 69 | ||
69 | state <<= __ffs(dd->idlest_mask); | 70 | state <<= __ffs(dd->idlest_mask); |
70 | 71 | ||
@@ -88,7 +89,7 @@ static int _omap3_wait_dpll_status(struct clk *clk, u8 state) | |||
88 | } | 89 | } |
89 | 90 | ||
90 | /* From 3430 TRM ES2 4.7.6.2 */ | 91 | /* From 3430 TRM ES2 4.7.6.2 */ |
91 | static u16 _omap3_dpll_compute_freqsel(struct clk *clk, u8 n) | 92 | static u16 _omap3_dpll_compute_freqsel(struct clk_hw_omap *clk, u8 n) |
92 | { | 93 | { |
93 | unsigned long fint; | 94 | unsigned long fint; |
94 | u16 f = 0; | 95 | u16 f = 0; |
@@ -133,14 +134,14 @@ static u16 _omap3_dpll_compute_freqsel(struct clk *clk, u8 n) | |||
133 | * 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 |
134 | * allotted, or DPLL3 was passed in, return -EINVAL. | 135 | * allotted, or DPLL3 was passed in, return -EINVAL. |
135 | */ | 136 | */ |
136 | static int _omap3_noncore_dpll_lock(struct clk *clk) | 137 | static int _omap3_noncore_dpll_lock(struct clk_hw_omap *clk) |
137 | { | 138 | { |
138 | const struct dpll_data *dd; | 139 | const struct dpll_data *dd; |
139 | u8 ai; | 140 | u8 ai; |
140 | u8 state = 1; | 141 | u8 state = 1; |
141 | int r = 0; | 142 | int r = 0; |
142 | 143 | ||
143 | pr_debug("clock: locking DPLL %s\n", __clk_get_name(clk)); | 144 | pr_debug("clock: locking DPLL %s\n", __clk_get_name(clk->hw.clk)); |
144 | 145 | ||
145 | dd = clk->dpll_data; | 146 | dd = clk->dpll_data; |
146 | state <<= __ffs(dd->idlest_mask); | 147 | state <<= __ffs(dd->idlest_mask); |
@@ -178,7 +179,7 @@ done: | |||
178 | * 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, |
179 | * return -EINVAL. | 180 | * return -EINVAL. |
180 | */ | 181 | */ |
181 | static int _omap3_noncore_dpll_bypass(struct clk *clk) | 182 | static int _omap3_noncore_dpll_bypass(struct clk_hw_omap *clk) |
182 | { | 183 | { |
183 | int r; | 184 | int r; |
184 | u8 ai; | 185 | u8 ai; |
@@ -187,7 +188,7 @@ static int _omap3_noncore_dpll_bypass(struct clk *clk) | |||
187 | return -EINVAL; | 188 | return -EINVAL; |
188 | 189 | ||
189 | pr_debug("clock: configuring DPLL %s for low-power bypass\n", | 190 | pr_debug("clock: configuring DPLL %s for low-power bypass\n", |
190 | __clk_get_name(clk)); | 191 | __clk_get_name(clk->hw.clk)); |
191 | 192 | ||
192 | ai = omap3_dpll_autoidle_read(clk); | 193 | ai = omap3_dpll_autoidle_read(clk); |
193 | 194 | ||
@@ -210,14 +211,14 @@ static int _omap3_noncore_dpll_bypass(struct clk *clk) | |||
210 | * 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 |
211 | * low-power stop, return -EINVAL; otherwise, return 0. | 212 | * low-power stop, return -EINVAL; otherwise, return 0. |
212 | */ | 213 | */ |
213 | static int _omap3_noncore_dpll_stop(struct clk *clk) | 214 | static int _omap3_noncore_dpll_stop(struct clk_hw_omap *clk) |
214 | { | 215 | { |
215 | u8 ai; | 216 | u8 ai; |
216 | 217 | ||
217 | if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP))) | 218 | if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP))) |
218 | return -EINVAL; | 219 | return -EINVAL; |
219 | 220 | ||
220 | pr_debug("clock: stopping DPLL %s\n", __clk_get_name(clk)); | 221 | pr_debug("clock: stopping DPLL %s\n", __clk_get_name(clk->hw.clk)); |
221 | 222 | ||
222 | ai = omap3_dpll_autoidle_read(clk); | 223 | ai = omap3_dpll_autoidle_read(clk); |
223 | 224 | ||
@@ -241,11 +242,11 @@ static int _omap3_noncore_dpll_stop(struct clk *clk) | |||
241 | * 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 |
242 | * out in non-multi-OMAP builds for those chips? | 243 | * out in non-multi-OMAP builds for those chips? |
243 | */ | 244 | */ |
244 | static void _lookup_dco(struct clk *clk, u8 *dco, u16 m, u8 n) | 245 | static void _lookup_dco(struct clk_hw_omap *clk, u8 *dco, u16 m, u8 n) |
245 | { | 246 | { |
246 | unsigned long fint, clkinp; /* watch out for overflow */ | 247 | unsigned long fint, clkinp; /* watch out for overflow */ |
247 | 248 | ||
248 | clkinp = __clk_get_rate(__clk_get_parent(clk)); | 249 | clkinp = __clk_get_rate(__clk_get_parent(clk->hw.clk)); |
249 | fint = (clkinp / n) * m; | 250 | fint = (clkinp / n) * m; |
250 | 251 | ||
251 | if (fint < 1000000000) | 252 | if (fint < 1000000000) |
@@ -266,12 +267,12 @@ static void _lookup_dco(struct clk *clk, u8 *dco, u16 m, u8 n) | |||
266 | * 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 |
267 | * out in non-multi-OMAP builds for those chips? | 268 | * out in non-multi-OMAP builds for those chips? |
268 | */ | 269 | */ |
269 | static void _lookup_sddiv(struct clk *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) |
270 | { | 271 | { |
271 | unsigned long clkinp, sd; /* watch out for overflow */ | 272 | unsigned long clkinp, sd; /* watch out for overflow */ |
272 | int mod1, mod2; | 273 | int mod1, mod2; |
273 | 274 | ||
274 | clkinp = __clk_get_rate(__clk_get_parent(clk)); | 275 | clkinp = __clk_get_rate(__clk_get_parent(clk->hw.clk)); |
275 | 276 | ||
276 | /* | 277 | /* |
277 | * target sigma-delta to near 250MHz | 278 | * target sigma-delta to near 250MHz |
@@ -298,7 +299,8 @@ static void _lookup_sddiv(struct clk *clk, u8 *sd_div, u16 m, u8 n) | |||
298 | * 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 |
299 | * lock.. Returns -EINVAL upon error, or 0 upon success. | 300 | * lock.. Returns -EINVAL upon error, or 0 upon success. |
300 | */ | 301 | */ |
301 | static int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel) | 302 | static int omap3_noncore_dpll_program(struct clk_hw_omap *clk, u16 m, u8 n, |
303 | u16 freqsel) | ||
302 | { | 304 | { |
303 | struct dpll_data *dd = clk->dpll_data; | 305 | struct dpll_data *dd = clk->dpll_data; |
304 | u8 dco, sd_div; | 306 | u8 dco, sd_div; |
@@ -355,8 +357,10 @@ static int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel) | |||
355 | * | 357 | * |
356 | * Recalculate and propagate the DPLL rate. | 358 | * Recalculate and propagate the DPLL rate. |
357 | */ | 359 | */ |
358 | unsigned long omap3_dpll_recalc(struct clk *clk) | 360 | unsigned long omap3_dpll_recalc(struct clk_hw *hw, unsigned long parent_rate) |
359 | { | 361 | { |
362 | struct clk_hw_omap *clk = to_clk_hw_omap(hw); | ||
363 | |||
360 | return omap2_get_dpll_rate(clk); | 364 | return omap2_get_dpll_rate(clk); |
361 | } | 365 | } |
362 | 366 | ||
@@ -376,8 +380,9 @@ unsigned long omap3_dpll_recalc(struct clk *clk) | |||
376 | * 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 |
377 | * bypass or lock, return -EINVAL; otherwise, return 0. | 381 | * bypass or lock, return -EINVAL; otherwise, return 0. |
378 | */ | 382 | */ |
379 | int omap3_noncore_dpll_enable(struct clk *clk) | 383 | int omap3_noncore_dpll_enable(struct clk_hw *hw) |
380 | { | 384 | { |
385 | struct clk_hw_omap *clk = to_clk_hw_omap(hw); | ||
381 | int r; | 386 | int r; |
382 | struct dpll_data *dd; | 387 | struct dpll_data *dd; |
383 | struct clk *parent; | 388 | struct clk *parent; |
@@ -386,22 +391,26 @@ int omap3_noncore_dpll_enable(struct clk *clk) | |||
386 | if (!dd) | 391 | if (!dd) |
387 | return -EINVAL; | 392 | return -EINVAL; |
388 | 393 | ||
389 | parent = __clk_get_parent(clk); | 394 | if (clk->clkdm) { |
395 | r = clkdm_clk_enable(clk->clkdm, hw->clk); | ||
396 | if (r) { | ||
397 | WARN(1, | ||
398 | "%s: could not enable %s's clockdomain %s: %d\n", | ||
399 | __func__, __clk_get_name(hw->clk), | ||
400 | clk->clkdm->name, r); | ||
401 | return r; | ||
402 | } | ||
403 | } | ||
404 | |||
405 | parent = __clk_get_parent(hw->clk); | ||
390 | 406 | ||
391 | if (__clk_get_rate(clk) == __clk_get_rate(dd->clk_bypass)) { | 407 | if (__clk_get_rate(hw->clk) == __clk_get_rate(dd->clk_bypass)) { |
392 | WARN_ON(parent != dd->clk_bypass); | 408 | WARN_ON(parent != dd->clk_bypass); |
393 | r = _omap3_noncore_dpll_bypass(clk); | 409 | r = _omap3_noncore_dpll_bypass(clk); |
394 | } else { | 410 | } else { |
395 | WARN_ON(parent != dd->clk_ref); | 411 | WARN_ON(parent != dd->clk_ref); |
396 | r = _omap3_noncore_dpll_lock(clk); | 412 | r = _omap3_noncore_dpll_lock(clk); |
397 | } | 413 | } |
398 | /* | ||
399 | *FIXME: this is dubious - if clk->rate has changed, what about | ||
400 | * propagating? | ||
401 | */ | ||
402 | if (!r) | ||
403 | clk->rate = (clk->recalc) ? clk->recalc(clk) : | ||
404 | omap2_get_dpll_rate(clk); | ||
405 | 414 | ||
406 | return r; | 415 | return r; |
407 | } | 416 | } |
@@ -413,9 +422,13 @@ int omap3_noncore_dpll_enable(struct clk *clk) | |||
413 | * 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 |
414 | * intended for use in struct clkops. No return value. | 423 | * intended for use in struct clkops. No return value. |
415 | */ | 424 | */ |
416 | void omap3_noncore_dpll_disable(struct clk *clk) | 425 | void omap3_noncore_dpll_disable(struct clk_hw *hw) |
417 | { | 426 | { |
427 | struct clk_hw_omap *clk = to_clk_hw_omap(hw); | ||
428 | |||
418 | _omap3_noncore_dpll_stop(clk); | 429 | _omap3_noncore_dpll_stop(clk); |
430 | if (clk->clkdm) | ||
431 | clkdm_clk_disable(clk->clkdm, hw->clk); | ||
419 | } | 432 | } |
420 | 433 | ||
421 | 434 | ||
@@ -432,80 +445,72 @@ void omap3_noncore_dpll_disable(struct clk *clk) | |||
432 | * 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 |
433 | * the DPLL. Returns -EINVAL upon error, or 0 upon success. | 446 | * the DPLL. Returns -EINVAL upon error, or 0 upon success. |
434 | */ | 447 | */ |
435 | int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate) | 448 | int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate, |
449 | unsigned long parent_rate) | ||
436 | { | 450 | { |
451 | struct clk_hw_omap *clk = to_clk_hw_omap(hw); | ||
437 | struct clk *new_parent = NULL; | 452 | struct clk *new_parent = NULL; |
438 | unsigned long hw_rate, bypass_rate; | ||
439 | u16 freqsel = 0; | 453 | u16 freqsel = 0; |
440 | struct dpll_data *dd; | 454 | struct dpll_data *dd; |
441 | int ret; | 455 | int ret; |
442 | 456 | ||
443 | if (!clk || !rate) | 457 | if (!hw || !rate) |
444 | return -EINVAL; | 458 | return -EINVAL; |
445 | 459 | ||
446 | dd = clk->dpll_data; | 460 | dd = clk->dpll_data; |
447 | if (!dd) | 461 | if (!dd) |
448 | return -EINVAL; | 462 | return -EINVAL; |
449 | 463 | ||
450 | hw_rate = (clk->recalc) ? clk->recalc(clk) : omap2_get_dpll_rate(clk); | 464 | __clk_prepare(dd->clk_bypass); |
451 | if (rate == hw_rate) | 465 | clk_enable(dd->clk_bypass); |
452 | return 0; | 466 | __clk_prepare(dd->clk_ref); |
453 | 467 | clk_enable(dd->clk_ref); | |
454 | /* | ||
455 | * Ensure both the bypass and ref clocks are enabled prior to | ||
456 | * doing anything; we need the bypass clock running to reprogram | ||
457 | * the DPLL. | ||
458 | */ | ||
459 | omap2_clk_enable(dd->clk_bypass); | ||
460 | omap2_clk_enable(dd->clk_ref); | ||
461 | 468 | ||
462 | bypass_rate = __clk_get_rate(dd->clk_bypass); | 469 | if (__clk_get_rate(dd->clk_bypass) == rate && |
463 | if (bypass_rate == rate && | 470 | (dd->modes & (1 << DPLL_LOW_POWER_BYPASS))) { |
464 | (clk->dpll_data->modes & (1 << DPLL_LOW_POWER_BYPASS))) { | 471 | pr_debug("%s: %s: set rate: entering bypass.\n", |
465 | pr_debug("clock: %s: set rate: entering bypass.\n", clk->name); | 472 | __func__, __clk_get_name(hw->clk)); |
466 | 473 | ||
467 | ret = _omap3_noncore_dpll_bypass(clk); | 474 | ret = _omap3_noncore_dpll_bypass(clk); |
468 | if (!ret) | 475 | if (!ret) |
469 | new_parent = dd->clk_bypass; | 476 | new_parent = dd->clk_bypass; |
470 | } else { | 477 | } else { |
471 | if (dd->last_rounded_rate != rate) | 478 | if (dd->last_rounded_rate != rate) |
472 | rate = clk->round_rate(clk, rate); | 479 | rate = __clk_round_rate(hw->clk, rate); |
473 | 480 | ||
474 | if (dd->last_rounded_rate == 0) | 481 | if (dd->last_rounded_rate == 0) |
475 | return -EINVAL; | 482 | return -EINVAL; |
476 | 483 | ||
477 | /* No freqsel on OMAP4 and OMAP3630 */ | 484 | /* No freqsel on OMAP4 and OMAP3630 */ |
478 | if (!soc_is_am33xx() && !cpu_is_omap44xx() && !cpu_is_omap3630()) { | 485 | if (!cpu_is_omap44xx() && !cpu_is_omap3630()) { |
479 | freqsel = _omap3_dpll_compute_freqsel(clk, | 486 | freqsel = _omap3_dpll_compute_freqsel(clk, |
480 | dd->last_rounded_n); | 487 | dd->last_rounded_n); |
481 | if (!freqsel) | 488 | if (!freqsel) |
482 | WARN_ON(1); | 489 | WARN_ON(1); |
483 | } | 490 | } |
484 | 491 | ||
485 | pr_debug("clock: %s: set rate: locking rate to %lu.\n", | 492 | pr_debug("%s: %s: set rate: locking rate to %lu.\n", |
486 | __clk_get_name(clk), rate); | 493 | __func__, __clk_get_name(hw->clk), rate); |
487 | 494 | ||
488 | ret = omap3_noncore_dpll_program(clk, dd->last_rounded_m, | 495 | ret = omap3_noncore_dpll_program(clk, dd->last_rounded_m, |
489 | dd->last_rounded_n, freqsel); | 496 | dd->last_rounded_n, freqsel); |
490 | if (!ret) | 497 | if (!ret) |
491 | new_parent = dd->clk_ref; | 498 | new_parent = dd->clk_ref; |
492 | } | 499 | } |
493 | if (!ret) { | 500 | /* |
494 | /* | 501 | * FIXME - this is all wrong. common code handles reparenting and |
495 | * Switch the parent clock in the hierarchy, and make sure | 502 | * migrating prepare/enable counts. dplls should be a multiplexer |
496 | * that the new parent's usecount is correct. Note: we | 503 | * clock and this should be a set_parent operation so that all of that |
497 | * enable the new parent before disabling the old to avoid | 504 | * stuff is inherited for free |
498 | * any unnecessary hardware disable->enable transitions. | 505 | */ |
499 | */ | 506 | |
500 | if (clk->usecount) { | 507 | if (!ret) |
501 | omap2_clk_enable(new_parent); | 508 | __clk_reparent(hw->clk, new_parent); |
502 | omap2_clk_disable(clk->parent); | 509 | |
503 | } | 510 | clk_disable(dd->clk_ref); |
504 | clk_reparent(clk, new_parent); | 511 | __clk_unprepare(dd->clk_ref); |
505 | clk->rate = rate; | 512 | clk_disable(dd->clk_bypass); |
506 | } | 513 | __clk_unprepare(dd->clk_bypass); |
507 | omap2_clk_disable(dd->clk_ref); | ||
508 | omap2_clk_disable(dd->clk_bypass); | ||
509 | 514 | ||
510 | return 0; | 515 | return 0; |
511 | } | 516 | } |
@@ -520,7 +525,7 @@ int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate) | |||
520 | * -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 |
521 | * appear to refer to a DPLL. | 526 | * appear to refer to a DPLL. |
522 | */ | 527 | */ |
523 | u32 omap3_dpll_autoidle_read(struct clk *clk) | 528 | u32 omap3_dpll_autoidle_read(struct clk_hw_omap *clk) |
524 | { | 529 | { |
525 | const struct dpll_data *dd; | 530 | const struct dpll_data *dd; |
526 | u32 v; | 531 | u32 v; |
@@ -549,7 +554,7 @@ u32 omap3_dpll_autoidle_read(struct clk *clk) | |||
549 | * OMAP3430. The DPLL will enter low-power stop when its downstream | 554 | * OMAP3430. The DPLL will enter low-power stop when its downstream |
550 | * clocks are gated. No return value. | 555 | * clocks are gated. No return value. |
551 | */ | 556 | */ |
552 | void omap3_dpll_allow_idle(struct clk *clk) | 557 | void omap3_dpll_allow_idle(struct clk_hw_omap *clk) |
553 | { | 558 | { |
554 | const struct dpll_data *dd; | 559 | const struct dpll_data *dd; |
555 | u32 v; | 560 | u32 v; |
@@ -559,11 +564,8 @@ void omap3_dpll_allow_idle(struct clk *clk) | |||
559 | 564 | ||
560 | dd = clk->dpll_data; | 565 | dd = clk->dpll_data; |
561 | 566 | ||
562 | if (!dd->autoidle_reg) { | 567 | if (!dd->autoidle_reg) |
563 | pr_debug("clock: DPLL %s: autoidle not supported\n", | ||
564 | __clk_get_name(clk)); | ||
565 | return; | 568 | return; |
566 | } | ||
567 | 569 | ||
568 | /* | 570 | /* |
569 | * REVISIT: CORE DPLL can optionally enter low-power bypass | 571 | * REVISIT: CORE DPLL can optionally enter low-power bypass |
@@ -583,7 +585,7 @@ void omap3_dpll_allow_idle(struct clk *clk) | |||
583 | * | 585 | * |
584 | * Disable DPLL automatic idle control. No return value. | 586 | * Disable DPLL automatic idle control. No return value. |
585 | */ | 587 | */ |
586 | void omap3_dpll_deny_idle(struct clk *clk) | 588 | void omap3_dpll_deny_idle(struct clk_hw_omap *clk) |
587 | { | 589 | { |
588 | const struct dpll_data *dd; | 590 | const struct dpll_data *dd; |
589 | u32 v; | 591 | u32 v; |
@@ -593,11 +595,8 @@ void omap3_dpll_deny_idle(struct clk *clk) | |||
593 | 595 | ||
594 | dd = clk->dpll_data; | 596 | dd = clk->dpll_data; |
595 | 597 | ||
596 | if (!dd->autoidle_reg) { | 598 | if (!dd->autoidle_reg) |
597 | pr_debug("clock: DPLL %s: autoidle not supported\n", | ||
598 | __clk_get_name(clk)); | ||
599 | return; | 599 | return; |
600 | } | ||
601 | 600 | ||
602 | v = __raw_readl(dd->autoidle_reg); | 601 | v = __raw_readl(dd->autoidle_reg); |
603 | v &= ~dd->autoidle_mask; | 602 | v &= ~dd->autoidle_mask; |
@@ -615,18 +614,25 @@ void omap3_dpll_deny_idle(struct clk *clk) | |||
615 | * 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 |
616 | * rate to the dpll_clk * 2; otherwise, just use dpll_clk. | 615 | * rate to the dpll_clk * 2; otherwise, just use dpll_clk. |
617 | */ | 616 | */ |
618 | unsigned long omap3_clkoutx2_recalc(struct clk *clk) | 617 | unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw, |
618 | unsigned long parent_rate) | ||
619 | { | 619 | { |
620 | const struct dpll_data *dd; | 620 | const struct dpll_data *dd; |
621 | unsigned long rate; | 621 | unsigned long rate; |
622 | u32 v; | 622 | u32 v; |
623 | struct clk *pclk; | 623 | struct clk_hw_omap *pclk = NULL; |
624 | unsigned long parent_rate; | 624 | struct clk *parent; |
625 | 625 | ||
626 | /* Walk up the parents of clk, looking for a DPLL */ | 626 | /* Walk up the parents of clk, looking for a DPLL */ |
627 | pclk = __clk_get_parent(clk); | 627 | do { |
628 | while (pclk && !pclk->dpll_data) | 628 | do { |
629 | pclk = __clk_get_parent(pclk); | 629 | parent = __clk_get_parent(hw->clk); |
630 | hw = __clk_get_hw(parent); | ||
631 | } while (hw && (__clk_get_flags(hw->clk) & CLK_IS_BASIC)); | ||
632 | if (!hw) | ||
633 | break; | ||
634 | pclk = to_clk_hw_omap(hw); | ||
635 | } while (pclk && !pclk->dpll_data); | ||
630 | 636 | ||
631 | /* 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 */ |
632 | if (!pclk) { | 638 | if (!pclk) { |
@@ -638,7 +644,6 @@ unsigned long omap3_clkoutx2_recalc(struct clk *clk) | |||
638 | 644 | ||
639 | WARN_ON(!dd->enable_mask); | 645 | WARN_ON(!dd->enable_mask); |
640 | 646 | ||
641 | parent_rate = __clk_get_rate(__clk_get_parent(clk)); | ||
642 | v = __raw_readl(dd->control_reg) & dd->enable_mask; | 647 | v = __raw_readl(dd->control_reg) & dd->enable_mask; |
643 | v >>= __ffs(dd->enable_mask); | 648 | v >>= __ffs(dd->enable_mask); |
644 | if ((v != OMAP3XXX_EN_DPLL_LOCKED) || (dd->flags & DPLL_J_TYPE)) | 649 | if ((v != OMAP3XXX_EN_DPLL_LOCKED) || (dd->flags & DPLL_J_TYPE)) |
@@ -649,15 +654,7 @@ unsigned long omap3_clkoutx2_recalc(struct clk *clk) | |||
649 | } | 654 | } |
650 | 655 | ||
651 | /* OMAP3/4 non-CORE DPLL clkops */ | 656 | /* OMAP3/4 non-CORE DPLL clkops */ |
652 | 657 | const struct clk_hw_omap_ops clkhwops_omap3_dpll = { | |
653 | const struct clkops clkops_omap3_noncore_dpll_ops = { | ||
654 | .enable = omap3_noncore_dpll_enable, | ||
655 | .disable = omap3_noncore_dpll_disable, | ||
656 | .allow_idle = omap3_dpll_allow_idle, | ||
657 | .deny_idle = omap3_dpll_deny_idle, | ||
658 | }; | ||
659 | |||
660 | const struct clkops clkops_omap3_core_dpll_ops = { | ||
661 | .allow_idle = omap3_dpll_allow_idle, | 658 | .allow_idle = omap3_dpll_allow_idle, |
662 | .deny_idle = omap3_dpll_deny_idle, | 659 | .deny_idle = omap3_dpll_deny_idle, |
663 | }; | 660 | }; |