aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-jz4740.c
diff options
context:
space:
mode:
authorPaul Cercueil <paul@crapouillou.net>2020-05-06 00:13:36 +0200
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2020-05-11 16:35:05 +0200
commit378252b6e24f764a5e41eb4552f1c3989ca12e81 (patch)
treee535d682ae9f85a062e5d59d68fdd4fa97564557 /drivers/rtc/rtc-jz4740.c
parent15eeadd801c0ea65c44c01f243f45097ac5970a8 (diff)
downloadlinux-378252b6e24f764a5e41eb4552f1c3989ca12e81.tar.gz
rtc: ingenic: Reset regulator register in probe
The regulator register specifies how many input clock cycles (minus one) are contained in one tick of the 1 Hz clock. Since this register can contain bogus values after the system boots, it needs to be reset in the probe register, otherwise the RTC may count way to slow or way too fast. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20200505221336.222313-7-paul@crapouillou.net Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-jz4740.c')
-rw-r--r--drivers/rtc/rtc-jz4740.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-jz4740.c b/drivers/rtc/rtc-jz4740.c
index 65e130726fc6d..9607e6b6e0b32 100644
--- a/drivers/rtc/rtc-jz4740.c
+++ b/drivers/rtc/rtc-jz4740.c
@@ -372,6 +372,9 @@ static int jz4740_rtc_probe(struct platform_device *pdev)
rate = clk_get_rate(clk);
jz4740_rtc_set_wakeup_params(rtc, np, rate);
+ /* Each 1 Hz pulse should happen after (rate) ticks */
+ jz4740_rtc_reg_write(rtc, JZ_REG_RTC_REGULATOR, rate - 1);
+
ret = rtc_register_device(rtc->rtc);
if (ret)
return ret;