Commit 378252b6 authored by Paul Cercueil's avatar Paul Cercueil Committed by Alexandre Belloni

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: default avatarPaul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20200505221336.222313-7-paul@crapouillou.netSigned-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent 15eeadd8
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment