diff options
Diffstat (limited to 'lib_sh')
| -rw-r--r-- | lib_sh/time.c | 26 | ||||
| -rw-r--r-- | lib_sh/time_sh2.c | 4 |
2 files changed, 15 insertions, 15 deletions
diff --git a/lib_sh/time.c b/lib_sh/time.c index 2bd771528..8fccce3d6 100644 --- a/lib_sh/time.c +++ b/lib_sh/time.c @@ -49,21 +49,21 @@ int timer_init (void) { /* Divide clock by TMU_CLK_DIVIDER */ u16 bit = 0; - switch( TMU_CLK_DIVIDER ){ - case 4: - bit = 0; - break; - case 16: - bit = 1; - break; - case 64: bit = 2; + + switch (TMU_CLK_DIVIDER) { + case 1024: + bit = 4; break; case 256: bit = 3; break; - case 1024: - bit = 4; + case 64: + bit = 2; break; + case 16: + bit = 1; + break; + case 4: default: bit = 0; break; @@ -71,7 +71,7 @@ int timer_init (void) writew(readw(TCR0) | bit, TCR0); /* Clock adjustment calc */ - clk_adj = (int)(1.0/((1.0/CONFIG_SYS_HZ)*1000000)); + clk_adj = (int)(1.0 / ((1.0 / CONFIG_SYS_HZ) * 1000000)); if (clk_adj < 1) clk_adj = 1; @@ -102,8 +102,8 @@ void udelay (unsigned long usec) unsigned long get_timer (unsigned long base) { - /* return msec */ - return ((get_usec()/clk_adj)/1000) - base; + /* return msec */ + return ((get_usec() / clk_adj) / 1000) - base; } void set_timer (unsigned long t) diff --git a/lib_sh/time_sh2.c b/lib_sh/time_sh2.c index 4f893c87b..5c6c9d438 100644 --- a/lib_sh/time_sh2.c +++ b/lib_sh/time_sh2.c @@ -28,7 +28,7 @@ #include <asm/io.h> #include <asm/processor.h> -#define CMT_CMCSR_INIT 0x0001 /* PCLK/32 */ +#define CMT_CMCSR_INIT 0x0001 /* PCLK/32 */ #define CMT_CMCSR_CALIB 0x0000 #define CMT_MAX_COUNTER (0xFFFFFFFF) #define CMT_TIMER_RESET (0xFFFF) @@ -87,7 +87,7 @@ static unsigned long get_usec (void) /* return msec */ ulong get_timer(ulong base) { - return (get_usec()/1000) - base; + return (get_usec() / 1000) - base; } void set_timer(ulong t) |