summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2017-09-23 19:27:37 +0100
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2024-05-24 20:01:10 +0100
commit5a35a104f0520dbfe3824f71313f3b435e059121 (patch)
tree68056fb52baadd634fb6440a06d7baf364f094fe /drivers
parenta4eea928b4d8de791011f1b13982635cba4ede25 (diff)
rtc: armada38x: provide set_offset_nsecrtc
Armada 388 resets the prescaler when the time register is written, so it requires the current second as close to the start of that second as possible. The data sheet is a bit unclear, so this has been confirmed on real hardware. Verified on Armada 388 based Clearfog. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/rtc/rtc-armada38x.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-armada38x.c b/drivers/rtc/rtc-armada38x.c
index 569c1054d6b0..be216a32db20 100644
--- a/drivers/rtc/rtc-armada38x.c
+++ b/drivers/rtc/rtc-armada38x.c
@@ -447,6 +447,15 @@ static int armada38x_rtc_set_offset(struct device *dev, long offset)
return 0;
}
+static void armada38x_rtc_pre_register(struct rtc_device *rtc)
+{
+ /*
+ * The Armada 388 resets the prescaler when we write the time.
+ * Validated on clearfog.
+ */
+ rtc->set_offset_nsec = 0;
+}
+
static const struct rtc_class_ops armada38x_rtc_ops = {
.read_time = armada38x_rtc_read_time,
.set_time = armada38x_rtc_set_time,
@@ -455,6 +464,7 @@ static const struct rtc_class_ops armada38x_rtc_ops = {
.alarm_irq_enable = armada38x_rtc_alarm_irq_enable,
.read_offset = armada38x_rtc_read_offset,
.set_offset = armada38x_rtc_set_offset,
+ .pre_register = armada38x_rtc_pre_register,
};
static const struct armada38x_rtc_data armada38x_data = {