mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-06-28 09:31:32 +00:00
sh: tmu: Inline tmu_timer_{start,stop}()
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>
This commit is contained in:
parent
eb05dcfea2
commit
15f11fc6d7
1 changed files with 3 additions and 17 deletions
|
@ -16,6 +16,7 @@
|
||||||
#include <sh_tmu.h>
|
#include <sh_tmu.h>
|
||||||
|
|
||||||
#define TCR_TPSC 0x07
|
#define TCR_TPSC 0x07
|
||||||
|
#define TSTR_STR0 BIT(0)
|
||||||
|
|
||||||
static struct tmu_regs *tmu = (struct tmu_regs *)TMU_BASE;
|
static struct tmu_regs *tmu = (struct tmu_regs *)TMU_BASE;
|
||||||
|
|
||||||
|
@ -29,26 +30,11 @@ unsigned long timer_read_counter(void)
|
||||||
return ~readl(&tmu->tcnt0);
|
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)
|
int timer_init(void)
|
||||||
{
|
{
|
||||||
writew(readw(&tmu->tcr0) & ~TCR_TPSC, &tmu->tcr0);
|
writew(readw(&tmu->tcr0) & ~TCR_TPSC, &tmu->tcr0);
|
||||||
|
writeb(readb(&tmu->tstr) & ~TSTR_STR0, &tmu->tstr);
|
||||||
tmu_timer_stop(0);
|
writeb(readb(&tmu->tstr) | TSTR_STR0, &tmu->tstr);
|
||||||
tmu_timer_start(0);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue