@@ -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 */