<feed xmlns='http://www.w3.org/2005/Atom'>
<title>u-boot.git/lib/time.c, branch v2014.10</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/'/>
<entry>
<title>lib/time.c cleanups</title>
<updated>2014-07-22T11:44:26+00:00</updated>
<author>
<name>Pavel Machek</name>
<email>pavel@denx.de</email>
</author>
<published>2014-07-13T11:14:27+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=fccacd3b4cffb5b3d50fe5e68ceb3604138041df'/>
<id>fccacd3b4cffb5b3d50fe5e68ceb3604138041df</id>
<content type='text'>
As I initially suspected overflow in time handling, I took a detailed
look at lib/time.c. This adds comments about units being used, reduces
amount of type casting being done, and makes __udelay() always wait at
least one tick. (Current code could do no delaying at all for short
delays).

Signed-off-by: Pavel Machek &lt;pavel@denx.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As I initially suspected overflow in time handling, I took a detailed
look at lib/time.c. This adds comments about units being used, reduces
amount of type casting being done, and makes __udelay() always wait at
least one tick. (Current code could do no delaying at all for short
delays).

Signed-off-by: Pavel Machek &lt;pavel@denx.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>lib: time: add weak timer_init() function</title>
<updated>2014-01-24T21:59:06+00:00</updated>
<author>
<name>Darwin Rambo</name>
<email>drambo@broadcom.com</email>
</author>
<published>2013-12-19T23:06:12+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=de351d6be6868270db21ed8a0f89d3ef703bc18e'/>
<id>de351d6be6868270db21ed8a0f89d3ef703bc18e</id>
<content type='text'>
If timer_init() is made a weak stub function, then it allows us to
remove several empty timer_init functions for those boards that
already have a timer initialized when u-boot starts. Architectures
that use the timer framework may also remove the need for timer.c.

Signed-off-by: Darwin Rambo &lt;drambo@broadcom.com&gt;
Reviewed-by: Tim Kryger &lt;tim.kryger@linaro.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If timer_init() is made a weak stub function, then it allows us to
remove several empty timer_init functions for those boards that
already have a timer initialized when u-boot starts. Architectures
that use the timer framework may also remove the need for timer.c.

Signed-off-by: Darwin Rambo &lt;drambo@broadcom.com&gt;
Reviewed-by: Tim Kryger &lt;tim.kryger@linaro.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>time: fix usec_to_tick()</title>
<updated>2013-12-13T14:15:33+00:00</updated>
<author>
<name>Stephen Warren</name>
<email>swarren@nvidia.com</email>
</author>
<published>2013-12-05T19:08:09+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=2cd1b57220697ac47e4a63fb6a0a79eda2217f9d'/>
<id>2cd1b57220697ac47e4a63fb6a0a79eda2217f9d</id>
<content type='text'>
Commit 8dfafdde88eb ("Introduce common timer functions") created a
common definition of usec_to_tick() which had a couple problems:

