From: Anders Larsen Date: Fri, 11 Nov 2005 16:56:04 +0100 Subject: [U-Boot-Users] [PATCH][BUGFIX] Incorrect handling of AT91RM9200 timer overflow Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi, the AT91RM9200 timer functions are confusing apples with bananas. When the (16-bit) timer overflows, we have lost exactly 2^16 counts (or a multiple thereof, but we currently can't catch that situation), but get_timer_raw() instead adds the (unrelated) conversion factor to milliseconds, causing udelay() to potentially return too early. The patch below fixes this. Cheers Anders CHANGELOG: Fix incorrect handling of at91rm9200 timer overflow in get_timer_raw() Patch by Anders Larsen, 11 Nov 2005 Signed-off-by: Anders Larsen --- cpu/arm920t/at91rm9200/interrupts.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/cpu/arm920t/at91rm9200/interrupts.c b/cpu/arm920t/at91rm9200/interrupts.c index 1054602..68ad58b 100644 --- a/cpu/arm920t/at91rm9200/interrupts.c +++ b/cpu/arm920t/at91rm9200/interrupts.c @@ -108,7 +108,7 @@ ulong get_timer_raw (void) timestamp += now - lastinc; } else { /* we have an overflow ... */ - timestamp += now + TIMER_LOAD_VAL - lastinc; + timestamp += now + 0x10000 - lastinc; } lastinc = now;