summaryrefslogtreecommitdiff
path: root/arch/sh
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut+renesas@gmail.com>2018-08-24 21:23:04 +0200
committerMarek Vasut <marex@denx.de>2018-09-15 03:19:07 +0200
commit15f11fc6d72175ff5b7763f03d7b0d502efd24af (patch)
tree01d72ae0247a3dc8c3ba6ee4a81d576d55cf6b7e /arch/sh
parenteb05dcfea29bbafbc9f8ce3b7894e3e53f35d743 (diff)
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>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/lib/time.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/arch/sh/lib/time.c b/arch/sh/lib/time.c
index 302f6bed83..6273f39f21 100644
--- a/arch/sh/lib/time.c
+++ b/arch/sh/lib/time.c
@@ -16,6 +16,7 @@
#include <sh_tmu.h>
#define TCR_TPSC 0x07
+#define TSTR_STR0 BIT(0)
static struct tmu_regs *tmu = (struct tmu_regs *)TMU_BASE;
@@ -29,26 +30,11 @@ unsigned long timer_read_counter(void)
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;
}