[U-Boot] [PATCH] udelay() fails at 32bit rollover

Peter Gsellmann pgsellmann at portner-elektronik.at
Tue Sep 14 14:50:05 CEST 2010


Only for Atmel ARM at91 family:
when returnvalue of get_ticks() > 2^32  udelay() never returns

Signed-off-by: Peter Gsellmann <pgsellmann at portner-elektronik.at>
---
 arch/arm/cpu/arm926ejs/at91/timer.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/at91/timer.c b/arch/arm/cpu/arm926ejs/at91/timer.c
index 8efc34b..2d851b0 100644
--- a/arch/arm/cpu/arm926ejs/at91/timer.c
+++ b/arch/arm/cpu/arm926ejs/at91/timer.c
@@ -36,8 +36,8 @@
  */
 #define TIMER_LOAD_VAL	0xfffff
 
-static ulong timestamp;
-static ulong lastinc;
+static unsigned long long timestamp;
+static unsigned long long lastinc;
 static ulong timer_freq;
 
 static inline unsigned long long tick_to_time(unsigned long long tick)
@@ -113,7 +113,7 @@ ulong get_timer_masked(void)
 void __udelay(unsigned long usec)
 {
 	unsigned long long tmp;
-	ulong tmo;
+	unsigned long long tmo;
 
 	tmo = usec_to_tick(usec);
 	tmp = get_ticks() + tmo;	/* get current timestamp */
-- 
1.7.2.2




More information about the U-Boot mailing list