[coreboot-gerrit] New patch to review for coreboot: rockchip/rk3288: rtc-rk808: fix rtc time reading issue
Patrick Georgi (pgeorgi@google.com)
gerrit at coreboot.org
Thu Jan 12 16:40:38 CET 2017
Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18127
-gerrit
commit 6e9baf72223952da4df5854126a66d76f9c2878b
Author: Jeffy Chen <jeffy.chen at rock-chips.com>
Date: Fri Dec 23 15:05:11 2016 +0800
rockchip/rk3288: rtc-rk808: fix rtc time reading issue
After we set the GET_TIME bit, the rtc time can't be read immediately. We
should wait up to 31.25 us, about one cycle of 32khz. Otherwise reading
RTC time will return a old time.
BUG=chrome-os-partner:61078
BRANCH=veyron
TEST=Build and Boot
Original-Change-Id: I6ec07fc6c4d6d8b27b12031423b86b8ab15da6f6
Original-Signed-off-by: Jeffy Chen <jeffy.chen at rock-chips.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/423272
Original-Reviewed-by: Julius Werner <jwerner at chromium.org>
Change-Id: I9806b624d6e968e51d52aab8c052ae3fa77f247d
Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
Original-Commit-Id: b4b708e29fbae0d8f5a2cece79711aa6b1887727
Original-Change-Id: I8c168c14437bb932a59ac0e91a01062df0cf11dc
Original-Signed-off-by: Jeffy Chen <jeffy.chen at rock-chips.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/427522
Original-Reviewed-by: Julius Werner <jwerner at chromium.org>
---
src/soc/rockchip/common/rk808.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/soc/rockchip/common/rk808.c b/src/soc/rockchip/common/rk808.c
index dc6b2ea..a68b838 100644
--- a/src/soc/rockchip/common/rk808.c
+++ b/src/soc/rockchip/common/rk808.c
@@ -181,6 +181,12 @@ int rtc_get(struct rtc_time *time)
rk808_clrsetbits(RTC_CTRL, RTC_CTRL_GET_TIME, 0);
rk808_clrsetbits(RTC_CTRL, 0, RTC_CTRL_GET_TIME | RTC_CTRL_RTC_READSEL);
+ /*
+ * After we set the GET_TIME bit, the rtc time can't be read
+ * immediately. So we should wait up to 31.25 us.
+ */
+ udelay(32);
+
ret |= rk808_read(RTC_SECOND, &value);
time->sec = bcd2bin(value & 0x7f);
More information about the coreboot-gerrit
mailing list