Skip to contentSkip to conversation

rtc: brcmstb-waketimer: Set wktmr prescaler

PATCH Superseded Justin Chen 2 participants 2 messages Feb 22, 2018 – Feb 23, 2018

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/rtc/rtc-brcmstb-waketimer.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/rtc/rtc-brcmstb-waketimer.c +4 -0
index 796ac79..46116b7 100644
@@ -60,6 +60,10 @@ 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(BRCMSTB_WKTMR_DEFAULT_FREQ,
+			timer->base + BRCMSTB_WKTMR_PRESCALER);
+
 	writel_relaxed(secs + 1, timer->base + BRCMSTB_WKTMR_ALARM);
 }
 
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Justin Chen

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.

---
 drivers/rtc/rtc-brcmstb-waketimer.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/rtc/rtc-brcmstb-waketimer.c +0 -0
index 796ac79..46116b7 100644

drivers/rtc/rtc-brcmstb-waketimer.c static void brcmstb_waketmr_set_alarm(struct brcmstb_waketmr *timer, · line 65

Quoted 6 lines
drivers/rtc/rtc-brcmstb-waketimer.c +3 -0
@@ -60,6 +60,10 @@ 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(BRCMSTB_WKTMR_DEFAULT_FREQ,
+			timer->base + BRCMSTB_WKTMR_PRESCALER);

The change is correct, however you would likely want to use timer->rate which makes sure that we either got the clock rate information from the LCCF, or we got the correct fixed rate frequency. With that fixed:

Signature · 1 line
Florian