summaryrefslogtreecommitdiff
path: root/arch/sh/lib/time.c
diff options
context:
space:
mode:
authorNobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>2013-08-20 14:33:15 +0900
committerNobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>2013-10-17 09:34:39 +0900
commitb8f1608645c98511e726f6e009169f9b9e2140f9 (patch)
tree1281ceba544acf702d507d357026ae8c50baac36 /arch/sh/lib/time.c
parent861bd4bcf7e7eba165b42e79cea005486851d69b (diff)
downloadu-boot-imx-b8f1608645c98511e726f6e009169f9b9e2140f9.zip
u-boot-imx-b8f1608645c98511e726f6e009169f9b9e2140f9.tar.gz
u-boot-imx-b8f1608645c98511e726f6e009169f9b9e2140f9.tar.bz2
sh: timer: Remove static global variable
"static u16 bit" is not necessary to use this as static global variable. This patch fixes this. Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com> Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Diffstat (limited to 'arch/sh/lib/time.c')
-rw-r--r--arch/sh/lib/time.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/sh/lib/time.c b/arch/sh/lib/time.c
index 8f83d46..c554fe8 100644
--- a/arch/sh/lib/time.c
+++ b/arch/sh/lib/time.c
@@ -21,13 +21,13 @@
static struct tmu_regs *tmu = (struct tmu_regs *)TMU_BASE;
-static u16 bit;
static unsigned long last_tcnt;
static unsigned long long overflow_ticks;
unsigned long get_tbclk(void)
{
- return get_tmu0_clk_rate() >> ((bit + 1) * 2);
+ u16 tmu_bit = (ffs(CONFIG_SYS_TMU_CLK_DIV) >> 1) - 1;
+ return get_tmu0_clk_rate() >> ((tmu_bit + 1) * 2);
}
static inline unsigned long long tick_to_time(unsigned long long tick)
@@ -62,8 +62,8 @@ static void tmu_timer_stop(unsigned int timer)
int timer_init(void)
{
- bit = (ffs(CONFIG_SYS_TMU_CLK_DIV) >> 1) - 1;
- writew((readw(&tmu->tcr0) & ~TCR_TPSC) | bit, &tmu->tcr0);
+ u16 tmu_bit = (ffs(CONFIG_SYS_TMU_CLK_DIV) >> 1) - 1;
+ writew((readw(&tmu->tcr0) & ~TCR_TPSC) | tmu_bit, &tmu->tcr0);
tmu_timer_stop(0);
tmu_timer_start(0);