summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorBai Ping <ping.bai@nxp.com>2016-08-30 13:01:29 +0800
committerBai Ping <ping.bai@nxp.com>2016-08-30 17:22:32 +0800
commit94c8ebd453aafa43f5ca842b91acc72f31c759fe (patch)
tree483002e6c1ebfb1e78fa1c13b1edfc76efc5bde1 /drivers
parenta11158ccd64c3ab6ac90fe85bbb663326fe40aca (diff)
MLK-13133-02 cpufreq: imx: Fix system hang when entring low bus mode on imx6ull
On i.MX6ULL, when the CPU freq is running at 198MHz or 396MHz, the system will enter low bus mode if no device need high bus mode. The first time the system entering low bus mode, CPU freq will be set to 24MHz, if cpufreq change the CPU freq from 198MHz(396MHz) to 396MHz(198MHz), the CPU freq will be set to 198MHz or 396 MHz. At this time, if the CPU enter low power idle, system will hang. Signed-off-by: Bai Ping <ping.bai@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/cpufreq/imx6q-cpufreq.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
index ca0ae8ddfad1..77894a12f064 100644
--- a/drivers/cpufreq/imx6q-cpufreq.c
+++ b/drivers/cpufreq/imx6q-cpufreq.c
@@ -54,6 +54,7 @@ static struct mutex set_cpufreq_lock;
static u32 *imx6_soc_volt;
static u32 soc_opp_count;
static bool ignore_dc_reg;
+static bool low_power_run_support;
static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index)
{
@@ -99,8 +100,12 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index)
* CPU freq is increasing, so need to ensure
* that bus frequency is increased too.
*/
- if (old_freq <= FREQ_396_MHZ && new_freq > FREQ_396_MHZ)
+ if (low_power_run_support) {
+ if (old_freq == freq_table[0].frequency)
+ request_bus_freq(BUS_FREQ_HIGH);
+ } else if (old_freq <= FREQ_396_MHZ && new_freq > FREQ_396_MHZ) {
request_bus_freq(BUS_FREQ_HIGH);
+ }
/* scaling up? scale voltage before frequency */
if (new_freq > old_freq) {
@@ -210,8 +215,12 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index)
* If CPU is dropped to the lowest level, release the need
* for a high bus frequency.
*/
- if (old_freq > FREQ_396_MHZ && new_freq <= FREQ_396_MHZ)
+ if (low_power_run_support) {
+ if (new_freq == freq_table[0].frequency)
+ release_bus_freq(BUS_FREQ_HIGH);
+ } else if (old_freq > FREQ_396_MHZ && new_freq <= FREQ_396_MHZ) {
release_bus_freq(BUS_FREQ_HIGH);
+ }
mutex_unlock(&set_cpufreq_lock);
return 0;
@@ -229,8 +238,12 @@ static int imx6q_cpufreq_init(struct cpufreq_policy *policy)
dev_err(cpu_dev, "imx6 cpufreq init failed!\n");
return ret;
}
- if (policy->cur > FREQ_396_MHZ)
+ if (low_power_run_support && policy->cur > freq_table[0].frequency) {
request_bus_freq(BUS_FREQ_HIGH);
+ } else if (policy->cur > FREQ_396_MHZ) {
+ request_bus_freq(BUS_FREQ_HIGH);
+ }
+
return 0;
}
@@ -358,6 +371,10 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
of_property_read_u32(np, "fsl,arm-soc-shared", &i);
if (i == 1)
soc_reg = arm_reg;
+
+ /* On i.MX6ULL, check the 24MHz low power run mode support */
+ low_power_run_support = of_property_read_bool(np, "fsl,low-power-run");
+
/*
* We expect an OPP table supplied by platform.
* Just, incase the platform did not supply the OPP