On 11/10/2017 22:48, David Kozub wrote: [ ... ]
>> >> + disable_timer(timer); >> + cs5535_mfgpt_write(timer, MFGPT_REG_COUNTER, 0); >> + >> /* Set up the IRQ on the MFGPT side */ >> if (cs5535_mfgpt_setup_irq(timer, MFGPT_CMP2, &timer_irq)) { >> printk(KERN_ERR DRV_NAME ": Could not set up IRQ %d\n", > > I tried that and the handler is still called. So I did some more random > experiments and I found out that if I call disable_timer(timer) twice, > then the issue is resolved (the handler is not called before the > registration is finished.) And I don't have to set MFGPT_REG_COUNTER to 0. Aha! we are close to a fix. > I have no idea why do I have to call disable_timer twice. For testing purpose, can you try by adding mmiowb() and/or wmb() after disable_timer()? -- <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog