[U-Boot] [PATCH 24/36] armv8: add timer_get_boot_us() for generic timer

Kever Yang kever.yang at rock-chips.com
Tue Mar 27 09:29:18 UTC 2018


We need timer_get_boot_us() for boot stage if we use generic timer only.

Signed-off-by: Kever Yang <kever.yang at rock-chips.com>
---

 arch/arm/cpu/armv8/generic_timer.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/cpu/armv8/generic_timer.c b/arch/arm/cpu/armv8/generic_timer.c
index a2dda33..d96217e 100644
--- a/arch/arm/cpu/armv8/generic_timer.c
+++ b/arch/arm/cpu/armv8/generic_timer.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <div64.h>
 #include <asm/system.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -52,6 +53,11 @@ uint64_t get_ticks(void)
 	return ticks;
 }
 
+ulong timer_get_boot_us(void)
+{
+	return lldiv(get_ticks(), CONFIG_SYS_HZ_CLOCK / (CONFIG_SYS_HZ * 1000));
+}
+
 unsigned long usec2ticks(unsigned long usec)
 {
 	ulong ticks;
-- 
1.9.1



More information about the U-Boot mailing list