
Add timer_get_boot_us() to support boards, that have CONFIG_BOOTSTAGE enabled, like pogo_v4.
Signed-off-by: Stefan Roese sr@denx.de --- v2: - Change timer_get_boot_us() to use the timer_early functions - Remove #if CONFIG_IS_ENABLED(BOOTSTAGE)
Simon, I'm currently looking into this timer_get_boot_us() to using timer_early_get_count() etc consolidation.
drivers/timer/orion-timer.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/drivers/timer/orion-timer.c b/drivers/timer/orion-timer.c index 14f318e57d4d..6c0b8550412d 100644 --- a/drivers/timer/orion-timer.c +++ b/drivers/timer/orion-timer.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ #include <asm/io.h> #include <common.h> +#include <div64.h> #include <dm/device.h> #include <dm/fdtaddr.h> #include <timer.h> @@ -39,6 +40,14 @@ u64 notrace timer_early_get_count(void) return timer_conv_64(~readl(MVEBU_TIMER_BASE + TIMER0_VAL)); }
+ulong timer_get_boot_us(void) +{ + u64 ticks; + + ticks = timer_early_get_count(); + return lldiv(ticks * 1000, timer_early_get_rate()); +} + static uint64_t orion_timer_get_count(struct udevice *dev) { struct orion_timer_priv *priv = dev_get_priv(dev);