| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * linux/drivers/rtc/rtc-pl030.c |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * 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. |
|---|
| 9 | 6 | */ |
|---|
| 10 | 7 | #include <linux/module.h> |
|---|
| 11 | 8 | #include <linux/rtc.h> |
|---|
| .. | .. |
|---|
| 39 | 36 | { |
|---|
| 40 | 37 | struct pl030_rtc *rtc = dev_get_drvdata(dev); |
|---|
| 41 | 38 | |
|---|
| 42 | | - rtc_time_to_tm(readl(rtc->base + RTC_MR), &alrm->time); |
|---|
| 39 | + rtc_time64_to_tm(readl(rtc->base + RTC_MR), &alrm->time); |
|---|
| 43 | 40 | return 0; |
|---|
| 44 | 41 | } |
|---|
| 45 | 42 | |
|---|
| 46 | 43 | static int pl030_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) |
|---|
| 47 | 44 | { |
|---|
| 48 | 45 | struct pl030_rtc *rtc = dev_get_drvdata(dev); |
|---|
| 49 | | - unsigned long time; |
|---|
| 50 | | - int ret; |
|---|
| 51 | 46 | |
|---|
| 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; |
|---|
| 61 | 50 | } |
|---|
| 62 | 51 | |
|---|
| 63 | 52 | static int pl030_read_time(struct device *dev, struct rtc_time *tm) |
|---|
| 64 | 53 | { |
|---|
| 65 | 54 | struct pl030_rtc *rtc = dev_get_drvdata(dev); |
|---|
| 66 | 55 | |
|---|
| 67 | | - rtc_time_to_tm(readl(rtc->base + RTC_DR), tm); |
|---|
| 56 | + rtc_time64_to_tm(readl(rtc->base + RTC_DR), tm); |
|---|
| 68 | 57 | |
|---|
| 69 | 58 | return 0; |
|---|
| 70 | 59 | } |
|---|
| .. | .. |
|---|
| 80 | 69 | static int pl030_set_time(struct device *dev, struct rtc_time *tm) |
|---|
| 81 | 70 | { |
|---|
| 82 | 71 | struct pl030_rtc *rtc = dev_get_drvdata(dev); |
|---|
| 83 | | - unsigned long time; |
|---|
| 84 | | - int ret; |
|---|
| 85 | 72 | |
|---|
| 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); |
|---|
| 89 | 74 | |
|---|
| 90 | | - return ret; |
|---|
| 75 | + return 0; |
|---|
| 91 | 76 | } |
|---|
| 92 | 77 | |
|---|
| 93 | 78 | static const struct rtc_class_ops pl030_ops = { |
|---|
| .. | .. |
|---|
| 119 | 104 | } |
|---|
| 120 | 105 | |
|---|
| 121 | 106 | rtc->rtc->ops = &pl030_ops; |
|---|
| 107 | + rtc->rtc->range_max = U32_MAX; |
|---|
| 122 | 108 | rtc->base = ioremap(dev->res.start, resource_size(&dev->res)); |
|---|
| 123 | 109 | if (!rtc->base) { |
|---|
| 124 | 110 | ret = -ENOMEM; |
|---|
| .. | .. |
|---|
| 151 | 137 | return ret; |
|---|
| 152 | 138 | } |
|---|
| 153 | 139 | |
|---|
| 154 | | -static int pl030_remove(struct amba_device *dev) |
|---|
| 140 | +static void pl030_remove(struct amba_device *dev) |
|---|
| 155 | 141 | { |
|---|
| 156 | 142 | struct pl030_rtc *rtc = amba_get_drvdata(dev); |
|---|
| 157 | 143 | |
|---|
| .. | .. |
|---|
| 160 | 146 | free_irq(dev->irq[0], rtc); |
|---|
| 161 | 147 | iounmap(rtc->base); |
|---|
| 162 | 148 | amba_release_regions(dev); |
|---|
| 163 | | - |
|---|
| 164 | | - return 0; |
|---|
| 165 | 149 | } |
|---|
| 166 | 150 | |
|---|
| 167 | 151 | static struct amba_id pl030_ids[] = { |
|---|