Skip to contentSkip to conversation

wdog: imx-wd: Fix imx soc reset

PATCH In review Stefan Christ 2 participants 2 messages Nov 27, 2015 – Nov 30, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wdog: imx-wd: Fix imx soc reset

From: Christian Hemp <[email protected]>

On i.MX6 boards the reset command doesn't work, after the commit "wdog:
imx-wd: watchdog cannot be disabled again". This commit doesn't allow negative values, but the imx reset handler passes -1 to the imx21_watchdog_set_timeout function for a reset in 0.5 seconds. This patch allows -1 as timeout to set the watchdog to 0.5 seconds.

---
Hi,

I'm sending this patch on behalf of Christian Hemp. The patch fixes a regression currently in the next branch.

Best regards,
Stefan Christ

---
 drivers/watchdog/imxwd.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/watchdog/imxwd.c +6 -3
index bb0d2db..1952548 100644
@@ -97,14 +97,17 @@ static int imx21_watchdog_set_timeout(struct imx_wd *priv, int timeout)
 
 	dev_dbg(priv->dev, "%s: %d\n", __func__, timeout);
 
-	if (timeout < 0 || timeout > 128)
+	if (timeout < -1 || timeout > 128)
 		return -EINVAL;
 
 	if (timeout == 0) /* bit 2 (WDE) cannot be set to 0 again */
 		return -ENOSYS;
 
-	val = ((timeout * 2 - 1) << 8) | IMX21_WDOG_WCR_SRS |
-		IMX21_WDOG_WCR_WDA;
+	if (timeout > 0)
+		val = ((timeout * 2 - 1) << 8) | IMX21_WDOG_WCR_SRS |
+			IMX21_WDOG_WCR_WDA;
+	else
+		val = 0;
 
 	writew(val, priv->base + IMX21_WDOG_WCR);
 	writew(IMX21_WDOG_WCR_WDE | val, priv->base + IMX21_WDOG_WCR);
Signature · 7 lines
1.9.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
maintainer
#1 lore raw
Quoted 10 lines · Stefan Christ

From: Christian Hemp <[email protected]>

On i.MX6 boards the reset command doesn't work, after the commit "wdog:
imx-wd: watchdog cannot be disabled again". This commit doesn't allow negative values, but the imx reset handler passes -1 to the imx21_watchdog_set_timeout function for a reset in 0.5 seconds. This patch allows -1 as timeout to set the watchdog to 0.5 seconds.

Squashed into the commit breaking it.

Thanks,
Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox