aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap
diff options
context:
space:
mode:
authorImre Deak <imre.deak@solidboot.com>2006-09-25 12:41:21 +0300
committerTony Lindgren <tony@atomide.com>2006-09-25 12:41:21 +0300
commitdf51a84d93e776b7481d937ccd60be1b27d320c5 (patch)
treee94a6327eff576dac2ea84cae1e7e3ebda0f0cfe /arch/arm/plat-omap
parentae78dcf79aefa98a1ed245898467eb6d3bfc11e6 (diff)
downloadkernel_samsung_aries-df51a84d93e776b7481d937ccd60be1b27d320c5.zip
kernel_samsung_aries-df51a84d93e776b7481d937ccd60be1b27d320c5.tar.gz
kernel_samsung_aries-df51a84d93e776b7481d937ccd60be1b27d320c5.tar.bz2
ARM: OMAP: timer32k: fix tick count calculation when reprogramming
Reprogramming takes places before putting the CPU into idle mode if the dynamic tick option is enabled. The timer is then set to expire at the next pending timer event. Because some time has already passed since the last reported jiffy we have to wait less than the time specified in jiffies. Also make sure we don't set a load value of 0 whose outcome is unspecified according to the TRM. Signed-off-by: Imre Deak <imre.deak@solidboot.com> Signed-off-by: Juha Yrjola <juha.yrjola@solidboot.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r--arch/arm/plat-omap/timer32k.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/arch/arm/plat-omap/timer32k.c b/arch/arm/plat-omap/timer32k.c
index 281ecc7..f7b4e89 100644
--- a/arch/arm/plat-omap/timer32k.c
+++ b/arch/arm/plat-omap/timer32k.c
@@ -105,6 +105,8 @@ static inline unsigned long omap_32k_timer_read(int reg)
static inline void omap_32k_timer_start(unsigned long load_val)
{
+ if (!load_val)
+ load_val = 1;
omap_32k_timer_write(load_val, OMAP1_32K_TIMER_TVR);
omap_32k_timer_write(0x0f, OMAP1_32K_TIMER_CR);
}
@@ -230,7 +232,15 @@ static irqreturn_t omap_32k_timer_interrupt(int irq, void *dev_id,
*/
void omap_32k_timer_reprogram(unsigned long next_tick)
{
- omap_32k_timer_start(JIFFIES_TO_HW_TICKS(next_tick, 32768) + 1);
+ unsigned long ticks = JIFFIES_TO_HW_TICKS(next_tick, 32768) + 1;
+ unsigned long now = omap_32k_sync_timer_read();
+ unsigned long idled = now - omap_32k_last_tick;
+
+ if (idled + 1 < ticks)
+ ticks -= idled;
+ else
+ ticks = 1;
+ omap_32k_timer_start(ticks);
}
static struct irqaction omap_32k_timer_irq;