0029-soc-mediatek-PMIC-wrap-clear-the-STAUPD_TRIG-bit-of-.patch 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. From b92861fbc79b3a7a9bc1c51e2dbfa2c191cc27ea Mon Sep 17 00:00:00 2001
  2. From: Henry Chen <henryc.chen@mediatek.com>
  3. Date: Thu, 21 Jan 2016 19:04:00 +0800
  4. Subject: [PATCH 029/102] soc: mediatek: PMIC wrap: clear the STAUPD_TRIG bit
  5. of WDT_SRC_EN
  6. Since STAUPD interrupts aren't handled on mt8173, disable watchdog timeout
  7. monitor of STAUPD to avoid WDT_INT triggered by STAUPD.
  8. Signed-off-by: Henry Chen <henryc.chen@mediatek.com>
  9. Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
  10. Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
  11. ---
  12. drivers/soc/mediatek/mtk-pmic-wrap.c | 19 +++++++++++++++++--
  13. 1 file changed, 17 insertions(+), 2 deletions(-)
  14. --- a/drivers/soc/mediatek/mtk-pmic-wrap.c
  15. +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
  16. @@ -60,6 +60,15 @@
  17. #define PWRAP_MAN_CMD_OP_OUTD (0x9 << 8)
  18. #define PWRAP_MAN_CMD_OP_OUTQ (0xa << 8)
  19. +/* macro for Watch Dog Timer Source */
  20. +#define PWRAP_WDT_SRC_EN_STAUPD_TRIG (1 << 25)
  21. +#define PWRAP_WDT_SRC_EN_HARB_STAUPD_DLE (1 << 20)
  22. +#define PWRAP_WDT_SRC_EN_HARB_STAUPD_ALE (1 << 6)
  23. +#define PWRAP_WDT_SRC_MASK_ALL 0xffffffff
  24. +#define PWRAP_WDT_SRC_MASK_NO_STAUPD ~(PWRAP_WDT_SRC_EN_STAUPD_TRIG | \
  25. + PWRAP_WDT_SRC_EN_HARB_STAUPD_DLE | \
  26. + PWRAP_WDT_SRC_EN_HARB_STAUPD_ALE)
  27. +
  28. /* macro for slave device wrapper registers */
  29. #define PWRAP_DEW_BASE 0xbc00
  30. #define PWRAP_DEW_EVENT_OUT_EN (PWRAP_DEW_BASE + 0x0)
  31. @@ -822,7 +831,7 @@ MODULE_DEVICE_TABLE(of, of_pwrap_match_t
  32. static int pwrap_probe(struct platform_device *pdev)
  33. {
  34. - int ret, irq;
  35. + int ret, irq, wdt_src;
  36. struct pmic_wrapper *wrp;
  37. struct device_node *np = pdev->dev.of_node;
  38. const struct of_device_id *of_id =
  39. @@ -912,7 +921,13 @@ static int pwrap_probe(struct platform_d
  40. /* Initialize watchdog, may not be done by the bootloader */
  41. pwrap_writel(wrp, 0xf, PWRAP_WDT_UNIT);
  42. - pwrap_writel(wrp, 0xffffffff, PWRAP_WDT_SRC_EN);
  43. + /*
  44. + * Since STAUPD was not used on mt8173 platform,
  45. + * so STAUPD of WDT_SRC which should be turned off
  46. + */
  47. + wdt_src = pwrap_is_mt8173(wrp) ?
  48. + PWRAP_WDT_SRC_MASK_NO_STAUPD : PWRAP_WDT_SRC_MASK_ALL;
  49. + pwrap_writel(wrp, wdt_src, PWRAP_WDT_SRC_EN);
  50. pwrap_writel(wrp, 0x1, PWRAP_TIMER_EN);
  51. pwrap_writel(wrp, ~((1 << 31) | (1 << 1)), PWRAP_INT_EN);