Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

watchdog: dw: Enable OF support for DW watchdog timer

Add device tree support to the DW watchdog timer.

Signed-off-by: Dinh Nguyen <dinguyen@altera.com>
Acked-by: Jamie Iles <jamie@jamieiles.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Pavel Machek <pavel@denx.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Cc: Viresh Kumar <viresh.linux@gmail.com>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
Cc: devicetree@vger.kernel.org
Cc: linux-watchdog@vger.kernel.org

authored by

Dinh Nguyen and committed by
Wim Van Sebroeck
58e56373 487722cf

+31
+21
Documentation/devicetree/bindings/watchdog/dw_wdt.txt
··· 1 + Synopsys Designware Watchdog Timer 2 + 3 + Required Properties: 4 + 5 + - compatible : Should contain "snps,dw-wdt" 6 + - reg : Base address and size of the watchdog timer registers. 7 + - clocks : phandle + clock-specifier for the clock that drives the 8 + watchdog timer. 9 + 10 + Optional Properties: 11 + 12 + - interrupts : The interrupt used for the watchdog timeout warning. 13 + 14 + Example: 15 + 16 + watchdog0: wd@ffd02000 { 17 + compatible = "snps,dw-wdt"; 18 + reg = <0xffd02000 0x1000>; 19 + interrupts = <0 171 4>; 20 + clocks = <&per_base_clk>; 21 + };
+10
drivers/watchdog/dw_wdt.c
··· 29 29 #include <linux/miscdevice.h> 30 30 #include <linux/module.h> 31 31 #include <linux/moduleparam.h> 32 + #include <linux/of.h> 32 33 #include <linux/pm.h> 33 34 #include <linux/platform_device.h> 34 35 #include <linux/spinlock.h> ··· 338 337 return 0; 339 338 } 340 339 340 + #ifdef CONFIG_OF 341 + static const struct of_device_id dw_wdt_of_match[] = { 342 + { .compatible = "snps,dw-wdt", }, 343 + { /* sentinel */ } 344 + }; 345 + MODULE_DEVICE_TABLE(of, dw_wdt_of_match); 346 + #endif 347 + 341 348 static struct platform_driver dw_wdt_driver = { 342 349 .probe = dw_wdt_drv_probe, 343 350 .remove = dw_wdt_drv_remove, 344 351 .driver = { 345 352 .name = "dw_wdt", 346 353 .owner = THIS_MODULE, 354 + .of_match_table = of_match_ptr(dw_wdt_of_match), 347 355 .pm = &dw_wdt_pm_ops, 348 356 }, 349 357 };