ipq806x: set v4.9 as default
[openwrt/openwrt.git] / target / linux / ipq806x / patches-4.4 / 010-4-watchdog-qcom-Report-reboot-reason.patch
1 From b6ef36d2c1e391adc1fe1b2dd2a0f887a9f3052b Mon Sep 17 00:00:00 2001
2 From: Guenter Roeck <groeck@chromium.org>
3 Date: Mon, 4 Apr 2016 17:37:46 -0700
4 Subject: watchdog: qcom: Report reboot reason
5
6 The Qualcom watchdog timer block reports if the system was reset by the
7 watchdog. Pass the information to user space.
8
9 Reviewed-by: Grant Grundler <grundler@chromium.org>
10 Tested-by: Grant Grundler <grundler@chromium.org>
11 Signed-off-by: Guenter Roeck <groeck@chromium.org>
12 Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
13 ---
14 drivers/watchdog/qcom-wdt.c | 7 ++++++-
15 1 file changed, 6 insertions(+), 1 deletion(-)
16
17 --- a/drivers/watchdog/qcom-wdt.c
18 +++ b/drivers/watchdog/qcom-wdt.c
19 @@ -21,6 +21,7 @@
20
21 #define WDT_RST 0x38
22 #define WDT_EN 0x40
23 +#define WDT_STS 0x44
24 #define WDT_BITE_TIME 0x5C
25
26 struct qcom_wdt {
27 @@ -108,7 +109,8 @@ static const struct watchdog_ops qcom_wd
28 static const struct watchdog_info qcom_wdt_info = {
29 .options = WDIOF_KEEPALIVEPING
30 | WDIOF_MAGICCLOSE
31 - | WDIOF_SETTIMEOUT,
32 + | WDIOF_SETTIMEOUT
33 + | WDIOF_CARDRESET,
34 .identity = KBUILD_MODNAME,
35 };
36
37 @@ -171,6 +173,9 @@ static int qcom_wdt_probe(struct platfor
38 wdt->wdd.max_timeout = 0x10000000U / wdt->rate;
39 wdt->wdd.parent = &pdev->dev;
40
41 + if (readl(wdt->base + WDT_STS) & 1)
42 + wdt->wdd.bootstatus = WDIOF_CARDRESET;
43 +
44 /*
45 * If 'timeout-sec' unspecified in devicetree, assume a 30 second
46 * default, unless the max timeout is less than 30 seconds, then use