From 58e5637333afc2bb024ff8aef212311be0614d47 Mon Sep 17 00:00:00 2001 From: Dinh Nguyen Date: Tue, 22 Oct 2013 11:59:12 -0500 Subject: [PATCH] watchdog: dw: Enable OF support for DW watchdog timer Add device tree support to the DW watchdog timer. Signed-off-by: Dinh Nguyen Acked-by: Jamie Iles Acked-by: Mark Rutland Reviewed-by: Pavel Machek Reviewed-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Cc: Viresh Kumar Cc: Rob Herring Cc: Pawel Moll Cc: Stephen Warren Cc: Ian Campbell Cc: devicetree@vger.kernel.org Cc: linux-watchdog@vger.kernel.org --- .../devicetree/bindings/watchdog/dw_wdt.txt | 21 +++++++++++++++++++ drivers/watchdog/dw_wdt.c | 10 +++++++++ 2 files changed, 31 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 000000000000..08e16f684f2d --- /dev/null +++ b/Documentation/devicetree/bindings/watchdog/dw_wdt.txt @@ -0,0 +1,21 @@ +Synopsys Designware Watchdog Timer + +Required Properties: + +- compatible : Should contain "snps,dw-wdt" +- reg : Base address and size of the watchdog timer registers. +- clocks : phandle + clock-specifier for the clock that drives the + watchdog timer. + +Optional Properties: + +- interrupts : The interrupt used for the watchdog timeout warning. + +Example: + + watchdog0: wd@ffd02000 { + compatible = "snps,dw-wdt"; + reg = <0xffd02000 0x1000>; + interrupts = <0 171 4>; + clocks = <&per_base_clk>; + }; diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c index 42cfd79edf2a..a46f5c7ee7ff 100644 --- a/drivers/watchdog/dw_wdt.c +++ b/drivers/watchdog/dw_wdt.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -337,12 +338,21 @@ static int dw_wdt_drv_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_OF +static const struct of_device_id dw_wdt_of_match[] = { + { .compatible = "snps,dw-wdt", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, dw_wdt_of_match); +#endif + 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), .pm = &dw_wdt_pm_ops, }, }; -- GitLab