ipq806x: add support for 4.0 kernel
[openwrt/openwrt.git] / target / linux / ipq806x / patches-4.0 / 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 diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c
18 index aa85618..aa03ca8 100644
19 --- a/drivers/watchdog/qcom-wdt.c
20 +++ b/drivers/watchdog/qcom-wdt.c
21 @@ -20,9 +20,9 @@
22 #include <linux/reboot.h>
23 #include <linux/watchdog.h>
24
25 -#define WDT_RST 0x0
26 -#define WDT_EN 0x8
27 -#define WDT_BITE_TIME 0x24
28 +#define WDT_RST 0x38
29 +#define WDT_EN 0x40
30 +#define WDT_BITE_TIME 0x5C
31
32 struct qcom_wdt {
33 struct watchdog_device wdd;
34 @@ -117,6 +117,8 @@ static int qcom_wdt_probe(struct platform_device *pdev)
35 {
36 struct qcom_wdt *wdt;
37 struct resource *res;
38 + struct device_node *np = pdev->dev.of_node;
39 + u32 percpu_offset;
40 int ret;
41
42 wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL);
43 @@ -124,6 +126,14 @@ static int qcom_wdt_probe(struct platform_device *pdev)
44 return -ENOMEM;
45
46 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
47 +
48 + /* We use CPU0's DGT for the watchdog */
49 + if (of_property_read_u32(np, "cpu-offset", &percpu_offset))
50 + percpu_offset = 0;
51 +
52 + res->start += percpu_offset;
53 + res->end += percpu_offset;
54 +
55 wdt->base = devm_ioremap_resource(&pdev->dev, res);
56 if (IS_ERR(wdt->base))
57 return PTR_ERR(wdt->base);
58 @@ -203,9 +213,8 @@ static int qcom_wdt_remove(struct platform_device *pdev)
59 }
60
61 static const struct of_device_id qcom_wdt_of_table[] = {
62 - { .compatible = "qcom,kpss-wdt-msm8960", },
63 - { .compatible = "qcom,kpss-wdt-apq8064", },
64 - { .compatible = "qcom,kpss-wdt-ipq8064", },
65 + { .compatible = "qcom,kpss-timer" },
66 + { .compatible = "qcom,scss-timer" },
67 { },
68 };
69 MODULE_DEVICE_TABLE(of, qcom_wdt_of_table);
70 --
71 1.9.1
72