summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTien Fong Chee <tfchee@pg-tfchee-lv.altera.com>2015-05-08 17:02:33 +0800
committerTien Fong Chee <tfchee@pg-tfchee-lv.altera.com>2015-05-08 17:02:33 +0800
commitd158abff7b29a20033c9debe615ca74697ea2237 (patch)
tree34088e3e8b70c02dfcf5e689f1d159b50de8d485
parent32c1d91bc0d10beca54c2dfc5b475d4ffeffc15a (diff)
downloadu-boot-socfpga-d158abff7b29a20033c9debe615ca74697ea2237.tar.gz
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 <tfchee@altera.com>
-rw-r--r--arch/arm/cpu/armv7/socfpga/timer.c4
1 files 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;