summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2008-04-30 15:50:39 +0200
committerWolfgang Denk <wd@denx.de>2008-05-03 20:44:54 +0200
commit0072b78be2b41e5a0ca3ddc39335574dc2e855bd (patch)
tree1692f785e7be8ed342c26349850e2db39885bed4 /drivers
parent50f93d30dae3c5d888aa244d964ccd77be9b1c0c (diff)
downloadu-boot-imx-0072b78be2b41e5a0ca3ddc39335574dc2e855bd.zip
u-boot-imx-0072b78be2b41e5a0ca3ddc39335574dc2e855bd.tar.gz
u-boot-imx-0072b78be2b41e5a0ca3ddc39335574dc2e855bd.tar.bz2
RTC: Fix month offset by one problem in M41T62 RTC driver
This patch fixes a problem with the month being read and written incorrectly (offset by one). This only gets visible by also using the Linux driver (rtc-m41t80). Tested on AMCC Canyonlands. Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/rtc/m41t62.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/rtc/m41t62.c b/drivers/rtc/m41t62.c
index cf2a957..89d4ccd 100644
--- a/drivers/rtc/m41t62.c
+++ b/drivers/rtc/m41t62.c
@@ -81,7 +81,7 @@ int rtc_get(struct rtc_time *tm)
tm->tm_hour = BCD2BIN(buf[M41T62_REG_HOUR] & 0x3f);
tm->tm_mday = BCD2BIN(buf[M41T62_REG_DAY] & 0x3f);
tm->tm_wday = buf[M41T62_REG_WDAY] & 0x07;
- tm->tm_mon = BCD2BIN(buf[M41T62_REG_MON] & 0x1f) - 1;
+ tm->tm_mon = BCD2BIN(buf[M41T62_REG_MON] & 0x1f);
/* assume 20YY not 19YY, and ignore the Century Bit */
/* U-Boot needs to add 1900 here */
@@ -119,7 +119,7 @@ void rtc_set(struct rtc_time *tm)
buf[M41T62_REG_DAY] =
BIN2BCD(tm->tm_mday) | (buf[M41T62_REG_DAY] & ~0x3f);
buf[M41T62_REG_MON] =
- BIN2BCD(tm->tm_mon + 1) | (buf[M41T62_REG_MON] & ~0x1f);
+ BIN2BCD(tm->tm_mon) | (buf[M41T62_REG_MON] & ~0x1f);
/* assume 20YY not 19YY */
buf[M41T62_REG_YEAR] = BIN2BCD(tm->tm_year % 100);