time: add weak annotation to timer_read_counter declaration
PATCH 1/2 time: add weak annotation to timer_read_counter declaration
From: Rob Herring <[email protected]>
A weak annotation is needed in order to prevent link errors when get_ticks is overridden. This fixes sandbox build.
--- lib/time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/time.c +1 -1
@@ -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 )
Signature · 1 line
1.8.1.2
PATCH 2/2 sandbox: convert to common time functions
From: Rob Herring <[email protected]>
Convert sandbox to use common time functions.
--- board/sandbox/sandbox/sandbox.c | 14 ++------------ include/configs/sandbox.h | 2 ++ 2 files changed, 4 insertions(+), 12 deletions(-)
board/sandbox/sandbox/sandbox.c +2 -12
@@ -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 )
include/configs/sandbox.h +2 -0
@@ -16,6 +16,8 @@#endif +#define CONFIG_SYS_TIMER_RATE 1000000 +#define CONFIG_BOOTSTAGE #define CONFIG_BOOTSTAGE_REPORT
Signature · 1 line
1.8.1.2
PATCH 2/2 sandbox: convert to common time functions
Hi Rob,
Quoted 23 lines · Rob Herring
From: Rob Herring <[email protected]>
Convert sandbox to use common time functions.
Signed-off-by Rob Herring <[email protected]>--- board/sandbox/sandbox/sandbox.c | 14 ++------------ include/configs/sandbox.h | 2 ++ 2 files changed, 4 insertions(+), 12 deletions(-)board/sandbox/sandbox/sandbox.c +1
-3@@ -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 ; -}
board/sandbox/sandbox/sandbox.c void flush_cache(unsigned long start, unsigned long size) · line 23
Quoted 10 lines
board/sandbox/sandbox/sandbox.c +1
-9- -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?
Quoted 17 lines
board/sandbox/sandbox/sandbox.c +0
-0}int timer_init (void )include/configs/sandbox.h +2
-1@@ -16,6 +16,8 @@#endif +#define CONFIG_SYS_TIMER_RATE 1000000 +#define CONFIG_BOOTSTAGE #define CONFIG_BOOTSTAGE_REPORT --
Quoted 2 lines
1.8.1.2
Regards,
Simon
PATCH 2/2 sandbox: convert to common time functions
Quoted 32 lines · Simon Glass
Hi Rob,
Quoted 29 lines · Rob Herring
From: Rob Herring <[email protected]>
Convert sandbox to use common time functions.
Signed-off-by Rob Herring <[email protected]>--- board/sandbox/sandbox/sandbox.c | 14 ++------------ include/configs/sandbox.h | 2 ++ 2 files changed, 4 insertions(+), 12 deletions(-)board/sandbox/sandbox/sandbox.c +1
-9@@ -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 ); -} -
Quoted 8 lines
board/sandbox/sandbox/sandbox.c void flush_cache(unsigned long start, unsigned long size) · line 23
Quoted 4 lines
board/sandbox/sandbox/sandbox.c +1
-3-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
PATCH 2/2 sandbox: convert to common time functions
Hi Rob,
Quoted 42 lines · Rob Herring
Quoted 32 lines · Simon Glass
Hi Rob,
Quoted 29 lines · Rob Herring
From: Rob Herring <[email protected]>
Convert sandbox to use common time functions.
Signed-off-by Rob Herring <[email protected]>--- board/sandbox/sandbox/sandbox.c | 14 ++------------ include/configs/sandbox.h | 2 ++ 2 files changed, 4 insertions(+), 12 deletions(-)board/sandbox/sandbox/sandbox.c +1
-9@@ -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 ); -} -Quoted 8 lines
board/sandbox/sandbox/sandbox.c void flush_cache(unsigned long start, unsigned long size) · line 23
Quoted 4 lines
board/sandbox/sandbox/sandbox.c +1
-3-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?
Quoted 5 lines
get_timeris still millisec.get_ticksis 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.
Regards,
Simon
PATCH 2/2 sandbox: convert to common time functions
In reply to Rob HerringQuoted 5 lines · Rob Herring
From: Rob Herring <[email protected]>
Convert sandbox to use common time functions.
Signed-off-by Rob Herring <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
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>
PATCH 1/2 time: add weak annotation to timer_read_counter declaration
In reply to Rob HerringQuoted 6 lines · Rob Herring
From: Rob Herring <[email protected]>
A weak annotation is needed in order to prevent link errors when
get_ticksis overridden. This fixes sandbox build.Signed-off-by Rob Herring <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
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>