Hi,
I have skimmed through your code. And I have a few comments:
You set the load register to FFF value.
__raw_writel(0xfff, timer_base + EPITLR);
With this I suppose you want to use the set and forget mode. If so, you need to set the RLD bit in the EPIT_CR register.
If it is not set, the timer will work in free-running mode as per my understanding and even if the compare is set, this will raise every overflow of the timer, which would end up like comparing FFFF_FFFF but in a different phase.
And one last thing:
__raw_writel(EPITCR_EN | EPITCR_OCIEN | EPITCR_CLKSRC_PERIPHERAL | EPITCR_WAITEN | EPITCR_OM_TOGGLE,
timer_base + EPITCR)
I recommned you to configure the timer before and at the end just enable it. In other words split the above line in two.
__raw_writel( EPITCR_OCIEN | EPITCR_CLKSRC_PERIPHERAL | EPITCR_WAITEN | EPITCR_OM_TOGGLE,
timer_base + EPITCR);
__raw_writel(EPITCR_EN , timer_base + EPITCR);
Best Regards,
Alejandro