summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-11-15 14:28:51 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-11-16 16:55:50 +0100
commit475eac0d469f38654626734944fab4c63a32bd58 (patch)
treefb02670540bef76bdfee65c4aac97e3bf9ccb29a
parent9b14a8b4b9f5d080bebc8fa9c2f0d45c787b87f5 (diff)
downloadbarebox-475eac0d469f38654626734944fab4c63a32bd58.tar.gz
barebox-475eac0d469f38654626734944fab4c63a32bd58.tar.xz
ARM: i.MX: When SRSR shows wdog then lookup reset source in wdog
On i.MX6 when the watchdog has resetted the system then the SRSR register correctly shows that the watchdog has resetted the system. This is not the desired result though, a "reset" in barebox or "reboot" in Linux should result in "RST" as reset source. So instead of making the SRSR register value overwrite the reset source read from the watchdog registers, interpret the SRSR value corresponding to watchdog reset as "lookup details in the watchdog registers". Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
-rw-r--r--arch/arm/mach-imx/imx.c6
-rw-r--r--drivers/watchdog/imxwd.c10
2 files changed, 8 insertions, 8 deletions
diff --git a/arch/arm/mach-imx/imx.c b/arch/arm/mach-imx/imx.c
index ad227663dd..63914d306e 100644
--- a/arch/arm/mach-imx/imx.c
+++ b/arch/arm/mach-imx/imx.c
@@ -199,12 +199,8 @@ void imx_set_reset_reason(void __iomem *srsr,
}
}
- /*
- * Report this with above default priority in order to make
- * sure we'll always override info from watchdog driver.
- */
reset_source_set_priority(type,
- RESET_SOURCE_DEFAULT_PRIORITY + 1);
+ RESET_SOURCE_DEFAULT_PRIORITY);
reset_source_set_instance(type, instance);
pr_info("i.MX reset reason %s (SRSR: 0x%08x)\n",
diff --git a/drivers/watchdog/imxwd.c b/drivers/watchdog/imxwd.c
index a66fae400c..8dba662392 100644
--- a/drivers/watchdog/imxwd.c
+++ b/drivers/watchdog/imxwd.c
@@ -162,19 +162,23 @@ static void __noreturn imxwd_force_soc_reset(struct restart_handler *rst)
static void imx_watchdog_detect_reset_source(struct imx_wd *priv)
{
u16 val = readw(priv->base + IMX21_WDOG_WSTR);
+ int priority = RESET_SOURCE_DEFAULT_PRIORITY;
+
+ if (reset_source_get() == RESET_WDG)
+ priority++;
if (val & WSTR_COLDSTART) {
- reset_source_set(RESET_POR);
+ reset_source_set_priority(RESET_POR, priority);
return;
}
if (val & (WSTR_HARDRESET | WSTR_WARMSTART)) {
- reset_source_set(RESET_RST);
+ reset_source_set_priority(RESET_RST, priority);
return;
}
if (val & WSTR_WDOG) {
- reset_source_set(RESET_WDG);
+ reset_source_set_priority(RESET_WDG, priority);
return;
}