summaryrefslogtreecommitdiff
path: root/arch/sh/lib
diff options
context:
space:
mode:
authorNobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>2013-07-23 13:57:24 +0900
committerNobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>2013-10-17 09:34:38 +0900
commit861bd4bcf7e7eba165b42e79cea005486851d69b (patch)
treeeee87c16112d4872b501f285047dd3fc93f65a93 /arch/sh/lib
parent183acb700378a8cfc5d50a01a65de93fb2c24586 (diff)
downloadu-boot-861bd4bcf7e7eba165b42e79cea005486851d69b.tar.gz
u-boot-861bd4bcf7e7eba165b42e79cea005486851d69b.tar.bz2
u-boot-861bd4bcf7e7eba165b42e79cea005486851d69b.zip
sh: timer: Mask bit of timer prescaler
timer_init function sets timer prescaler bit. The previous code so did not mask this bit, this function was to overwrite the bit. This will fix this problem. Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com> Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Diffstat (limited to 'arch/sh/lib')
-rw-r--r--arch/sh/lib/time.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/sh/lib/time.c b/arch/sh/lib/time.c
index 1fe537e83b..8f83d46792 100644
--- a/arch/sh/lib/time.c
+++ b/arch/sh/lib/time.c
@@ -17,6 +17,8 @@
#include <asm/io.h>
#include <sh_tmu.h>
+#define TCR_TPSC 0x07
+
static struct tmu_regs *tmu = (struct tmu_regs *)TMU_BASE;
static u16 bit;
@@ -61,7 +63,7 @@ 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) | bit, &tmu->tcr0);
+ writew((readw(&tmu->tcr0) & ~TCR_TPSC) | bit, &tmu->tcr0);
tmu_timer_stop(0);
tmu_timer_start(0);