[PATCH 01/10] arm: arch_timer: Add timer_early functions

Stefan Roese sr at denx.de
Wed Sep 21 16:06:16 CEST 2022


Currently this timer driver provides timer_get_boot_us() to support the
BOOTSTAGE functionality. This patch adds the timer_early functions so
that the "normal" timer functions can be used, when CONFIG_TIMER_EARLY
is enabled.

timer_get_boot_us() will get removed in a follow-up patch, once the
BOOTSTAGE interface is migrated to timer_get_us().

Signed-off-by: Stefan Roese <sr at denx.de>
Cc: Patrick Delaunay <patrick.delaunay at st.com>
---
 arch/arm/cpu/armv7/arch_timer.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/arm/cpu/armv7/arch_timer.c b/arch/arm/cpu/armv7/arch_timer.c
index d96406f7626f..80cfaf2d09a4 100644
--- a/arch/arm/cpu/armv7/arch_timer.c
+++ b/arch/arm/cpu/armv7/arch_timer.c
@@ -62,3 +62,19 @@ ulong get_tbclk(void)
 {
 	return gd->arch.timer_rate_hz;
 }
+
+unsigned long notrace timer_early_get_rate(void)
+{
+	if (!gd->arch.timer_rate_hz)
+		timer_init();
+
+	return gd->arch.timer_rate_hz;
+}
+
+u64 notrace timer_early_get_count(void)
+{
+	if (!gd->arch.timer_rate_hz)
+		timer_init();
+
+	return get_ticks();
+}
-- 
2.37.3



More information about the U-Boot mailing list