aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonard Crestez <leonard.crestez@nxp.com>2017-08-28 07:05:18 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-08-28 18:22:52 -0400
commitfded5fc8412a0bfadd2b130433109a5be7ffdf82 (patch)
treeb8a191be45dbb992899ff9ba4cf726e3a895d13b
parent843791bb6c76b1f808951b284be5c10ee47fd245 (diff)
cpufreq: imx6q: Fix imx6sx low frequency support
This patch contains the minimal changes required to support imx6sx OPP of 198 Mhz. Without this patch cpufreq still reports success but the frequency is not changed, the "arm" clock will still be at 396000000 in clk_summary. In order to do this PLL1 needs to be still kept enabled while changing the ARM clock. This is a hardware requirement: when ARM_PODF is changed in CCM we need to check the busy bit of CCM_CDHIPR bit 16 arm_podf_busy, and this bit is sync with PLL1 clock, so if PLL1 NOT enabled, this bit will never get clear. Keep pll1_sys explicitly enabled until after the rate is change to deal with this. Otherwise from the clk framework perspective pll1_sys is unused and gets turned off. Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> Reviewed-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/cpufreq/imx6q-cpufreq.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
index b6edd3ccaa55..14466a9b01c0 100644
--- a/drivers/cpufreq/imx6q-cpufreq.c
+++ b/drivers/cpufreq/imx6q-cpufreq.c
@@ -47,6 +47,7 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index)
47 struct dev_pm_opp *opp; 47 struct dev_pm_opp *opp;
48 unsigned long freq_hz, volt, volt_old; 48 unsigned long freq_hz, volt, volt_old;
49 unsigned int old_freq, new_freq; 49 unsigned int old_freq, new_freq;
50 bool pll1_sys_temp_enabled = false;
50 int ret; 51 int ret;
51 52
52 new_freq = freq_table[index].frequency; 53 new_freq = freq_table[index].frequency;
@@ -124,6 +125,10 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index)
124 if (freq_hz > clk_get_rate(pll2_pfd2_396m_clk)) { 125 if (freq_hz > clk_get_rate(pll2_pfd2_396m_clk)) {
125 clk_set_rate(pll1_sys_clk, new_freq * 1000); 126 clk_set_rate(pll1_sys_clk, new_freq * 1000);
126 clk_set_parent(pll1_sw_clk, pll1_sys_clk); 127 clk_set_parent(pll1_sw_clk, pll1_sys_clk);
128 } else {
129 /* pll1_sys needs to be enabled for divider rate change to work. */
130 pll1_sys_temp_enabled = true;
131 clk_prepare_enable(pll1_sys_clk);
127 } 132 }
128 } 133 }
129 134
@@ -135,6 +140,10 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index)
135 return ret; 140 return ret;
136 } 141 }
137 142
143 /* PLL1 is only needed until after ARM-PODF is set. */
144 if (pll1_sys_temp_enabled)
145 clk_disable_unprepare(pll1_sys_clk);
146
138 /* scaling down? scale voltage after frequency */ 147 /* scaling down? scale voltage after frequency */
139 if (new_freq < old_freq) { 148 if (new_freq < old_freq) {
140 ret = regulator_set_voltage_tol(arm_reg, volt, 0); 149 ret = regulator_set_voltage_tol(arm_reg, volt, 0);