public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Anders Larsen <alarsen@rea.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH][BUGFIX] Incorrect handling of AT91RM9200 timer overflow
Date: Fri, 11 Nov 2005 16:56:04 +0100	[thread overview]
Message-ID: <fc.004c4e48003a7993004c4e48003a7993.3a79ba@rea.de> (raw)

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;
 

             reply	other threads:[~2005-11-11 15:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-11 15:56 Anders Larsen [this message]
2005-11-22  9:32 ` [U-Boot-Users] [PATCH][BUGFIX] Incorrect handling of AT91RM9200 timer overflow Steven Scholz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fc.004c4e48003a7993004c4e48003a7993.3a79ba@rea.de \
    --to=alarsen@rea.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox