public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH][BUGFIX] Incorrect handling of AT91RM9200 timer overflow
@ 2005-11-11 15:56 Anders Larsen
  2005-11-22  9:32 ` Steven Scholz
  0 siblings, 1 reply; 2+ messages in thread
From: Anders Larsen @ 2005-11-11 15:56 UTC (permalink / raw)
  To: u-boot

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 <alarsen@rea.de>

---

 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;
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-11-22  9:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-11 15:56 [U-Boot-Users] [PATCH][BUGFIX] Incorrect handling of AT91RM9200 timer overflow Anders Larsen
2005-11-22  9:32 ` Steven Scholz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox