summaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-mv.c
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2019-03-15 14:35:10 +0100
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2019-04-04 10:06:54 +0200
commitb46c5815be4c6fa27dbb66447e15902261a21ace (patch)
tree71d6719601bea3e0933dfe1e5bfa770fb1af20b4 /drivers/rtc/rtc-mv.c
parent5b25a71b68eb9fcdc1c99447fdc4ee3c1d23a64f (diff)
downloadblackbird-op-linux-b46c5815be4c6fa27dbb66447e15902261a21ace.tar.gz
blackbird-op-linux-b46c5815be4c6fa27dbb66447e15902261a21ace.zip
rtc: mv: add range
This RTC handles time from 2000-01-01 00:00:00 to 2099-12-31 23:59:59 with a weird rollover to 2000-06-23 00:00:00. Tested-by: Gregory CLEMENT <gregory.clement@bootlin.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-mv.c')
-rw-r--r--drivers/rtc/rtc-mv.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c
index 7c0cf532a18d..ab9db57a6834 100644
--- a/drivers/rtc/rtc-mv.c
+++ b/drivers/rtc/rtc-mv.c
@@ -57,7 +57,7 @@ static int mv_rtc_set_time(struct device *dev, struct rtc_time *tm)
rtc_reg = (bin2bcd(tm->tm_mday) << RTC_MDAY_OFFS) |
(bin2bcd(tm->tm_mon + 1) << RTC_MONTH_OFFS) |
- (bin2bcd(tm->tm_year % 100) << RTC_YEAR_OFFS);
+ (bin2bcd(tm->tm_year - 100) << RTC_YEAR_OFFS);
writel(rtc_reg, ioaddr + RTC_DATE_REG_OFFS);
return 0;
@@ -156,7 +156,7 @@ static int mv_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
<< RTC_MONTH_OFFS;
if (alm->time.tm_year >= 0)
- rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_year % 100))
+ rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_year - 100))
<< RTC_YEAR_OFFS;
writel(rtc_reg, ioaddr + RTC_ALARM_DATE_REG_OFFS);
@@ -277,6 +277,9 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
pdata->rtc->ops = &mv_rtc_ops;
}
+ pdata->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
+ pdata->rtc->range_max = RTC_TIMESTAMP_END_2099;
+
ret = rtc_register_device(pdata->rtc);
if (!ret)
return 0;
OpenPOWER on IntegriCloud