[U-Boot] [PATCHv2 02/13] Nomadik: timer: push down single-use macros

Rabin Vincent rabin.vincent at stericsson.com
Thu Apr 8 15:43:09 CEST 2010


Eliminate some single-use macros.  USEC_TO_COUNT and COUNT_TO_USEC are
replaced in a later patch.

Cc: Alessandro Rubini <rubini at unipv.it>
Acked-by: Michael Brandt <michael.brandt at stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent at stericsson.com>
---
 cpu/arm926ejs/nomadik/timer.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/cpu/arm926ejs/nomadik/timer.c b/cpu/arm926ejs/nomadik/timer.c
index 1d98ef3..fdab650 100644
--- a/cpu/arm926ejs/nomadik/timer.c
+++ b/cpu/arm926ejs/nomadik/timer.c
@@ -31,8 +31,6 @@
 #define TIMER_CLOCK		(24 * 100 * 1000)
 #define COUNT_TO_USEC(x)	((x) * 5 / 12)	/* overflows at 6min */
 #define USEC_TO_COUNT(x)	((x) * 12 / 5)	/* overflows at 6min */
-#define TICKS_PER_HZ		(TIMER_CLOCK / CONFIG_SYS_HZ)
-#define TICKS_TO_HZ(x)		((x) / TICKS_PER_HZ)
 
 /* macro to read the decrementing 32 bit timer as an increasing count */
 #define READ_TIMER() (0 - readl(CONFIG_SYS_TIMERBASE + MTU_VAL(0)))
@@ -64,7 +62,8 @@ void reset_timer(void)
 /* Return how many HZ passed since "base" */
 ulong get_timer(ulong base)
 {
-	return  TICKS_TO_HZ(READ_TIMER()) - base;
+	ulong hz = READ_TIMER() / (TIMER_CLOCK / CONFIG_SYS_HZ);
+	return hz - base;
 }
 
 /* Delay x useconds */
-- 
1.7.0



More information about the U-Boot mailing list