[U-Boot] [U-Boot, 24/36] armv8: add timer_get_boot_us() for generic timer

Philipp Tomsich philipp.tomsich at theobroma-systems.com
Sun Apr 1 21:53:35 UTC 2018



On Tue, 27 Mar 2018, Kever Yang wrote:

> We need timer_get_boot_us() for boot stage if we use generic timer only.
>
> Signed-off-by: Kever Yang <kever.yang at rock-chips.com>

See below for requested changes/questions.

> ---
>
> arch/arm/cpu/armv8/generic_timer.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/arch/arm/cpu/armv8/generic_timer.c b/arch/arm/cpu/armv8/generic_timer.c
> index a2dda33..d96217e 100644
> --- a/arch/arm/cpu/armv8/generic_timer.c
> +++ b/arch/arm/cpu/armv8/generic_timer.c
> @@ -7,6 +7,7 @@
>
> #include <common.h>
> #include <command.h>
> +#include <div64.h>
> #include <asm/system.h>
>
> DECLARE_GLOBAL_DATA_PTR;
> @@ -52,6 +53,11 @@ uint64_t get_ticks(void)
> 	return ticks;
> }
>
> +ulong timer_get_boot_us(void)
> +{
> +	return lldiv(get_ticks(), CONFIG_SYS_HZ_CLOCK / (CONFIG_SYS_HZ * 1000));
> +}
> +

Can we be sure that this does never conflict with what is added by another 
timer implementation (e.g. DM_TIMER)?  If not, you may have to add some 
additional infrastructure to allow selection of what timer is the 
boot-timer.

> unsigned long usec2ticks(unsigned long usec)
> {
> 	ulong ticks;
>


More information about the U-Boot mailing list