Skip to contentSkip to conversation

omap: timer: Set dmtimer used as clocksource in autoreload mode

PATCH In review Hemant Pedanekar 2 participants 2 messages Aug 10, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 omap: timer: Set dmtimer used as clocksource in autoreload mode

If CONFIG_OMAP_32K_TIMER is not selected and dmtimer is used as clocksource, the timer stops counting once overflow occurs as it was not set in autoreload mode. This results into timekeeping failure: for example, 'sleep 1' at the shell after the timer counter overflow would hang.

This patch sets up autoreload when starting the clocksource timer which fixes the above issue.

---
 arch/arm/mach-omap2/timer.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/timer.c +2 -1
index e964072..cf1de7d 100644
@@ -293,7 +293,8 @@ static void __init omap2_gp_clocksource_init(int gptimer_id,
 	pr_info("OMAP clocksource: GPTIMER%d at %lu Hz\n",
 		gptimer_id, clksrc.rate);
 
-	__omap_dm_timer_load_start(clksrc.io_base, OMAP_TIMER_CTRL_ST, 0, 1);
+	__omap_dm_timer_load_start(clksrc.io_base,
+			OMAP_TIMER_CTRL_ST | OMAP_TIMER_CTRL_AR, 0, 1);
 	init_sched_clock(&cd, dmtimer_update_sched_clock, 32, clksrc.rate);
 
 	if (clocksource_register_hz(&clocksource_gpt, clksrc.rate))
Signature · 1 line
1.7.3.5
maintainer
#1 lore raw
Quoted 7 lines · Hemant Pedanekar

If CONFIG_OMAP_32K_TIMER is not selected and dmtimer is used as clocksource, the timer stops counting once overflow occurs as it was not set in autoreload mode. This results into timekeeping failure: for example, 'sleep 1' at the shell after the timer counter overflow would hang.

This patch sets up autoreload when starting the clocksource timer which fixes the above issue.

Thanks for updating this, will apply into fixes.

Tony

Quoted 23 lines
---
 arch/arm/mach-omap2/timer.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/timer.c +2 -1
index e964072..cf1de7d 100644
@@ -293,7 +293,8 @@ static void __init omap2_gp_clocksource_init(int gptimer_id,
 	pr_info("OMAP clocksource: GPTIMER%d at %lu Hz\n",
 		gptimer_id, clksrc.rate);
 
-	__omap_dm_timer_load_start(clksrc.io_base, OMAP_TIMER_CTRL_ST, 0, 1);
+	__omap_dm_timer_load_start(clksrc.io_base,
+			OMAP_TIMER_CTRL_ST | OMAP_TIMER_CTRL_AR, 0, 1);
 	init_sched_clock(&cd, dmtimer_update_sched_clock, 32, clksrc.rate);
 
 	if (clocksource_register_hz(&clocksource_gpt, clksrc.rate))
Signature · 1 line
1.7.3.5