Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions drivers/watchdog/sbsa_gwdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ MODULE_PARM_DESC(nowayout,
"Watchdog cannot be stopped once started (default="
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");

static bool force_enable;
module_param(force_enable, bool, 0);
MODULE_PARM_DESC(force_enable,
"Force enable watchdog on probe (default=0)");

/*
* Arm Base System Architecture 1.0 introduces watchdog v1 which
* increases the length watchdog offset register to 48 bits.
Expand Down Expand Up @@ -297,6 +302,7 @@ static int sbsa_gwdt_probe(struct platform_device *pdev)
struct sbsa_gwdt *gwdt;
int ret, irq;
u32 status;
bool force_action;

gwdt = devm_kzalloc(dev, sizeof(*gwdt), GFP_KERNEL);
if (!gwdt)
Expand Down Expand Up @@ -387,14 +393,27 @@ static int sbsa_gwdt_probe(struct platform_device *pdev)
*/
sbsa_gwdt_set_timeout(wdd, wdd->timeout);

force_action = force_enable && !(status & SBSA_GWDT_WCS_EN);
if (force_action) {
sbsa_gwdt_start(wdd);
set_bit(WDOG_HW_RUNNING, &wdd->status);
dev_info(dev, "Watchdog force enabled.\n");
}

watchdog_stop_on_reboot(wdd);
ret = devm_watchdog_register_device(dev, wdd);
if (ret)
if (ret) {
dev_err(dev, "Failed to register watchdog: %d\n", ret);
if (force_action) {
clear_bit(WDOG_HW_RUNNING, &wdd->status);
sbsa_gwdt_stop(wdd);
}
return ret;
}

dev_info(dev, "Initialized with %ds timeout @ %u Hz, action=%d.%s\n",
wdd->timeout, gwdt->clk, action,
status & SBSA_GWDT_WCS_EN ? " [enabled]" : "");
watchdog_hw_running(wdd) ? " [enabled]" : "");

return 0;
}
Expand Down