diff options
author | Paul Walmsley <paul@pwsan.com> | 2009-05-12 19:26:32 -0400 |
---|---|---|
committer | paul <paul@twilight.(none)> | 2009-05-12 19:27:10 -0400 |
commit | 4519c2bf433b97d091635eb51e4ba8ffa1c84d62 (patch) | |
tree | 0b36fc5e39c6a29005783c74f727c953c75e2198 | |
parent | b2abb271a5705bc80478e79d95fc9f3babc2605c (diff) |
OMAP3 clock: only unlock SDRC DLL if SDRC clk < 83MHz
According to the 34xx TRM Rev. K section 11.2.4.4.11.1 "Purpose of the
DLL/CDL Module," the SDRC delay-locked-loop can be locked at any SDRC
clock frequency from 83MHz to 166MHz. CDP code unconditionally
unlocked the DLL whenever shifting to a lower SDRC speed, but this
seems unnecessary and error-prone, as the DLL is no longer able to
compensate for process, voltage, and temperature variations. Instead,
only unlock the DLL when the SDRC clock rate would be less than 83MHz.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
-rw-r--r-- | arch/arm/mach-omap2/clock34xx.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-omap2/sram34xx.S | 13 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/mach/sram.h | 6 | ||||
-rw-r--r-- | arch/arm/plat-omap/sram.c | 7 |
4 files changed, 24 insertions, 12 deletions
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c index 0a14dca31e30..811360af60dc 100644 --- a/arch/arm/mach-omap2/clock34xx.c +++ b/arch/arm/mach-omap2/clock34xx.c | |||
@@ -281,6 +281,8 @@ static struct omap_clk omap34xx_clks[] = { | |||
281 | 281 | ||
282 | #define MAX_DPLL_WAIT_TRIES 1000000 | 282 | #define MAX_DPLL_WAIT_TRIES 1000000 |
283 | 283 | ||
284 | #define MIN_SDRC_DLL_LOCK_FREQ 83000000 | ||
285 | |||
284 | /** | 286 | /** |
285 | * omap3_dpll_recalc - recalculate DPLL rate | 287 | * omap3_dpll_recalc - recalculate DPLL rate |
286 | * @clk: DPLL struct clk | 288 | * @clk: DPLL struct clk |
@@ -703,6 +705,7 @@ static int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate) | |||
703 | static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate) | 705 | static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate) |
704 | { | 706 | { |
705 | u32 new_div = 0; | 707 | u32 new_div = 0; |
708 | u32 unlock_dll = 0; | ||
706 | unsigned long validrate, sdrcrate; | 709 | unsigned long validrate, sdrcrate; |
707 | struct omap_sdrc_params *sp; | 710 | struct omap_sdrc_params *sp; |
708 | 711 | ||
@@ -729,6 +732,11 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate) | |||
729 | if (!sp) | 732 | if (!sp) |
730 | return -EINVAL; | 733 | return -EINVAL; |
731 | 734 | ||
735 | if (sdrcrate < MIN_SDRC_DLL_LOCK_FREQ) { | ||
736 | pr_debug("clock: will unlock SDRC DLL\n"); | ||
737 | unlock_dll = 1; | ||
738 | } | ||
739 | |||
732 | pr_info("clock: changing CORE DPLL rate from %lu to %lu\n", clk->rate, | 740 | pr_info("clock: changing CORE DPLL rate from %lu to %lu\n", clk->rate, |
733 | validrate); | 741 | validrate); |
734 | pr_info("clock: SDRC timing params used: %08x %08x %08x\n", | 742 | pr_info("clock: SDRC timing params used: %08x %08x %08x\n", |
@@ -739,7 +747,7 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate) | |||
739 | 747 | ||
740 | /* REVISIT: Add SDRC_MR changing to this code also */ | 748 | /* REVISIT: Add SDRC_MR changing to this code also */ |
741 | omap3_configure_core_dpll(sp->rfr_ctrl, sp->actim_ctrla, | 749 | omap3_configure_core_dpll(sp->rfr_ctrl, sp->actim_ctrla, |
742 | sp->actim_ctrlb, new_div); | 750 | sp->actim_ctrlb, new_div, unlock_dll); |
743 | 751 | ||
744 | return 0; | 752 | return 0; |
745 | } | 753 | } |
diff --git a/arch/arm/mach-omap2/sram34xx.S b/arch/arm/mach-omap2/sram34xx.S index 35131e5bc7d1..c080c82521e1 100644 --- a/arch/arm/mach-omap2/sram34xx.S +++ b/arch/arm/mach-omap2/sram34xx.S | |||
@@ -40,22 +40,23 @@ | |||
40 | /* | 40 | /* |
41 | * Change frequency of core dpll | 41 | * Change frequency of core dpll |
42 | * r0 = sdrc_rfr_ctrl r1 = sdrc_actim_ctrla r2 = sdrc_actim_ctrlb r3 = M2 | 42 | * r0 = sdrc_rfr_ctrl r1 = sdrc_actim_ctrla r2 = sdrc_actim_ctrlb r3 = M2 |
43 | * r4 = Unlock SDRC DLL? (1 = yes, 0 = no) -- only unlock DLL for | ||
44 | * SDRC rates < 83MHz | ||
43 | */ | 45 | */ |
44 | ENTRY(omap3_sram_configure_core_dpll) | 46 | ENTRY(omap3_sram_configure_core_dpll) |
45 | stmfd sp!, {r1-r12, lr} @ store regs to stack | 47 | stmfd sp!, {r1-r12, lr} @ store regs to stack |
48 | ldr r4, [sp, #52] @ pull extra args off the stack | ||
46 | dsb @ flush buffered writes to interconnect | 49 | dsb @ flush buffered writes to interconnect |
47 | cmp r3, #0x2 | 50 | cmp r3, #0x2 |
48 | blne configure_sdrc | 51 | blne configure_sdrc |
49 | cmp r3, #0x2 | 52 | cmp r4, #0x1 |
53 | bleq unlock_dll | ||
50 | blne lock_dll | 54 | blne lock_dll |
51 | cmp r3, #0x1 | ||
52 | blne unlock_dll | ||
53 | bl sdram_in_selfrefresh @ put the SDRAM in self refresh | 55 | bl sdram_in_selfrefresh @ put the SDRAM in self refresh |
54 | bl configure_core_dpll | 56 | bl configure_core_dpll |
55 | bl enable_sdrc | 57 | bl enable_sdrc |
56 | cmp r3, #0x1 | 58 | cmp r4, #0x1 |
57 | blne wait_dll_unlock | 59 | bleq wait_dll_unlock |
58 | cmp r3, #0x2 | ||
59 | blne wait_dll_lock | 60 | blne wait_dll_lock |
60 | cmp r3, #0x1 | 61 | cmp r3, #0x1 |
61 | blne configure_sdrc | 62 | blne configure_sdrc |
diff --git a/arch/arm/plat-omap/include/mach/sram.h b/arch/arm/plat-omap/include/mach/sram.h index ab35d622dcf5..dca7c16ae903 100644 --- a/arch/arm/plat-omap/include/mach/sram.h +++ b/arch/arm/plat-omap/include/mach/sram.h | |||
@@ -23,7 +23,8 @@ extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass); | |||
23 | 23 | ||
24 | extern u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl, | 24 | extern u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl, |
25 | u32 sdrc_actim_ctrla, | 25 | u32 sdrc_actim_ctrla, |
26 | u32 sdrc_actim_ctrlb, u32 m2); | 26 | u32 sdrc_actim_ctrlb, u32 m2, |
27 | u32 unlock_dll); | ||
27 | 28 | ||
28 | /* Do not use these */ | 29 | /* Do not use these */ |
29 | extern void omap1_sram_reprogram_clock(u32 ckctl, u32 dpllctl); | 30 | extern void omap1_sram_reprogram_clock(u32 ckctl, u32 dpllctl); |
@@ -60,7 +61,8 @@ extern unsigned long omap243x_sram_reprogram_sdrc_sz; | |||
60 | 61 | ||
61 | extern u32 omap3_sram_configure_core_dpll(u32 sdrc_rfr_ctrl, | 62 | extern u32 omap3_sram_configure_core_dpll(u32 sdrc_rfr_ctrl, |
62 | u32 sdrc_actim_ctrla, | 63 | u32 sdrc_actim_ctrla, |
63 | u32 sdrc_actim_ctrlb, u32 m2); | 64 | u32 sdrc_actim_ctrlb, u32 m2, |
65 | u32 unlock_dll); | ||
64 | extern unsigned long omap3_sram_configure_core_dpll_sz; | 66 | extern unsigned long omap3_sram_configure_core_dpll_sz; |
65 | 67 | ||
66 | #endif | 68 | #endif |
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c index 38353386e91e..876f5a7ecafd 100644 --- a/arch/arm/plat-omap/sram.c +++ b/arch/arm/plat-omap/sram.c | |||
@@ -365,16 +365,17 @@ static inline int omap243x_sram_init(void) | |||
365 | static u32 (*_omap3_sram_configure_core_dpll)(u32 sdrc_rfr_ctrl, | 365 | static u32 (*_omap3_sram_configure_core_dpll)(u32 sdrc_rfr_ctrl, |
366 | u32 sdrc_actim_ctrla, | 366 | u32 sdrc_actim_ctrla, |
367 | u32 sdrc_actim_ctrlb, | 367 | u32 sdrc_actim_ctrlb, |
368 | u32 m2); | 368 | u32 m2, u32 unlock_dll); |
369 | u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl, u32 sdrc_actim_ctrla, | 369 | u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl, u32 sdrc_actim_ctrla, |
370 | u32 sdrc_actim_ctrlb, u32 m2) | 370 | u32 sdrc_actim_ctrlb, u32 m2, u32 unlock_dll) |
371 | { | 371 | { |
372 | if (!_omap3_sram_configure_core_dpll) | 372 | if (!_omap3_sram_configure_core_dpll) |
373 | omap_sram_error(); | 373 | omap_sram_error(); |
374 | 374 | ||
375 | return _omap3_sram_configure_core_dpll(sdrc_rfr_ctrl, | 375 | return _omap3_sram_configure_core_dpll(sdrc_rfr_ctrl, |
376 | sdrc_actim_ctrla, | 376 | sdrc_actim_ctrla, |
377 | sdrc_actim_ctrlb, m2); | 377 | sdrc_actim_ctrlb, m2, |
378 | unlock_dll); | ||
378 | } | 379 | } |
379 | 380 | ||
380 | /* REVISIT: Should this be same as omap34xx_sram_init() after off-idle? */ | 381 | /* REVISIT: Should this be same as omap34xx_sram_init() after off-idle? */ |