From 861bd4bcf7e7eba165b42e79cea005486851d69b Mon Sep 17 00:00:00 2001 From: Nobuhiro Iwamatsu Date: Tue, 23 Jul 2013 13:57:24 +0900 Subject: 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 Signed-off-by: Nobuhiro Iwamatsu --- arch/sh/lib/time.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'arch') 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 #include +#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); -- cgit v1.2.1 From b8f1608645c98511e726f6e009169f9b9e2140f9 Mon Sep 17 00:00:00 2001 From: Nobuhiro Iwamatsu Date: Tue, 20 Aug 2013 14:33:15 +0900 Subject: 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 Signed-off-by: Nobuhiro Iwamatsu --- arch/sh/lib/time.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'arch') diff --git a/arch/sh/lib/time.c b/arch/sh/lib/time.c index 8f83d46792..c554fe8b66 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); -- cgit v1.2.1 From a633a18f906bb21a46634f0d4b1c453ca0e6735b Mon Sep 17 00:00:00 2001 From: Nobuhiro Iwamatsu Date: Thu, 22 Aug 2013 08:43:47 +0900 Subject: sh: cache: Change cache API to defines as U-Boot A chache API of SH is developped by reference in linux kernel. And API was the same as the linux kernel. This patch change cache API to defines as U-Boot. Signed-off-by: Nobuhiro Iwamatsu Signed-off-by: Nobuhiro Iwamatsu --- arch/sh/cpu/sh4/cache.c | 4 ++-- arch/sh/cpu/sh4/cpu.c | 2 +- arch/sh/include/asm/cache.h | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-) (limited to 'arch') diff --git a/arch/sh/cpu/sh4/cache.c b/arch/sh/cpu/sh4/cache.c index 1947ec8e95..e1ee970a91 100644 --- a/arch/sh/cpu/sh4/cache.c +++ b/arch/sh/cpu/sh4/cache.c @@ -91,7 +91,7 @@ int cache_control(unsigned int cmd) return 0; } -void dcache_wback_range(u32 start, u32 end) +void flush_dcache_range(unsigned long start, unsigned long end) { u32 v; @@ -102,7 +102,7 @@ void dcache_wback_range(u32 start, u32 end) } } -void dcache_invalid_range(u32 start, u32 end) +void invalidate_dcache_range(unsigned long start, unsigned long end) { u32 v; diff --git a/arch/sh/cpu/sh4/cpu.c b/arch/sh/cpu/sh4/cpu.c index 9fae61473b..91133a38ae 100644 --- a/arch/sh/cpu/sh4/cpu.c +++ b/arch/sh/cpu/sh4/cpu.c @@ -41,7 +41,7 @@ int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) void flush_cache (unsigned long addr, unsigned long size) { - dcache_invalid_range( addr , addr + size ); + invalidate_dcache_range(addr , addr + size); } void icache_enable (void) diff --git a/arch/sh/include/asm/cache.h b/arch/sh/include/asm/cache.h index 24941b3019..b21dc4422e 100644 --- a/arch/sh/include/asm/cache.h +++ b/arch/sh/include/asm/cache.h @@ -10,9 +10,6 @@ int cache_control(unsigned int cmd); struct __large_struct { unsigned long buf[100]; }; #define __m(x) (*(struct __large_struct *)(x)) -void dcache_wback_range(u32 start, u32 end); -void dcache_invalid_range(u32 start, u32 end); - #else /* -- cgit v1.2.1