* [PATCH] imx: syscounter: support timer_get_boot_us
@ 2022-07-21 10:30 Jun Nie
2022-07-25 3:39 ` Shawn Guo
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jun Nie @ 2022-07-21 10:30 UTC (permalink / raw)
To: adrian.alonso, sbabic, festevam, u-boot; +Cc: peng.fan, shawn.guo, Jun Nie
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>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] imx: syscounter: support timer_get_boot_us
2022-07-21 10:30 [PATCH] imx: syscounter: support timer_get_boot_us Jun Nie
@ 2022-07-25 3:39 ` Shawn Guo
2022-07-25 10:27 ` Fabio Estevam
2022-07-26 13:51 ` sbabic
2 siblings, 0 replies; 4+ messages in thread
From: Shawn Guo @ 2022-07-25 3:39 UTC (permalink / raw)
To: Jun Nie; +Cc: adrian.alonso, sbabic, festevam, u-boot, peng.fan
On Thu, Jul 21, 2022 at 6:30 PM Jun Nie <jun.nie@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@linaro.org>
FWIW, it also fixes boot failure when bootstage is enabled.
Acked-by: Shawn Guo <shawn.guo@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
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] imx: syscounter: support timer_get_boot_us
2022-07-21 10:30 [PATCH] imx: syscounter: support timer_get_boot_us Jun Nie
2022-07-25 3:39 ` Shawn Guo
@ 2022-07-25 10:27 ` Fabio Estevam
2022-07-26 13:51 ` sbabic
2 siblings, 0 replies; 4+ messages in thread
From: Fabio Estevam @ 2022-07-25 10:27 UTC (permalink / raw)
To: Jun Nie; +Cc: Adrian Alonso, Stefano Babic, U-Boot-Denx, Peng Fan, Shawn Guo
Hi Jun,
On Thu, Jul 21, 2022 at 7:30 AM Jun Nie <jun.nie@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@linaro.org>
Reviewed-by: Fabio Estevam <festevam@denx.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] imx: syscounter: support timer_get_boot_us
2022-07-21 10:30 [PATCH] imx: syscounter: support timer_get_boot_us Jun Nie
2022-07-25 3:39 ` Shawn Guo
2022-07-25 10:27 ` Fabio Estevam
@ 2022-07-26 13:51 ` sbabic
2 siblings, 0 replies; 4+ messages in thread
From: sbabic @ 2022-07-26 13:51 UTC (permalink / raw)
To: Jun Nie, u-boot
> 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>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-07-26 13:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-21 10:30 [PATCH] imx: syscounter: support timer_get_boot_us Jun Nie
2022-07-25 3:39 ` Shawn Guo
2022-07-25 10:27 ` Fabio Estevam
2022-07-26 13:51 ` sbabic
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.