Skip to contentSkip to conversation

udelay() fails at 32bit rollover

PATCH New Peter Gsellmann 2 participants 2 messages Sep 14, 2010 – Oct 12, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 udelay() fails at 32bit rollover

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

---
 arch/arm/cpu/arm926ejs/at91/timer.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/cpu/arm926ejs/at91/timer.c +3 -3
index 8efc34b..2d851b0 100644
@@ -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 */
Signature · 1 line
1.7.2.2
#1 lore raw

PATCH 1/1 udelay() fails at 32bit rollover

Dear Peter Gsellmann,

this issue is already fixed by the patch:

[PATCH] AT91 clock/timer: move static data to global_data struct (Message-Id: <[email protected]>) of Oct 5, 2010. Please try that patch. I will apply it to u-boot-atmel soon if no complaints are heard.

arch/arm/cpu/arm926ejs/at91/timer.c line 40

Quoted 4 lines
arch/arm/cpu/arm926ejs/at91/timer.c +2 -2
-static ulong timestamp;
-static ulong lastinc;
+static unsigned long long timestamp;
+static unsigned long long lastinc;

static would not work anymore with relocation

Reinhard