.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Real Time Clock interface for StrongARM SA1x00 and XScale PXA2xx |
---|
3 | 4 | * |
---|
.. | .. |
---|
14 | 15 | * |
---|
15 | 16 | * Converted to the RTC subsystem and Driver Model |
---|
16 | 17 | * by Richard Purdie <rpurdie@rpsys.net> |
---|
17 | | - * |
---|
18 | | - * This program is free software; you can redistribute it and/or |
---|
19 | | - * modify it under the terms of the GNU General Public License |
---|
20 | | - * as published by the Free Software Foundation; either version |
---|
21 | | - * 2 of the License, or (at your option) any later version. |
---|
22 | 18 | */ |
---|
23 | 19 | |
---|
24 | 20 | #include <linux/platform_device.h> |
---|
.. | .. |
---|
115 | 111 | { |
---|
116 | 112 | struct sa1100_rtc *info = dev_get_drvdata(dev); |
---|
117 | 113 | |
---|
118 | | - rtc_time_to_tm(readl_relaxed(info->rcnr), tm); |
---|
| 114 | + rtc_time64_to_tm(readl_relaxed(info->rcnr), tm); |
---|
119 | 115 | return 0; |
---|
120 | 116 | } |
---|
121 | 117 | |
---|
122 | 118 | static int sa1100_rtc_set_time(struct device *dev, struct rtc_time *tm) |
---|
123 | 119 | { |
---|
124 | 120 | struct sa1100_rtc *info = dev_get_drvdata(dev); |
---|
125 | | - unsigned long time; |
---|
126 | | - int ret; |
---|
127 | 121 | |
---|
128 | | - ret = rtc_tm_to_time(tm, &time); |
---|
129 | | - if (ret == 0) |
---|
130 | | - writel_relaxed(time, info->rcnr); |
---|
131 | | - return ret; |
---|
| 122 | + writel_relaxed(rtc_tm_to_time64(tm), info->rcnr); |
---|
| 123 | + |
---|
| 124 | + return 0; |
---|
132 | 125 | } |
---|
133 | 126 | |
---|
134 | 127 | static int sa1100_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) |
---|
.. | .. |
---|
145 | 138 | static int sa1100_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) |
---|
146 | 139 | { |
---|
147 | 140 | struct sa1100_rtc *info = dev_get_drvdata(dev); |
---|
148 | | - unsigned long time; |
---|
149 | | - int ret; |
---|
150 | 141 | |
---|
151 | 142 | spin_lock_irq(&info->lock); |
---|
152 | | - ret = rtc_tm_to_time(&alrm->time, &time); |
---|
153 | | - if (ret != 0) |
---|
154 | | - goto out; |
---|
155 | 143 | writel_relaxed(readl_relaxed(info->rtsr) & |
---|
156 | 144 | (RTSR_HZE | RTSR_ALE | RTSR_AL), info->rtsr); |
---|
157 | | - writel_relaxed(time, info->rtar); |
---|
| 145 | + writel_relaxed(rtc_tm_to_time64(&alrm->time), info->rtar); |
---|
158 | 146 | if (alrm->enabled) |
---|
159 | 147 | writel_relaxed(readl_relaxed(info->rtsr) | RTSR_ALE, info->rtsr); |
---|
160 | 148 | else |
---|
161 | 149 | writel_relaxed(readl_relaxed(info->rtsr) & ~RTSR_ALE, info->rtsr); |
---|
162 | | -out: |
---|
163 | 150 | spin_unlock_irq(&info->lock); |
---|
164 | 151 | |
---|
165 | | - return ret; |
---|
| 152 | + return 0; |
---|
166 | 153 | } |
---|
167 | 154 | |
---|
168 | 155 | static int sa1100_rtc_proc(struct device *dev, struct seq_file *seq) |
---|
.. | .. |
---|
216 | 203 | |
---|
217 | 204 | info->rtc->ops = &sa1100_rtc_ops; |
---|
218 | 205 | info->rtc->max_user_freq = RTC_FREQ; |
---|
| 206 | + info->rtc->range_max = U32_MAX; |
---|
219 | 207 | |
---|
220 | 208 | ret = rtc_register_device(info->rtc); |
---|
221 | 209 | if (ret) { |
---|
.. | .. |
---|
254 | 242 | static int sa1100_rtc_probe(struct platform_device *pdev) |
---|
255 | 243 | { |
---|
256 | 244 | struct sa1100_rtc *info; |
---|
257 | | - struct resource *iores; |
---|
258 | 245 | void __iomem *base; |
---|
259 | 246 | int irq_1hz, irq_alarm; |
---|
260 | 247 | int ret; |
---|
.. | .. |
---|
287 | 274 | return ret; |
---|
288 | 275 | } |
---|
289 | 276 | |
---|
290 | | - iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
---|
291 | | - base = devm_ioremap_resource(&pdev->dev, iores); |
---|
| 277 | + base = devm_platform_ioremap_resource(pdev, 0); |
---|
292 | 278 | if (IS_ERR(base)) |
---|
293 | 279 | return PTR_ERR(base); |
---|
294 | 280 | |
---|