9
0
Fork 0

wdog: imx-wd: watchdog cannot be disabled again

The i.MX21/i.MX6 watchdog cannot be disabled after it was activated.
Bit 2 (WDE) cannot be set to 0 again. Notify the user about that by
returning -ENOSYS.

Signed-off-by: Stefan Christ <s.christ@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Stefan Christ 2015-11-12 13:18:55 +01:00 committed by Sascha Hauer
parent 92327f1f6e
commit fbcf721db1
1 changed files with 4 additions and 1 deletions

View File

@ -97,9 +97,12 @@ static int imx21_watchdog_set_timeout(struct imx_wd *priv, int timeout)
dev_dbg(priv->dev, "%s: %d\n", __func__, timeout);
if (!timeout || timeout > 128)
if (timeout < -1 || timeout > 128)
return -EINVAL;
if (timeout == 0) /* bit 2 (WDE) cannot be set to 0 again */
return -ENOSYS;
if (timeout > 0)
val = ((timeout * 2 - 1) << 8) | IMX21_WDOG_WCR_SRS |
IMX21_WDOG_WCR_WDA;