]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
armv8/fsl-lsch3: Implement workaround for erratum A008585
authorYork Sun <yorksun@freescale.com>
Sat, 21 Mar 2015 02:28:05 +0000 (19:28 -0700)
committerYork Sun <yorksun@freescale.com>
Thu, 23 Apr 2015 15:55:54 +0000 (08:55 -0700)
Generic Timer may contain an erroneous value. The workaround is to
read it twice until getting the same value.

Signed-off-by: York Sun <yorksun@freescale.com>
arch/arm/cpu/armv8/generic_timer.c
arch/arm/include/asm/arch-fsl-lsch3/config.h

index 223b95e210edd7146c6a8549bbf7f43b362d105b..8e60baebc53487d17556facc322003e23dfbd15f 100644 (file)
@@ -25,7 +25,18 @@ unsigned long get_tbclk(void)
 unsigned long timer_read_counter(void)
 {
        unsigned long cntpct;
+#ifdef CONFIG_SYS_FSL_ERRATUM_A008585
+       /* This erratum number needs to be confirmed to match ARM document */
+       unsigned long temp;
+#endif
        isb();
        asm volatile("mrs %0, cntpct_el0" : "=r" (cntpct));
+#ifdef CONFIG_SYS_FSL_ERRATUM_A008585
+       asm volatile("mrs %0, cntpct_el0" : "=r" (temp));
+       while (temp != cntpct) {
+               asm volatile("mrs %0, cntpct_el0" : "=r" (cntpct));
+               asm volatile("mrs %0, cntpct_el0" : "=r" (temp));
+       }
+#endif
        return cntpct;
 }
index 1d2a7fa913be21abafe8c8c3bf6bd3e02b0fdd4a..2d461d93293cbc825cabdcb79ebe315b41da04d8 100644 (file)
 #ifdef CONFIG_LS2085A
 #define CONFIG_SYS_FSL_ERRATUM_A008336
 #define CONFIG_SYS_FSL_ERRATUM_A008514
+#define CONFIG_SYS_FSL_ERRATUM_A008585
 #endif
 
 #endif /* _ASM_ARMV8_FSL_LSCH3_CONFIG_ */