diff options
author | Guenter Roeck <groeck@chromium.org> | 2016-04-04 20:37:46 -0400 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2016-05-14 03:08:01 -0400 |
commit | b6ef36d2c1e391adc1fe1b2dd2a0f887a9f3052b (patch) | |
tree | ad72b98e55b0b1cd6d537b9f3951fc1e48872804 | |
parent | 44549e8f5eea4e0a41b487b63e616cb089922b99 (diff) |
watchdog: qcom: Report reboot reason
The Qualcom watchdog timer block reports if the system was reset by the
watchdog. Pass the information to user space.
Reviewed-by: Grant Grundler <grundler@chromium.org>
Tested-by: Grant Grundler <grundler@chromium.org>
Signed-off-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
-rw-r--r-- | drivers/watchdog/qcom-wdt.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c index 20563ccb7be0..a043fa4f60e5 100644 --- a/drivers/watchdog/qcom-wdt.c +++ b/drivers/watchdog/qcom-wdt.c | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #define WDT_RST 0x38 | 22 | #define WDT_RST 0x38 |
23 | #define WDT_EN 0x40 | 23 | #define WDT_EN 0x40 |
24 | #define WDT_STS 0x44 | ||
24 | #define WDT_BITE_TIME 0x5C | 25 | #define WDT_BITE_TIME 0x5C |
25 | 26 | ||
26 | struct qcom_wdt { | 27 | struct qcom_wdt { |
@@ -108,7 +109,8 @@ static const struct watchdog_ops qcom_wdt_ops = { | |||
108 | static const struct watchdog_info qcom_wdt_info = { | 109 | static const struct watchdog_info qcom_wdt_info = { |
109 | .options = WDIOF_KEEPALIVEPING | 110 | .options = WDIOF_KEEPALIVEPING |
110 | | WDIOF_MAGICCLOSE | 111 | | WDIOF_MAGICCLOSE |
111 | | WDIOF_SETTIMEOUT, | 112 | | WDIOF_SETTIMEOUT |
113 | | WDIOF_CARDRESET, | ||
112 | .identity = KBUILD_MODNAME, | 114 | .identity = KBUILD_MODNAME, |
113 | }; | 115 | }; |
114 | 116 | ||
@@ -171,6 +173,9 @@ static int qcom_wdt_probe(struct platform_device *pdev) | |||
171 | wdt->wdd.max_timeout = 0x10000000U / wdt->rate; | 173 | wdt->wdd.max_timeout = 0x10000000U / wdt->rate; |
172 | wdt->wdd.parent = &pdev->dev; | 174 | wdt->wdd.parent = &pdev->dev; |
173 | 175 | ||
176 | if (readl(wdt->base + WDT_STS) & 1) | ||
177 | wdt->wdd.bootstatus = WDIOF_CARDRESET; | ||
178 | |||
174 | /* | 179 | /* |
175 | * If 'timeout-sec' unspecified in devicetree, assume a 30 second | 180 | * If 'timeout-sec' unspecified in devicetree, assume a 30 second |
176 | * default, unless the max timeout is less than 30 seconds, then use | 181 | * default, unless the max timeout is less than 30 seconds, then use |