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.szyprow...@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

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to