Commit 081574f7 authored by Vladimir Panteleev's avatar Vladimir Panteleev Committed by Wim Van Sebroeck

watchdog: sp5100_tco: Add "action" module parameter

Allow configuring the "action" bit, as documented in [1].

Previously, the only action supported by this module was to reset the
system (0).  It can now be configured to power off (1) instead.

[1]: https://www.amd.com/system/files/TechDocs/44413.pdfSigned-off-by: default avatarVladimir Panteleev <git@vladimir.panteleev.md>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20220920092721.7686-1-git@vladimir.panteleev.mdSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
parent 8ed2dc48
...@@ -65,6 +65,12 @@ static struct pci_dev *sp5100_tco_pci; ...@@ -65,6 +65,12 @@ static struct pci_dev *sp5100_tco_pci;
/* module parameters */ /* module parameters */
#define WATCHDOG_ACTION 0
static bool action = WATCHDOG_ACTION;
module_param(action, bool, 0);
MODULE_PARM_DESC(action, "Action taken when watchdog expires, 0 to reset, 1 to poweroff (default="
__MODULE_STRING(WATCHDOG_ACTION) ")");
#define WATCHDOG_HEARTBEAT 60 /* 60 sec default heartbeat. */ #define WATCHDOG_HEARTBEAT 60 /* 60 sec default heartbeat. */
static int heartbeat = WATCHDOG_HEARTBEAT; /* in seconds */ static int heartbeat = WATCHDOG_HEARTBEAT; /* in seconds */
module_param(heartbeat, int, 0); module_param(heartbeat, int, 0);
...@@ -297,8 +303,11 @@ static int sp5100_tco_timer_init(struct sp5100_tco *tco) ...@@ -297,8 +303,11 @@ static int sp5100_tco_timer_init(struct sp5100_tco *tco)
if (val & SP5100_WDT_FIRED) if (val & SP5100_WDT_FIRED)
wdd->bootstatus = WDIOF_CARDRESET; wdd->bootstatus = WDIOF_CARDRESET;
/* Set watchdog action to reset the system */ /* Set watchdog action */
val &= ~SP5100_WDT_ACTION_RESET; if (action)
val |= SP5100_WDT_ACTION_RESET;
else
val &= ~SP5100_WDT_ACTION_RESET;
writel(val, SP5100_WDT_CONTROL(tco->tcobase)); writel(val, SP5100_WDT_CONTROL(tco->tcobase));
/* Set a reasonable heartbeat before we stop the timer */ /* Set a reasonable heartbeat before we stop the timer */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment