summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBai Ping <ping.bai@nxp.com>2016-02-23 13:20:37 +0800
committerMax Krummenacher <max.krummenacher@toradex.com>2016-06-24 14:46:25 +0200
commit90529dac7b3fcb71f22b9b7b5bd319e28e7bc8fe (patch)
tree789c858c3e97d6c1dd1620167fae1ab42b15f8c6
parent7b20ca6cdb752ac4770c2c11e9500b7c1d8bc395 (diff)
MLK-12623-01 cpufreq: imx: Add support for 700MHz setpoint in cpufreq
On i.MX6UL EVK board, we use a external GPIO DC regulator to control the VDD_ARM_SOC_IN voltage, if default voltage is 1.4V when the system is bootup. Per design team, when the highest setpoint freq is not bigger than 528MHz, we can decrease this regulator voltage to 1.3V. On i.MX6UL TO1.1, we add a 700MHz setpoint. When the highest setpoint freq is 700MHz, the DC regulator should be at 1.4V to to cover the IR drop. Signed-off-by: Bai Ping <ping.bai@nxp.com> (cherry picked from commit 0e3293e53f4bd5b122abc250b610dd61850e3ce9)
-rw-r--r--drivers/cpufreq/imx6q-cpufreq.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
index d9093e14571e..2447a4561410 100644
--- a/drivers/cpufreq/imx6q-cpufreq.c
+++ b/drivers/cpufreq/imx6q-cpufreq.c
@@ -24,6 +24,7 @@
#define DC_VOLTAGE_MAX 1400000
#define FREQ_1P2_GHZ 1200000000
#define FREQ_396_MHZ 396000
+#define FREQ_696_MHZ 696000
static struct regulator *arm_reg;
static struct regulator *pu_reg;
@@ -50,6 +51,7 @@ static unsigned int transition_latency;
static struct mutex set_cpufreq_lock;
static u32 *imx6_soc_volt;
static u32 soc_opp_count;
+static bool ignore_dc_reg;
static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index)
{
@@ -140,6 +142,10 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index)
clk_set_parent(secondary_sel, pll2_pfd2_396m_clk);
clk_set_parent(step_clk, secondary_sel);
clk_set_parent(pll1_sw_clk, step_clk);
+ if (freq_hz > clk_get_rate(pll2_bus)) {
+ clk_set_rate(pll1, new_freq * 1000);
+ clk_set_parent(pll1_sw_clk, pll1_sys_clk);
+ }
} else {
clk_set_parent(step_clk, pll2_pfd2_396m_clk);
clk_set_parent(pll1_sw_clk, step_clk);
@@ -246,13 +252,13 @@ static int imx6_cpufreq_pm_notify(struct notifier_block *nb,
cpufreq_policy_min_pre_suspend = data->user_policy.min;
data->user_policy.min = data->user_policy.max;
- if (!IS_ERR(dc_reg))
+ if (!IS_ERR(dc_reg) && !ignore_dc_reg)
regulator_set_voltage_tol(dc_reg, DC_VOLTAGE_MAX, 0);
break;
case PM_POST_SUSPEND:
data->user_policy.min = cpufreq_policy_min_pre_suspend;
- if (!IS_ERR(dc_reg))
+ if (!IS_ERR(dc_reg) && !ignore_dc_reg)
regulator_set_voltage_tol(dc_reg, DC_VOLTAGE_MIN, 0);
break;
default:
@@ -322,8 +328,6 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
}
dc_reg = devm_regulator_get_optional(cpu_dev, "dc");
- if (!IS_ERR(dc_reg))
- regulator_set_voltage_tol(dc_reg, DC_VOLTAGE_MIN, 0);
/*
* soc_reg sync with arm_reg if arm shares the same regulator
@@ -365,6 +369,15 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
goto out_free_opp;
}
+ /*
+ * On i.MX6UL EVK board, if the SOC is run in overide frequency,
+ * the dc_regulator voltage should not be touched.
+ */
+ if (freq_table[num - 1].frequency == FREQ_696_MHZ)
+ ignore_dc_reg = true;
+ if (!IS_ERR(dc_reg) && !ignore_dc_reg)
+ regulator_set_voltage_tol(dc_reg, DC_VOLTAGE_MIN, 0);
+
/* Make imx6_soc_volt array's size same as arm opp number */
imx6_soc_volt = devm_kzalloc(cpu_dev, sizeof(*imx6_soc_volt) * num, GFP_KERNEL);
if (imx6_soc_volt == NULL) {