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