010-4-watchdog-qcom-Report-reboot-reason.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. The Qualcom watchdog timer block reports if the system was reset by the
  6. watchdog. Pass the information to user space.
  7. Reviewed-by: Grant Grundler <grundler@chromium.org>
  8. Tested-by: Grant Grundler <grundler@chromium.org>
  9. Signed-off-by: Guenter Roeck <groeck@chromium.org>
  10. Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
  11. ---
  12. drivers/watchdog/qcom-wdt.c | 7 ++++++-
  13. 1 file changed, 6 insertions(+), 1 deletion(-)
  14. --- a/drivers/watchdog/qcom-wdt.c
  15. +++ b/drivers/watchdog/qcom-wdt.c
  16. @@ -21,6 +21,7 @@
  17. #define WDT_RST 0x38
  18. #define WDT_EN 0x40
  19. +#define WDT_STS 0x44
  20. #define WDT_BITE_TIME 0x5C
  21. struct qcom_wdt {
  22. @@ -108,7 +109,8 @@ static const struct watchdog_ops qcom_wd
  23. static const struct watchdog_info qcom_wdt_info = {
  24. .options = WDIOF_KEEPALIVEPING
  25. | WDIOF_MAGICCLOSE
  26. - | WDIOF_SETTIMEOUT,
  27. + | WDIOF_SETTIMEOUT
  28. + | WDIOF_CARDRESET,
  29. .identity = KBUILD_MODNAME,
  30. };
  31. @@ -171,6 +173,9 @@ static int qcom_wdt_probe(struct platfor
  32. wdt->wdd.max_timeout = 0x10000000U / wdt->rate;
  33. wdt->wdd.parent = &pdev->dev;
  34. + if (readl(wdt->base + WDT_STS) & 1)
  35. + wdt->wdd.bootstatus = WDIOF_CARDRESET;
  36. +
  37. /*
  38. * If 'timeout-sec' unspecified in devicetree, assume a 30 second
  39. * default, unless the max timeout is less than 30 seconds, then use