We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6adb559 commit db60d55Copy full SHA for db60d55
drivers/watchdog/imx_sc_wdt.c
@@ -56,6 +56,25 @@ static int imx_sc_wdt_ping(struct watchdog_device *wdog)
56
return 0;
57
}
58
59
+static bool imx_sc_wdt_is_running(void)
60
+{
61
+ struct arm_smccc_res res;
62
+
63
+ arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_START_WDOG,
64
+ 0, 0, 0, 0, 0, 0, &res);
65
66
+ /* Already enabled (SC_TIMER_ERR_BUSY)? */
67
+ if (res.a0 == SC_TIMER_ERR_BUSY)
68
+ return true;
69
70
+ /* Undo only if that was us who has (successfully) enabled the WDT */
71
+ if (!res.a0)
72
+ arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_STOP_WDOG,
73
74
75
+ return false;
76
+}
77
78
static int imx_sc_wdt_start(struct watchdog_device *wdog)
79
{
80
struct arm_smccc_res res;
@@ -183,6 +202,9 @@ static int imx_sc_wdt_probe(struct platform_device *pdev)
183
202
if (ret)
184
203
return ret;
185
204
205
+ if (imx_sc_wdt_is_running())
206
+ set_bit(WDOG_HW_RUNNING, &wdog->status);
207
186
208
watchdog_stop_on_reboot(wdog);
187
209
watchdog_stop_on_unregister(wdog);
188
210
0 commit comments