diff options
Diffstat (limited to 'arch/arm/mach-omap2/memory.c')
-rw-r--r-- | arch/arm/mach-omap2/memory.c | 48 |
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 | */ | ||
60 | u32 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 | */ | ||
76 | u32 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 | |||
56 | void omap2_init_memory_params(u32 force_lock_to_unlock_mode) | 104 | void omap2_init_memory_params(u32 force_lock_to_unlock_mode) |
57 | { | 105 | { |
58 | unsigned long dll_cnt; | 106 | unsigned long dll_cnt; |