summaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorJustin Chen <justin.chen@broadcom.com>2018-02-26 21:09:58 +0100
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2018-03-17 14:20:51 +0100
commit58d3d5e79ece544b50829ac409064b58fec32000 (patch)
treee8ef082cf854b4386074d2e3c3bc593e8f58dbb8 /drivers/rtc
parentrtc: fix rtc_time64_to_tm for 3477 (diff)
downloadlinux-58d3d5e79ece544b50829ac409064b58fec32000.tar.xz
linux-58d3d5e79ece544b50829ac409064b58fec32000.zip
rtc: brcmstb-waketimer: Set wktmr prescaler
The HW default is one tick per second, however instead of assuming this, lets make sure the waketimer is actually one tick per second before arming the alarm. Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Justin Chen <justinpopo6@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-brcmstb-waketimer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-brcmstb-waketimer.c b/drivers/rtc/rtc-brcmstb-waketimer.c
index 6cee61201c30..bdd6674a1054 100644
--- a/drivers/rtc/rtc-brcmstb-waketimer.c
+++ b/drivers/rtc/rtc-brcmstb-waketimer.c
@@ -60,6 +60,9 @@ static void brcmstb_waketmr_set_alarm(struct brcmstb_waketmr *timer,
{
brcmstb_waketmr_clear_alarm(timer);
+ /* Make sure we are actually counting in seconds */
+ writel_relaxed(timer->rate, timer->base + BRCMSTB_WKTMR_PRESCALER);
+
writel_relaxed(secs + 1, timer->base + BRCMSTB_WKTMR_ALARM);
}