summaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorJuergen Beisert <jbe@pengutronix.de>2012-11-30 12:14:04 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2012-12-03 09:49:52 +0100
commit17176c2e2bba606190d9ae51943acb5701063573 (patch)
treea0360240e3a23cad643a422c9c3e8df39059063b /drivers/watchdog
parent7ce8a13c26eb47a0aa115f9001a9dcc7805085e9 (diff)
downloadbarebox-17176c2e2bba606190d9ae51943acb5701063573.tar.gz
barebox-17176c2e2bba606190d9ae51943acb5701063573.tar.xz
ARM/MXS/i.MX28: distinguish POR and wake-up event correctly
When the built-in RTC in the i.MX28 is programmed to wake-up the SoC, the RTC reports two events: RST and WAKE. RST is okay in this case, because the PMIC was really powered down. But the real event is the WAKE from the RTC and should have precedence over the RST event. So, report the WAKE event for this special case. Signed-off-by: Juergen Beisert <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/im28wd.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/watchdog/im28wd.c b/drivers/watchdog/im28wd.c
index ca32a729d2..bc19369782 100644
--- a/drivers/watchdog/im28wd.c
+++ b/drivers/watchdog/im28wd.c
@@ -82,6 +82,17 @@ static void __maybe_unused imx28_detect_reset_source(const struct imx28_wd *p)
if (reg & MXS_RTC_PERSISTENT0_EXT_RST) {
writel(MXS_RTC_PERSISTENT0_EXT_RST,
p->regs + MXS_RTC_PERSISTENT0 + MXS_RTC_CLR_ADDR);
+ /*
+ * if the RTC has woken up the SoC, additionally the ALARM_WAKE
+ * bit is set. This bit should have precedence, because it
+ * reports the real event, why we are here.
+ */
+ if (reg & MXS_RTC_PERSISTENT0_ALARM_WAKE) {
+ writel(MXS_RTC_PERSISTENT0_ALARM_WAKE,
+ p->regs + MXS_RTC_PERSISTENT0 + MXS_RTC_CLR_ADDR);
+ set_reset_source(RESET_WKE);
+ return;
+ }
set_reset_source(RESET_POR);
return;
}