U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] Make sleep shell command is reliablefor all architectures
Date: Tue, 20 May 2008 10:24:04 -0500	[thread overview]
Message-ID: <4832ED14.702@freescale.com> (raw)
In-Reply-To: <1211295950.3617.17.camel@mcmullan-linux.cifs.lab.netapp.com>

McMullan, Jason wrote:
> On Tue, 2008-05-20 at 16:23 +0200, Wolfgang Denk wrote:
>> Well, even if this happens, it should not cause get_timer()  to  show
>> such problems. get_timer() returns an "unsigned long" and is counting
>> in milliseconds, so a wrap-around should take about 50 days.
> 
> Yes, but get_timer() is not guaranteed to return 0 to MAX_ULONG, as
> far as I can tell.
> 
> On MIPS (even after my CFG_HZ patch), get_timer() will only return
> 0 to 14316 on a 300MHZ machine, as the 32-bit MIPS tick timer that
> forms the MIPS time base wraps to 0 after 14.316 seconds.
> 
>> I tend to reject this patch because I think we should fix  the  cause
>> of  the  problems  rather than the symptoms - there are more areas in
>> the code that rely on sane behaviour of the get_timer() functione.
> 
> Well, then we've got a big problem on MIPS.

This can be fixed by maintaining the upper bits of the timebase in 
software, as long we can guarantee that get_timer() is called at least 
once per wraparound.  That is, remember the last value, and if the new 
value is less than the old value, increment the upper word.

-Scott

  reply	other threads:[~2008-05-20 15:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-20 13:57 [U-Boot-Users] [PATCH] Make sleep shell command is reliable for all architectures Jason McMullan
2008-05-20 14:23 ` Wolfgang Denk
2008-05-20 15:05   ` [U-Boot-Users] [PATCH] Make sleep shell command is reliablefor " McMullan, Jason
2008-05-20 15:24     ` Scott Wood [this message]
2008-05-20 18:42     ` Wolfgang Denk

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=4832ED14.702@freescale.com \
    --to=scottwood@freescale.com \
    --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