From: Dinh Nguyen <[email protected]>

Add device tree support to the DW watchdog timer.

Signed-off-by: Dinh Nguyen <[email protected]>
Acked-by: Jamie Iles <[email protected]>
Reviewed-by: Pavel Machek <[email protected]>
Cc: Guenter Roeck <[email protected]>
Cc: Jamie Iles <[email protected]>
Cc: Viresh Kumar <[email protected]>
Cc: Wim Van Sebroeck <[email protected]>
Cc: Pavel Machek <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Pawel Moll <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Stephen Warren <[email protected]>
Cc: Ian Campbell <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
v3:
- Clean up documentation
v2:
- Use of_match_ptr() for of_match_table
---
 .../devicetree/bindings/watchdog/dw_wdt.txt        |   14 ++++++++++++++
 drivers/watchdog/dw_wdt.c                          |    8 ++++++++
 2 files changed, 22 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/watchdog/dw_wdt.txt

diff --git a/Documentation/devicetree/bindings/watchdog/dw_wdt.txt 
b/Documentation/devicetree/bindings/watchdog/dw_wdt.txt
new file mode 100644
index 0000000..c5e9b65
--- /dev/null
+++ b/Documentation/devicetree/bindings/watchdog/dw_wdt.txt
@@ -0,0 +1,14 @@
+Synopsys Designware Watchdog Timer
+
+Required Properties:
+
+- compatible   : Should be "snps,dw-wdt"
+- reg          : Base address and size of the watchdog timer register.
+
+Example:
+
+       watchdog0: wd@ffd02000 {
+               compatible = "snps,dw-wdt";
+               reg = <0xffd02000 0x1000>;
+               clocks = <&per_base_clk>;
+       };
diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index e621098..261fa42 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -29,6 +29,7 @@
 #include <linux/miscdevice.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
+#include <linux/of.h>
 #include <linux/pm.h>
 #include <linux/platform_device.h>
 #include <linux/spinlock.h>
@@ -340,12 +341,19 @@ static int dw_wdt_drv_remove(struct platform_device *pdev)
        return 0;
 }
 
+static const struct of_device_id dw_wdt_of_match[] = {
+       { .compatible = "snps,dw-wdt", },
+       { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, dw_wdt_of_match);
+
 static struct platform_driver dw_wdt_driver = {
        .probe          = dw_wdt_drv_probe,
        .remove         = dw_wdt_drv_remove,
        .driver         = {
                .name   = "dw_wdt",
                .owner  = THIS_MODULE,
+               .of_match_table = of_match_ptr(dw_wdt_of_match),
 #ifdef CONFIG_PM
                .pm     = &dw_wdt_pm_ops,
 #endif /* CONFIG_PM */
-- 
1.7.9.5


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to