Skip to content

Commit

Permalink
watchdog: qcom: Report reboot reason
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Guenter Roeck authored and Wim Van Sebroeck committed May 14, 2016
1 parent 44549e8 commit b6ef36d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/watchdog/qcom-wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#define WDT_RST 0x38
#define WDT_EN 0x40
#define WDT_STS 0x44
#define WDT_BITE_TIME 0x5C

struct qcom_wdt {
Expand Down Expand Up @@ -108,7 +109,8 @@ static const struct watchdog_ops qcom_wdt_ops = {
static const struct watchdog_info qcom_wdt_info = {
.options = WDIOF_KEEPALIVEPING
| WDIOF_MAGICCLOSE
| WDIOF_SETTIMEOUT,
| WDIOF_SETTIMEOUT
| WDIOF_CARDRESET,
.identity = KBUILD_MODNAME,
};

Expand Down Expand Up @@ -171,6 +173,9 @@ static int qcom_wdt_probe(struct platform_device *pdev)
wdt->wdd.max_timeout = 0x10000000U / wdt->rate;
wdt->wdd.parent = &pdev->dev;

if (readl(wdt->base + WDT_STS) & 1)
wdt->wdd.bootstatus = WDIOF_CARDRESET;

/*
* If 'timeout-sec' unspecified in devicetree, assume a 30 second
* default, unless the max timeout is less than 30 seconds, then use
Expand Down

0 comments on commit b6ef36d

Please sign in to comment.