These functions are always called for timer = 0, so drop the
timer check. Since these functions are called from one place
only and they are reduced to one line of code, just inline
them.
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
#include <sh_tmu.h>
#define TCR_TPSC 0x07
+#define TSTR_STR0 BIT(0)
static struct tmu_regs *tmu = (struct tmu_regs *)TMU_BASE;
return ~readl(&tmu->tcnt0);
}
-static void tmu_timer_start(unsigned int timer)
-{
- if (timer > 2)
- return;
- writeb(readb(&tmu->tstr) | (1 << timer), &tmu->tstr);
-}
-
-static void tmu_timer_stop(unsigned int timer)
-{
- if (timer > 2)
- return;
- writeb(readb(&tmu->tstr) & ~(1 << timer), &tmu->tstr);
-}
-
int timer_init(void)
{
writew(readw(&tmu->tcr0) & ~TCR_TPSC, &tmu->tcr0);
-
- tmu_timer_stop(0);
- tmu_timer_start(0);
+ writeb(readb(&tmu->tstr) & ~TSTR_STR0, &tmu->tstr);
+ writeb(readb(&tmu->tstr) | TSTR_STR0, &tmu->tstr);
return 0;
}