All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtc: brcmstb-waketimer: Set wktmr prescaler
@ 2018-02-22  1:15 ` Justin Chen
  0 siblings, 0 replies; 4+ messages in thread
From: Justin Chen @ 2018-02-22  1:15 UTC (permalink / raw)
  To: linux-rtc
  Cc: a.zummo, alexandre.belloni, computersforpeace, gregory.0xf0,
	f.fainelli, bcm-kernel-feedback-list, linux-arm-kernel,
	linux-kernel, Justin Chen, 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.

Signed-off-by: Justin Chen <justinpopo6@gmail.com>
---
 drivers/rtc/rtc-brcmstb-waketimer.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/rtc/rtc-brcmstb-waketimer.c b/drivers/rtc/rtc-brcmstb-waketimer.c
index 796ac79..46116b7 100644
--- a/drivers/rtc/rtc-brcmstb-waketimer.c
+++ b/drivers/rtc/rtc-brcmstb-waketimer.c
@@ -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);
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] rtc: brcmstb-waketimer: Set wktmr prescaler
@ 2018-02-22  1:15 ` Justin Chen
  0 siblings, 0 replies; 4+ messages in thread
From: Justin Chen @ 2018-02-22  1:15 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Justin Chen <justinpopo6@gmail.com>
---
 drivers/rtc/rtc-brcmstb-waketimer.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/rtc/rtc-brcmstb-waketimer.c b/drivers/rtc/rtc-brcmstb-waketimer.c
index 796ac79..46116b7 100644
--- a/drivers/rtc/rtc-brcmstb-waketimer.c
+++ b/drivers/rtc/rtc-brcmstb-waketimer.c
@@ -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);
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] rtc: brcmstb-waketimer: Set wktmr prescaler
  2018-02-22  1:15 ` Justin Chen
@ 2018-02-23 19:01   ` Florian Fainelli
  -1 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2018-02-23 19:01 UTC (permalink / raw)
  To: Justin Chen, linux-rtc
  Cc: a.zummo, alexandre.belloni, computersforpeace, gregory.0xf0,
	f.fainelli, bcm-kernel-feedback-list, linux-arm-kernel,
	linux-kernel, Justin Chen

On 02/21/2018 05:15 PM, Justin Chen wrote:
> 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.
> 
> Signed-off-by: Justin Chen <justinpopo6@gmail.com>
> ---
>  drivers/rtc/rtc-brcmstb-waketimer.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/rtc/rtc-brcmstb-waketimer.c b/drivers/rtc/rtc-brcmstb-waketimer.c
> index 796ac79..46116b7 100644
> --- a/drivers/rtc/rtc-brcmstb-waketimer.c
> +++ b/drivers/rtc/rtc-brcmstb-waketimer.c
> @@ -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:

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] rtc: brcmstb-waketimer: Set wktmr prescaler
@ 2018-02-23 19:01   ` Florian Fainelli
  0 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2018-02-23 19:01 UTC (permalink / raw)
  To: linux-arm-kernel

On 02/21/2018 05:15 PM, Justin Chen wrote:
> 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.
> 
> Signed-off-by: Justin Chen <justinpopo6@gmail.com>
> ---
>  drivers/rtc/rtc-brcmstb-waketimer.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/rtc/rtc-brcmstb-waketimer.c b/drivers/rtc/rtc-brcmstb-waketimer.c
> index 796ac79..46116b7 100644
> --- a/drivers/rtc/rtc-brcmstb-waketimer.c
> +++ b/drivers/rtc/rtc-brcmstb-waketimer.c
> @@ -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:

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-02-23 19:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-22  1:15 [PATCH] rtc: brcmstb-waketimer: Set wktmr prescaler Justin Chen
2018-02-22  1:15 ` Justin Chen
2018-02-23 19:01 ` Florian Fainelli
2018-02-23 19:01   ` Florian Fainelli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.