MLK-9777 cpufreq: imx6: fix the high bus count mismatch
authorBai Ping <b51503@freescale.com>
Fri, 31 Oct 2014 08:28:03 +0000 (16:28 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:48:39 +0000 (14:48 -0500)
Normally, the system is booting up with higher cpufreq. In the
cpufreq set_target_index we will release the high bus mode if
the target cpu frequency is the lowest. It will release the high
bus mode and dcrease the high_bus_count.This will lead to a wrong
release of high bus mode. So, in the cpufreq_init function, if the
original frequency is not the lowest, we need request high busfreq.

Signed-off-by: Bai Ping <b51503@freescale.com>
(cherry picked from commit 7df8887a6ddac148d33cd583da31ec72d0ba07da)

drivers/cpufreq/imx6q-cpufreq.c

index 4059228..6955a0e 100644 (file)
@@ -178,8 +178,20 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index)
 
 static int imx6q_cpufreq_init(struct cpufreq_policy *policy)
 {
+       int ret;
+
        policy->clk = arm_clk;
-       return cpufreq_generic_init(policy, freq_table, transition_latency);
+       policy->cur = clk_get_rate(arm_clk) / 1000;
+
+       ret = cpufreq_generic_init(policy, freq_table, transition_latency);
+       if (ret) {
+               dev_err(cpu_dev, "imx6 cpufreq init failed!\n");
+               return ret;
+       }
+       if (policy->cur > freq_table[0].frequency)
+               request_bus_freq(BUS_FREQ_HIGH);
+
+       return 0;
 }
 
 static struct cpufreq_driver imx6q_cpufreq_driver = {