[U-Boot] [PATCH 7/9] arm: armv8: add support for boards with broken/unset counter frequency

Marek Szyprowski m.szyprowski at samsung.com
Wed Nov 7 15:04:41 UTC 2018


Some boards use legacy firmware which doesn't properly configure ARM
architected timer registers. This patch adds a workaround to use the
defined COUNTER_FREQUENCY instead of reading its value from the timer
registers.

Signed-off-by: Marek Szyprowski <m.szyprowski at samsung.com>
---
 arch/arm/cpu/armv8/generic_timer.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/cpu/armv8/generic_timer.c b/arch/arm/cpu/armv8/generic_timer.c
index c1706dcec1..5ac62a0a32 100644
--- a/arch/arm/cpu/armv8/generic_timer.c
+++ b/arch/arm/cpu/armv8/generic_timer.c
@@ -15,9 +15,13 @@ DECLARE_GLOBAL_DATA_PTR;
  */
 unsigned long get_tbclk(void)
 {
+#ifndef COUNTER_FREQUENCY
 	unsigned long cntfrq;
 	asm volatile("mrs %0, cntfrq_el0" : "=r" (cntfrq));
 	return cntfrq;
+#else
+	return COUNTER_FREQUENCY;
+#endif
 }
 
 #ifdef CONFIG_SYS_FSL_ERRATUM_A008585
-- 
2.17.1



More information about the U-Boot mailing list