RTC: Fix month offset by one problem in M41T62 RTC driver
PATCH 1/1 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 <[email protected]>
---
Wolfgang, could you please apply this for 1.3.3?
Thanks.
drivers/rtc/m41t62.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/rtc/m41t62.c +2 -2
@@ -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 );
Signature · 1 line
1.5.5.1
Wolfgang Denk
AppliedPATCH 1/1 RTC: Fix month offset by one problem in M41T62 RTC driver
Quoted 6 lines · In message <[email protected]> you wrote:
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.
Quoted 8 lines
Signed-off-by Stefan Roese <[email protected]>---
Wolfgang, could you please apply this for 1.3.3?
Thanks.drivers/rtc/m41t62.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de I am pleased to see that we have differences. May we together become greater than the sum of both of us. -- Surak of Vulcan, "The Savage Curtain", stardate 5906.4