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>
This commit is contained in:
York Sun 2015-03-20 19:28:05 -07:00
parent 5abf13e48a
commit 060ef09460
2 changed files with 12 additions and 0 deletions

View file

@ -25,7 +25,18 @@ unsigned long get_tbclk(void)
unsigned long timer_read_counter(void) unsigned long timer_read_counter(void)
{ {
unsigned long cntpct; 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(); isb();
asm volatile("mrs %0, cntpct_el0" : "=r" (cntpct)); 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; return cntpct;
} }

View file

@ -120,6 +120,7 @@
#ifdef CONFIG_LS2085A #ifdef CONFIG_LS2085A
#define CONFIG_SYS_FSL_ERRATUM_A008336 #define CONFIG_SYS_FSL_ERRATUM_A008336
#define CONFIG_SYS_FSL_ERRATUM_A008514 #define CONFIG_SYS_FSL_ERRATUM_A008514
#define CONFIG_SYS_FSL_ERRATUM_A008585
#endif #endif
#endif /* _ASM_ARMV8_FSL_LSCH3_CONFIG_ */ #endif /* _ASM_ARMV8_FSL_LSCH3_CONFIG_ */