hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/rtc/rtc-sa1100.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Real Time Clock interface for StrongARM SA1x00 and XScale PXA2xx
34 *
....@@ -14,11 +15,6 @@
1415 *
1516 * Converted to the RTC subsystem and Driver Model
1617 * 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.
2218 */
2319
2420 #include <linux/platform_device.h>
....@@ -115,20 +111,17 @@
115111 {
116112 struct sa1100_rtc *info = dev_get_drvdata(dev);
117113
118
- rtc_time_to_tm(readl_relaxed(info->rcnr), tm);
114
+ rtc_time64_to_tm(readl_relaxed(info->rcnr), tm);
119115 return 0;
120116 }
121117
122118 static int sa1100_rtc_set_time(struct device *dev, struct rtc_time *tm)
123119 {
124120 struct sa1100_rtc *info = dev_get_drvdata(dev);
125
- unsigned long time;
126
- int ret;
127121
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;
132125 }
133126
134127 static int sa1100_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
....@@ -145,24 +138,18 @@
145138 static int sa1100_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
146139 {
147140 struct sa1100_rtc *info = dev_get_drvdata(dev);
148
- unsigned long time;
149
- int ret;
150141
151142 spin_lock_irq(&info->lock);
152
- ret = rtc_tm_to_time(&alrm->time, &time);
153
- if (ret != 0)
154
- goto out;
155143 writel_relaxed(readl_relaxed(info->rtsr) &
156144 (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);
158146 if (alrm->enabled)
159147 writel_relaxed(readl_relaxed(info->rtsr) | RTSR_ALE, info->rtsr);
160148 else
161149 writel_relaxed(readl_relaxed(info->rtsr) & ~RTSR_ALE, info->rtsr);
162
-out:
163150 spin_unlock_irq(&info->lock);
164151
165
- return ret;
152
+ return 0;
166153 }
167154
168155 static int sa1100_rtc_proc(struct device *dev, struct seq_file *seq)
....@@ -216,6 +203,7 @@
216203
217204 info->rtc->ops = &sa1100_rtc_ops;
218205 info->rtc->max_user_freq = RTC_FREQ;
206
+ info->rtc->range_max = U32_MAX;
219207
220208 ret = rtc_register_device(info->rtc);
221209 if (ret) {
....@@ -254,7 +242,6 @@
254242 static int sa1100_rtc_probe(struct platform_device *pdev)
255243 {
256244 struct sa1100_rtc *info;
257
- struct resource *iores;
258245 void __iomem *base;
259246 int irq_1hz, irq_alarm;
260247 int ret;
....@@ -287,8 +274,7 @@
287274 return ret;
288275 }
289276
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);
292278 if (IS_ERR(base))
293279 return PTR_ERR(base);
294280