watchdog: sp805: ping fails to abort wdt reset
PATCH 1/1 watchdog: sp805: ping fails to abort wdt reset
sp805 wdt asserts interrupt for the first expiry and
reloads the counter. If wdt interrupt is set and count reaches zero then wdt reset event is generated.To get wdt reset at t timeout the driver loads wdt counter with t/2. A ping before t second *should* prevent wdt reset. Currently if ping is done after t/2 sec then wdt interrupt condition gets set. On the next countdown of loadval wdt reset event occurs eventhough wdt was reloaded before the set timeout t.
This patch clears the interrupt condition on ping.
--- drivers/watchdog/sp805_wdt.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/watchdog/sp805_wdt.c +2 -3
@@ -139,12 +139,11 @@ static int wdt_config(struct watchdog_device *wdd, bool ping)writel_relaxed (UNLOCK , wdt->base +WDTLOCK );writel_relaxed (wdt->load_val, wdt->base +WDTLOAD ); +writel_relaxed (INT_MASK , wdt->base +WDTINTCLR ); -if (!ping) { -writel_relaxed (INT_MASK , wdt->base +WDTINTCLR ); +if (!ping)writel_relaxed (INT_ENABLE |RESET_ENABLE , wdt->base +WDTCONTROL ); - }writel_relaxed (LOCK , wdt->base +WDTLOCK );
Signature · 1 line
1.7.9.5
Quoted 1 line · Sandeep Tripathy
sp805 wdt asserts interrupt for the first expiry and
Why an extra space before sp805 ?
Quoted 2 lines
reloads the counter. If wdt interrupt is set and count reaches zero then wdt reset event is generated.To get
Add space after full-stop.
Quoted 1 line
wdt reset at t timeout the driver loads wdt counter
Keep t and t/2 in single quotes, its hardly readable otherwise.
Quoted 7 lines
with t/2. A ping before t second *should* prevent wdt reset. Currently if ping is done after t/2 sec then wdt interrupt condition gets set. On the next countdown of loadval wdt reset event occurs eventhough wdt was reloaded before the set timeout t.
This patch clears the interrupt condition on ping.
Why extra spaces before 'This'?
Quoted 14 lines
Signed-off-by Sandeep Tripathy <[email protected]>--- drivers/watchdog/sp805_wdt.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/watchdog/sp805_wdt.c +0
-0@@ -139,12 +139,11 @@ static int wdt_config(struct watchdog_device *wdd, bool ping)writel_relaxed (UNLOCK , wdt->base +WDTLOCK );writel_relaxed (wdt->load_val, wdt->base +WDTLOAD );
drivers/watchdog/sp805_wdt.c static int wdt_config(struct watchdog_device *wdd, bool ping) · line 148
Quoted 10 lines
drivers/watchdog/sp805_wdt.c +2
-3+writel_relaxed (INT_MASK , wdt->base +WDTINTCLR ); -if (!ping) { -writel_relaxed (INT_MASK , wdt->base +WDTINTCLR ); +if (!ping)writel_relaxed (INT_ENABLE |RESET_ENABLE , wdt->base +WDTCONTROL ); - }writel_relaxed (LOCK , wdt->base +WDTLOCK );
If I read the TRM properly, then you don't need to load the WDTLOAD register on ping and so your change can be written as:
drivers/watchdog/sp805_wdt.c +2 -2
@@ -138,10 +138,10 @@ static int wdt_config(struct watchdog_device *wdd, bool ping)spin_lock (&wdt->lock);writel_relaxed (UNLOCK , wdt->base +WDTLOCK ); -writel_relaxed (wdt->load_val, wdt->base +WDTLOAD ); +writel_relaxed (INT_MASK , wdt->base +WDTINTCLR );if (!ping) { -writel_relaxed (INT_MASK , wdt->base +WDTINTCLR ); +writel_relaxed (wdt->load_val, wdt->base +WDTLOAD );writel_relaxed (INT_ENABLE |RESET_ENABLE , wdt->base +WDTCONTROL ); }
Please try if this works or not.
Signature · 1 line
viresh
Guenter Roeck
maintainerQuoted 60 lines · Viresh Kumar
Quoted 1 line · Sandeep Tripathy
sp805 wdt asserts interrupt for the first expiry and
Why an extra space before sp805 ?
Quoted 2 lines
reloads the counter. If wdt interrupt is set and count reaches zero then wdt reset event is generated.To get
Add space after full-stop.
Quoted 1 line
wdt reset at t timeout the driver loads wdt counter
Keep t and t/2 in single quotes, its hardly readable otherwise.
Quoted 7 lines
with t/2. A ping before t second *should* prevent wdt reset. Currently if ping is done after t/2 sec then wdt interrupt condition gets set. On the next countdown of loadval wdt reset event occurs eventhough wdt was reloaded before the set timeout t.
This patch clears the interrupt condition on ping.
Why extra spaces before 'This'?
Quoted 14 lines
Signed-off-by Sandeep Tripathy <[email protected]>--- drivers/watchdog/sp805_wdt.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/watchdog/sp805_wdt.c +0
-0@@ -139,12 +139,11 @@ static int wdt_config(struct watchdog_device *wdd, bool ping)writel_relaxed (UNLOCK , wdt->base +WDTLOCK );writel_relaxed (wdt->load_val, wdt->base +WDTLOAD );drivers/watchdog/sp805_wdt.c static int wdt_config(struct watchdog_device *wdd, bool ping) · line 148
Quoted 10 lines
drivers/watchdog/sp805_wdt.c +2
-3+writel_relaxed (INT_MASK , wdt->base +WDTINTCLR ); -if (!ping) { -writel_relaxed (INT_MASK , wdt->base +WDTINTCLR ); +if (!ping)writel_relaxed (INT_ENABLE |RESET_ENABLE , wdt->base +WDTCONTROL ); - }writel_relaxed (LOCK , wdt->base +WDTLOCK );If I read the TRM properly, then you don't need to load the WDTLOAD register on ping and so your change can be written as:
drivers/watchdog/sp805_wdt.c +0
-0@@ -138,10 +138,10 @@ static int wdt_config(struct watchdog_device *wdd, bool ping)spin_lock (&wdt->lock);
drivers/watchdog/sp805_wdt.c static int wdt_config(struct watchdog_device *wdd, bool ping) · line 147
Quoted 10 lines
drivers/watchdog/sp805_wdt.c +2
-2writel_relaxed (UNLOCK , wdt->base +WDTLOCK ); -writel_relaxed (wdt->load_val, wdt->base +WDTLOAD ); +writel_relaxed (INT_MASK , wdt->base +WDTINTCLR );if (!ping) { -writel_relaxed (INT_MASK , wdt->base +WDTINTCLR ); +writel_relaxed (wdt->load_val, wdt->base +WDTLOAD );writel_relaxed (INT_ENABLE |RESET_ENABLE , wdt->base +WDTCONTROL ); }
That would require additional changes. Reason is that the load value is not immediately written after a timeout change, but only with the next ping (which happens immediately afterwards). With your proposed change, the load value would never be updated.
Besides, that would be a separate change, and would require a separate patch.
Guenter
Quoted 76 lines · Guenter Roeck
Quoted 60 lines · Viresh Kumar
Quoted 1 line · Sandeep Tripathy
sp805 wdt asserts interrupt for the first expiry and
Why an extra space before sp805 ?
Quoted 2 lines
reloads the counter. If wdt interrupt is set and count reaches zero then wdt reset event is generated.To get
Add space after full-stop.
Quoted 1 line
wdt reset at t timeout the driver loads wdt counter
Keep t and t/2 in single quotes, its hardly readable otherwise.
Quoted 7 lines
with t/2. A ping before t second *should* prevent wdt reset. Currently if ping is done after t/2 sec then wdt interrupt condition gets set. On the next countdown of loadval wdt reset event occurs eventhough wdt was reloaded before the set timeout t.
This patch clears the interrupt condition on ping.
Why extra spaces before 'This'?
Quoted 14 lines
Signed-off-by Sandeep Tripathy <[email protected]>--- drivers/watchdog/sp805_wdt.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/watchdog/sp805_wdt.c +0
-0@@ -139,12 +139,11 @@ static int wdt_config(struct watchdog_device *wdd, bool ping)writel_relaxed (UNLOCK , wdt->base +WDTLOCK );writel_relaxed (wdt->load_val, wdt->base +WDTLOAD );drivers/watchdog/sp805_wdt.c static int wdt_config(struct watchdog_device *wdd, bool ping) · line 148
Quoted 10 lines
drivers/watchdog/sp805_wdt.c +2
-3+writel_relaxed (INT_MASK , wdt->base +WDTINTCLR ); -if (!ping) { -writel_relaxed (INT_MASK , wdt->base +WDTINTCLR ); +if (!ping)writel_relaxed (INT_ENABLE |RESET_ENABLE , wdt->base +WDTCONTROL ); - }writel_relaxed (LOCK , wdt->base +WDTLOCK );If I read the TRM properly, then you don't need to load the WDTLOAD register on ping and so your change can be written as:
drivers/watchdog/sp805_wdt.c +0
-0@@ -138,10 +138,10 @@ static int wdt_config(struct watchdog_device *wdd, bool ping)spin_lock (&wdt->lock);drivers/watchdog/sp805_wdt.c static int wdt_config(struct watchdog_device *wdd, bool ping) · line 147
Quoted 10 lines
drivers/watchdog/sp805_wdt.c +2
-2writel_relaxed (UNLOCK , wdt->base +WDTLOCK ); -writel_relaxed (wdt->load_val, wdt->base +WDTLOAD ); +writel_relaxed (INT_MASK , wdt->base +WDTINTCLR );if (!ping) { -writel_relaxed (INT_MASK , wdt->base +WDTINTCLR ); +writel_relaxed (wdt->load_val, wdt->base +WDTLOAD );writel_relaxed (INT_ENABLE |RESET_ENABLE , wdt->base +WDTCONTROL ); }That would require additional changes. Reason is that the load value is not immediately written after a timeout change, but only with the next ping (which happens immediately afterwards). With your proposed change, the load value would never be updated.
Quoted 1 line
Besides, that would be a separate change, and would require a separate patch.
Hmm, maybe then we can keep the original patch as is :)
@Sandeep: Please resend your patch after fixing the commit log and not the diff.
Signature · 1 line
viresh