aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/clock.c17
-rw-r--r--arch/arm/mach-omap2/clock.h4
-rw-r--r--arch/arm/mach-omap2/clock24xx.c20
-rw-r--r--arch/arm/mach-omap2/clock24xx.h10
-rw-r--r--arch/arm/mach-omap2/clock34xx.c12
-rw-r--r--arch/arm/mach-omap2/clock34xx.h4
6 files changed, 35 insertions, 32 deletions
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 1b40d757500d..5020cb1f2e7e 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -239,11 +239,11 @@ u32 omap2_get_dpll_rate(struct clk *clk)
239 * Used for clocks that have the same value as the parent clock, 239 * Used for clocks that have the same value as the parent clock,
240 * divided by some factor 240 * divided by some factor
241 */ 241 */
242void omap2_fixed_divisor_recalc(struct clk *clk) 242unsigned long omap2_fixed_divisor_recalc(struct clk *clk)
243{ 243{
244 WARN_ON(!clk->fixed_div); 244 WARN_ON(!clk->fixed_div);
245 245
246 clk->rate = clk->parent->rate / clk->fixed_div; 246 return clk->parent->rate / clk->fixed_div;
247} 247}
248 248
249/** 249/**
@@ -449,21 +449,22 @@ err:
449 * Used for clocks that are part of CLKSEL_xyz governed clocks. 449 * Used for clocks that are part of CLKSEL_xyz governed clocks.
450 * REVISIT: Maybe change to use clk->enable() functions like on omap1? 450 * REVISIT: Maybe change to use clk->enable() functions like on omap1?
451 */ 451 */
452void omap2_clksel_recalc(struct clk *clk) 452unsigned long omap2_clksel_recalc(struct clk *clk)
453{ 453{
454 unsigned long rate;
454 u32 div = 0; 455 u32 div = 0;
455 456
456 pr_debug("clock: recalc'ing clksel clk %s\n", clk->name); 457 pr_debug("clock: recalc'ing clksel clk %s\n", clk->name);
457 458
458 div = omap2_clksel_get_divisor(clk); 459 div = omap2_clksel_get_divisor(clk);
459 if (div == 0) 460 if (div == 0)
460 return; 461 return clk->rate;
461 462
462 if (clk->rate == (clk->parent->rate / div)) 463 rate = clk->parent->rate / div;
463 return; 464
464 clk->rate = clk->parent->rate / div; 465 pr_debug("clock: new clock rate is %ld (div %d)\n", rate, div);
465 466
466 pr_debug("clock: new clock rate is %ld (div %d)\n", clk->rate, div); 467 return rate;
467} 468}
468 469
469/** 470/**
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index 90077f0df78d..ca6bf226859e 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -36,7 +36,7 @@ void omap2_clk_disable_unused(struct clk *clk);
36#define omap2_clk_disable_unused NULL 36#define omap2_clk_disable_unused NULL
37#endif 37#endif
38 38
39void omap2_clksel_recalc(struct clk *clk); 39unsigned long omap2_clksel_recalc(struct clk *clk);
40void omap2_init_clk_clkdm(struct clk *clk); 40void omap2_init_clk_clkdm(struct clk *clk);
41void omap2_init_clksel_parent(struct clk *clk); 41void omap2_init_clksel_parent(struct clk *clk);
42u32 omap2_clksel_get_divisor(struct clk *clk); 42u32 omap2_clksel_get_divisor(struct clk *clk);
@@ -44,7 +44,7 @@ u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate,
44 u32 *new_div); 44 u32 *new_div);
45u32 omap2_clksel_to_divisor(struct clk *clk, u32 field_val); 45u32 omap2_clksel_to_divisor(struct clk *clk, u32 field_val);
46u32 omap2_divisor_to_clksel(struct clk *clk, u32 div); 46u32 omap2_divisor_to_clksel(struct clk *clk, u32 div);
47void omap2_fixed_divisor_recalc(struct clk *clk); 47unsigned long omap2_fixed_divisor_recalc(struct clk *clk);
48long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate); 48long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate);
49int omap2_clksel_set_rate(struct clk *clk, unsigned long rate); 49int omap2_clksel_set_rate(struct clk *clk, unsigned long rate);
50u32 omap2_get_dpll_rate(struct clk *clk); 50u32 omap2_get_dpll_rate(struct clk *clk);
diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c
index 069f3e1827a6..f2b74e9b7d8d 100644
--- a/arch/arm/mach-omap2/clock24xx.c
+++ b/arch/arm/mach-omap2/clock24xx.c
@@ -369,9 +369,9 @@ static long omap2_dpllcore_round_rate(unsigned long target_rate)
369 369
370} 370}
371 371
372static void omap2_dpllcore_recalc(struct clk *clk) 372static unsigned long omap2_dpllcore_recalc(struct clk *clk)
373{ 373{
374 clk->rate = omap2_get_dpll_rate_24xx(clk); 374 return omap2_get_dpll_rate_24xx(clk);
375} 375}
376 376
377static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate) 377static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
@@ -448,9 +448,9 @@ static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
448 * 448 *
449 * Set virt_prcm_set's rate to the mpu_speed field of the current PRCM set. 449 * Set virt_prcm_set's rate to the mpu_speed field of the current PRCM set.
450 */ 450 */
451static void omap2_table_mpu_recalc(struct clk *clk) 451static unsigned long omap2_table_mpu_recalc(struct clk *clk)
452{ 452{
453 clk->rate = curr_prcm_set->mpu_speed; 453 return curr_prcm_set->mpu_speed;
454} 454}
455 455
456/* 456/*
@@ -647,14 +647,14 @@ static u32 omap2_get_sysclkdiv(void)
647 return div; 647 return div;
648} 648}
649 649
650static void omap2_osc_clk_recalc(struct clk *clk) 650static unsigned long omap2_osc_clk_recalc(struct clk *clk)
651{ 651{
652 clk->rate = omap2_get_apll_clkin() * omap2_get_sysclkdiv(); 652 return omap2_get_apll_clkin() * omap2_get_sysclkdiv();
653} 653}
654 654
655static void omap2_sys_clk_recalc(struct clk *clk) 655static unsigned long omap2_sys_clk_recalc(struct clk *clk)
656{ 656{
657 clk->rate = clk->parent->rate / omap2_get_sysclkdiv(); 657 return clk->parent->rate / omap2_get_sysclkdiv();
658} 658}
659 659
660/* 660/*
@@ -707,9 +707,9 @@ int __init omap2_clk_init(void)
707 707
708 clk_init(&omap2_clk_functions); 708 clk_init(&omap2_clk_functions);
709 709
710 omap2_osc_clk_recalc(&osc_ck); 710 osc_ck.rate = omap2_osc_clk_recalc(&osc_ck);
711 propagate_rate(&osc_ck); 711 propagate_rate(&osc_ck);
712 omap2_sys_clk_recalc(&sys_ck); 712 sys_ck.rate = omap2_sys_clk_recalc(&sys_ck);
713 propagate_rate(&sys_ck); 713 propagate_rate(&sys_ck);
714 714
715 for (c = omap24xx_clks; c < omap24xx_clks + ARRAY_SIZE(omap24xx_clks); c++) 715 for (c = omap24xx_clks; c < omap24xx_clks + ARRAY_SIZE(omap24xx_clks); c++)
diff --git a/arch/arm/mach-omap2/clock24xx.h b/arch/arm/mach-omap2/clock24xx.h
index 759489822ee9..11da6215392b 100644
--- a/arch/arm/mach-omap2/clock24xx.h
+++ b/arch/arm/mach-omap2/clock24xx.h
@@ -24,13 +24,13 @@
24#include "cm-regbits-24xx.h" 24#include "cm-regbits-24xx.h"
25#include "sdrc.h" 25#include "sdrc.h"
26 26
27static void omap2_table_mpu_recalc(struct clk *clk); 27static unsigned long omap2_table_mpu_recalc(struct clk *clk);
28static int omap2_select_table_rate(struct clk *clk, unsigned long rate); 28static int omap2_select_table_rate(struct clk *clk, unsigned long rate);
29static long omap2_round_to_table_rate(struct clk *clk, unsigned long rate); 29static long omap2_round_to_table_rate(struct clk *clk, unsigned long rate);
30static void omap2_sys_clk_recalc(struct clk *clk); 30static unsigned long omap2_sys_clk_recalc(struct clk *clk);
31static void omap2_osc_clk_recalc(struct clk *clk); 31static unsigned long omap2_osc_clk_recalc(struct clk *clk);
32static void omap2_sys_clk_recalc(struct clk *clk); 32static unsigned long omap2_sys_clk_recalc(struct clk *clk);
33static void omap2_dpllcore_recalc(struct clk *clk); 33static unsigned long omap2_dpllcore_recalc(struct clk *clk);
34static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate); 34static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate);
35 35
36/* Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated. 36/* Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated.
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index 3b6e27bc9fe3..fb0f53b96811 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -289,9 +289,9 @@ static struct omap_clk omap34xx_clks[] = {
289 * 289 *
290 * Recalculate and propagate the DPLL rate. 290 * Recalculate and propagate the DPLL rate.
291 */ 291 */
292static void omap3_dpll_recalc(struct clk *clk) 292static unsigned long omap3_dpll_recalc(struct clk *clk)
293{ 293{
294 clk->rate = omap2_get_dpll_rate(clk); 294 return omap2_get_dpll_rate(clk);
295} 295}
296 296
297/* _omap3_dpll_write_clken - write clken_bits arg to a DPLL's enable bits */ 297/* _omap3_dpll_write_clken - write clken_bits arg to a DPLL's enable bits */
@@ -787,9 +787,10 @@ static void omap3_dpll_deny_idle(struct clk *clk)
787 * Using parent clock DPLL data, look up DPLL state. If locked, set our 787 * Using parent clock DPLL data, look up DPLL state. If locked, set our
788 * rate to the dpll_clk * 2; otherwise, just use dpll_clk. 788 * rate to the dpll_clk * 2; otherwise, just use dpll_clk.
789 */ 789 */
790static void omap3_clkoutx2_recalc(struct clk *clk) 790static unsigned long omap3_clkoutx2_recalc(struct clk *clk)
791{ 791{
792 const struct dpll_data *dd; 792 const struct dpll_data *dd;
793 unsigned long rate;
793 u32 v; 794 u32 v;
794 struct clk *pclk; 795 struct clk *pclk;
795 796
@@ -808,9 +809,10 @@ static void omap3_clkoutx2_recalc(struct clk *clk)
808 v = __raw_readl(dd->control_reg) & dd->enable_mask; 809 v = __raw_readl(dd->control_reg) & dd->enable_mask;
809 v >>= __ffs(dd->enable_mask); 810 v >>= __ffs(dd->enable_mask);
810 if (v != DPLL_LOCKED) 811 if (v != DPLL_LOCKED)
811 clk->rate = clk->parent->rate; 812 rate = clk->parent->rate;
812 else 813 else
813 clk->rate = clk->parent->rate * 2; 814 rate = clk->parent->rate * 2;
815 return rate;
814} 816}
815 817
816/* Common clock code */ 818/* Common clock code */
diff --git a/arch/arm/mach-omap2/clock34xx.h b/arch/arm/mach-omap2/clock34xx.h
index 2138a58f6346..764c7cd9fd84 100644
--- a/arch/arm/mach-omap2/clock34xx.h
+++ b/arch/arm/mach-omap2/clock34xx.h
@@ -27,8 +27,8 @@
27#include "prm.h" 27#include "prm.h"
28#include "prm-regbits-34xx.h" 28#include "prm-regbits-34xx.h"
29 29
30static void omap3_dpll_recalc(struct clk *clk); 30static unsigned long omap3_dpll_recalc(struct clk *clk);
31static void omap3_clkoutx2_recalc(struct clk *clk); 31static unsigned long omap3_clkoutx2_recalc(struct clk *clk);
32static void omap3_dpll_allow_idle(struct clk *clk); 32static void omap3_dpll_allow_idle(struct clk *clk);
33static void omap3_dpll_deny_idle(struct clk *clk); 33static void omap3_dpll_deny_idle(struct clk *clk);
34static u32 omap3_dpll_autoidle_read(struct clk *clk); 34static u32 omap3_dpll_autoidle_read(struct clk *clk);