udelay() fails at 32bit rollover
Subsystems (2)
PATCH 1/1 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 <[email protected]>
--- arch/arm/cpu/arm926ejs/at91/timer.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/cpu/arm926ejs/at91/timer.c +3 -3
@@ -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
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