All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Matthias Weißer" <weisserm@arcor.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V5 1/3] arm: Add support for MB86R0x SoCs
Date: Mon, 09 Aug 2010 08:55:37 +0200	[thread overview]
Message-ID: <4C5FA669.6070303@arcor.de> (raw)
In-Reply-To: <20100807213541.ACF031536EF@gemini.denx.de>

Hello Wolfgang

Am 07.08.2010 23:35, schrieb Wolfgang Denk:
> Dear Matthias Weisser,
>
> In message<1280734550-18403-2-git-send-email-weisserm@arcor.de>  you wrote:
>> +void __udelay(unsigned long usec)
>> +{
>> +	unsigned long long tmp;
>> +	ulong tmo;
>> +
>> +	tmo = usec_to_tick(usec);
>> +	tmp = get_ticks() + tmo;	/* get current timestamp */
>> +
>> +	while (get_ticks()<  tmp)	/* loop till event */
>> +		 /*NOP*/;
>
> This is broken when the timer wraps around. Compare the limit against
> the difference, to make use of unsigned arithmetics.

Isn't this a theoretical problem? The timer increments with approx. 
160kHz. get_ticks() returns a 64 bit value which wraps all ~ 3*10^6 
years. I don't expect my hardware to work that long without a reboot.

Can you point me to an example where the timer stuff is done right? I 
see it done differently on nearly all ARM SOCs.

Thanks for the review
Matthias

  reply	other threads:[~2010-08-09  6:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-02  7:35 [U-Boot] [PATCH V5 0/3] Add support for MB86R0x SoCs Matthias Weisser
2010-08-02  7:35 ` [U-Boot] [PATCH V5 1/3] arm: " Matthias Weisser
2010-08-07 21:35   ` Wolfgang Denk
2010-08-09  6:55     ` Matthias Weißer [this message]
2010-08-09  9:24       ` Wolfgang Denk
2010-08-02  7:35 ` [U-Boot] [PATCH V5 2/3] video: add support for display controller in " Matthias Weisser
2010-08-02  7:35 ` [U-Boot] [PATCH V5 3/3] arm: Add support for jadecpu board based on MB86R01 SoC Matthias Weisser

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=4C5FA669.6070303@arcor.de \
    --to=weisserm@arcor.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.