* [U-Boot] [PATCH 1/2] time: add weak annotation to timer_read_counter declaration
@ 2013-11-08 14:40 Rob Herring
2013-11-08 14:40 ` [U-Boot] [PATCH 2/2] sandbox: convert to common time functions Rob Herring
2013-11-08 22:25 ` [U-Boot] [PATCH 1/2] time: add weak annotation to timer_read_counter declaration Tom Rini
0 siblings, 2 replies; 7+ messages in thread
From: Rob Herring @ 2013-11-08 14:40 UTC (permalink / raw)
To: u-boot
From: Rob Herring <rob.herring@calxeda.com>
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 <rob.herring@calxeda.com>
---
lib/time.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/time.c b/lib/time.c
index 8361ddd..111b493 100644
--- a/lib/time.c
+++ b/lib/time.c
@@ -37,7 +37,7 @@ unsigned long notrace timer_read_counter(void)
#endif
}
#else
-extern unsigned long timer_read_counter(void);
+extern unsigned long __weak timer_read_counter(void);
#endif
unsigned long long __weak notrace get_ticks(void)
--
1.8.1.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 2/2] sandbox: convert to common time functions
2013-11-08 14:40 [U-Boot] [PATCH 1/2] time: add weak annotation to timer_read_counter declaration Rob Herring
@ 2013-11-08 14:40 ` Rob Herring
2013-11-08 16:32 ` Simon Glass
2013-11-08 22:25 ` Tom Rini
2013-11-08 22:25 ` [U-Boot] [PATCH 1/2] time: add weak annotation to timer_read_counter declaration Tom Rini
1 sibling, 2 replies; 7+ messages in thread
From: Rob Herring @ 2013-11-08 14:40 UTC (permalink / raw)
To: u-boot
From: Rob Herring <rob.herring@calxeda.com>
Convert sandbox to use common time functions.
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
board/sandbox/sandbox/sandbox.c | 14 ++------------
include/configs/sandbox.h | 2 ++
2 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/board/sandbox/sandbox/sandbox.c b/board/sandbox/sandbox/sandbox.c
index f471cb7..65dcce8 100644
--- a/board/sandbox/sandbox/sandbox.c
+++ b/board/sandbox/sandbox/sandbox.c
@@ -18,19 +18,9 @@ void flush_cache(unsigned long start, unsigned long size)
{
}
-ulong get_tbclk(void)
+unsigned long timer_read_counter(void)
{
- return CONFIG_SYS_HZ;
-}
-
-unsigned long long get_ticks(void)
-{
- return get_timer(0);
-}
-
-ulong get_timer(ulong base)
-{
- return (os_get_nsec() / 1000000) - base;
+ return os_get_nsec() / 1000;
}
int timer_init(void)
diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index 279abbc..01628e1 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -16,6 +16,8 @@
#endif
+#define CONFIG_SYS_TIMER_RATE 1000000
+
#define CONFIG_BOOTSTAGE
#define CONFIG_BOOTSTAGE_REPORT
--
1.8.1.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 2/2] sandbox: convert to common time functions
2013-11-08 14:40 ` [U-Boot] [PATCH 2/2] sandbox: convert to common time functions Rob Herring
@ 2013-11-08 16:32 ` Simon Glass
2013-11-08 17:18 ` Rob Herring
2013-11-08 22:25 ` Tom Rini
1 sibling, 1 reply; 7+ messages in thread
From: Simon Glass @ 2013-11-08 16:32 UTC (permalink / raw)
To: u-boot
Hi Rob,
On Fri, Nov 8, 2013 at 7:40 AM, Rob Herring <robherring2@gmail.com> wrote:
> From: Rob Herring <rob.herring@calxeda.com>
>
> Convert sandbox to use common time functions.
>
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
> ---
> board/sandbox/sandbox/sandbox.c | 14 ++------------
> include/configs/sandbox.h | 2 ++
> 2 files changed, 4 insertions(+), 12 deletions(-)
>
> diff --git a/board/sandbox/sandbox/sandbox.c b/board/sandbox/sandbox/sandbox.c
> index f471cb7..65dcce8 100644
> --- a/board/sandbox/sandbox/sandbox.c
> +++ b/board/sandbox/sandbox/sandbox.c
> @@ -18,19 +18,9 @@ void flush_cache(unsigned long start, unsigned long size)
> {
> }
>
> -ulong get_tbclk(void)
> +unsigned long timer_read_counter(void)
> {
> - return CONFIG_SYS_HZ;
> -}
> -
> -unsigned long long get_ticks(void)
> -{
> - return get_timer(0);
> -}
> -
> -ulong get_timer(ulong base)
> -{
> - return (os_get_nsec() / 1000000) - base;
> + return os_get_nsec() / 1000;
Doesn't this change the time base to microseconds? It would be good to
keep sandbox at milliseconds like other boards. Or did I miss the
reason for this change?
> }
>
> int timer_init(void)
> diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
> index 279abbc..01628e1 100644
> --- a/include/configs/sandbox.h
> +++ b/include/configs/sandbox.h
> @@ -16,6 +16,8 @@
>
> #endif
>
> +#define CONFIG_SYS_TIMER_RATE 1000000
> +
> #define CONFIG_BOOTSTAGE
> #define CONFIG_BOOTSTAGE_REPORT
>
> --
> 1.8.1.2
>
Regards,
Simon
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 2/2] sandbox: convert to common time functions
2013-11-08 16:32 ` Simon Glass
@ 2013-11-08 17:18 ` Rob Herring
2013-11-08 18:36 ` Simon Glass
0 siblings, 1 reply; 7+ messages in thread
From: Rob Herring @ 2013-11-08 17:18 UTC (permalink / raw)
To: u-boot
On Fri, Nov 8, 2013 at 10:32 AM, Simon Glass <sjg@chromium.org> wrote:
> Hi Rob,
>
> On Fri, Nov 8, 2013 at 7:40 AM, Rob Herring <robherring2@gmail.com> wrote:
>> From: Rob Herring <rob.herring@calxeda.com>
>>
>> Convert sandbox to use common time functions.
>>
>> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
>> ---
>> board/sandbox/sandbox/sandbox.c | 14 ++------------
>> include/configs/sandbox.h | 2 ++
>> 2 files changed, 4 insertions(+), 12 deletions(-)
>>
>> diff --git a/board/sandbox/sandbox/sandbox.c b/board/sandbox/sandbox/sandbox.c
>> index f471cb7..65dcce8 100644
>> --- a/board/sandbox/sandbox/sandbox.c
>> +++ b/board/sandbox/sandbox/sandbox.c
>> @@ -18,19 +18,9 @@ void flush_cache(unsigned long start, unsigned long size)
>> {
>> }
>>
>> -ulong get_tbclk(void)
>> +unsigned long timer_read_counter(void)
>> {
>> - return CONFIG_SYS_HZ;
>> -}
>> -
>> -unsigned long long get_ticks(void)
>> -{
>> - return get_timer(0);
>> -}
>> -
>> -ulong get_timer(ulong base)
>> -{
>> - return (os_get_nsec() / 1000000) - base;
>> + return os_get_nsec() / 1000;
>
> Doesn't this change the time base to microseconds? It would be good to
> keep sandbox at milliseconds like other boards. Or did I miss the
> reason for this change?
get_timer is still millisec. get_ticks is the "raw" counter ticks
which is in microsec for sandbox. Some boards are equal here and some
are not. The advantage of the latter is udelay has better resolution.
However, in the case of sandbox, it uses the OS usleep so this doesn't
matter.
Rob
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 2/2] sandbox: convert to common time functions
2013-11-08 17:18 ` Rob Herring
@ 2013-11-08 18:36 ` Simon Glass
0 siblings, 0 replies; 7+ messages in thread
From: Simon Glass @ 2013-11-08 18:36 UTC (permalink / raw)
To: u-boot
Hi Rob,
On Fri, Nov 8, 2013 at 10:18 AM, Rob Herring <robherring2@gmail.com> wrote:
> On Fri, Nov 8, 2013 at 10:32 AM, Simon Glass <sjg@chromium.org> wrote:
>> Hi Rob,
>>
>> On Fri, Nov 8, 2013 at 7:40 AM, Rob Herring <robherring2@gmail.com> wrote:
>>> From: Rob Herring <rob.herring@calxeda.com>
>>>
>>> Convert sandbox to use common time functions.
>>>
>>> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
>>> ---
>>> board/sandbox/sandbox/sandbox.c | 14 ++------------
>>> include/configs/sandbox.h | 2 ++
>>> 2 files changed, 4 insertions(+), 12 deletions(-)
>>>
>>> diff --git a/board/sandbox/sandbox/sandbox.c b/board/sandbox/sandbox/sandbox.c
>>> index f471cb7..65dcce8 100644
>>> --- a/board/sandbox/sandbox/sandbox.c
>>> +++ b/board/sandbox/sandbox/sandbox.c
>>> @@ -18,19 +18,9 @@ void flush_cache(unsigned long start, unsigned long size)
>>> {
>>> }
>>>
>>> -ulong get_tbclk(void)
>>> +unsigned long timer_read_counter(void)
>>> {
>>> - return CONFIG_SYS_HZ;
>>> -}
>>> -
>>> -unsigned long long get_ticks(void)
>>> -{
>>> - return get_timer(0);
>>> -}
>>> -
>>> -ulong get_timer(ulong base)
>>> -{
>>> - return (os_get_nsec() / 1000000) - base;
>>> + return os_get_nsec() / 1000;
>>
>> Doesn't this change the time base to microseconds? It would be good to
>> keep sandbox at milliseconds like other boards. Or did I miss the
>> reason for this change?
>
> get_timer is still millisec. get_ticks is the "raw" counter ticks
> which is in microsec for sandbox. Some boards are equal here and some
> are not. The advantage of the latter is udelay has better resolution.
> However, in the case of sandbox, it uses the OS usleep so this doesn't
> matter.
OK that sounds good. I missed your timer patches at the time.
Acked-by: Simon Glass <sjg@chromium.org>
Regards,
Simon
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 1/2] time: add weak annotation to timer_read_counter declaration
2013-11-08 14:40 [U-Boot] [PATCH 1/2] time: add weak annotation to timer_read_counter declaration Rob Herring
2013-11-08 14:40 ` [U-Boot] [PATCH 2/2] sandbox: convert to common time functions Rob Herring
@ 2013-11-08 22:25 ` Tom Rini
1 sibling, 0 replies; 7+ messages in thread
From: Tom Rini @ 2013-11-08 22:25 UTC (permalink / raw)
To: u-boot
On Fri, Nov 08, 2013 at 08:40:43AM -0600, Rob Herring wrote:
> From: Rob Herring <rob.herring@calxeda.com>
>
> 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 <rob.herring@calxeda.com>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131108/58d446d4/attachment.pgp>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 2/2] sandbox: convert to common time functions
2013-11-08 14:40 ` [U-Boot] [PATCH 2/2] sandbox: convert to common time functions Rob Herring
2013-11-08 16:32 ` Simon Glass
@ 2013-11-08 22:25 ` Tom Rini
1 sibling, 0 replies; 7+ messages in thread
From: Tom Rini @ 2013-11-08 22:25 UTC (permalink / raw)
To: u-boot
On Fri, Nov 08, 2013 at 08:40:44AM -0600, Rob Herring wrote:
> From: Rob Herring <rob.herring@calxeda.com>
>
> Convert sandbox to use common time functions.
>
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131108/008c203c/attachment.pgp>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-11-08 22:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-08 14:40 [U-Boot] [PATCH 1/2] time: add weak annotation to timer_read_counter declaration Rob Herring
2013-11-08 14:40 ` [U-Boot] [PATCH 2/2] sandbox: convert to common time functions Rob Herring
2013-11-08 16:32 ` Simon Glass
2013-11-08 17:18 ` Rob Herring
2013-11-08 18:36 ` Simon Glass
2013-11-08 22:25 ` Tom Rini
2013-11-08 22:25 ` [U-Boot] [PATCH 1/2] time: add weak annotation to timer_read_counter declaration Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox