| From b16f66d354ab2349eefb4f2ca92001f61962251d Mon Sep 17 00:00:00 2001 |
| From: Fabio Estevam <festevam@gmail.com> |
| Date: Sun, 12 Apr 2020 20:01:22 -0300 |
| Subject: [PATCH] watchdog: imx_sc_wdt: Fix reboot on crash |
| |
| commit e56d48e92b1017b6a8dbe64923a889283733fd96 upstream. |
| |
| Currently when running the samples/watchdog/watchdog-simple.c |
| application and forcing a kernel crash by doing: |
| |
| # ./watchdog-simple & |
| # echo c > /proc/sysrq-trigger |
| |
| The system does not reboot as expected. |
| |
| Fix it by calling imx_sc_wdt_set_timeout() to configure the i.MX8QXP |
| watchdog with a proper timeout. |
| |
| Cc: <stable@vger.kernel.org> |
| Fixes: 986857acbc9a ("watchdog: imx_sc: Add i.MX system controller watchdog support") |
| Reported-by: Breno Lima <breno.lima@nxp.com> |
| Signed-off-by: Fabio Estevam <festevam@gmail.com> |
| Reviewed-by: Guenter Roeck <linux@roeck-us.net> |
| Tested-by: Breno Lima <breno.lima@nxp.com> |
| Link: https://lore.kernel.org/r/20200412230122.5601-1-festevam@gmail.com |
| Signed-off-by: Guenter Roeck <linux@roeck-us.net> |
| Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/watchdog/imx_sc_wdt.c b/drivers/watchdog/imx_sc_wdt.c |
| index 49848b66186c..8916fe9a74e9 100644 |
| --- a/drivers/watchdog/imx_sc_wdt.c |
| +++ b/drivers/watchdog/imx_sc_wdt.c |
| @@ -119,6 +119,11 @@ static int imx_sc_wdt_probe(struct platform_device *pdev) |
| imx_sc_wdd->timeout = DEFAULT_TIMEOUT; |
| |
| watchdog_init_timeout(imx_sc_wdd, 0, dev); |
| + |
| + ret = imx_sc_wdt_set_timeout(imx_sc_wdd, imx_sc_wdd->timeout); |
| + if (ret) |
| + return ret; |
| + |
| watchdog_stop_on_reboot(imx_sc_wdd); |
| watchdog_stop_on_unregister(imx_sc_wdd); |
| |
| -- |
| 2.27.0 |
| |