summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2012-12-06 22:54:41 +0800
committerNitin Garg <nitin.garg@freescale.com>2014-06-03 23:01:54 -0500
commita6d5a78b55434cf339e0c932329c466802867f1e (patch)
tree786ea532e1165faa5bd442d511ee1eef3fc497dc /arch
parent71f7ba405931566f80ba6de29e4a25647e96f810 (diff)
ARM: imx: return zero in case next event gets a large increment
The return of v2_set_next_event() will lead to an infinite loop in tick_handle_oneshot_broadcast() - "goto again;" with imx6q WAIT mode (to be enabled). This happens because when global event did not expire any CPU local events, the broadcast device will be rearmed to a CPU local next_event, which could be far away from now and result in a max_delta_tick programming in set_next_event(). Fix the problem by detecting those next events with increments larger than 0x7fffffff, and simply return zero in that case. It leaves mx1_2_set_next_event() unchanged since only v2_set_next_event() will be running with imx6q WAIT mode support. Thanks Russell King for helping understand the problem. Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/plat-mxc/time.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c
index aaeedb66d66d..08504b3e9bea 100644
--- a/arch/arm/plat-mxc/time.c
+++ b/arch/arm/plat-mxc/time.c
@@ -165,7 +165,9 @@ static int v2_set_next_event(unsigned long evt,
__raw_writel(tcmp, timer_base + V2_TCMP);
- return 0;
+ return evt < 0x7fffffff &&
+ (int)(tcmp - __raw_readl(timer_base + V2_TCN)) < 0 ?
+ -ETIME : 0;
}
#ifdef DEBUG