0037-soc-mediatek-PMIC-wrap-move-wdt_src-into-the-pmic_wr.patch 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. From 6aecbc79322efd3068c6140f74a68654fbe5b5f6 Mon Sep 17 00:00:00 2001
  2. From: John Crispin <blogic@openwrt.org>
  3. Date: Wed, 20 Jan 2016 10:48:35 +0100
  4. Subject: [PATCH 037/102] soc: mediatek: PMIC wrap: move wdt_src into the
  5. pmic_wrapper_type struct
  6. Different SoCs will use different bitmask for the wdt_src. This patch
  7. defines the bitmask in the pmic_wrapper_type struct. This allows us to
  8. support new SoCs with a different bitmask to the one currently used.
  9. Signed-off-by: John Crispin <blogic@openwrt.org>
  10. ---
  11. drivers/soc/mediatek/mtk-pmic-wrap.c | 9 +++++----
  12. 1 file changed, 5 insertions(+), 4 deletions(-)
  13. --- a/drivers/soc/mediatek/mtk-pmic-wrap.c
  14. +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
  15. @@ -373,6 +373,7 @@ struct pmic_wrapper_type {
  16. u32 arb_en_all;
  17. u32 int_en_all;
  18. u32 spi_w;
  19. + u32 wdt_src;
  20. int (*init_reg_clock)(struct pmic_wrapper *wrp);
  21. int (*init_soc_specific)(struct pmic_wrapper *wrp);
  22. };
  23. @@ -829,6 +830,7 @@ static struct pmic_wrapper_type pwrap_mt
  24. .arb_en_all = 0x1ff,
  25. .int_en_all = ~(BIT(31) | BIT(1)),
  26. .spi_w = PWRAP_MAN_CMD_SPI_WRITE,
  27. + .wdt_src = PWRAP_WDT_SRC_MASK_ALL,
  28. .init_reg_clock = pwrap_mt8135_init_reg_clock,
  29. .init_soc_specific = pwrap_mt8135_init_soc_specific,
  30. };
  31. @@ -839,6 +841,7 @@ static struct pmic_wrapper_type pwrap_mt
  32. .arb_en_all = 0x3f,
  33. .int_en_all = ~(BIT(31) | BIT(1)),
  34. .spi_w = PWRAP_MAN_CMD_SPI_WRITE,
  35. + .wdt_src = PWRAP_WDT_SRC_MASK_NO_STAUPD,
  36. .init_reg_clock = pwrap_mt8173_init_reg_clock,
  37. .init_soc_specific = pwrap_mt8173_init_soc_specific,
  38. };
  39. @@ -858,7 +861,7 @@ MODULE_DEVICE_TABLE(of, of_pwrap_match_t
  40. static int pwrap_probe(struct platform_device *pdev)
  41. {
  42. - int ret, irq, wdt_src;
  43. + int ret, irq;
  44. struct pmic_wrapper *wrp;
  45. struct device_node *np = pdev->dev.of_node;
  46. const struct of_device_id *of_id =
  47. @@ -948,9 +951,7 @@ static int pwrap_probe(struct platform_d
  48. * Since STAUPD was not used on mt8173 platform,
  49. * so STAUPD of WDT_SRC which should be turned off
  50. */
  51. - wdt_src = pwrap_is_mt8173(wrp) ?
  52. - PWRAP_WDT_SRC_MASK_NO_STAUPD : PWRAP_WDT_SRC_MASK_ALL;
  53. - pwrap_writel(wrp, wdt_src, PWRAP_WDT_SRC_EN);
  54. + pwrap_writel(wrp, wrp->master->wdt_src, PWRAP_WDT_SRC_EN);
  55. pwrap_writel(wrp, 0x1, PWRAP_TIMER_EN);
  56. pwrap_writel(wrp, wrp->master->int_en_all, PWRAP_INT_EN);