18 #include <linux/module.h>
19 #include <linux/kernel.h>
20 #include <linux/device.h>
21 #include <linux/list.h>
22 #include <linux/errno.h>
27 #include <plat/clock.h>
40 #define M_LOCK_CTRL (1 << 2)
45 static struct memory_timings mem_timings;
48 static u32 omap2xxx_sdrc_get_slow_dll_ctrl(
void)
50 return mem_timings.slow_dll_ctrl;
53 static u32 omap2xxx_sdrc_get_fast_dll_ctrl(
void)
55 return mem_timings.fast_dll_ctrl;
58 static u32 omap2xxx_sdrc_get_type(
void)
60 return mem_timings.m_type;
72 if ((dll_state & (1 << 2)) == (1 << 2))
91 if ((curr_perf_level == level) && !force)
95 dll_ctrl = omap2xxx_sdrc_get_slow_dll_ctrl();
97 dll_ctrl = omap2xxx_sdrc_get_fast_dll_ctrl();
101 m_type = omap2xxx_sdrc_get_type();
113 curr_perf_level =
level;
122 unsigned long dll_cnt;
126 mem_timings.m_type = !((sdrc_read_reg(
SDRC_MR_0) & 0x3) == 0x1);
132 mem_timings.base_cs = 1;
134 mem_timings.base_cs = 0;
136 if (mem_timings.m_type !=
M_DDR)
140 if (((mem_timings.fast_dll_ctrl & (1 << 2)) ==
M_LOCK_CTRL))
143 mem_timings.dll_mode =
M_LOCK;
145 if (mem_timings.base_cs == 0) {
152 if (force_lock_to_unlock_mode) {
157 mem_timings.fast_dll_ctrl = (fast_dll | (3 << 8));
161 mem_timings.fast_dll_ctrl,
163 force_lock_to_unlock_mode);
164 mem_timings.slow_dll_ctrl &= 0xff00;
167 mem_timings.slow_dll_ctrl |=
168 ((mem_timings.fast_dll_ctrl & 0xF) | (1 << 2));
171 mem_timings.slow_dll_ctrl |= ((1 << 1) | (3 << 8));