From d158abff7b29a20033c9debe615ca74697ea2237 Mon Sep 17 00:00:00 2001 From: Tien Fong Chee Date: Fri, 8 May 2015 17:02:33 +0800 Subject: FogBugz #260361: Fixed intermittent QSPI flash erase failures This patch fixed the overflow formula in both get_timer_masked and get_timer_count_masked. This bug can cause QSPI flash failed to erase and time out intermittent during the process of erasing. Signed-off-by: Tien Fong --- arch/arm/cpu/armv7/socfpga/timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/cpu/armv7/socfpga/timer.c b/arch/arm/cpu/armv7/socfpga/timer.c index 0c87ba6040..5766eebdec 100644 --- a/arch/arm/cpu/armv7/socfpga/timer.c +++ b/arch/arm/cpu/armv7/socfpga/timer.c @@ -88,7 +88,7 @@ ulong get_timer_masked(void) } else { /* we have overflow of the count down timer */ gd->tbl += (TIMER_LOAD_VAL / (CONFIG_TIMER_CLOCK_KHZ * 1000 - / CONFIG_SYS_HZ)) - gd->lastinc + now; + / CONFIG_SYS_HZ)) - now + gd->lastinc; } gd->lastinc = now; return gd->tbl; @@ -122,7 +122,7 @@ ulong get_timer_count_masked(void) gd->tbl += gd->lastinc - now; } else { /* we have overflow of the count down timer */ - gd->tbl += TIMER_LOAD_VAL - gd->lastinc + now; + gd->tbl += TIMER_LOAD_VAL - now + gd->lastinc; } gd->lastinc = now; return gd->tbl; -- cgit v1.2.1