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

Merge git://www.linux-watchdog.org/linux-watchdog

Pull watchdog updates from Wim Van Sebroeck:
- remove unnecessary checks after platform_get_resource()
- fix watchdog api documentation typo's
- imx2_wdt: adds big endianness support
- move restart code to the sunxi watchdog driver

* git://www.linux-watchdog.org/linux-watchdog:
wdt: sunxi: Move restart code to the watchdog driver
Documentation: fix two typos in watchdog-api.txt
watchdog: imx2_wdt: adds big endianness support.
watchdog: shwdt: Remove the unnecessary check of resource after platform_get_resource()
watchdog: lantiq_wdt: Remove the un-necessary check of resource after platform_get_resource()
watchdog: dw_wdt: Remove the un-necessary check after platform_get_resource()

+43 -13
+5
Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.txt
··· 5 5 - reg : Should contain WDT registers location and length 6 6 - interrupts : Should contain WDT interrupt 7 7 8 + Optional property: 9 + - big-endian: If present the watchdog device's registers are implemented 10 + in big endian mode, otherwise in little mode. 11 + 8 12 Examples: 9 13 10 14 wdt@73f98000 { 11 15 compatible = "fsl,imx51-wdt", "fsl,imx21-wdt"; 12 16 reg = <0x73f98000 0x4000>; 13 17 interrupts = <58>; 18 + big-endian; 14 19 };
+1 -1
Documentation/watchdog/watchdog-api.txt
··· 118 118 Note that the pretimeout is the number of seconds before the time 119 119 when the timeout will go off. It is not the number of seconds until 120 120 the pretimeout. So, for instance, if you set the timeout to 60 seconds 121 - and the pretimeout to 10 seconds, the pretimout will go of in 50 121 + and the pretimeout to 10 seconds, the pretimeout will go off in 50 122 122 seconds. Setting a pretimeout to zero disables it. 123 123 124 124 There is also a get function for getting the pretimeout:
-3
drivers/watchdog/dw_wdt.c
··· 296 296 int ret; 297 297 struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 298 298 299 - if (!mem) 300 - return -EINVAL; 301 - 302 299 dw_wdt.regs = devm_ioremap_resource(&pdev->dev, mem); 303 300 if (IS_ERR(dw_wdt.regs)) 304 301 return PTR_ERR(dw_wdt.regs);
+7
drivers/watchdog/imx2_wdt.c
··· 28 28 #include <linux/kernel.h> 29 29 #include <linux/module.h> 30 30 #include <linux/moduleparam.h> 31 + #include <linux/of_address.h> 31 32 #include <linux/platform_device.h> 32 33 #include <linux/regmap.h> 33 34 #include <linux/timer.h> ··· 191 190 192 191 static int __init imx2_wdt_probe(struct platform_device *pdev) 193 192 { 193 + struct device_node *np = pdev->dev.of_node; 194 194 struct imx2_wdt_device *wdev; 195 195 struct watchdog_device *wdog; 196 196 struct resource *res; 197 197 void __iomem *base; 198 + bool big_endian; 198 199 int ret; 199 200 u32 val; 200 201 201 202 wdev = devm_kzalloc(&pdev->dev, sizeof(*wdev), GFP_KERNEL); 202 203 if (!wdev) 203 204 return -ENOMEM; 205 + 206 + big_endian = of_property_read_bool(np, "big-endian"); 207 + if (big_endian) 208 + imx2_wdt_regmap_config.val_format_endian = REGMAP_ENDIAN_BIG; 204 209 205 210 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 206 211 base = devm_ioremap_resource(&pdev->dev, res);
-5
drivers/watchdog/lantiq_wdt.c
··· 192 192 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 193 193 struct clk *clk; 194 194 195 - if (!res) { 196 - dev_err(&pdev->dev, "cannot obtain I/O memory region"); 197 - return -ENOENT; 198 - } 199 - 200 195 ltq_wdt_membase = devm_ioremap_resource(&pdev->dev, res); 201 196 if (IS_ERR(ltq_wdt_membase)) 202 197 return PTR_ERR(ltq_wdt_membase);
+1 -4
drivers/watchdog/shwdt.c
··· 230 230 if (pdev->id != -1) 231 231 return -EINVAL; 232 232 233 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 234 - if (unlikely(!res)) 235 - return -EINVAL; 236 - 237 233 wdt = devm_kzalloc(&pdev->dev, sizeof(struct sh_wdt), GFP_KERNEL); 238 234 if (unlikely(!wdt)) 239 235 return -ENOMEM; ··· 245 249 wdt->clk = NULL; 246 250 } 247 251 252 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 248 253 wdt->base = devm_ioremap_resource(wdt->dev, res); 249 254 if (IS_ERR(wdt->base)) 250 255 return PTR_ERR(wdt->base);
+29
drivers/watchdog/sunxi_wdt.c
··· 14 14 */ 15 15 16 16 #include <linux/clk.h> 17 + #include <linux/delay.h> 17 18 #include <linux/err.h> 18 19 #include <linux/init.h> 19 20 #include <linux/io.h> ··· 23 22 #include <linux/moduleparam.h> 24 23 #include <linux/of.h> 25 24 #include <linux/platform_device.h> 25 + #include <linux/reboot.h> 26 26 #include <linux/types.h> 27 27 #include <linux/watchdog.h> 28 + 29 + #include <asm/system_misc.h> 28 30 29 31 #define WDT_MAX_TIMEOUT 16 30 32 #define WDT_MIN_TIMEOUT 1 ··· 73 69 [14] = 0xA, /* 14s */ 74 70 [16] = 0xB, /* 16s */ 75 71 }; 72 + 73 + static void __iomem *reboot_wdt_base; 74 + 75 + static void sun4i_wdt_restart(enum reboot_mode mode, const char *cmd) 76 + { 77 + /* Enable timer and set reset bit in the watchdog */ 78 + writel(WDT_MODE_EN | WDT_MODE_RST_EN, reboot_wdt_base + WDT_MODE); 79 + 80 + /* 81 + * Restart the watchdog. The default (and lowest) interval 82 + * value for the watchdog is 0.5s. 83 + */ 84 + writel(WDT_CTRL_RELOAD, reboot_wdt_base + WDT_CTRL); 85 + 86 + while (1) { 87 + mdelay(5); 88 + writel(WDT_MODE_EN | WDT_MODE_RST_EN, 89 + reboot_wdt_base + WDT_MODE); 90 + } 91 + } 76 92 77 93 static int sunxi_wdt_ping(struct watchdog_device *wdt_dev) 78 94 { ··· 205 181 if (unlikely(err)) 206 182 return err; 207 183 184 + reboot_wdt_base = sunxi_wdt->wdt_base; 185 + arm_pm_restart = sun4i_wdt_restart; 186 + 208 187 dev_info(&pdev->dev, "Watchdog enabled (timeout=%d sec, nowayout=%d)", 209 188 sunxi_wdt->wdt_dev.timeout, nowayout); 210 189 ··· 217 190 static int sunxi_wdt_remove(struct platform_device *pdev) 218 191 { 219 192 struct sunxi_wdt_dev *sunxi_wdt = platform_get_drvdata(pdev); 193 + 194 + arm_pm_restart = NULL; 220 195 221 196 watchdog_unregister_device(&sunxi_wdt->wdt_dev); 222 197 watchdog_set_drvdata(&sunxi_wdt->wdt_dev, NULL);