static unsigned long long usec_to_tick(unsigned long usec)
{
       uint64_t tick = usec * get_tbclk();

That likely overflows.

       usec *= get_tbclk();

That was an attempt to fix it by performing the multiply after the
promotion of usec to 64-bit, but was applied to the wrong variable,
which was never used.

This patch fixes these issues. A user-visible symptom of the problem was
the e.g. "dhcp zImage" using an ASIX USB Ethernet dongle would print:

Waiting for Ethernet connection... unable to connect.

... with no delay before "unable to connect". There are likely other
symptoms.

Signed-off-by: Stephen Warren &lt;swarren@nvidia.com&gt;
Acked-by: Rob Herring &lt;rob.herring@calxeda.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Commit 8dfafdde88eb ("Introduce common timer functions") created a
common definition of usec_to_tick() which had a couple problems:

static unsigned long long usec_to_tick(unsigned long usec)
{
       uint64_t tick = usec * get_tbclk();

That likely overflows.

       usec *= get_tbclk();

That was an attempt to fix it by performing the multiply after the
promotion of usec to 64-bit, but was applied to the wrong variable,
which was never used.

This patch fixes these issues. A user-visible symptom of the problem was
the e.g. "dhcp zImage" using an ASIX USB Ethernet dongle would print:

Waiting for Ethernet connection... unable to connect.

... with no delay before "unable to connect". There are likely other
symptoms.

Signed-off-by: Stephen Warren &lt;swarren@nvidia.com&gt;
Acked-by: Rob Herring &lt;rob.herring@calxeda.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>time: fix gcc warnings on MIPS64</title>
<updated>2013-11-11T14:46:41+00:00</updated>
<author>
<name>Daniel Schwierzeck</name>
<email>daniel.schwierzeck@gmail.com</email>
</author>
<published>2013-11-08T23:30:14+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=d770f3961f44295509ad23b7f056d9a37b947601'/>
<id>d770f3961f44295509ad23b7f056d9a37b947601</id>
<content type='text'>
Commit 8dfafdde88eb3e71d5569846396ae67a91017232 introduced
new gcc warnings on MIPS64:

time.c: In function 'tick_to_time':
time.c:59:2: warning: comparison of distinct pointer types lacks a cast [enabled by default]
time.c:59:2: warning: passing argument 1 of '__div64_32' from incompatible pointer type [enabled by default]
In file included from time.c:10:0:
./u-boot-mips/include/div64.h:22:17: note: expected 'uint64_t *' but argument is of type 'long long unsigned int *'
time.c: In function 'usec_to_tick':
time.c:76:2: warning: comparison of distinct pointer types lacks a cast [enabled by default]
time.c:76:2: warning: passing argument 1 of '__div64_32' from incompatible pointer type [enabled by default]
In file included from time.c:10:0:
./u-boot-mips/include/div64.h:22:17: note: expected 'uint64_t *' but argument is of type 'long long unsigned int *'

Signed-off-by: Daniel Schwierzeck &lt;daniel.schwierzeck@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Commit 8dfafdde88eb3e71d5569846396ae67a91017232 introduced
new gcc warnings on MIPS64:

time.c: In function 'tick_to_time':
time.c:59:2: warning: comparison of distinct pointer types lacks a cast [enabled by default]
time.c:59:2: warning: passing argument 1 of '__div64_32' from incompatible pointer type [enabled by default]
In file included from time.c:10:0:
./u-boot-mips/include/div64.h:22:17: note: expected 'uint64_t *' but argument is of type 'long long unsigned int *'
time.c: In function 'usec_to_tick':
time.c:76:2: warning: comparison of distinct pointer types lacks a cast [enabled by default]
time.c:76:2: warning: passing argument 1 of '__div64_32' from incompatible pointer type [enabled by default]
In file included from time.c:10:0:
./u-boot-mips/include/div64.h:22:17: note: expected 'uint64_t *' but argument is of type 'long long unsigned int *'

Signed-off-by: Daniel Schwierzeck &lt;daniel.schwierzeck@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>time: add weak annotation to timer_read_counter declaration</title>
<updated>2013-11-08T20:25:14+00:00</updated>
<author>
<name>Rob Herring</name>
<email>rob.herring@calxeda.com</email>
</author>
<published>2013-11-08T14:40:43+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=65ba7add0d609bbd035b8d42fafdaf428ac24751'/>
<id>65ba7add0d609bbd035b8d42fafdaf428ac24751</id>
<content type='text'>
A weak annotation is needed in order to prevent link errors when
get_ticks is overridden. This fixes sandbox build.

Signed-off-by: Rob Herring &lt;rob.herring@calxeda.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A weak annotation is needed in order to prevent link errors when
get_ticks is overridden. This fixes sandbox build.

Signed-off-by: Rob Herring &lt;rob.herring@calxeda.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Introduce common timer functions</title>
<updated>2013-11-04T16:06:16+00:00</updated>
<author>
<name>Rob Herring</name>
<email>rob.herring@calxeda.com</email>
</author>
<published>2013-10-04T15:22:41+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=8dfafdde88eb3e71d5569846396ae67a91017232'/>
<id>8dfafdde88eb3e71d5569846396ae67a91017232</id>
<content type='text'>
Many platforms duplicate pretty much the same timer code yet they all have
a 32-bit freerunning counter register. Create a common implementation that
minimally requires 2 or 3 defines to add timer support:

CONFIG_SYS_TIMER_RATE - Clock rate of the timer counter
CONFIG_SYS_TIMER_COUNTER - Address of 32-bit counter
CONFIG_SYS_TIMER_COUNTS_DOWN - Define if counter counts down

All functions are weak or ifdef'ed so they can still be overriden by any
platform.

Signed-off-by: Rob Herring &lt;rob.herring@calxeda.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Many platforms duplicate pretty much the same timer code yet they all have
a 32-bit freerunning counter register. Create a common implementation that
minimally requires 2 or 3 defines to add timer support:

CONFIG_SYS_TIMER_RATE - Clock rate of the timer counter
CONFIG_SYS_TIMER_COUNTER - Address of 32-bit counter
CONFIG_SYS_TIMER_COUNTS_DOWN - Define if counter counts down

All functions are weak or ifdef'ed so they can still be overriden by any
platform.

Signed-off-by: Rob Herring &lt;rob.herring@calxeda.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>config: consolidate CONFIG_SYS_HZ definition</title>
<updated>2013-11-04T16:05:58+00:00</updated>
<author>
<name>Rob Herring</name>
<email>rob.herring@calxeda.com</email>
</author>
<published>2013-10-04T13:40:03+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=2108f4c4a302a021a8807a7baac16dd680a8f3d0'/>
<id>2108f4c4a302a021a8807a7baac16dd680a8f3d0</id>
<content type='text'>
According to the README, CONFIG_SYS_HZ must be 1000 and most platforms
follow that. In preparation to remove CONFIG_SYS_HZ from all these
platforms, provide a common definition. The platforms which use a value
other than 1000 will get build warning now. These configs are:

include/configs/M5271EVB.h:#define CONFIG_SYS_HZ                        1000000
include/configs/balloon3.h:#define      CONFIG_SYS_HZ                   3250000         /* Timer @ 3250000 Hz */
include/configs/idmr.h:#define CONFIG_SYS_HZ                    (50000000 / 64)
include/configs/mini2440.h:#define CONFIG_SYS_HZ                        1562500
include/configs/mx1ads.h:#define CONFIG_SYS_HZ                  3686400
include/configs/omap3_zoom2.h:#define CONFIG_SYS_HZ                     ((V_SCLK) / (2 &lt;&lt; CONFIG_SYS_PTV))
include/configs/omap730p2.h:#define CONFIG_SYS_HZ                       ((CONFIG_SYS_CLK_FREQ)/(2 &lt;&lt; CONFIG_SYS_PTV))
include/configs/palmld.h:#define        CONFIG_SYS_HZ                   3250000         /* Timer @ 3250000 Hz */
include/configs/palmtc.h:#define        CONFIG_SYS_HZ                   3686400         /* Timer @ 3686400 Hz */
include/configs/rsk7203.h:#define CONFIG_SYS_HZ                 (CONFIG_SYS_CLK_FREQ / CMT_CLK_DIVIDER)
include/configs/rsk7264.h:#define CONFIG_SYS_HZ         (CONFIG_SYS_CLK_FREQ / CMT_CLK_DIVIDER)
include/configs/rsk7269.h:#define CONFIG_SYS_HZ         (CONFIG_SYS_CLK_FREQ / CMT_CLK_DIVIDER)
include/configs/scb9328.h:#define CONFIG_SYS_HZ                 3686400      /* incrementer freq: 3.6864 MHz */
include/configs/versatile.h:#define CONFIG_SYS_HZ                       (1000000 / 256)
include/configs/zipitz2.h:#define       CONFIG_SYS_HZ                   3250000         /* Timer @ 3250000 Hz */

Signed-off-by: Rob Herring &lt;rob.herring@calxeda.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
According to the README, CONFIG_SYS_HZ must be 1000 and most platforms
follow that. In preparation to remove CONFIG_SYS_HZ from all these
platforms, provide a common definition. The platforms which use a value
other than 1000 will get build warning now. These configs are:

include/configs/M5271EVB.h:#define CONFIG_SYS_HZ                        1000000
include/configs/balloon3.h:#define      CONFIG_SYS_HZ                   3250000         /* Timer @ 3250000 Hz */
include/configs/idmr.h:#define CONFIG_SYS_HZ                    (50000000 / 64)
include/configs/mini2440.h:#define CONFIG_SYS_HZ                        1562500
include/configs/mx1ads.h:#define CONFIG_SYS_HZ                  3686400
include/configs/omap3_zoom2.h:#define CONFIG_SYS_HZ                     ((V_SCLK) / (2 &lt;&lt; CONFIG_SYS_PTV))
include/configs/omap730p2.h:#define CONFIG_SYS_HZ                       ((CONFIG_SYS_CLK_FREQ)/(2 &lt;&lt; CONFIG_SYS_PTV))
include/configs/palmld.h:#define        CONFIG_SYS_HZ                   3250000         /* Timer @ 3250000 Hz */
include/configs/palmtc.h:#define        CONFIG_SYS_HZ                   3686400         /* Timer @ 3686400 Hz */
include/configs/rsk7203.h:#define CONFIG_SYS_HZ                 (CONFIG_SYS_CLK_FREQ / CMT_CLK_DIVIDER)
include/configs/rsk7264.h:#define CONFIG_SYS_HZ         (CONFIG_SYS_CLK_FREQ / CMT_CLK_DIVIDER)
include/configs/rsk7269.h:#define CONFIG_SYS_HZ         (CONFIG_SYS_CLK_FREQ / CMT_CLK_DIVIDER)
include/configs/scb9328.h:#define CONFIG_SYS_HZ                 3686400      /* incrementer freq: 3.6864 MHz */
include/configs/versatile.h:#define CONFIG_SYS_HZ                       (1000000 / 256)
include/configs/zipitz2.h:#define       CONFIG_SYS_HZ                   3250000         /* Timer @ 3250000 Hz */

Signed-off-by: Rob Herring &lt;rob.herring@calxeda.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Add GPL-2.0+ SPDX-License-Identifier to source files</title>
<updated>2013-07-24T13:44:38+00:00</updated>
<author>
<name>Wolfgang Denk</name>
<email>wd@denx.de</email>
</author>
<published>2013-07-08T07:37:19+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=1a4596601fd395f3afb8f82f3f840c5e00bdd57a'/>
<id>1a4596601fd395f3afb8f82f3f840c5e00bdd57a</id>
<content type='text'>
Signed-off-by: Wolfgang Denk &lt;wd@denx.de&gt;
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini &lt;trini@ti.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Wolfgang Denk &lt;wd@denx.de&gt;
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini &lt;trini@ti.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Move bootstage timer out of lib/time.c</title>
<updated>2012-04-10T21:35:32+00:00</updated>
<author>
<name>Simon Glass</name>
<email>sjg@chromium.org</email>
</author>
<published>2012-04-05T12:05:17+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=3786980dd3f28960947084c53878fd849ece897c'/>
<id>3786980dd3f28960947084c53878fd849ece897c</id>
<content type='text'>
The standalone example does not have get_timer() defined, so we cannot
rely on it being available.

Move the timer function into boootstage.c to avoid this problem.

This corrects a build breakage for the standalone example on some boards.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
Acked-by: Matthias Fuchs &lt;matthias.fuchs@esd.eu&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The standalone example does not have get_timer() defined, so we cannot
rely on it being available.

Move the timer function into boootstage.c to avoid this problem.

This corrects a build breakage for the standalone example on some boards.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
Acked-by: Matthias Fuchs &lt;matthias.fuchs@esd.eu&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>bootstage: Define an optional microsecond timer</title>
<updated>2012-03-18T20:33:53+00:00</updated>
<author>
<name>Simon Glass</name>
<email>sjg@chromium.org</email>
</author>
<published>2011-12-10T11:08:03+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=5ff55390ed80da2570fbeab51bdd2d2a43d4901a'/>
<id>5ff55390ed80da2570fbeab51bdd2d2a43d4901a</id>
<content type='text'>
Define timer_get_boot_us() which returns the number of microseconds
since boot. If undefined then we use get_timer() * 1000.

We can fit this in a 32-bit register which keeps everyone happy on
the efficiency side. It will wrap around after about an hour. If we
are still looking at it after an hour then we had better not be
timing the boot.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Define timer_get_boot_us() which returns the number of microseconds
since boot. If undefined then we use get_timer() * 1000.

We can fit this in a 32-bit register which keeps everyone happy on
the efficiency side. It will wrap around after about an hour. If we
are still looking at it after an hour then we had better not be
timing the boot.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
