Skip to content
Snippets Groups Projects
Commit 861bd4bc authored by Nobuhiro Iwamatsu's avatar Nobuhiro Iwamatsu
Browse files

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: default avatarNobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: default avatarNobuhiro Iwamatsu <iwamatsu@nigauri.org>
parent 183acb70
No related branches found
No related tags found
No related merge requests found
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include <asm/io.h> #include <asm/io.h>
#include <sh_tmu.h> #include <sh_tmu.h>
#define TCR_TPSC 0x07
static struct tmu_regs *tmu = (struct tmu_regs *)TMU_BASE; static struct tmu_regs *tmu = (struct tmu_regs *)TMU_BASE;
static u16 bit; static u16 bit;
...@@ -61,7 +63,7 @@ static void tmu_timer_stop(unsigned int timer) ...@@ -61,7 +63,7 @@ static void tmu_timer_stop(unsigned int timer)
int timer_init(void) int timer_init(void)
{ {
bit = (ffs(CONFIG_SYS_TMU_CLK_DIV) >> 1) - 1; 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_stop(0);
tmu_timer_start(0); tmu_timer_start(0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment