summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSantosh Shilimkar <santosh.shilimkar@ti.com>2011-01-28 10:07:53 +0100
committerSebastien Jan <s-jan@ti.com>2011-01-28 10:17:12 +0100
commit8c59d0f29ab5b716a87efce027a40bc49b6aebfa (patch)
treee2d4c732d5ab5daa108298f584cdad77f84df66d
parent9f7914c89ee67a39b0fea351a15fa3e8bc8d9d8e (diff)
Fix border effect of local timer DVFS fix
The following patch added a potential mutex call in an atomix context: ARM: smp_twd: Fix the local timer library for DVFS This patch moves the access to timer_rate to avoid this issue. Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Signed-off-by: Sebastien Jan <s-jan@ti.com>
-rw-r--r--arch/arm/mach-omap2/clock.h2
-rw-r--r--arch/arm/mach-omap2/clock44xx_data.c12
-rw-r--r--arch/arm/mach-omap2/timer-mpu.c11
3 files changed, 17 insertions, 8 deletions
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index 6d67edb5ab7c..296a518327d1 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -139,6 +139,8 @@ extern const struct clksel_rate gpt_32k_rates[];
extern const struct clksel_rate gpt_sys_rates[];
extern const struct clksel_rate gfx_l3_rates[];
+extern unsigned long mpu_timer_rate;
+
#ifdef CONFIG_CPU_FREQ
#ifdef CONFIG_ARCH_OMAP2
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
index 838441676cf8..a0fdc80399cf 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -32,6 +32,8 @@
#include "prm.h"
#include "prm-regbits-44xx.h"
+unsigned long mpu_timer_rate;
+
/* Root clocks */
static struct clk extalt_clkin_ck = {
@@ -3006,6 +3008,7 @@ int __init omap4xxx_clk_init(void)
{
struct omap_clk *c;
u32 cpu_clkflg;
+ struct clk *mpu_clk;
if (cpu_is_omap44xx()) {
cpu_mask = RATE_IN_4430;
@@ -3034,5 +3037,14 @@ int __init omap4xxx_clk_init(void)
*/
clk_enable_init_clocks();
+ mpu_clk = clk_get(NULL, "dpll_mpu_ck");
+ if (!mpu_clk) {
+ pr_err("timer-mpu: Could not get mpu_clk\n");
+ BUG();
+ }
+
+ /* Timet clock = mpu clk/2 */
+ mpu_timer_rate = clk_get_rate(mpu_clk);
+
return 0;
}
diff --git a/arch/arm/mach-omap2/timer-mpu.c b/arch/arm/mach-omap2/timer-mpu.c
index e6d3d4831f18..b0758f637f6b 100644
--- a/arch/arm/mach-omap2/timer-mpu.c
+++ b/arch/arm/mach-omap2/timer-mpu.c
@@ -25,22 +25,17 @@
#include <asm/smp_twd.h>
#include <asm/localtimer.h>
+#include "clock.h"
+
/*
* Setup the local clock events for a CPU.
*/
void __cpuinit local_timer_setup(struct clock_event_device *evt)
{
#ifdef CONFIG_CPU_FREQ
- struct clk *mpu_clk;
unsigned long timer_rate;
- mpu_clk = clk_get(NULL, "dpll_mpu_ck");
- if (!mpu_clk) {
- pr_err("timer-mpu: Could not get mpu_clk\n");
- BUG();
- }
- /* Timet clock = mpu clk/2 */
- timer_rate = (clk_get_rate(mpu_clk)) >> 1;
+ timer_rate = (mpu_timer_rate >> 1);
/*
* Select the lowest timer target clock freq so that