diff options
author | Ranjani Vaidyanathan <ra5478@freescale.com> | 2012-08-25 00:14:51 -0500 |
---|---|---|
committer | Ranjani Vaidyanathan <ra5478@freescale.com> | 2012-08-26 14:41:11 -0500 |
commit | df63a57d034f77674d2fce9949f0eef6570e02f0 (patch) | |
tree | a47a8fdbc7854d652a80259efad2076fe690175f /arch/arm/plat-mxc | |
parent | 0b04f438957b0d93718650058a39653cdd8c1c34 (diff) |
ENGR00221440 MX6x-Fix race-condition in checking bus_freq variables
Checking of the bus_freq variables and changing of the
bus/ddr frequency should be done under one mutex.
Else there is a race-condition that the variable changed
just after it was checked.
Also ensure that the bus freq is always increased before
the cpu freq is set to anything other than the lowest setpoint.
Else there is a possibility that the ARM is set to run from
PLL1 at higher frequency when bus/DDR are still at 24MHz.
This is dangerous since when system enters WAIT mode in
low bus freq state, PLL1 is set to bypass when ARM is being
sourced from it.
Signed-off-by: Ranjani Vaidyanathan <ra5478@freescale.com>
Diffstat (limited to 'arch/arm/plat-mxc')
-rwxr-xr-x | arch/arm/plat-mxc/cpufreq.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/arch/arm/plat-mxc/cpufreq.c b/arch/arm/plat-mxc/cpufreq.c index ee041507038e..b6c1e28e4aca 100755 --- a/arch/arm/plat-mxc/cpufreq.c +++ b/arch/arm/plat-mxc/cpufreq.c @@ -58,13 +58,7 @@ extern struct regulator *soc_regulator; extern struct regulator *pu_regulator; extern int dvfs_core_is_active; extern struct cpu_op *(*get_cpu_op)(int *op); -extern int low_bus_freq_mode; -extern int audio_bus_freq_mode; -extern int high_bus_freq_mode; -extern int set_low_bus_freq(void); -extern int set_high_bus_freq(int high_bus_speed); -extern int low_freq_bus_used(void); -extern struct mutex bus_freq_mutex; +extern void bus_freq_update(struct clk *clk, bool flag); int set_cpu_freq(int freq) { @@ -95,12 +89,9 @@ int set_cpu_freq(int freq) #endif /*Set the voltage for the GP domain. */ if (freq > org_cpu_rate) { - mutex_lock(&bus_freq_mutex); - if (low_bus_freq_mode || audio_bus_freq_mode) { - mutex_unlock(&bus_freq_mutex); - set_high_bus_freq(0); - } else - mutex_unlock(&bus_freq_mutex); + /* Check if the bus freq needs to be increased first */ + bus_freq_update(cpu_clk, true); + if (freq == cpu_op_tbl[0].cpu_rate && !IS_ERR(soc_regulator) && !IS_ERR(pu_regulator)) { ret = regulator_set_voltage(soc_regulator, soc_volt, soc_volt); @@ -152,11 +143,8 @@ int set_cpu_freq(int freq) } soc_regulator_set = 0; } - mutex_lock(&bus_freq_mutex); - if (low_freq_bus_used() && - !(low_bus_freq_mode || audio_bus_freq_mode)) - set_low_bus_freq(); - mutex_unlock(&bus_freq_mutex); + /* Check if the bus freq can be decreased.*/ + bus_freq_update(cpu_clk, false); } return ret; |