diff options
author | Stefan Christ <s.christ@phytec.de> | 2015-11-12 13:18:55 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-11-30 08:22:30 +0100 |
commit | fbcf721db1304505045bc31dbd4dc6fc2fb23e68 (patch) | |
tree | 2b66b12ad5f8923c768e12cd82e5be468d098f5b /drivers/watchdog | |
parent | 92327f1f6e57962b75e525eb34e11dfa03191332 (diff) | |
download | barebox-fbcf721db1304505045bc31dbd4dc6fc2fb23e68.tar.gz barebox-fbcf721db1304505045bc31dbd4dc6fc2fb23e68.tar.xz |
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>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r-- | drivers/watchdog/imxwd.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/watchdog/imxwd.c b/drivers/watchdog/imxwd.c index dd11a62613..1952548fa7 100644 --- a/drivers/watchdog/imxwd.c +++ b/drivers/watchdog/imxwd.c @@ -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; |