提交 0a5f19cf 编写于 作者: L Lokesh Vutla 提交者: Greg Kroah-Hartman

memory: emif: Fix the lpmode timeout calculation

The driver tries to round up the specified timeout cycles to
the next power of 2 value. This should be done defore updating
timeout variable.
Correcting this here.
Reported-by: NNishanth Menon <nm@ti.com>
Signed-off-by: NLokesh Vutla <lokeshvutla@ti.com>
Acked-by: NSantosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 275b5d20
...@@ -728,13 +728,17 @@ static u32 get_pwr_mgmt_ctrl(u32 freq, struct emif_data *emif, u32 ip_rev) ...@@ -728,13 +728,17 @@ static u32 get_pwr_mgmt_ctrl(u32 freq, struct emif_data *emif, u32 ip_rev)
/* Timeout based on DDR frequency */ /* Timeout based on DDR frequency */
timeout = freq >= freq_threshold ? timeout_perf : timeout_pwr; timeout = freq >= freq_threshold ? timeout_perf : timeout_pwr;
/* The value to be set in register is "log2(timeout) - 3" */ /*
* The value to be set in register is "log2(timeout) - 3"
* if timeout < 16 load 0 in register
* if timeout is not a power of 2, round to next highest power of 2
*/
if (timeout < 16) { if (timeout < 16) {
timeout = 0; timeout = 0;
} else { } else {
timeout = __fls(timeout) - 3;
if (timeout & (timeout - 1)) if (timeout & (timeout - 1))
timeout++; timeout <<= 1;
timeout = __fls(timeout) - 3;
} }
switch (lpmode) { switch (lpmode) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册