From eda3daf6fbef58d2dd64c40ec9c1fb943158d920 Mon Sep 17 00:00:00 2001 From: Ranjani Vaidyanathan Date: Tue, 25 Jan 2011 14:16:57 -0600 Subject: [PATCH] ENGR00138516: MX5X: Initialize CPU working point correctly for DVFS-CORE CPU working point needs to be initialized based on the current CPU frequency in start_dvfs() and should correspond with the correct entry in the cpu_wp_auto table. If its not initialized correctly, DVFS-CORE will fail when PLL-relock results in a frequency that is not the same as set in the cpu_wp_auto table. So fix it by finding the entry that closely matches the CPU frequency. Signed-off-by: Ranjani Vaidyanathan --- arch/arm/plat-mxc/dvfs_core.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm/plat-mxc/dvfs_core.c b/arch/arm/plat-mxc/dvfs_core.c index 6e408f1e004..6bfc8574616 100644 --- a/arch/arm/plat-mxc/dvfs_core.c +++ b/arch/arm/plat-mxc/dvfs_core.c @@ -347,6 +347,14 @@ static int start_dvfs(void) dvfs_load_config(0); + /* get current working point */ + cpu_rate = clk_get_rate(cpu_clk); + curr_wp = cpu_wp_nr - 1; + do { + if (cpu_rate <= cpu_wp_tbl[curr_wp].cpu_rate) + break; + } while (--curr_wp >= 0); + old_wp = curr_wp; /* config reg GPC_CNTR */ reg = __raw_readl(dvfs_data->gpc_cntr_reg_addr);