All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: Ian Campbell <ijc@hellion.org.uk>
Cc: grub-devel@gnu.org, Leif Lindholm <leif.lindholm@arm.com>
Subject: Re: [PATCH] * grub-core/kern/uboot/init.c (uboot_timer_ms) correct units
Date: Sun, 22 Dec 2013 02:52:30 +0100	[thread overview]
Message-ID: <52B645DE.6090106@gmail.com> (raw)
In-Reply-To: <1387675775.17491.16.camel@dagon.hellion.org.uk>

[-- Attachment #1: Type: text/plain, Size: 2292 bytes --]

On 22.12.2013 02:29, Ian Campbell wrote:
> On Sun, 2013-12-22 at 01:21 +0000, Ian Campbell wrote:
>> On Sat, 2013-12-21 at 23:23 +0100, Vladimir 'φ-coder/phcoder' Serbinenko
>> wrote:
>>> On 15.12.2013 16:23, Ian Campbell wrote:
>>>> From: Ian Campbell <ian.campbell@citrix.com>
>>>>
>>>> u-boot's API_GET_TIMER returns the current time in ms by directly exposing the
>>>> internal get_timer which is in ms, which isn't all that clearly documented but
>>>> is obvious from the use within u-boot and is mentioned in
>>>> http://www.denx.de/wiki/U-Boot/TaskTimerAPI.
>>>>
>>> During tests on my raspberry pi, I actually experienced the exact
>>> opposite. On PI timer API is in microseconds.
>>> Are you sure you made no mistake?
>>
>> I'm quite sure that on the Midway platform get_timer was returning ms
>> and the 5s grub countdown took 5s after my fix and some interminably
>> long time before it.
>>
>> Sadly actual documentation of the u-boot API is a bit thin on the
>> ground, but get_timer==ms is also corroborated by some ad-hoc googling I
>> did (e.g. resulting in the above link) as well as inspection of some
>> random u-boot ports. Some ports have an explicit get_timer_us function,
>> which adds credence to the idea that get_timer is in ms instead.
> 
> See also this patch to u-boot upstream:
> 
Ok, I've kept current code as generic and added own timer implementation
for raspberry pie
> commit 5eaa215607c8668bfa6a7183407eba8fec63d648
> Author: Stephen Warren <swarren@wwwdotorg.org>
> Date:   Wed Mar 27 18:43:23 2013 +0000
> 
>     ARM: bcm2835: fix get_timer() to return ms
>     
>     Apparently, CONFIG_SYS_HZ must be 1000. Change this, and fix the timer
>     driver to conform to this.
>     
>     Have the timer implementation export a custom API get_timer_us() for use
>     by the BCM2835 MMC API, which needs us resolution for a HW workaround.
>     
>     Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
> 
> and from README:
> 
> - CPU timer options:
>                 CONFIG_SYS_HZ
> 
>                 The frequency of the timer returned by get_timer().
>                 get_timer() must operate in milliseconds and this CONFIG
>                 option must be set to 1000.
> 
> Ian.
> 
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 291 bytes --]

      reply	other threads:[~2013-12-22  1:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-15 15:23 [PATCH] * grub-core/kern/uboot/init.c (uboot_timer_ms) correct units Ian Campbell
2013-12-15 17:00 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-21 22:23 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-22  1:21   ` Ian Campbell
2013-12-22  1:29     ` Ian Campbell
2013-12-22  1:52       ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]

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=52B645DE.6090106@gmail.com \
    --to=phcoder@gmail.com \
    --cc=grub-devel@gnu.org \
    --cc=ijc@hellion.org.uk \
    --cc=leif.lindholm@arm.com \
    /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.