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

Only for Atmel ARM at91 family: when returnvalue of get_ticks() > 2^32 udelay() never returns
Signed-off-by: Peter Gsellmann pgsellmann@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 */

Dear Peter Gsellmann,
this issue is already fixed by the patch:
[PATCH] AT91 clock/timer: move static data to global_data struct (Message-Id: 1286290475-2989-1-git-send-email-u-boot@emk-elektronik.de) of Oct 5, 2010. Please try that patch. I will apply it to u-boot-atmel soon if no complaints are heard.
-static ulong timestamp; -static ulong lastinc; +static unsigned long long timestamp; +static unsigned long long lastinc;
static would not work anymore with relocation
Reinhard
participants (2)
-
Peter Gsellmann
-
Reinhard Meyer