aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/memory.c
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2008-03-18 04:35:15 -0400
committerTony Lindgren <tony@atomide.com>2008-04-14 13:29:38 -0400
commit6b8858a972a0eff1dc1ab77b0fd9fc25387c217c (patch)
treea34e94f4d372670c5125e8f490c85e9364d222df /arch/arm/mach-omap2/memory.c
parent543d93781a3c744017594d0721c4c1814a26bcce (diff)
ARM: OMAP2: Change 24xx to use shared clock code and new reg access
This patch changes 24xx to use shared clock code and new register access. Note that patch adds some temporary OLD_CK defines to keep patch more readable. These temporary defines will be removed in the next patch. Also not all clocks are changed in this patch to limit the size. Also, the patch fixes few incorrect clock defines in clock24xx.h. Signed-off-by: Paul Walmsley <paul@pwsan.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/memory.c')
-rw-r--r--arch/arm/mach-omap2/memory.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/memory.c b/arch/arm/mach-omap2/memory.c
index b56c1a082d92..12479081881a 100644
--- a/arch/arm/mach-omap2/memory.c
+++ b/arch/arm/mach-omap2/memory.c
@@ -53,6 +53,54 @@ u32 omap2_memory_get_type(void)
53 return mem_timings.m_type; 53 return mem_timings.m_type;
54} 54}
55 55
56/*
57 * Check the DLL lock state, and return tue if running in unlock mode.
58 * This is needed to compensate for the shifted DLL value in unlock mode.
59 */
60u32 omap2_dll_force_needed(void)
61{
62 /* dlla and dllb are a set */
63 u32 dll_state = sdrc_read_reg(SDRC_DLLA_CTRL);
64
65 if ((dll_state & (1 << 2)) == (1 << 2))
66 return 1;
67 else
68 return 0;
69}
70
71/*
72 * 'level' is the value to store to CM_CLKSEL2_PLL.CORE_CLK_SRC.
73 * Practical values are CORE_CLK_SRC_DPLL (for CORE_CLK = DPLL_CLK) or
74 * CORE_CLK_SRC_DPLL_X2 (for CORE_CLK = * DPLL_CLK * 2)
75 */
76u32 omap2_reprogram_sdrc(u32 level, u32 force)
77{
78 u32 dll_ctrl, m_type;
79 u32 prev = curr_perf_level;
80 unsigned long flags;
81
82 if ((curr_perf_level == level) && !force)
83 return prev;
84
85 if (level == CORE_CLK_SRC_DPLL) {
86 dll_ctrl = omap2_memory_get_slow_dll_ctrl();
87 } else if (level == CORE_CLK_SRC_DPLL_X2) {
88 dll_ctrl = omap2_memory_get_fast_dll_ctrl();
89 } else {
90 return prev;
91 }
92
93 m_type = omap2_memory_get_type();
94
95 local_irq_save(flags);
96 __raw_writel(0xffff, OMAP24XX_PRCM_VOLTSETUP);
97 omap2_sram_reprogram_sdrc(level, dll_ctrl, m_type);
98 curr_perf_level = level;
99 local_irq_restore(flags);
100
101 return prev;
102}
103
56void omap2_init_memory_params(u32 force_lock_to_unlock_mode) 104void omap2_init_memory_params(u32 force_lock_to_unlock_mode)
57{ 105{
58 unsigned long dll_cnt; 106 unsigned long dll_cnt;