mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] watchdog: prevent the STPMIC1 watchdog probe from modifying the global turn-OFF behaviour
@ 2021-02-11 15:03 Leonard Göhrs
  2021-02-11 15:32 ` Leonard Goehrs
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Leonard Göhrs @ 2021-02-11 15:03 UTC (permalink / raw)
  To: barebox; +Cc: Leonard Göhrs

According to Table 12 in the STPMIC1-datasheet (Rev 7 - December 2020)
there are the following turn-OFF conditions:

- Software switch-OFF*
- PONKEYn long key press*
- Thermal shutdown
- Overcurrent protection
- Watchdog*
- VIN_OK_Fall*

The conditions marked with an * can be re-configured from turn-Off conditions
to restart requests using the RREQ_EN-bit in the CR register
(Called RESTART_REQUEST_ENABLED in Linux/Barebox).

The watchdog code enabled this bit in it's probe function to trigger a restart
on a watchdog event. This may however result in unexpected behaviour,
like a long-press of the PONKEY resulting in a restart instead of a turn-off
when the watchdog is enabled vs. when it is not.

This change does not affect the restart and poweroff functionality provided by
the wdt driver, as the restart-/poweroff-handlers explicitly set/clear the
RESTART_REQUEST_ENABLED flag when triggering a software turn-OFF.

To prevent unexpected behaviour of the PONKEYn and other turn-OFF sources the
RESTART_REQUEST_ENABLED configuration in the probe function can and should thus be removed.

Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
---
 drivers/watchdog/stpmic1_wdt.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/watchdog/stpmic1_wdt.c b/drivers/watchdog/stpmic1_wdt.c
index 12280f144..105ba39fb 100644
--- a/drivers/watchdog/stpmic1_wdt.c
+++ b/drivers/watchdog/stpmic1_wdt.c
@@ -174,10 +174,6 @@ static int stpmic1_wdt_probe(struct device_d *dev)
 	wdd->set_timeout = stpmic1_wdt_set_timeout;
 	wdd->timeout_max = PMIC_WDT_MAX_TIMEOUT;
 
-	/* have the watchdog reset, not power-off the system */
-	regmap_write_bits(wdt->regmap, SWOFF_PWRCTRL_CR,
-			  RESTART_REQUEST_ENABLED, RESTART_REQUEST_ENABLED);
-
 	ret = watchdog_register(wdd);
 	if (ret) {
 		dev_err(dev, "Failed to register watchdog device\n");
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2021-02-12  8:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-11 15:03 [PATCH] watchdog: prevent the STPMIC1 watchdog probe from modifying the global turn-OFF behaviour Leonard Göhrs
2021-02-11 15:32 ` Leonard Goehrs
2021-02-11 15:35 ` Ahmad Fatoum
2021-02-12  8:50 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox