011-watchdog-qcom-use-timer-devicetree-binding.patch 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. From fded70251b1b58f68de1d3757ece9965f0b75452 Mon Sep 17 00:00:00 2001
  2. From: Mathieu Olivari <mathieu@codeaurora.org>
  3. Date: Thu, 19 Feb 2015 20:19:30 -0800
  4. Subject: [PATCH 1/3] watchdog: qcom: use timer devicetree binding
  5. MSM watchdog configuration happens in the same register block as the
  6. timer, so we'll use the same binding as the existing timer.
  7. The qcom-wdt will now be probed when devicetree has an entry compatible
  8. with "qcom,kpss-timer" or "qcom-scss-timer".
  9. Signed-off-by: Mathieu Olivari <mathieu@codeaurora.org>
  10. ---
  11. drivers/watchdog/qcom-wdt.c | 21 +++++++++++++++------
  12. 1 file changed, 15 insertions(+), 6 deletions(-)
  13. --- a/drivers/watchdog/qcom-wdt.c
  14. +++ b/drivers/watchdog/qcom-wdt.c
  15. @@ -20,9 +20,9 @@
  16. #include <linux/reboot.h>
  17. #include <linux/watchdog.h>
  18. -#define WDT_RST 0x0
  19. -#define WDT_EN 0x8
  20. -#define WDT_BITE_TIME 0x24
  21. +#define WDT_RST 0x38
  22. +#define WDT_EN 0x40
  23. +#define WDT_BITE_TIME 0x5C
  24. struct qcom_wdt {
  25. struct watchdog_device wdd;
  26. @@ -117,6 +117,8 @@ static int qcom_wdt_probe(struct platfor
  27. {
  28. struct qcom_wdt *wdt;
  29. struct resource *res;
  30. + struct device_node *np = pdev->dev.of_node;
  31. + u32 percpu_offset;
  32. int ret;
  33. wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL);
  34. @@ -124,6 +126,14 @@ static int qcom_wdt_probe(struct platfor
  35. return -ENOMEM;
  36. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  37. +
  38. + /* We use CPU0's DGT for the watchdog */
  39. + if (of_property_read_u32(np, "cpu-offset", &percpu_offset))
  40. + percpu_offset = 0;
  41. +
  42. + res->start += percpu_offset;
  43. + res->end += percpu_offset;
  44. +
  45. wdt->base = devm_ioremap_resource(&pdev->dev, res);
  46. if (IS_ERR(wdt->base))
  47. return PTR_ERR(wdt->base);
  48. @@ -203,9 +213,8 @@ static int qcom_wdt_remove(struct platfo
  49. }
  50. static const struct of_device_id qcom_wdt_of_table[] = {
  51. - { .compatible = "qcom,kpss-wdt-msm8960", },
  52. - { .compatible = "qcom,kpss-wdt-apq8064", },
  53. - { .compatible = "qcom,kpss-wdt-ipq8064", },
  54. + { .compatible = "qcom,kpss-timer" },
  55. + { .compatible = "qcom,scss-timer" },
  56. { },
  57. };
  58. MODULE_DEVICE_TABLE(of, qcom_wdt_of_table);