Received: from list by lists.gnu.org with archive (Exim 4.71) id 1VuXra-00018e-Ur for mharc-grub-devel@gnu.org; Sat, 21 Dec 2013 20:29:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36839) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VuXrV-000185-CW for grub-devel@gnu.org; Sat, 21 Dec 2013 20:29:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VuXrN-0000Ic-M8 for grub-devel@gnu.org; Sat, 21 Dec 2013 20:29:45 -0500 Received: from benson.vm.bytemark.co.uk ([212.110.190.137]:54549) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VuXrN-0000IS-G7 for grub-devel@gnu.org; Sat, 21 Dec 2013 20:29:37 -0500 Received: from cpc22-cmbg14-2-0-cust482.5-4.cable.virginm.net ([86.6.25.227] helo=[192.168.1.7]) by benson.vm.bytemark.co.uk with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1VuXrM-0006fl-Au; Sun, 22 Dec 2013 01:29:36 +0000 Message-ID: <1387675775.17491.16.camel@dagon.hellion.org.uk> Subject: Re: [PATCH] * grub-core/kern/uboot/init.c (uboot_timer_ms) correct units From: Ian Campbell To: Vladimir =?UTF-8?Q?=27=CF=86-coder/phcoder=27?= Serbinenko Date: Sun, 22 Dec 2013 01:29:35 +0000 In-Reply-To: <1387675298.17491.14.camel@dagon.hellion.org.uk> References: <1387121014-19415-1-git-send-email-ijc@hellion.org.uk> <52B614E6.1090100@gmail.com> <1387675298.17491.14.camel@dagon.hellion.org.uk> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.4.4-4+b1 Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.110.190.137 Cc: grub-devel@gnu.org, Leif Lindholm X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Dec 2013 01:29:50 -0000 On Sun, 2013-12-22 at 01:21 +0000, Ian Campbell wrote: > On Sat, 2013-12-21 at 23:23 +0100, Vladimir '=CF=86-coder/phcoder' Serbin= enko > wrote: > > On 15.12.2013 16:23, Ian Campbell wrote: > > > From: Ian Campbell > > >=20 > > > u-boot's API_GET_TIMER returns the current time in ms by directly exp= osing the > > > internal get_timer which is in ms, which isn't all that clearly docum= ented but > > > is obvious from the use within u-boot and is mentioned in > > > http://www.denx.de/wiki/U-Boot/TaskTimerAPI. > > >=20 > > 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? >=20 > 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. >=20 > Sadly actual documentation of the u-boot API is a bit thin on the > ground, but get_timer=3D=3Dms is also corroborated by some ad-hoc googlin= g 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: commit 5eaa215607c8668bfa6a7183407eba8fec63d648 Author: Stephen Warren Date: Wed Mar 27 18:43:23 2013 +0000 ARM: bcm2835: fix get_timer() to return ms =20 Apparently, CONFIG_SYS_HZ must be 1000. Change this, and fix the timer driver to conform to this. =20 Have the timer implementation export a custom API get_timer_us() for us= e by the BCM2835 MMC API, which needs us resolution for a HW workaround. =20 Signed-off-by: Stephen Warren 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.