summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2014-12-30 18:38:06 -0800
committerPatrick Georgi <pgeorgi@google.com>2015-04-17 09:20:54 +0200
commit90d0acbe9a32f2b01e1e7a2d973bf23dd1998f13 (patch)
tree630ae3b098da07f7d50ba064fdae78c5c6907332
parent55cb84b244732dc93a096aadb2d324a1a05801db (diff)
as3277: Fix month-off-by-one error for RTC driver
The AS3277 RTC code seems to closely follow the corresponding Linux driver. Unfortunately, while coreboot (and even other parts of Linux, like mktime()) directly follows the standard IBM PC RTC time representation (except for the BCD part), Linux' struct rtc_time decided to use 0-based (instead of 1-based) months instead. This patch removes the faulty month offset that was copied into our driver so that we will generate correct timestamps again. BRANCH=nyan BUG=chrome-os-partner:34108 TEST=firmware_EventLog (pre-release version) gets further than before (and then craps up on unrelated problems with suspend/resume events). Change-Id: Ica221a8bcfd7c1c6cd7ba382d760b586d511e3a3 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: 5b55c3f5bbecc776a71338256b910aecccac1e04 Original-Change-Id: I163fa4778ec534cd9e6f92a6b6dc55e9871a6a82 Original-Signed-off-by: Julius Werner <jwerner@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/238122 Original-Reviewed-by: David Hendricks <dhendrix@chromium.org> Reviewed-on: http://review.coreboot.org/9723 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
-rw-r--r--src/drivers/ams/as3722rtc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/drivers/ams/as3722rtc.c b/src/drivers/ams/as3722rtc.c
index 8fe5748e16..e15ae32628 100644
--- a/src/drivers/ams/as3722rtc.c
+++ b/src/drivers/ams/as3722rtc.c
@@ -72,7 +72,7 @@ int rtc_set(const struct rtc_time *time)
as3722_write(AS3722_RTC_MINUTE, bin2bcd(time->min));
as3722_write(AS3722_RTC_HOUR, bin2bcd(time->hour));
as3722_write(AS3722_RTC_DAY, bin2bcd(time->mday));
- as3722_write(AS3722_RTC_MONTH, bin2bcd(time->mon + 1));
+ as3722_write(AS3722_RTC_MONTH, bin2bcd(time->mon));
as3722_write(AS3722_RTC_YEAR, bin2bcd(time->year));
return 0;
}
@@ -85,7 +85,7 @@ int rtc_get(struct rtc_time *time)
time->min = bcd2bin(as3722_read(AS3722_RTC_MINUTE) & 0x7f);
time->hour = bcd2bin(as3722_read(AS3722_RTC_HOUR) & 0x3f);
time->mday = bcd2bin(as3722_read(AS3722_RTC_DAY) & 0x3f);
- time->mon = bcd2bin(as3722_read(AS3722_RTC_MONTH) & 0x1f) - 1;
+ time->mon = bcd2bin(as3722_read(AS3722_RTC_MONTH) & 0x1f);
time->year = bcd2bin(as3722_read(AS3722_RTC_YEAR) & 0x7f);
return 0;
}