[PATCH 08/17] OMAP2/3: GPTIMER: Clear pending interrupts when entering suspend

Tero Kristo
2009-10-16T11:04:25Z

From: Tero Kristo <tero.kristo@nokia.com>

OMAP GP timers keep running for a few cycles after they are stopped,
which can cause the timer to expire and generate an interrupt. The pending
interrupt will prevent OMAP from entering suspend, thus we ack it manually.

Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
---
arch/arm/mach-omap2/timer-gp.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
index 9c056ff..c9d47bb 100644
--- a/arch/arm/mach-omap2/timer-gp.c
+++ b/arch/arm/mach-omap2/timer-gp.c
@@ -92,9 +92,21 @@ static void omap2_gp_timer_set_mode(enum clock_event_mode mode,
case CLOCK_EVT_MODE_ONESHOT:
break;
case CLOCK_EVT_MODE_UNUSED:
- case CLOCK_EVT_MODE_SHUTDOWN:
case CLOCK_EVT_MODE_RESUME:
break;
+ case CLOCK_EVT_MODE_SHUTDOWN:
+ /*
+ * Wait for min period x 2 to make sure that timer is
+ * stopped
+ */
+ udelay(evt->min_delta_ns / 500);
+ /*
+ * Clear possibly pending interrupt, this will occasionally
+ * generate spurious timer IRQs during suspend but this
+ * is okay, as another option is not to enter suspend at all
+ */
+ omap_dm_timer_write_status(gptimer, OMAP_TIMER_INT_OVERFLOW);
+ break;
}
}

--
1.5.4.3