summaryrefslogtreecommitdiff
path: root/arch/arm/cpu/armv8
diff options
context:
space:
mode:
authorYork Sun <yorksun@freescale.com>2015-03-20 19:28:05 -0700
committerYork Sun <yorksun@freescale.com>2015-04-23 08:55:54 -0700
commit060ef094600373ea2b25111006edc56c072d9bd7 (patch)
treec43903ed0168ea3d2790da49fc674f9550d080e8 /arch/arm/cpu/armv8
parent5abf13e48a818eeb44cd236c3d3de79a0df59fac (diff)
downloadu-boot-imx-060ef094600373ea2b25111006edc56c072d9bd7.zip
u-boot-imx-060ef094600373ea2b25111006edc56c072d9bd7.tar.gz
u-boot-imx-060ef094600373ea2b25111006edc56c072d9bd7.tar.bz2
armv8/fsl-lsch3: Implement workaround for erratum A008585
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>
Diffstat (limited to 'arch/arm/cpu/armv8')
-rw-r--r--arch/arm/cpu/armv8/generic_timer.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/arm/cpu/armv8/generic_timer.c b/arch/arm/cpu/armv8/generic_timer.c
index 223b95e..8e60bae 100644
--- a/arch/arm/cpu/armv8/generic_timer.c
+++ b/arch/arm/cpu/armv8/generic_timer.c
@@ -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;
}