Commit 5285eb57 authored by Nicolas Pitre's avatar Nicolas Pitre Committed by Russell King

[ARM] 3135/1: harden SA11x0 and PXA2xx timer init code

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: default avatarNicolas Pitre <nico@cam.org>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent d07ad967
...@@ -132,11 +132,13 @@ static void __init pxa_timer_init(void) ...@@ -132,11 +132,13 @@ static void __init pxa_timer_init(void)
tv.tv_sec = pxa_get_rtc_time(); tv.tv_sec = pxa_get_rtc_time();
do_settimeofday(&tv); 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 */ OSSR = 0xf; /* clear status on all timers */
setup_irq(IRQ_OST0, &pxa_timer_irq); setup_irq(IRQ_OST0, &pxa_timer_irq);
OIER |= OIER_E0; /* enable match on timer 0 to cause interrupts */ OIER = OIER_E0; /* enable match on timer 0 to cause interrupts */
OSCR = 0; /* initialize free-running timer, force first match */ OSCR = 0; /* initialize free-running timer */
} }
#ifdef CONFIG_NO_IDLE_HZ #ifdef CONFIG_NO_IDLE_HZ
......
...@@ -124,11 +124,13 @@ static void __init sa1100_timer_init(void) ...@@ -124,11 +124,13 @@ static void __init sa1100_timer_init(void)
tv.tv_sec = sa1100_get_rtc_time(); tv.tv_sec = sa1100_get_rtc_time();
do_settimeofday(&tv); 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 */ OSSR = 0xf; /* clear status on all timers */
setup_irq(IRQ_OST0, &sa1100_timer_irq); setup_irq(IRQ_OST0, &sa1100_timer_irq);
OIER |= OIER_E0; /* enable match on timer 0 to cause interrupts */ OIER = OIER_E0; /* enable match on timer 0 to cause interrupts */
OSCR = 0; /* initialize free-running timer, force first match */ OSCR = 0; /* initialize free-running timer */
} }
#ifdef CONFIG_NO_IDLE_HZ #ifdef CONFIG_NO_IDLE_HZ
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment