hc
2024-05-10 748e4f3d702def1a4bff191e0cf93b6a05340f01
kernel/drivers/rtc/rtc-pl030.c
....@@ -1,11 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * linux/drivers/rtc/rtc-pl030.c
34 *
45 * Copyright (C) 2000-2001 Deep Blue Solutions Ltd.
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License version 2 as
8
- * published by the Free Software Foundation.
96 */
107 #include <linux/module.h>
118 #include <linux/rtc.h>
....@@ -39,32 +36,24 @@
3936 {
4037 struct pl030_rtc *rtc = dev_get_drvdata(dev);
4138
42
- rtc_time_to_tm(readl(rtc->base + RTC_MR), &alrm->time);
39
+ rtc_time64_to_tm(readl(rtc->base + RTC_MR), &alrm->time);
4340 return 0;
4441 }
4542
4643 static int pl030_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
4744 {
4845 struct pl030_rtc *rtc = dev_get_drvdata(dev);
49
- unsigned long time;
50
- int ret;
5146
52
- /*
53
- * At the moment, we can only deal with non-wildcarded alarm times.
54
- */
55
- ret = rtc_valid_tm(&alrm->time);
56
- if (ret == 0)
57
- ret = rtc_tm_to_time(&alrm->time, &time);
58
- if (ret == 0)
59
- writel(time, rtc->base + RTC_MR);
60
- return ret;
47
+ writel(rtc_tm_to_time64(&alrm->time), rtc->base + RTC_MR);
48
+
49
+ return 0;
6150 }
6251
6352 static int pl030_read_time(struct device *dev, struct rtc_time *tm)
6453 {
6554 struct pl030_rtc *rtc = dev_get_drvdata(dev);
6655
67
- rtc_time_to_tm(readl(rtc->base + RTC_DR), tm);
56
+ rtc_time64_to_tm(readl(rtc->base + RTC_DR), tm);
6857
6958 return 0;
7059 }
....@@ -80,14 +69,10 @@
8069 static int pl030_set_time(struct device *dev, struct rtc_time *tm)
8170 {
8271 struct pl030_rtc *rtc = dev_get_drvdata(dev);
83
- unsigned long time;
84
- int ret;
8572
86
- ret = rtc_tm_to_time(tm, &time);
87
- if (ret == 0)
88
- writel(time + 1, rtc->base + RTC_LR);
73
+ writel(rtc_tm_to_time64(tm) + 1, rtc->base + RTC_LR);
8974
90
- return ret;
75
+ return 0;
9176 }
9277
9378 static const struct rtc_class_ops pl030_ops = {
....@@ -119,6 +104,7 @@
119104 }
120105
121106 rtc->rtc->ops = &pl030_ops;
107
+ rtc->rtc->range_max = U32_MAX;
122108 rtc->base = ioremap(dev->res.start, resource_size(&dev->res));
123109 if (!rtc->base) {
124110 ret = -ENOMEM;
....@@ -151,7 +137,7 @@
151137 return ret;
152138 }
153139
154
-static int pl030_remove(struct amba_device *dev)
140
+static void pl030_remove(struct amba_device *dev)
155141 {
156142 struct pl030_rtc *rtc = amba_get_drvdata(dev);
157143
....@@ -160,8 +146,6 @@
160146 free_irq(dev->irq[0], rtc);
161147 iounmap(rtc->base);
162148 amba_release_regions(dev);
163
-
164
- return 0;
165149 }
166150
167151 static struct amba_id pl030_ids[] = {