summaryrefslogtreecommitdiffstats
path: root/arch/arm/cpu/armv7/omap-common/timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/cpu/armv7/omap-common/timer.c')
-rw-r--r--arch/arm/cpu/armv7/omap-common/timer.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/arm/cpu/armv7/omap-common/timer.c b/arch/arm/cpu/armv7/omap-common/timer.c
index 9beebb1e74..59bbca84a6 100644
--- a/arch/arm/cpu/armv7/omap-common/timer.c
+++ b/arch/arm/cpu/armv7/omap-common/timer.c
@@ -43,8 +43,9 @@ static struct gptimer *timer_base = (struct gptimer *)CONFIG_SYS_TIMERBASE;
* Nothing really to do with interrupts, just starts up a counter.
*/
-#define TIMER_CLOCK (V_SCLK / (2 << CONFIG_SYS_PTV))
-#define TIMER_LOAD_VAL 0xffffffff
+#define TIMER_CLOCK (V_SCLK / (2 << CONFIG_SYS_PTV))
+#define TIMER_OVERFLOW_VAL 0xffffffff
+#define TIMER_LOAD_VAL 0
int timer_init(void)
{
@@ -86,7 +87,7 @@ void __udelay(unsigned long usec)
while (tmo > 0) {
now = readl(&timer_base->tcrr);
if (last > now) /* count up timer overflow */
- tmo -= TIMER_LOAD_VAL - last + now;
+ tmo -= TIMER_OVERFLOW_VAL - last + now + 1;
else
tmo -= now - last;
last = now;
OpenPOWER on IntegriCloud