diff options
author | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2018-06-04 10:15:28 -0400 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2018-06-07 14:10:17 -0400 |
commit | b8e62b58bc004391c68890ab0313317cff07fb6b (patch) | |
tree | 9608219c04d1ab0dcfaab991f1d02c6aa11fda62 /drivers/rtc | |
parent | 73318f8b6bf0dbdbff4f21a3fff02d1467479555 (diff) |
rtc: ftrtc010: let the core handle range
The current range handling is highly suspicious. Anyway, let the core
handle it.
The RTC has a 32 bit counter on top of days + hh:mm:ss registers.
Acked-by: Hans Ulli Kroll <ulli.kroll@googlemail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-ftrtc010.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-ftrtc010.c b/drivers/rtc/rtc-ftrtc010.c index 2cdc78ffeb17..61f798c6101f 100644 --- a/drivers/rtc/rtc-ftrtc010.c +++ b/drivers/rtc/rtc-ftrtc010.c | |||
@@ -95,9 +95,6 @@ static int ftrtc010_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
95 | u32 sec, min, hour, day, offset; | 95 | u32 sec, min, hour, day, offset; |
96 | timeu64_t time; | 96 | timeu64_t time; |
97 | 97 | ||
98 | if (tm->tm_year >= 2148) /* EPOCH Year + 179 */ | ||
99 | return -EINVAL; | ||
100 | |||
101 | time = rtc_tm_to_time64(tm); | 98 | time = rtc_tm_to_time64(tm); |
102 | 99 | ||
103 | sec = readl(rtc->rtc_base + FTRTC010_RTC_SECOND); | 100 | sec = readl(rtc->rtc_base + FTRTC010_RTC_SECOND); |
@@ -120,6 +117,7 @@ static const struct rtc_class_ops ftrtc010_rtc_ops = { | |||
120 | 117 | ||
121 | static int ftrtc010_rtc_probe(struct platform_device *pdev) | 118 | static int ftrtc010_rtc_probe(struct platform_device *pdev) |
122 | { | 119 | { |
120 | u32 days, hour, min, sec; | ||
123 | struct ftrtc010_rtc *rtc; | 121 | struct ftrtc010_rtc *rtc; |
124 | struct device *dev = &pdev->dev; | 122 | struct device *dev = &pdev->dev; |
125 | struct resource *res; | 123 | struct resource *res; |
@@ -172,6 +170,15 @@ static int ftrtc010_rtc_probe(struct platform_device *pdev) | |||
172 | 170 | ||
173 | rtc->rtc_dev->ops = &ftrtc010_rtc_ops; | 171 | rtc->rtc_dev->ops = &ftrtc010_rtc_ops; |
174 | 172 | ||
173 | sec = readl(rtc->rtc_base + FTRTC010_RTC_SECOND); | ||
174 | min = readl(rtc->rtc_base + FTRTC010_RTC_MINUTE); | ||
175 | hour = readl(rtc->rtc_base + FTRTC010_RTC_HOUR); | ||
176 | days = readl(rtc->rtc_base + FTRTC010_RTC_DAYS); | ||
177 | |||
178 | rtc->rtc_dev->range_min = (u64)days * 86400 + hour * 3600 + | ||
179 | min * 60 + sec; | ||
180 | rtc->rtc_dev->range_max = U32_MAX + rtc->rtc_dev->range_min; | ||
181 | |||
175 | ret = devm_request_irq(dev, rtc->rtc_irq, ftrtc010_rtc_interrupt, | 182 | ret = devm_request_irq(dev, rtc->rtc_irq, ftrtc010_rtc_interrupt, |
176 | IRQF_SHARED, pdev->name, dev); | 183 | IRQF_SHARED, pdev->name, dev); |
177 | if (unlikely(ret)) | 184 | if (unlikely(ret)) |