]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
imx: syscounter: support timer_get_boot_us
authorJun Nie <jun.nie@linaro.org>
Thu, 21 Jul 2022 10:30:05 +0000 (18:30 +0800)
committerStefano Babic <sbabic@denx.de>
Tue, 26 Jul 2022 09:28:43 +0000 (11:28 +0200)
With supporting timer_get_boot_us, we can profile boot up time with below
configs and function bootstage_mark_name().

CONFIG_BOOTSTAGE=y
CONFIG_BOOTSTAGE_REPORT=y
CONFIG_CMD_BOOTSTAGE=y

Signed-off-by: Jun Nie <jun.nie@linaro.org>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Reviewed-by: Fabio Estevam <festevam@denx.de>
arch/arm/mach-imx/syscounter.c

index 7c02e199a38c69c8009559c9beebaa8a1766904a..df478a23263703d31ab8a2b8f940f1d4cb3c698d 100644 (file)
@@ -79,6 +79,7 @@ int timer_init(void)
        gd->arch.tbl = 0;
        gd->arch.tbu = 0;
 
+       gd->arch.timer_rate_hz = freq;
        return 0;
 }
 #endif
@@ -100,6 +101,14 @@ ulong get_timer(ulong base)
        return tick_to_time(get_ticks()) - base;
 }
 
+ulong timer_get_boot_us(void)
+{
+       if (!gd->arch.timer_rate_hz)
+               timer_init();
+
+       return tick_to_time(get_ticks());
+}
+
 void __udelay(unsigned long usec)
 {
        unsigned long long tmp;