rtc: brcmstb-waketimer: Set wktmr prescaler
authorJustin Chen <justin.chen@broadcom.com>
Mon, 26 Feb 2018 20:09:58 +0000 (12:09 -0800)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Sat, 17 Mar 2018 13:20:51 +0000 (14:20 +0100)
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>
drivers/rtc/rtc-brcmstb-waketimer.c

index 6cee612..bdd6674 100644 (file)
@@ -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);
 }