010-6-watchdog-qcom-configure-BARK-time-in-addition-to-BITE-time.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. From 10073a205df269abcbd9c3fbc690a813827107ef Mon Sep 17 00:00:00 2001
  2. From: Matthew McClintock <mmcclint@codeaurora.org>
  3. Date: Tue, 28 Jun 2016 11:35:21 -0700
  4. Subject: watchdog: qcom: configure BARK time in addition to BITE time
  5. For certain parts and some versions of TZ, TZ will reset the chip
  6. when a BARK is triggered even though it was not configured here. So
  7. by default let's configure this BARK time as well.
  8. Signed-off-by: Matthew McClintock <mmcclint@codeaurora.org>
  9. Reviewed-by: Guenter Roeck <linux@roeck-us.net>
  10. Signed-off-by: Thomas Pedersen <twp@codeaurora.org>
  11. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
  12. Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
  13. ---
  14. drivers/watchdog/qcom-wdt.c | 5 +++++
  15. 1 file changed, 5 insertions(+)
  16. --- a/drivers/watchdog/qcom-wdt.c
  17. +++ b/drivers/watchdog/qcom-wdt.c
  18. @@ -24,6 +24,7 @@ enum wdt_reg {
  19. WDT_RST,
  20. WDT_EN,
  21. WDT_STS,
  22. + WDT_BARK_TIME,
  23. WDT_BITE_TIME,
  24. };
  25. @@ -31,6 +32,7 @@ static const u32 reg_offset_data_apcs_tm
  26. [WDT_RST] = 0x38,
  27. [WDT_EN] = 0x40,
  28. [WDT_STS] = 0x44,
  29. + [WDT_BARK_TIME] = 0x4C,
  30. [WDT_BITE_TIME] = 0x5C,
  31. };
  32. @@ -38,6 +40,7 @@ static const u32 reg_offset_data_kpss[]
  33. [WDT_RST] = 0x4,
  34. [WDT_EN] = 0x8,
  35. [WDT_STS] = 0xC,
  36. + [WDT_BARK_TIME] = 0x10,
  37. [WDT_BITE_TIME] = 0x14,
  38. };
  39. @@ -66,6 +69,7 @@ static int qcom_wdt_start(struct watchdo
  40. writel(0, wdt_addr(wdt, WDT_EN));
  41. writel(1, wdt_addr(wdt, WDT_RST));
  42. + writel(wdd->timeout * wdt->rate, wdt_addr(wdt, WDT_BARK_TIME));
  43. writel(wdd->timeout * wdt->rate, wdt_addr(wdt, WDT_BITE_TIME));
  44. writel(1, wdt_addr(wdt, WDT_EN));
  45. return 0;
  46. @@ -108,6 +112,7 @@ static int qcom_wdt_restart(struct watch
  47. writel(0, wdt_addr(wdt, WDT_EN));
  48. writel(1, wdt_addr(wdt, WDT_RST));
  49. + writel(timeout, wdt_addr(wdt, WDT_BARK_TIME));
  50. writel(timeout, wdt_addr(wdt, WDT_BITE_TIME));
  51. writel(1, wdt_addr(wdt, WDT_EN));