Skip to content

Commit

Permalink
[ARM] 3135/1: harden SA11x0 and PXA2xx timer init code
Browse files Browse the repository at this point in the history
Patch from Nicolas Pitre

Make it completely deterministic and leave nothing to chance
(even if it had at worst 0.001% probability of failing).

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Nicolas Pitre authored and Russell King committed Nov 8, 2005
1 parent d07ad96 commit 5285eb5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions arch/arm/mach-pxa/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,13 @@ static void __init pxa_timer_init(void)
tv.tv_sec = pxa_get_rtc_time();
do_settimeofday(&tv);

OSMR0 = 0; /* set initial match at 0 */
OIER = 0; /* disable any timer interrupts */
OSCR = LATCH*2; /* push OSCR out of the way */
OSMR0 = LATCH; /* set initial match */
OSSR = 0xf; /* clear status on all timers */
setup_irq(IRQ_OST0, &pxa_timer_irq);
OIER |= OIER_E0; /* enable match on timer 0 to cause interrupts */
OSCR = 0; /* initialize free-running timer, force first match */
OIER = OIER_E0; /* enable match on timer 0 to cause interrupts */
OSCR = 0; /* initialize free-running timer */
}

#ifdef CONFIG_NO_IDLE_HZ
Expand Down
8 changes: 5 additions & 3 deletions arch/arm/mach-sa1100/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,13 @@ static void __init sa1100_timer_init(void)
tv.tv_sec = sa1100_get_rtc_time();
do_settimeofday(&tv);

OSMR0 = 0; /* set initial match at 0 */
OIER = 0; /* disable any timer interrupts */
OSCR = LATCH*2; /* push OSCR out of the way */
OSMR0 = LATCH; /* set initial match */
OSSR = 0xf; /* clear status on all timers */
setup_irq(IRQ_OST0, &sa1100_timer_irq);
OIER |= OIER_E0; /* enable match on timer 0 to cause interrupts */
OSCR = 0; /* initialize free-running timer, force first match */
OIER = OIER_E0; /* enable match on timer 0 to cause interrupts */
OSCR = 0; /* initialize free-running timer */
}

#ifdef CONFIG_NO_IDLE_HZ
Expand Down

0 comments on commit 5285eb5

Please sign in to comment.