[PATCH] imx: syscounter: support timer_get_boot_us

Shawn Guo shawn.guo at linaro.org
Mon Jul 25 05:39:32 CEST 2022


On Thu, Jul 21, 2022 at 6:30 PM Jun Nie <jun.nie at linaro.org> wrote:
>
> 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 at linaro.org>

FWIW, it also fixes boot failure when bootstage is enabled.

Acked-by: Shawn Guo <shawn.guo at linaro.org>

Shawn

> ---
>  arch/arm/mach-imx/syscounter.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/arch/arm/mach-imx/syscounter.c b/arch/arm/mach-imx/syscounter.c
> index 7c02e199a3..df478a2326 100644
> --- a/arch/arm/mach-imx/syscounter.c
> +++ b/arch/arm/mach-imx/syscounter.c
> @@ -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;
> --
> 2.25.1
>


More information about the U-Boot mailing list