summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-12-17 12:59:16 -0800
committerGerrit <chrome-bot@google.com>2012-12-17 14:24:50 -0800
commiteb6e08570a46fe641308ff696225acfa1643a5a8 (patch)
tree882f31493aa329c875c9cce2f4462b6a7e23e309
parent55645f87cbd3433a69557366008e9728e3e08790 (diff)
downloadchrome-ec-eb6e08570a46fe641308ff696225acfa1643a5a8.tar.gz
link: Workaround for errata 3.2
Reads of HIBRTCC and HIBRTCCSS are not properly synchronized and may return incorrect data. We were re-checking HIBRTC, but not HIBRTCSS. BUG=chrome-os-partner:16864 BRANCH=link TEST=from ec console, do 'rtc' command repeatedly; printed values should be strictly increasing. Change-Id: I3e59dc840316ad36bb4851f03b66a3ae3df5cccd Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/39795 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--chip/lm4/system.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/chip/lm4/system.c b/chip/lm4/system.c
index eac0c48b0a..130fc34367 100644
--- a/chip/lm4/system.c
+++ b/chip/lm4/system.c
@@ -189,7 +189,7 @@ void __attribute__((section(".iram.text"))) __enter_hibernate(int hibctl)
uint32_t system_get_rtc(uint32_t *ss_ptr)
{
uint32_t rtc, rtc2;
- uint32_t rtcss;
+ uint32_t rtcss, rtcss2;
/*
* The hibernate module isn't synchronized, so need to read repeatedly
@@ -198,8 +198,9 @@ uint32_t system_get_rtc(uint32_t *ss_ptr)
do {
rtc = LM4_HIBERNATE_HIBRTCC;
rtcss = LM4_HIBERNATE_HIBRTCSS & 0x7fff;
+ rtcss2 = LM4_HIBERNATE_HIBRTCSS & 0x7fff;
rtc2 = LM4_HIBERNATE_HIBRTCC;
- } while (rtc != rtc2);
+ } while (rtc != rtc2 || rtcss != rtcss2);
if (ss_ptr)
*ss_ptr = rtcss;