ARM: sunxi: stop timer from ticking before enabling interrupts
PATCH 1/1 ARM: sunxi: stop timer from ticking before enabling interrupts
The sun4i timer can still be ticking when we enable the interrupt. If another timer is actually used (A7 architected timer, for example), odds are that the interrupt will eventually fire with the event_handler pointer being NULL.
The obvious fix it to stop the timer before registering the interrupt.
Observed and tested on sun7i (cubietruck).
--- drivers/clocksource/sun4i_timer.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/clocksource/sun4i_timer.c +3 -0
@@ -179,6 +179,9 @@ static void __init sun4i_timer_init(struct device_node *node)writel (TIMER_CTL_CLK_SRC (TIMER_CTL_CLK_SRC_OSC24M ), timer_base +TIMER_CTL_REG (0 )); +/* Make sure timer is stopped before playing with interrupts */ +sun4i_clkevt_time_stop (0 ); + ret =setup_irq (irq, &sun4i_timer_irq);if (ret)pr_warn ("failed to setup irq %d\n" , irq);
Signature · 1 line
1.8.4.3
PATCH 1/1 ARM: sunxi: stop timer from ticking before enabling interrupts
Hi Marc,
Quoted 10 lines · Marc Zyngier
The sun4i timer can still be ticking when we enable the interrupt. If another timer is actually used (A7 architected timer, for example), odds are that the interrupt will eventually fire with the
event_handlerpointer being NULL.The obvious fix it to stop the timer before registering the interrupt.
Observed and tested on sun7i (cubietruck).
Signed-off-by Marc Zyngier <[email protected]>
You can add my Acked-by, but you should rather send this to Daniel Lezcano, which is the clocksource/clockevent maintainer.
Thanks,
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131130/af58cd59/attachment.sig>
PATCH 1/1 ARM: sunxi: stop timer from ticking before enabling interrupts
On 2013-11-30 14:15, Maxime Ripard wrote:
Hi Maxime,
Quoted 11 lines · Marc Zyngier
Quoted 10 lines
The sun4i timer can still be ticking when we enable the interrupt. If another timer is actually used (A7 architected timer, for example),
odds are that the interrupt will eventually fire with theevent_handler
pointer being NULL.The obvious fix it to stop the timer before registering the interrupt.
Quoted 6 lines
Quoted 3 lines
Observed and tested on sun7i (cubietruck).
Signed-off-by Marc Zyngier <[email protected]>You can add my Acked-by, but you should rather send this to Daniel Lezcano, which is the clocksource/clockevent maintainer.
Thanks. I'll push that to Daniel directly.
Cheers,
M.
Signature · 1 line
Fast, cheap, reliable. Pick two.