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:
- new driver for NXP LPC18xx Watchdog Timer
- new driver for SAMA5D4 watchdog timer
- add support for MCP79 to nv_tco driver
- clean-up and improvement of the mpc8xxx watchdog driver
- improvements to gpio-wdt
- at91sam9_wdt clock improvements
... and other small fixes and improvements

* git://www.linux-watchdog.org/linux-watchdog: (25 commits)
Watchdog: Fix parent of watchdog_devices
watchdog: at91rm9200: Correct check for syscon_node_to_regmap() errors
watchdog: at91sam9: get and use slow clock
Documentation: dt: binding: atmel-sama5d4-wdt: for SAMA5D4 watchdog driver
watchdog: add a driver to support SAMA5D4 watchdog timer
watchdog: mpc8xxx: allow to compile for MPC512x
watchdog: mpc8xxx: use better error code when watchdog cannot be enabled
watchdog: mpc8xxx: use dynamic memory for device specific data
watchdog: mpc8xxx: use devm_ioremap_resource to map memory
watchdog: mpc8xxx: make use of of_device_get_match_data
watchdog: mpc8xxx: simplify registration
watchdog: mpc8xxx: remove dead code
watchdog: lpc18xx_wdt_get_timeleft() can be static
DT: watchdog: Add NXP LPC18xx Watchdog Timer binding documentation
watchdog: NXP LPC18xx Watchdog Timer Driver
watchdog: gpio-wdt: ping already at startup for always running devices
watchdog: gpio-wdt: be more strict about hw_algo matching
Documentation: watchdog: at91sam9_wdt: add clocks property
watchdog: booke_wdt: Use infrastructure to check timeout limits
watchdog: (nv_tco) add support for MCP79
...

+916 -135
+35
Documentation/devicetree/bindings/watchdog/atmel-sama5d4-wdt.txt
··· 1 + * Atmel SAMA5D4 Watchdog Timer (WDT) Controller 2 + 3 + Required properties: 4 + - compatible: "atmel,sama5d4-wdt" 5 + - reg: base physical address and length of memory mapped region. 6 + 7 + Optional properties: 8 + - timeout-sec: watchdog timeout value (in seconds). 9 + - interrupts: interrupt number to the CPU. 10 + - atmel,watchdog-type: should be "hardware" or "software". 11 + "hardware": enable watchdog fault reset. A watchdog fault triggers 12 + watchdog reset. 13 + "software": enable watchdog fault interrupt. A watchdog fault asserts 14 + watchdog interrupt. 15 + - atmel,idle-halt: present if you want to stop the watchdog when the CPU is 16 + in idle state. 17 + CAUTION: This property should be used with care, it actually makes the 18 + watchdog not counting when the CPU is in idle state, therefore the 19 + watchdog reset time depends on mean CPU usage and will not reset at all 20 + if the CPU stop working while it is in idle state, which is probably 21 + not what you want. 22 + - atmel,dbg-halt: present if you want to stop the watchdog when the CPU is 23 + in debug state. 24 + 25 + Example: 26 + watchdog@fc068640 { 27 + compatible = "atmel,sama5d4-wdt"; 28 + reg = <0xfc068640 0x10>; 29 + interrupts = <4 IRQ_TYPE_LEVEL_HIGH 5>; 30 + timeout-sec = <10>; 31 + atmel,watchdog-type = "hardware"; 32 + atmel,dbg-halt; 33 + atmel,idle-halt; 34 + status = "okay"; 35 + };
+19
Documentation/devicetree/bindings/watchdog/lpc18xx-wdt.txt
··· 1 + * NXP LPC18xx Watchdog Timer (WDT) 2 + 3 + Required properties: 4 + - compatible: Should be "nxp,lpc1850-wwdt" 5 + - reg: Should contain WDT registers location and length 6 + - clocks: Must contain an entry for each entry in clock-names. 7 + - clock-names: Should contain "wdtclk" and "reg"; the watchdog counter 8 + clock and register interface clock respectively. 9 + - interrupts: Should contain WDT interrupt 10 + 11 + Examples: 12 + 13 + watchdog@40080000 { 14 + compatible = "nxp,lpc1850-wwdt"; 15 + reg = <0x40080000 0x24>; 16 + clocks = <&cgu BASE_SAFE_CLK>, <&ccu1 CLK_CPU_WWDT>; 17 + clock-names = "wdtclk", "reg"; 18 + interrupts = <49>; 19 + };
+17 -5
Documentation/watchdog/src/watchdog-test.c
··· 41 41 int main(int argc, char *argv[]) 42 42 { 43 43 int flags; 44 + unsigned int ping_rate = 1; 44 45 45 46 fd = open("/dev/watchdog", O_WRONLY); 46 47 ··· 64 63 fprintf(stderr, "Watchdog card enabled.\n"); 65 64 fflush(stderr); 66 65 goto end; 66 + } else if (!strncasecmp(argv[1], "-t", 2) && argv[2]) { 67 + flags = atoi(argv[2]); 68 + ioctl(fd, WDIOC_SETTIMEOUT, &flags); 69 + fprintf(stderr, "Watchdog timeout set to %u seconds.\n", flags); 70 + fflush(stderr); 71 + goto end; 72 + } else if (!strncasecmp(argv[1], "-p", 2) && argv[2]) { 73 + ping_rate = strtoul(argv[2], NULL, 0); 74 + fprintf(stderr, "Watchdog ping rate set to %u seconds.\n", ping_rate); 75 + fflush(stderr); 67 76 } else { 68 - fprintf(stderr, "-d to disable, -e to enable.\n"); 77 + fprintf(stderr, "-d to disable, -e to enable, -t <n> to set " \ 78 + "the timeout,\n-p <n> to set the ping rate, and \n"); 69 79 fprintf(stderr, "run by itself to tick the card.\n"); 70 80 fflush(stderr); 71 81 goto end; 72 82 } 73 - } else { 74 - fprintf(stderr, "Watchdog Ticking Away!\n"); 75 - fflush(stderr); 76 83 } 84 + 85 + fprintf(stderr, "Watchdog Ticking Away!\n"); 86 + fflush(stderr); 77 87 78 88 signal(SIGINT, term); 79 89 80 90 while(1) { 81 91 keep_alive(); 82 - sleep(1); 92 + sleep(ping_rate); 83 93 } 84 94 end: 85 95 close(fd);
+1
drivers/misc/mei/wd.c
··· 364 364 365 365 int ret; 366 366 367 + amt_wd_dev.parent = dev->dev; 367 368 /* unlock to perserve correct locking order */ 368 369 mutex_unlock(&dev->device_lock); 369 370 ret = watchdog_register_device(&amt_wd_dev);
+21 -1
drivers/watchdog/Kconfig
··· 188 188 Watchdog timer embedded into AT91SAM9X and AT91CAP9 chips. This will 189 189 reboot your system when the timeout is reached. 190 190 191 + config SAMA5D4_WATCHDOG 192 + tristate "Atmel SAMA5D4 Watchdog Timer" 193 + depends on ARCH_AT91 194 + select WATCHDOG_CORE 195 + help 196 + Atmel SAMA5D4 watchdog timer is embedded into SAMA5D4 chips. 197 + Its Watchdog Timer Mode Register can be written more than once. 198 + This will reboot your system when the timeout is reached. 199 + 191 200 config CADENCE_WATCHDOG 192 201 tristate "Cadence Watchdog Timer" 193 202 depends on HAS_IOMEM ··· 566 557 in Conexant Digicolor SoCs. 567 558 To compile this driver as a module, choose M here: the 568 559 module will be called digicolor_wdt. 560 + 561 + config LPC18XX_WATCHDOG 562 + tristate "LPC18xx/43xx Watchdog" 563 + depends on ARCH_LPC18XX || COMPILE_TEST 564 + select WATCHDOG_CORE 565 + help 566 + Say Y here if to include support for the watchdog timer 567 + in NXP LPC SoCs family, which includes LPC18xx/LPC43xx 568 + processors. 569 + To compile this driver as a module, choose M here: the 570 + module will be called lpc18xx_wdt. 569 571 570 572 # AVR32 Architecture 571 573 ··· 1354 1334 1355 1335 config 8xxx_WDT 1356 1336 tristate "MPC8xxx Platform Watchdog Timer" 1357 - depends on PPC_8xx || PPC_83xx || PPC_86xx 1337 + depends on PPC_8xx || PPC_83xx || PPC_86xx || PPC_MPC512x 1358 1338 select WATCHDOG_CORE 1359 1339 help 1360 1340 This driver is for a SoC level watchdog that exists on some
+2
drivers/watchdog/Makefile
··· 41 41 obj-$(CONFIG_KS8695_WATCHDOG) += ks8695_wdt.o 42 42 obj-$(CONFIG_S3C2410_WATCHDOG) += s3c2410_wdt.o 43 43 obj-$(CONFIG_SA1100_WATCHDOG) += sa1100_wdt.o 44 + obj-$(CONFIG_SAMA5D4_WATCHDOG) += sama5d4_wdt.o 44 45 obj-$(CONFIG_DW_WATCHDOG) += dw_wdt.o 45 46 obj-$(CONFIG_EP93XX_WATCHDOG) += ep93xx_wdt.o 46 47 obj-$(CONFIG_PNX4008_WATCHDOG) += pnx4008_wdt.o ··· 67 66 obj-$(CONFIG_MESON_WATCHDOG) += meson_wdt.o 68 67 obj-$(CONFIG_MEDIATEK_WATCHDOG) += mtk_wdt.o 69 68 obj-$(CONFIG_DIGICOLOR_WATCHDOG) += digicolor_wdt.o 69 + obj-$(CONFIG_LPC18XX_WATCHDOG) += lpc18xx_wdt.o 70 70 71 71 # AVR32 Architecture 72 72 obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o
+1 -1
drivers/watchdog/at91rm9200_wdt.c
··· 244 244 } 245 245 246 246 regmap_st = syscon_node_to_regmap(parent->of_node); 247 - if (!regmap_st) 247 + if (IS_ERR(regmap_st)) 248 248 return -ENODEV; 249 249 250 250 res = misc_register(&at91wdt_miscdev);
+20 -2
drivers/watchdog/at91sam9_wdt.c
··· 17 17 18 18 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 19 19 20 + #include <linux/clk.h> 20 21 #include <linux/errno.h> 21 22 #include <linux/init.h> 22 23 #include <linux/interrupt.h> ··· 91 90 unsigned long heartbeat; /* WDT heartbeat in jiffies */ 92 91 bool nowayout; 93 92 unsigned int irq; 93 + struct clk *sclk; 94 94 }; 95 95 96 96 /* ......................................................................... */ ··· 354 352 if (IS_ERR(wdt->base)) 355 353 return PTR_ERR(wdt->base); 356 354 355 + wdt->sclk = devm_clk_get(&pdev->dev, NULL); 356 + if (IS_ERR(wdt->sclk)) 357 + return PTR_ERR(wdt->sclk); 358 + 359 + err = clk_prepare_enable(wdt->sclk); 360 + if (err) { 361 + dev_err(&pdev->dev, "Could not enable slow clock\n"); 362 + return err; 363 + } 364 + 357 365 if (pdev->dev.of_node) { 358 366 err = of_at91wdt_init(pdev->dev.of_node, wdt); 359 367 if (err) 360 - return err; 368 + goto err_clk; 361 369 } 362 370 363 371 err = at91_wdt_init(pdev, wdt); 364 372 if (err) 365 - return err; 373 + goto err_clk; 366 374 367 375 platform_set_drvdata(pdev, wdt); 368 376 ··· 380 368 wdt->wdd.timeout, wdt->nowayout); 381 369 382 370 return 0; 371 + 372 + err_clk: 373 + clk_disable_unprepare(wdt->sclk); 374 + 375 + return err; 383 376 } 384 377 385 378 static int __exit at91wdt_remove(struct platform_device *pdev) ··· 394 377 395 378 pr_warn("I quit now, hardware will probably reboot!\n"); 396 379 del_timer(&wdt->timer); 380 + clk_disable_unprepare(wdt->sclk); 397 381 398 382 return 0; 399 383 }
+2
drivers/watchdog/at91sam9_wdt.h
··· 22 22 23 23 #define AT91_WDT_MR 0x04 /* Watchdog Mode Register */ 24 24 #define AT91_WDT_WDV (0xfff << 0) /* Counter Value */ 25 + #define AT91_WDT_SET_WDV(x) ((x) & AT91_WDT_WDV) 25 26 #define AT91_WDT_WDFIEN (1 << 12) /* Fault Interrupt Enable */ 26 27 #define AT91_WDT_WDRSTEN (1 << 13) /* Reset Processor */ 27 28 #define AT91_WDT_WDRPROC (1 << 14) /* Timer Restart */ 28 29 #define AT91_WDT_WDDIS (1 << 15) /* Watchdog Disable */ 29 30 #define AT91_WDT_WDD (0xfff << 16) /* Delta Value */ 31 + #define AT91_WDT_SET_WDD(x) (((x) << 16) & AT91_WDT_WDD) 30 32 #define AT91_WDT_WDDBGHLT (1 << 28) /* Debug Halt */ 31 33 #define AT91_WDT_WDIDLEHLT (1 << 29) /* Idle Halt */ 32 34
+1
drivers/watchdog/bcm2835_wdt.c
··· 182 182 watchdog_set_drvdata(&bcm2835_wdt_wdd, wdt); 183 183 watchdog_init_timeout(&bcm2835_wdt_wdd, heartbeat, dev); 184 184 watchdog_set_nowayout(&bcm2835_wdt_wdd, nowayout); 185 + bcm2835_wdt_wdd.parent = &pdev->dev; 185 186 err = watchdog_register_device(&bcm2835_wdt_wdd); 186 187 if (err) { 187 188 dev_err(dev, "Failed to register watchdog device");
+1
drivers/watchdog/bcm47xx_wdt.c
··· 209 209 210 210 wdt->wdd.info = &bcm47xx_wdt_info; 211 211 wdt->wdd.timeout = WDT_DEFAULT_TIME; 212 + wdt->wdd.parent = &pdev->dev; 212 213 ret = wdt->wdd.ops->set_timeout(&wdt->wdd, timeout); 213 214 if (ret) 214 215 goto err_timer;
+1
drivers/watchdog/bcm_kona_wdt.c
··· 319 319 spin_lock_init(&wdt->lock); 320 320 platform_set_drvdata(pdev, wdt); 321 321 watchdog_set_drvdata(&bcm_kona_wdt_wdd, wdt); 322 + bcm_kona_wdt_wdd.parent = &pdev->dev; 322 323 323 324 ret = bcm_kona_wdt_set_timeout_reg(&bcm_kona_wdt_wdd, 0); 324 325 if (ret) {
+1 -3
drivers/watchdog/booke_wdt.c
··· 186 186 static int booke_wdt_set_timeout(struct watchdog_device *wdt_dev, 187 187 unsigned int timeout) 188 188 { 189 - if (timeout > MAX_WDT_TIMEOUT) 190 - return -EINVAL; 191 189 wdt_dev->timeout = timeout; 192 190 booke_wdt_set(wdt_dev); 193 191 ··· 209 211 .info = &booke_wdt_info, 210 212 .ops = &booke_wdt_ops, 211 213 .min_timeout = 1, 212 - .max_timeout = 0xFFFF 213 214 }; 214 215 215 216 static void __exit booke_wdt_exit(void) ··· 226 229 booke_wdt_set_timeout(&booke_wdt_dev, 227 230 period_to_sec(booke_wdt_period)); 228 231 watchdog_set_nowayout(&booke_wdt_dev, nowayout); 232 + booke_wdt_dev.max_timeout = MAX_WDT_TIMEOUT; 229 233 if (booke_wdt_enabled) 230 234 booke_wdt_start(&booke_wdt_dev); 231 235
+1
drivers/watchdog/coh901327_wdt.c
··· 358 358 if (ret < 0) 359 359 coh901327_wdt.timeout = 60; 360 360 361 + coh901327_wdt.parent = &pdev->dev; 361 362 ret = watchdog_register_device(&coh901327_wdt); 362 363 if (ret == 0) 363 364 dev_info(&pdev->dev,
+1
drivers/watchdog/da9052_wdt.c
··· 195 195 da9052_wdt->timeout = DA9052_DEF_TIMEOUT; 196 196 da9052_wdt->info = &da9052_wdt_info; 197 197 da9052_wdt->ops = &da9052_wdt_ops; 198 + da9052_wdt->parent = &pdev->dev; 198 199 watchdog_set_drvdata(da9052_wdt, driver_data); 199 200 200 201 kref_init(&driver_data->kref);
+1
drivers/watchdog/da9055_wdt.c
··· 161 161 da9055_wdt->timeout = DA9055_DEF_TIMEOUT; 162 162 da9055_wdt->info = &da9055_wdt_info; 163 163 da9055_wdt->ops = &da9055_wdt_ops; 164 + da9055_wdt->parent = &pdev->dev; 164 165 watchdog_set_nowayout(da9055_wdt, nowayout); 165 166 watchdog_set_drvdata(da9055_wdt, driver_data); 166 167
+1
drivers/watchdog/da9062_wdt.c
··· 210 210 wdt->wdtdev.max_timeout = DA9062_WDT_MAX_TIMEOUT; 211 211 wdt->wdtdev.timeout = DA9062_WDG_DEFAULT_TIMEOUT; 212 212 wdt->wdtdev.status = WATCHDOG_NOWAYOUT_INIT_STATUS; 213 + wdt->wdtdev.parent = &pdev->dev; 213 214 214 215 watchdog_set_drvdata(&wdt->wdtdev, wdt); 215 216 dev_set_drvdata(&pdev->dev, wdt);
+1
drivers/watchdog/da9063_wdt.c
··· 175 175 wdt->wdtdev.min_timeout = DA9063_WDT_MIN_TIMEOUT; 176 176 wdt->wdtdev.max_timeout = DA9063_WDT_MAX_TIMEOUT; 177 177 wdt->wdtdev.timeout = DA9063_WDG_TIMEOUT; 178 + wdt->wdtdev.parent = &pdev->dev; 178 179 179 180 wdt->wdtdev.status = WATCHDOG_NOWAYOUT_INIT_STATUS; 180 181
+1
drivers/watchdog/davinci_wdt.c
··· 179 179 wdd->min_timeout = 1; 180 180 wdd->max_timeout = MAX_HEARTBEAT; 181 181 wdd->timeout = DEFAULT_HEARTBEAT; 182 + wdd->parent = &pdev->dev; 182 183 183 184 watchdog_init_timeout(wdd, heartbeat, dev); 184 185
+1
drivers/watchdog/digicolor_wdt.c
··· 143 143 } 144 144 dc_wdt_wdd.max_timeout = U32_MAX / clk_get_rate(wdt->clk); 145 145 dc_wdt_wdd.timeout = dc_wdt_wdd.max_timeout; 146 + dc_wdt_wdd.parent = &pdev->dev; 146 147 147 148 spin_lock_init(&wdt->lock); 148 149
+1
drivers/watchdog/ep93xx_wdt.c
··· 132 132 val = readl(mmio_base + EP93XX_WATCHDOG); 133 133 ep93xx_wdt_wdd.bootstatus = (val & 0x01) ? WDIOF_CARDRESET : 0; 134 134 ep93xx_wdt_wdd.timeout = timeout; 135 + ep93xx_wdt_wdd.parent = &pdev->dev; 135 136 136 137 watchdog_set_nowayout(&ep93xx_wdt_wdd, nowayout); 137 138
+33 -32
drivers/watchdog/gpio_wdt.c
··· 50 50 gpio_direction_input(priv->gpio); 51 51 } 52 52 53 + static void gpio_wdt_hwping(unsigned long data) 54 + { 55 + struct watchdog_device *wdd = (struct watchdog_device *)data; 56 + struct gpio_wdt_priv *priv = watchdog_get_drvdata(wdd); 57 + 58 + if (priv->armed && time_after(jiffies, priv->last_jiffies + 59 + msecs_to_jiffies(wdd->timeout * 1000))) { 60 + dev_crit(wdd->dev, "Timer expired. System will reboot soon!\n"); 61 + return; 62 + } 63 + 64 + /* Restart timer */ 65 + mod_timer(&priv->timer, jiffies + priv->hw_margin); 66 + 67 + switch (priv->hw_algo) { 68 + case HW_ALGO_TOGGLE: 69 + /* Toggle output pin */ 70 + priv->state = !priv->state; 71 + gpio_set_value_cansleep(priv->gpio, priv->state); 72 + break; 73 + case HW_ALGO_LEVEL: 74 + /* Pulse */ 75 + gpio_set_value_cansleep(priv->gpio, !priv->active_low); 76 + udelay(1); 77 + gpio_set_value_cansleep(priv->gpio, priv->active_low); 78 + break; 79 + } 80 + } 81 + 53 82 static void gpio_wdt_start_impl(struct gpio_wdt_priv *priv) 54 83 { 55 84 priv->state = priv->active_low; 56 85 gpio_direction_output(priv->gpio, priv->state); 57 86 priv->last_jiffies = jiffies; 58 - mod_timer(&priv->timer, priv->last_jiffies + priv->hw_margin); 87 + gpio_wdt_hwping((unsigned long)&priv->wdd); 59 88 } 60 89 61 90 static int gpio_wdt_start(struct watchdog_device *wdd) ··· 124 95 wdd->timeout = t; 125 96 126 97 return gpio_wdt_ping(wdd); 127 - } 128 - 129 - static void gpio_wdt_hwping(unsigned long data) 130 - { 131 - struct watchdog_device *wdd = (struct watchdog_device *)data; 132 - struct gpio_wdt_priv *priv = watchdog_get_drvdata(wdd); 133 - 134 - if (priv->armed && time_after(jiffies, priv->last_jiffies + 135 - msecs_to_jiffies(wdd->timeout * 1000))) { 136 - dev_crit(wdd->dev, "Timer expired. System will reboot soon!\n"); 137 - return; 138 - } 139 - 140 - /* Restart timer */ 141 - mod_timer(&priv->timer, jiffies + priv->hw_margin); 142 - 143 - switch (priv->hw_algo) { 144 - case HW_ALGO_TOGGLE: 145 - /* Toggle output pin */ 146 - priv->state = !priv->state; 147 - gpio_set_value_cansleep(priv->gpio, priv->state); 148 - break; 149 - case HW_ALGO_LEVEL: 150 - /* Pulse */ 151 - gpio_set_value_cansleep(priv->gpio, !priv->active_low); 152 - udelay(1); 153 - gpio_set_value_cansleep(priv->gpio, priv->active_low); 154 - break; 155 - } 156 98 } 157 99 158 100 static int gpio_wdt_notify_sys(struct notifier_block *nb, unsigned long code, ··· 182 182 ret = of_property_read_string(pdev->dev.of_node, "hw_algo", &algo); 183 183 if (ret) 184 184 return ret; 185 - if (!strncmp(algo, "toggle", 6)) { 185 + if (!strcmp(algo, "toggle")) { 186 186 priv->hw_algo = HW_ALGO_TOGGLE; 187 187 f = GPIOF_IN; 188 - } else if (!strncmp(algo, "level", 5)) { 188 + } else if (!strcmp(algo, "level")) { 189 189 priv->hw_algo = HW_ALGO_LEVEL; 190 190 f = priv->active_low ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW; 191 191 } else { ··· 217 217 priv->wdd.ops = &gpio_wdt_ops; 218 218 priv->wdd.min_timeout = SOFT_TIMEOUT_MIN; 219 219 priv->wdd.max_timeout = SOFT_TIMEOUT_MAX; 220 + priv->wdd.parent = &pdev->dev; 220 221 221 222 if (watchdog_init_timeout(&priv->wdd, 0, &pdev->dev) < 0) 222 223 priv->wdd.timeout = SOFT_TIMEOUT_DEF;
+1
drivers/watchdog/ie6xx_wdt.c
··· 267 267 268 268 ie6xx_wdt_dev.timeout = timeout; 269 269 watchdog_set_nowayout(&ie6xx_wdt_dev, nowayout); 270 + ie6xx_wdt_dev.parent = &pdev->dev; 270 271 271 272 spin_lock_init(&ie6xx_wdt_data.unlock_sequence); 272 273
+1
drivers/watchdog/imgpdc_wdt.c
··· 316 316 { 317 317 struct pdc_wdt_dev *pdc_wdt = platform_get_drvdata(pdev); 318 318 319 + unregister_restart_handler(&pdc_wdt->restart_handler); 319 320 pdc_wdt_stop(&pdc_wdt->wdt_dev); 320 321 watchdog_unregister_device(&pdc_wdt->wdt_dev); 321 322 clk_disable_unprepare(pdc_wdt->wdt_clk);
+1
drivers/watchdog/intel-mid_wdt.c
··· 137 137 wdt_dev->min_timeout = MID_WDT_TIMEOUT_MIN; 138 138 wdt_dev->max_timeout = MID_WDT_TIMEOUT_MAX; 139 139 wdt_dev->timeout = MID_WDT_DEFAULT_TIMEOUT; 140 + wdt_dev->parent = &pdev->dev; 140 141 141 142 watchdog_set_drvdata(wdt_dev, &pdev->dev); 142 143 platform_set_drvdata(pdev, wdt_dev);
+1
drivers/watchdog/jz4740_wdt.c
··· 174 174 jz4740_wdt->timeout = heartbeat; 175 175 jz4740_wdt->min_timeout = 1; 176 176 jz4740_wdt->max_timeout = MAX_HEARTBEAT; 177 + jz4740_wdt->parent = &pdev->dev; 177 178 watchdog_set_nowayout(jz4740_wdt, nowayout); 178 179 watchdog_set_drvdata(jz4740_wdt, drvdata); 179 180
+340
drivers/watchdog/lpc18xx_wdt.c
··· 1 + /* 2 + * NXP LPC18xx Watchdog Timer (WDT) 3 + * 4 + * Copyright (c) 2015 Ariel D'Alessandro <ariel@vanguardiasur.com> 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License version 2 as published by 8 + * the Free Software Foundation. 9 + * 10 + * Notes 11 + * ----- 12 + * The Watchdog consists of a fixed divide-by-4 clock pre-scaler and a 24-bit 13 + * counter which decrements on every clock cycle. 14 + */ 15 + 16 + #include <linux/clk.h> 17 + #include <linux/io.h> 18 + #include <linux/module.h> 19 + #include <linux/of.h> 20 + #include <linux/platform_device.h> 21 + #include <linux/reboot.h> 22 + #include <linux/watchdog.h> 23 + 24 + /* Registers */ 25 + #define LPC18XX_WDT_MOD 0x00 26 + #define LPC18XX_WDT_MOD_WDEN BIT(0) 27 + #define LPC18XX_WDT_MOD_WDRESET BIT(1) 28 + 29 + #define LPC18XX_WDT_TC 0x04 30 + #define LPC18XX_WDT_TC_MIN 0xff 31 + #define LPC18XX_WDT_TC_MAX 0xffffff 32 + 33 + #define LPC18XX_WDT_FEED 0x08 34 + #define LPC18XX_WDT_FEED_MAGIC1 0xaa 35 + #define LPC18XX_WDT_FEED_MAGIC2 0x55 36 + 37 + #define LPC18XX_WDT_TV 0x0c 38 + 39 + /* Clock pre-scaler */ 40 + #define LPC18XX_WDT_CLK_DIV 4 41 + 42 + /* Timeout values in seconds */ 43 + #define LPC18XX_WDT_DEF_TIMEOUT 30U 44 + 45 + static int heartbeat; 46 + module_param(heartbeat, int, 0); 47 + MODULE_PARM_DESC(heartbeat, "Watchdog heartbeats in seconds (default=" 48 + __MODULE_STRING(LPC18XX_WDT_DEF_TIMEOUT) ")"); 49 + 50 + static bool nowayout = WATCHDOG_NOWAYOUT; 51 + module_param(nowayout, bool, 0); 52 + MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" 53 + __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); 54 + 55 + struct lpc18xx_wdt_dev { 56 + struct watchdog_device wdt_dev; 57 + struct clk *reg_clk; 58 + struct clk *wdt_clk; 59 + unsigned long clk_rate; 60 + void __iomem *base; 61 + struct timer_list timer; 62 + struct notifier_block restart_handler; 63 + spinlock_t lock; 64 + }; 65 + 66 + static int lpc18xx_wdt_feed(struct watchdog_device *wdt_dev) 67 + { 68 + struct lpc18xx_wdt_dev *lpc18xx_wdt = watchdog_get_drvdata(wdt_dev); 69 + unsigned long flags; 70 + 71 + /* 72 + * An abort condition will occur if an interrupt happens during the feed 73 + * sequence. 74 + */ 75 + spin_lock_irqsave(&lpc18xx_wdt->lock, flags); 76 + writel(LPC18XX_WDT_FEED_MAGIC1, lpc18xx_wdt->base + LPC18XX_WDT_FEED); 77 + writel(LPC18XX_WDT_FEED_MAGIC2, lpc18xx_wdt->base + LPC18XX_WDT_FEED); 78 + spin_unlock_irqrestore(&lpc18xx_wdt->lock, flags); 79 + 80 + return 0; 81 + } 82 + 83 + static void lpc18xx_wdt_timer_feed(unsigned long data) 84 + { 85 + struct watchdog_device *wdt_dev = (struct watchdog_device *)data; 86 + struct lpc18xx_wdt_dev *lpc18xx_wdt = watchdog_get_drvdata(wdt_dev); 87 + 88 + lpc18xx_wdt_feed(wdt_dev); 89 + 90 + /* Use safe value (1/2 of real timeout) */ 91 + mod_timer(&lpc18xx_wdt->timer, jiffies + 92 + msecs_to_jiffies((wdt_dev->timeout * MSEC_PER_SEC) / 2)); 93 + } 94 + 95 + /* 96 + * Since LPC18xx Watchdog cannot be disabled in hardware, we must keep feeding 97 + * it with a timer until userspace watchdog software takes over. 98 + */ 99 + static int lpc18xx_wdt_stop(struct watchdog_device *wdt_dev) 100 + { 101 + lpc18xx_wdt_timer_feed((unsigned long)wdt_dev); 102 + 103 + return 0; 104 + } 105 + 106 + static void __lpc18xx_wdt_set_timeout(struct lpc18xx_wdt_dev *lpc18xx_wdt) 107 + { 108 + unsigned int val; 109 + 110 + val = DIV_ROUND_UP(lpc18xx_wdt->wdt_dev.timeout * lpc18xx_wdt->clk_rate, 111 + LPC18XX_WDT_CLK_DIV); 112 + writel(val, lpc18xx_wdt->base + LPC18XX_WDT_TC); 113 + } 114 + 115 + static int lpc18xx_wdt_set_timeout(struct watchdog_device *wdt_dev, 116 + unsigned int new_timeout) 117 + { 118 + struct lpc18xx_wdt_dev *lpc18xx_wdt = watchdog_get_drvdata(wdt_dev); 119 + 120 + lpc18xx_wdt->wdt_dev.timeout = new_timeout; 121 + __lpc18xx_wdt_set_timeout(lpc18xx_wdt); 122 + 123 + return 0; 124 + } 125 + 126 + static unsigned int lpc18xx_wdt_get_timeleft(struct watchdog_device *wdt_dev) 127 + { 128 + struct lpc18xx_wdt_dev *lpc18xx_wdt = watchdog_get_drvdata(wdt_dev); 129 + unsigned int val; 130 + 131 + val = readl(lpc18xx_wdt->base + LPC18XX_WDT_TV); 132 + return (val * LPC18XX_WDT_CLK_DIV) / lpc18xx_wdt->clk_rate; 133 + } 134 + 135 + static int lpc18xx_wdt_start(struct watchdog_device *wdt_dev) 136 + { 137 + struct lpc18xx_wdt_dev *lpc18xx_wdt = watchdog_get_drvdata(wdt_dev); 138 + unsigned int val; 139 + 140 + if (timer_pending(&lpc18xx_wdt->timer)) 141 + del_timer(&lpc18xx_wdt->timer); 142 + 143 + val = readl(lpc18xx_wdt->base + LPC18XX_WDT_MOD); 144 + val |= LPC18XX_WDT_MOD_WDEN; 145 + val |= LPC18XX_WDT_MOD_WDRESET; 146 + writel(val, lpc18xx_wdt->base + LPC18XX_WDT_MOD); 147 + 148 + /* 149 + * Setting the WDEN bit in the WDMOD register is not sufficient to 150 + * enable the Watchdog. A valid feed sequence must be completed after 151 + * setting WDEN before the Watchdog is capable of generating a reset. 152 + */ 153 + lpc18xx_wdt_feed(wdt_dev); 154 + 155 + return 0; 156 + } 157 + 158 + static struct watchdog_info lpc18xx_wdt_info = { 159 + .identity = "NXP LPC18xx Watchdog", 160 + .options = WDIOF_SETTIMEOUT | 161 + WDIOF_KEEPALIVEPING | 162 + WDIOF_MAGICCLOSE, 163 + }; 164 + 165 + static const struct watchdog_ops lpc18xx_wdt_ops = { 166 + .owner = THIS_MODULE, 167 + .start = lpc18xx_wdt_start, 168 + .stop = lpc18xx_wdt_stop, 169 + .ping = lpc18xx_wdt_feed, 170 + .set_timeout = lpc18xx_wdt_set_timeout, 171 + .get_timeleft = lpc18xx_wdt_get_timeleft, 172 + }; 173 + 174 + static int lpc18xx_wdt_restart(struct notifier_block *this, unsigned long mode, 175 + void *cmd) 176 + { 177 + struct lpc18xx_wdt_dev *lpc18xx_wdt = container_of(this, 178 + struct lpc18xx_wdt_dev, restart_handler); 179 + unsigned long flags; 180 + int val; 181 + 182 + /* 183 + * Incorrect feed sequence causes immediate watchdog reset if enabled. 184 + */ 185 + spin_lock_irqsave(&lpc18xx_wdt->lock, flags); 186 + 187 + val = readl(lpc18xx_wdt->base + LPC18XX_WDT_MOD); 188 + val |= LPC18XX_WDT_MOD_WDEN; 189 + val |= LPC18XX_WDT_MOD_WDRESET; 190 + writel(val, lpc18xx_wdt->base + LPC18XX_WDT_MOD); 191 + 192 + writel(LPC18XX_WDT_FEED_MAGIC1, lpc18xx_wdt->base + LPC18XX_WDT_FEED); 193 + writel(LPC18XX_WDT_FEED_MAGIC2, lpc18xx_wdt->base + LPC18XX_WDT_FEED); 194 + 195 + writel(LPC18XX_WDT_FEED_MAGIC1, lpc18xx_wdt->base + LPC18XX_WDT_FEED); 196 + writel(LPC18XX_WDT_FEED_MAGIC1, lpc18xx_wdt->base + LPC18XX_WDT_FEED); 197 + 198 + spin_unlock_irqrestore(&lpc18xx_wdt->lock, flags); 199 + 200 + return NOTIFY_OK; 201 + } 202 + 203 + static int lpc18xx_wdt_probe(struct platform_device *pdev) 204 + { 205 + struct lpc18xx_wdt_dev *lpc18xx_wdt; 206 + struct device *dev = &pdev->dev; 207 + struct resource *res; 208 + int ret; 209 + 210 + lpc18xx_wdt = devm_kzalloc(dev, sizeof(*lpc18xx_wdt), GFP_KERNEL); 211 + if (!lpc18xx_wdt) 212 + return -ENOMEM; 213 + 214 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 215 + lpc18xx_wdt->base = devm_ioremap_resource(dev, res); 216 + if (IS_ERR(lpc18xx_wdt->base)) 217 + return PTR_ERR(lpc18xx_wdt->base); 218 + 219 + lpc18xx_wdt->reg_clk = devm_clk_get(dev, "reg"); 220 + if (IS_ERR(lpc18xx_wdt->reg_clk)) { 221 + dev_err(dev, "failed to get the reg clock\n"); 222 + return PTR_ERR(lpc18xx_wdt->reg_clk); 223 + } 224 + 225 + lpc18xx_wdt->wdt_clk = devm_clk_get(dev, "wdtclk"); 226 + if (IS_ERR(lpc18xx_wdt->wdt_clk)) { 227 + dev_err(dev, "failed to get the wdt clock\n"); 228 + return PTR_ERR(lpc18xx_wdt->wdt_clk); 229 + } 230 + 231 + ret = clk_prepare_enable(lpc18xx_wdt->reg_clk); 232 + if (ret) { 233 + dev_err(dev, "could not prepare or enable sys clock\n"); 234 + return ret; 235 + } 236 + 237 + ret = clk_prepare_enable(lpc18xx_wdt->wdt_clk); 238 + if (ret) { 239 + dev_err(dev, "could not prepare or enable wdt clock\n"); 240 + goto disable_reg_clk; 241 + } 242 + 243 + /* We use the clock rate to calculate timeouts */ 244 + lpc18xx_wdt->clk_rate = clk_get_rate(lpc18xx_wdt->wdt_clk); 245 + if (lpc18xx_wdt->clk_rate == 0) { 246 + dev_err(dev, "failed to get clock rate\n"); 247 + ret = -EINVAL; 248 + goto disable_wdt_clk; 249 + } 250 + 251 + lpc18xx_wdt->wdt_dev.info = &lpc18xx_wdt_info; 252 + lpc18xx_wdt->wdt_dev.ops = &lpc18xx_wdt_ops; 253 + 254 + lpc18xx_wdt->wdt_dev.min_timeout = DIV_ROUND_UP(LPC18XX_WDT_TC_MIN * 255 + LPC18XX_WDT_CLK_DIV, lpc18xx_wdt->clk_rate); 256 + 257 + lpc18xx_wdt->wdt_dev.max_timeout = (LPC18XX_WDT_TC_MAX * 258 + LPC18XX_WDT_CLK_DIV) / lpc18xx_wdt->clk_rate; 259 + 260 + lpc18xx_wdt->wdt_dev.timeout = min(lpc18xx_wdt->wdt_dev.max_timeout, 261 + LPC18XX_WDT_DEF_TIMEOUT); 262 + 263 + spin_lock_init(&lpc18xx_wdt->lock); 264 + 265 + lpc18xx_wdt->wdt_dev.parent = dev; 266 + watchdog_set_drvdata(&lpc18xx_wdt->wdt_dev, lpc18xx_wdt); 267 + 268 + ret = watchdog_init_timeout(&lpc18xx_wdt->wdt_dev, heartbeat, dev); 269 + 270 + __lpc18xx_wdt_set_timeout(lpc18xx_wdt); 271 + 272 + setup_timer(&lpc18xx_wdt->timer, lpc18xx_wdt_timer_feed, 273 + (unsigned long)&lpc18xx_wdt->wdt_dev); 274 + 275 + watchdog_set_nowayout(&lpc18xx_wdt->wdt_dev, nowayout); 276 + 277 + platform_set_drvdata(pdev, lpc18xx_wdt); 278 + 279 + ret = watchdog_register_device(&lpc18xx_wdt->wdt_dev); 280 + if (ret) 281 + goto disable_wdt_clk; 282 + 283 + lpc18xx_wdt->restart_handler.notifier_call = lpc18xx_wdt_restart; 284 + lpc18xx_wdt->restart_handler.priority = 128; 285 + ret = register_restart_handler(&lpc18xx_wdt->restart_handler); 286 + if (ret) 287 + dev_warn(dev, "failed to register restart handler: %d\n", ret); 288 + 289 + return 0; 290 + 291 + disable_wdt_clk: 292 + clk_disable_unprepare(lpc18xx_wdt->wdt_clk); 293 + disable_reg_clk: 294 + clk_disable_unprepare(lpc18xx_wdt->reg_clk); 295 + return ret; 296 + } 297 + 298 + static void lpc18xx_wdt_shutdown(struct platform_device *pdev) 299 + { 300 + struct lpc18xx_wdt_dev *lpc18xx_wdt = platform_get_drvdata(pdev); 301 + 302 + lpc18xx_wdt_stop(&lpc18xx_wdt->wdt_dev); 303 + } 304 + 305 + static int lpc18xx_wdt_remove(struct platform_device *pdev) 306 + { 307 + struct lpc18xx_wdt_dev *lpc18xx_wdt = platform_get_drvdata(pdev); 308 + 309 + unregister_restart_handler(&lpc18xx_wdt->restart_handler); 310 + 311 + dev_warn(&pdev->dev, "I quit now, hardware will probably reboot!\n"); 312 + del_timer(&lpc18xx_wdt->timer); 313 + 314 + watchdog_unregister_device(&lpc18xx_wdt->wdt_dev); 315 + clk_disable_unprepare(lpc18xx_wdt->wdt_clk); 316 + clk_disable_unprepare(lpc18xx_wdt->reg_clk); 317 + 318 + return 0; 319 + } 320 + 321 + static const struct of_device_id lpc18xx_wdt_match[] = { 322 + { .compatible = "nxp,lpc1850-wwdt" }, 323 + {} 324 + }; 325 + MODULE_DEVICE_TABLE(of, lpc18xx_wdt_match); 326 + 327 + static struct platform_driver lpc18xx_wdt_driver = { 328 + .driver = { 329 + .name = "lpc18xx-wdt", 330 + .of_match_table = lpc18xx_wdt_match, 331 + }, 332 + .probe = lpc18xx_wdt_probe, 333 + .remove = lpc18xx_wdt_remove, 334 + .shutdown = lpc18xx_wdt_shutdown, 335 + }; 336 + module_platform_driver(lpc18xx_wdt_driver); 337 + 338 + MODULE_AUTHOR("Ariel D'Alessandro <ariel@vanguardiasur.com.ar>"); 339 + MODULE_DESCRIPTION("NXP LPC18xx Watchdog Timer Driver"); 340 + MODULE_LICENSE("GPL v2");
+1
drivers/watchdog/mena21_wdt.c
··· 197 197 watchdog_init_timeout(&a21_wdt, 30, &pdev->dev); 198 198 watchdog_set_nowayout(&a21_wdt, nowayout); 199 199 watchdog_set_drvdata(&a21_wdt, drv); 200 + a21_wdt.parent = &pdev->dev; 200 201 201 202 reset = a21_wdt_get_bootstatus(drv); 202 203 if (reset == 2)
+1
drivers/watchdog/menf21bmc_wdt.c
··· 130 130 drv_data->wdt.info = &menf21bmc_wdt_info; 131 131 drv_data->wdt.min_timeout = BMC_WD_TIMEOUT_MIN; 132 132 drv_data->wdt.max_timeout = BMC_WD_TIMEOUT_MAX; 133 + drv_data->wdt.parent = &pdev->dev; 133 134 drv_data->i2c_client = i2c_client; 134 135 135 136 /*
+66 -90
drivers/watchdog/mpc8xxx_wdt.c
··· 50 50 bool hw_enabled; 51 51 }; 52 52 53 - static struct mpc8xxx_wdt __iomem *wd_base; 54 - static int mpc8xxx_wdt_init_late(void); 53 + struct mpc8xxx_wdt_ddata { 54 + struct mpc8xxx_wdt __iomem *base; 55 + struct watchdog_device wdd; 56 + struct timer_list timer; 57 + spinlock_t lock; 58 + }; 55 59 56 60 static u16 timeout = 0xffff; 57 61 module_param(timeout, ushort, 0); ··· 72 68 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " 73 69 "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); 74 70 75 - /* 76 - * We always prescale, but if someone really doesn't want to they can set this 77 - * to 0 78 - */ 79 - static int prescale = 1; 80 - 81 - static DEFINE_SPINLOCK(wdt_spinlock); 82 - 83 - static void mpc8xxx_wdt_keepalive(void) 71 + static void mpc8xxx_wdt_keepalive(struct mpc8xxx_wdt_ddata *ddata) 84 72 { 85 73 /* Ping the WDT */ 86 - spin_lock(&wdt_spinlock); 87 - out_be16(&wd_base->swsrr, 0x556c); 88 - out_be16(&wd_base->swsrr, 0xaa39); 89 - spin_unlock(&wdt_spinlock); 74 + spin_lock(&ddata->lock); 75 + out_be16(&ddata->base->swsrr, 0x556c); 76 + out_be16(&ddata->base->swsrr, 0xaa39); 77 + spin_unlock(&ddata->lock); 90 78 } 91 - 92 - static struct watchdog_device mpc8xxx_wdt_dev; 93 - static void mpc8xxx_wdt_timer_ping(unsigned long arg); 94 - static DEFINE_TIMER(wdt_timer, mpc8xxx_wdt_timer_ping, 0, 95 - (unsigned long)&mpc8xxx_wdt_dev); 96 79 97 80 static void mpc8xxx_wdt_timer_ping(unsigned long arg) 98 81 { 99 - struct watchdog_device *w = (struct watchdog_device *)arg; 82 + struct mpc8xxx_wdt_ddata *ddata = (void *)arg; 100 83 101 - mpc8xxx_wdt_keepalive(); 84 + mpc8xxx_wdt_keepalive(ddata); 102 85 /* We're pinging it twice faster than needed, just to be sure. */ 103 - mod_timer(&wdt_timer, jiffies + HZ * w->timeout / 2); 86 + mod_timer(&ddata->timer, jiffies + HZ * ddata->wdd.timeout / 2); 104 87 } 105 88 106 89 static int mpc8xxx_wdt_start(struct watchdog_device *w) 107 90 { 108 - u32 tmp = SWCRR_SWEN; 91 + struct mpc8xxx_wdt_ddata *ddata = 92 + container_of(w, struct mpc8xxx_wdt_ddata, wdd); 93 + 94 + u32 tmp = SWCRR_SWEN | SWCRR_SWPR; 109 95 110 96 /* Good, fire up the show */ 111 - if (prescale) 112 - tmp |= SWCRR_SWPR; 113 97 if (reset) 114 98 tmp |= SWCRR_SWRI; 115 99 116 100 tmp |= timeout << 16; 117 101 118 - out_be32(&wd_base->swcrr, tmp); 102 + out_be32(&ddata->base->swcrr, tmp); 119 103 120 - del_timer_sync(&wdt_timer); 104 + del_timer_sync(&ddata->timer); 121 105 122 106 return 0; 123 107 } 124 108 125 109 static int mpc8xxx_wdt_ping(struct watchdog_device *w) 126 110 { 127 - mpc8xxx_wdt_keepalive(); 111 + struct mpc8xxx_wdt_ddata *ddata = 112 + container_of(w, struct mpc8xxx_wdt_ddata, wdd); 113 + 114 + mpc8xxx_wdt_keepalive(ddata); 128 115 return 0; 129 116 } 130 117 131 118 static int mpc8xxx_wdt_stop(struct watchdog_device *w) 132 119 { 133 - mod_timer(&wdt_timer, jiffies); 120 + struct mpc8xxx_wdt_ddata *ddata = 121 + container_of(w, struct mpc8xxx_wdt_ddata, wdd); 122 + 123 + mod_timer(&ddata->timer, jiffies); 134 124 return 0; 135 125 } 136 126 ··· 141 143 .stop = mpc8xxx_wdt_stop, 142 144 }; 143 145 144 - static struct watchdog_device mpc8xxx_wdt_dev = { 145 - .info = &mpc8xxx_wdt_info, 146 - .ops = &mpc8xxx_wdt_ops, 147 - }; 148 - 149 - static const struct of_device_id mpc8xxx_wdt_match[]; 150 146 static int mpc8xxx_wdt_probe(struct platform_device *ofdev) 151 147 { 152 148 int ret; 153 - const struct of_device_id *match; 154 - struct device_node *np = ofdev->dev.of_node; 149 + struct resource *res; 155 150 const struct mpc8xxx_wdt_type *wdt_type; 151 + struct mpc8xxx_wdt_ddata *ddata; 156 152 u32 freq = fsl_get_sys_freq(); 157 153 bool enabled; 158 154 unsigned int timeout_sec; 159 155 160 - match = of_match_device(mpc8xxx_wdt_match, &ofdev->dev); 161 - if (!match) 156 + wdt_type = of_device_get_match_data(&ofdev->dev); 157 + if (!wdt_type) 162 158 return -EINVAL; 163 - wdt_type = match->data; 164 159 165 160 if (!freq || freq == -1) 166 161 return -EINVAL; 167 162 168 - wd_base = of_iomap(np, 0); 169 - if (!wd_base) 163 + ddata = devm_kzalloc(&ofdev->dev, sizeof(*ddata), GFP_KERNEL); 164 + if (!ddata) 170 165 return -ENOMEM; 171 166 172 - enabled = in_be32(&wd_base->swcrr) & SWCRR_SWEN; 167 + res = platform_get_resource(ofdev, IORESOURCE_MEM, 0); 168 + ddata->base = devm_ioremap_resource(&ofdev->dev, res); 169 + if (IS_ERR(ddata->base)) 170 + return PTR_ERR(ddata->base); 171 + 172 + enabled = in_be32(&ddata->base->swcrr) & SWCRR_SWEN; 173 173 if (!enabled && wdt_type->hw_enabled) { 174 174 pr_info("could not be enabled in software\n"); 175 - ret = -ENOSYS; 176 - goto err_unmap; 175 + return -ENODEV; 177 176 } 178 177 179 - /* Calculate the timeout in seconds */ 180 - if (prescale) 181 - timeout_sec = (timeout * wdt_type->prescaler) / freq; 182 - else 183 - timeout_sec = timeout / freq; 178 + spin_lock_init(&ddata->lock); 179 + setup_timer(&ddata->timer, mpc8xxx_wdt_timer_ping, 180 + (unsigned long)ddata); 184 181 185 - mpc8xxx_wdt_dev.timeout = timeout_sec; 186 - #ifdef MODULE 187 - ret = mpc8xxx_wdt_init_late(); 188 - if (ret) 189 - goto err_unmap; 190 - #endif 182 + ddata->wdd.info = &mpc8xxx_wdt_info, 183 + ddata->wdd.ops = &mpc8xxx_wdt_ops, 184 + 185 + /* Calculate the timeout in seconds */ 186 + timeout_sec = (timeout * wdt_type->prescaler) / freq; 187 + 188 + ddata->wdd.timeout = timeout_sec; 189 + 190 + watchdog_set_nowayout(&ddata->wdd, nowayout); 191 + 192 + ret = watchdog_register_device(&ddata->wdd); 193 + if (ret) { 194 + pr_err("cannot register watchdog device (err=%d)\n", ret); 195 + return ret; 196 + } 191 197 192 198 pr_info("WDT driver for MPC8xxx initialized. mode:%s timeout=%d (%d seconds)\n", 193 199 reset ? "reset" : "interrupt", timeout, timeout_sec); ··· 202 200 * userspace handles it. 203 201 */ 204 202 if (enabled) 205 - mod_timer(&wdt_timer, jiffies); 203 + mod_timer(&ddata->timer, jiffies); 204 + 205 + platform_set_drvdata(ofdev, ddata); 206 206 return 0; 207 - err_unmap: 208 - iounmap(wd_base); 209 - wd_base = NULL; 210 - return ret; 211 207 } 212 208 213 209 static int mpc8xxx_wdt_remove(struct platform_device *ofdev) 214 210 { 211 + struct mpc8xxx_wdt_ddata *ddata = platform_get_drvdata(ofdev); 212 + 215 213 pr_crit("Watchdog removed, expect the %s soon!\n", 216 214 reset ? "reset" : "machine check exception"); 217 - del_timer_sync(&wdt_timer); 218 - watchdog_unregister_device(&mpc8xxx_wdt_dev); 219 - iounmap(wd_base); 215 + del_timer_sync(&ddata->timer); 216 + watchdog_unregister_device(&ddata->wdd); 220 217 221 218 return 0; 222 219 } ··· 253 252 .of_match_table = mpc8xxx_wdt_match, 254 253 }, 255 254 }; 256 - 257 - /* 258 - * We do wdt initialization in two steps: arch_initcall probes the wdt 259 - * very early to start pinging the watchdog (misc devices are not yet 260 - * available), and later module_init() just registers the misc device. 261 - */ 262 - static int mpc8xxx_wdt_init_late(void) 263 - { 264 - int ret; 265 - 266 - if (!wd_base) 267 - return -ENODEV; 268 - 269 - watchdog_set_nowayout(&mpc8xxx_wdt_dev, nowayout); 270 - 271 - ret = watchdog_register_device(&mpc8xxx_wdt_dev); 272 - if (ret) { 273 - pr_err("cannot register watchdog device (err=%d)\n", ret); 274 - return ret; 275 - } 276 - return 0; 277 - } 278 - #ifndef MODULE 279 - module_init(mpc8xxx_wdt_init_late); 280 - #endif 281 255 282 256 static int __init mpc8xxx_wdt_init(void) 283 257 {
+39
drivers/watchdog/mtk_wdt.c
··· 210 210 return 0; 211 211 } 212 212 213 + static void mtk_wdt_shutdown(struct platform_device *pdev) 214 + { 215 + struct mtk_wdt_dev *mtk_wdt = platform_get_drvdata(pdev); 216 + 217 + if (watchdog_active(&mtk_wdt->wdt_dev)) 218 + mtk_wdt_stop(&mtk_wdt->wdt_dev); 219 + } 220 + 213 221 static int mtk_wdt_remove(struct platform_device *pdev) 214 222 { 215 223 struct mtk_wdt_dev *mtk_wdt = platform_get_drvdata(pdev); ··· 229 221 return 0; 230 222 } 231 223 224 + #ifdef CONFIG_PM_SLEEP 225 + static int mtk_wdt_suspend(struct device *dev) 226 + { 227 + struct mtk_wdt_dev *mtk_wdt = dev_get_drvdata(dev); 228 + 229 + if (watchdog_active(&mtk_wdt->wdt_dev)) 230 + mtk_wdt_stop(&mtk_wdt->wdt_dev); 231 + 232 + return 0; 233 + } 234 + 235 + static int mtk_wdt_resume(struct device *dev) 236 + { 237 + struct mtk_wdt_dev *mtk_wdt = dev_get_drvdata(dev); 238 + 239 + if (watchdog_active(&mtk_wdt->wdt_dev)) { 240 + mtk_wdt_start(&mtk_wdt->wdt_dev); 241 + mtk_wdt_ping(&mtk_wdt->wdt_dev); 242 + } 243 + 244 + return 0; 245 + } 246 + #endif 247 + 232 248 static const struct of_device_id mtk_wdt_dt_ids[] = { 233 249 { .compatible = "mediatek,mt6589-wdt" }, 234 250 { /* sentinel */ } 235 251 }; 236 252 MODULE_DEVICE_TABLE(of, mtk_wdt_dt_ids); 237 253 254 + static const struct dev_pm_ops mtk_wdt_pm_ops = { 255 + SET_SYSTEM_SLEEP_PM_OPS(mtk_wdt_suspend, 256 + mtk_wdt_resume) 257 + }; 258 + 238 259 static struct platform_driver mtk_wdt_driver = { 239 260 .probe = mtk_wdt_probe, 240 261 .remove = mtk_wdt_remove, 262 + .shutdown = mtk_wdt_shutdown, 241 263 .driver = { 242 264 .name = DRV_NAME, 265 + .pm = &mtk_wdt_pm_ops, 243 266 .of_match_table = mtk_wdt_dt_ids, 244 267 }, 245 268 };
+2
drivers/watchdog/nv_tco.c
··· 294 294 PCI_ANY_ID, PCI_ANY_ID, }, 295 295 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SMBUS, 296 296 PCI_ANY_ID, PCI_ANY_ID, }, 297 + { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP79_SMBUS, 298 + PCI_ANY_ID, PCI_ANY_ID, }, 297 299 { 0, }, /* End of list */ 298 300 }; 299 301 MODULE_DEVICE_TABLE(pci, tco_pci_tbl);
+1
drivers/watchdog/omap_wdt.c
··· 253 253 wdev->wdog.ops = &omap_wdt_ops; 254 254 wdev->wdog.min_timeout = TIMER_MARGIN_MIN; 255 255 wdev->wdog.max_timeout = TIMER_MARGIN_MAX; 256 + wdev->wdog.parent = &pdev->dev; 256 257 257 258 if (watchdog_init_timeout(&wdev->wdog, timer_margin, &pdev->dev) < 0) 258 259 wdev->wdog.timeout = TIMER_MARGIN_DEFAULT;
+1
drivers/watchdog/orion_wdt.c
··· 567 567 568 568 dev->wdt.timeout = wdt_max_duration; 569 569 dev->wdt.max_timeout = wdt_max_duration; 570 + dev->wdt.parent = &pdev->dev; 570 571 watchdog_init_timeout(&dev->wdt, heartbeat, &pdev->dev); 571 572 572 573 platform_set_drvdata(pdev, &dev->wdt);
+1
drivers/watchdog/pnx4008_wdt.c
··· 167 167 168 168 pnx4008_wdd.bootstatus = (readl(WDTIM_RES(wdt_base)) & WDOG_RESET) ? 169 169 WDIOF_CARDRESET : 0; 170 + pnx4008_wdd.parent = &pdev->dev; 170 171 watchdog_set_nowayout(&pnx4008_wdd, nowayout); 171 172 172 173 pnx4008_wdt_stop(&pnx4008_wdd); /* disable for now */
+1
drivers/watchdog/qcom-wdt.c
··· 171 171 wdt->wdd.ops = &qcom_wdt_ops; 172 172 wdt->wdd.min_timeout = 1; 173 173 wdt->wdd.max_timeout = 0x10000000U / wdt->rate; 174 + wdt->wdd.parent = &pdev->dev; 174 175 175 176 /* 176 177 * If 'timeout-sec' unspecified in devicetree, assume a 30 second
+1
drivers/watchdog/retu_wdt.c
··· 127 127 retu_wdt->timeout = RETU_WDT_MAX_TIMER; 128 128 retu_wdt->min_timeout = 0; 129 129 retu_wdt->max_timeout = RETU_WDT_MAX_TIMER; 130 + retu_wdt->parent = &pdev->dev; 130 131 131 132 watchdog_set_drvdata(retu_wdt, wdev); 132 133 watchdog_set_nowayout(retu_wdt, nowayout);
+1
drivers/watchdog/rt2880_wdt.c
··· 161 161 rt288x_wdt_dev.dev = &pdev->dev; 162 162 rt288x_wdt_dev.bootstatus = rt288x_wdt_bootcause(); 163 163 rt288x_wdt_dev.max_timeout = (0xfffful / rt288x_wdt_freq); 164 + rt288x_wdt_dev.parent = &pdev->dev; 164 165 165 166 watchdog_init_timeout(&rt288x_wdt_dev, rt288x_wdt_dev.max_timeout, 166 167 &pdev->dev);
+1
drivers/watchdog/s3c2410_wdt.c
··· 607 607 watchdog_set_nowayout(&wdt->wdt_device, nowayout); 608 608 609 609 wdt->wdt_device.bootstatus = s3c2410wdt_get_bootstatus(wdt); 610 + wdt->wdt_device.parent = &pdev->dev; 610 611 611 612 ret = watchdog_register_device(&wdt->wdt_device); 612 613 if (ret) {
+280
drivers/watchdog/sama5d4_wdt.c
··· 1 + /* 2 + * Driver for Atmel SAMA5D4 Watchdog Timer 3 + * 4 + * Copyright (C) 2015 Atmel Corporation 5 + * 6 + * Licensed under GPLv2. 7 + */ 8 + 9 + #include <linux/interrupt.h> 10 + #include <linux/io.h> 11 + #include <linux/kernel.h> 12 + #include <linux/module.h> 13 + #include <linux/of.h> 14 + #include <linux/of_irq.h> 15 + #include <linux/platform_device.h> 16 + #include <linux/reboot.h> 17 + #include <linux/watchdog.h> 18 + 19 + #include "at91sam9_wdt.h" 20 + 21 + /* minimum and maximum watchdog timeout, in seconds */ 22 + #define MIN_WDT_TIMEOUT 1 23 + #define MAX_WDT_TIMEOUT 16 24 + #define WDT_DEFAULT_TIMEOUT MAX_WDT_TIMEOUT 25 + 26 + #define WDT_SEC2TICKS(s) ((s) ? (((s) << 8) - 1) : 0) 27 + 28 + struct sama5d4_wdt { 29 + struct watchdog_device wdd; 30 + void __iomem *reg_base; 31 + u32 config; 32 + }; 33 + 34 + static int wdt_timeout = WDT_DEFAULT_TIMEOUT; 35 + static bool nowayout = WATCHDOG_NOWAYOUT; 36 + 37 + module_param(wdt_timeout, int, 0); 38 + MODULE_PARM_DESC(wdt_timeout, 39 + "Watchdog timeout in seconds. (default = " 40 + __MODULE_STRING(WDT_DEFAULT_TIMEOUT) ")"); 41 + 42 + module_param(nowayout, bool, 0); 43 + MODULE_PARM_DESC(nowayout, 44 + "Watchdog cannot be stopped once started (default=" 45 + __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); 46 + 47 + #define wdt_read(wdt, field) \ 48 + readl_relaxed((wdt)->reg_base + (field)) 49 + 50 + #define wdt_write(wtd, field, val) \ 51 + writel_relaxed((val), (wdt)->reg_base + (field)) 52 + 53 + static int sama5d4_wdt_start(struct watchdog_device *wdd) 54 + { 55 + struct sama5d4_wdt *wdt = watchdog_get_drvdata(wdd); 56 + u32 reg; 57 + 58 + reg = wdt_read(wdt, AT91_WDT_MR); 59 + reg &= ~AT91_WDT_WDDIS; 60 + wdt_write(wdt, AT91_WDT_MR, reg); 61 + 62 + return 0; 63 + } 64 + 65 + static int sama5d4_wdt_stop(struct watchdog_device *wdd) 66 + { 67 + struct sama5d4_wdt *wdt = watchdog_get_drvdata(wdd); 68 + u32 reg; 69 + 70 + reg = wdt_read(wdt, AT91_WDT_MR); 71 + reg |= AT91_WDT_WDDIS; 72 + wdt_write(wdt, AT91_WDT_MR, reg); 73 + 74 + return 0; 75 + } 76 + 77 + static int sama5d4_wdt_ping(struct watchdog_device *wdd) 78 + { 79 + struct sama5d4_wdt *wdt = watchdog_get_drvdata(wdd); 80 + 81 + wdt_write(wdt, AT91_WDT_CR, AT91_WDT_KEY | AT91_WDT_WDRSTT); 82 + 83 + return 0; 84 + } 85 + 86 + static int sama5d4_wdt_set_timeout(struct watchdog_device *wdd, 87 + unsigned int timeout) 88 + { 89 + struct sama5d4_wdt *wdt = watchdog_get_drvdata(wdd); 90 + u32 value = WDT_SEC2TICKS(timeout); 91 + u32 reg; 92 + 93 + reg = wdt_read(wdt, AT91_WDT_MR); 94 + reg &= ~AT91_WDT_WDV; 95 + reg &= ~AT91_WDT_WDD; 96 + reg |= AT91_WDT_SET_WDV(value); 97 + reg |= AT91_WDT_SET_WDD(value); 98 + wdt_write(wdt, AT91_WDT_MR, reg); 99 + 100 + wdd->timeout = timeout; 101 + 102 + return 0; 103 + } 104 + 105 + static const struct watchdog_info sama5d4_wdt_info = { 106 + .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, 107 + .identity = "Atmel SAMA5D4 Watchdog", 108 + }; 109 + 110 + static struct watchdog_ops sama5d4_wdt_ops = { 111 + .owner = THIS_MODULE, 112 + .start = sama5d4_wdt_start, 113 + .stop = sama5d4_wdt_stop, 114 + .ping = sama5d4_wdt_ping, 115 + .set_timeout = sama5d4_wdt_set_timeout, 116 + }; 117 + 118 + static irqreturn_t sama5d4_wdt_irq_handler(int irq, void *dev_id) 119 + { 120 + struct sama5d4_wdt *wdt = platform_get_drvdata(dev_id); 121 + 122 + if (wdt_read(wdt, AT91_WDT_SR)) { 123 + pr_crit("Atmel Watchdog Software Reset\n"); 124 + emergency_restart(); 125 + pr_crit("Reboot didn't succeed\n"); 126 + } 127 + 128 + return IRQ_HANDLED; 129 + } 130 + 131 + static int of_sama5d4_wdt_init(struct device_node *np, struct sama5d4_wdt *wdt) 132 + { 133 + const char *tmp; 134 + 135 + wdt->config = AT91_WDT_WDDIS; 136 + 137 + if (!of_property_read_string(np, "atmel,watchdog-type", &tmp) && 138 + !strcmp(tmp, "software")) 139 + wdt->config |= AT91_WDT_WDFIEN; 140 + else 141 + wdt->config |= AT91_WDT_WDRSTEN; 142 + 143 + if (of_property_read_bool(np, "atmel,idle-halt")) 144 + wdt->config |= AT91_WDT_WDIDLEHLT; 145 + 146 + if (of_property_read_bool(np, "atmel,dbg-halt")) 147 + wdt->config |= AT91_WDT_WDDBGHLT; 148 + 149 + return 0; 150 + } 151 + 152 + static int sama5d4_wdt_init(struct sama5d4_wdt *wdt) 153 + { 154 + struct watchdog_device *wdd = &wdt->wdd; 155 + u32 value = WDT_SEC2TICKS(wdd->timeout); 156 + u32 reg; 157 + 158 + /* 159 + * Because the fields WDV and WDD must not be modified when the WDDIS 160 + * bit is set, so clear the WDDIS bit before writing the WDT_MR. 161 + */ 162 + reg = wdt_read(wdt, AT91_WDT_MR); 163 + reg &= ~AT91_WDT_WDDIS; 164 + wdt_write(wdt, AT91_WDT_MR, reg); 165 + 166 + reg = wdt->config; 167 + reg |= AT91_WDT_SET_WDD(value); 168 + reg |= AT91_WDT_SET_WDV(value); 169 + 170 + wdt_write(wdt, AT91_WDT_MR, reg); 171 + 172 + return 0; 173 + } 174 + 175 + static int sama5d4_wdt_probe(struct platform_device *pdev) 176 + { 177 + struct watchdog_device *wdd; 178 + struct sama5d4_wdt *wdt; 179 + struct resource *res; 180 + void __iomem *regs; 181 + u32 irq = 0; 182 + int ret; 183 + 184 + wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); 185 + if (!wdt) 186 + return -ENOMEM; 187 + 188 + wdd = &wdt->wdd; 189 + wdd->timeout = wdt_timeout; 190 + wdd->info = &sama5d4_wdt_info; 191 + wdd->ops = &sama5d4_wdt_ops; 192 + wdd->min_timeout = MIN_WDT_TIMEOUT; 193 + wdd->max_timeout = MAX_WDT_TIMEOUT; 194 + 195 + watchdog_set_drvdata(wdd, wdt); 196 + 197 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 198 + regs = devm_ioremap_resource(&pdev->dev, res); 199 + if (IS_ERR(regs)) 200 + return PTR_ERR(regs); 201 + 202 + wdt->reg_base = regs; 203 + 204 + if (pdev->dev.of_node) { 205 + irq = irq_of_parse_and_map(pdev->dev.of_node, 0); 206 + if (!irq) 207 + dev_warn(&pdev->dev, "failed to get IRQ from DT\n"); 208 + 209 + ret = of_sama5d4_wdt_init(pdev->dev.of_node, wdt); 210 + if (ret) 211 + return ret; 212 + } 213 + 214 + if ((wdt->config & AT91_WDT_WDFIEN) && irq) { 215 + ret = devm_request_irq(&pdev->dev, irq, sama5d4_wdt_irq_handler, 216 + IRQF_SHARED | IRQF_IRQPOLL | 217 + IRQF_NO_SUSPEND, pdev->name, pdev); 218 + if (ret) { 219 + dev_err(&pdev->dev, 220 + "cannot register interrupt handler\n"); 221 + return ret; 222 + } 223 + } 224 + 225 + ret = watchdog_init_timeout(wdd, wdt_timeout, &pdev->dev); 226 + if (ret) { 227 + dev_err(&pdev->dev, "unable to set timeout value\n"); 228 + return ret; 229 + } 230 + 231 + ret = sama5d4_wdt_init(wdt); 232 + if (ret) 233 + return ret; 234 + 235 + watchdog_set_nowayout(wdd, nowayout); 236 + 237 + ret = watchdog_register_device(wdd); 238 + if (ret) { 239 + dev_err(&pdev->dev, "failed to register watchdog device\n"); 240 + return ret; 241 + } 242 + 243 + platform_set_drvdata(pdev, wdt); 244 + 245 + dev_info(&pdev->dev, "initialized (timeout = %d sec, nowayout = %d)\n", 246 + wdt_timeout, nowayout); 247 + 248 + return 0; 249 + } 250 + 251 + static int sama5d4_wdt_remove(struct platform_device *pdev) 252 + { 253 + struct sama5d4_wdt *wdt = platform_get_drvdata(pdev); 254 + 255 + sama5d4_wdt_stop(&wdt->wdd); 256 + 257 + watchdog_unregister_device(&wdt->wdd); 258 + 259 + return 0; 260 + } 261 + 262 + static const struct of_device_id sama5d4_wdt_of_match[] = { 263 + { .compatible = "atmel,sama5d4-wdt", }, 264 + { } 265 + }; 266 + MODULE_DEVICE_TABLE(of, sama5d4_wdt_of_match); 267 + 268 + static struct platform_driver sama5d4_wdt_driver = { 269 + .probe = sama5d4_wdt_probe, 270 + .remove = sama5d4_wdt_remove, 271 + .driver = { 272 + .name = "sama5d4_wdt", 273 + .of_match_table = sama5d4_wdt_of_match, 274 + } 275 + }; 276 + module_platform_driver(sama5d4_wdt_driver); 277 + 278 + MODULE_AUTHOR("Atmel Corporation"); 279 + MODULE_DESCRIPTION("Atmel SAMA5D4 Watchdog Timer driver"); 280 + MODULE_LICENSE("GPL v2");
+1
drivers/watchdog/shwdt.c
··· 252 252 253 253 watchdog_set_nowayout(&sh_wdt_dev, nowayout); 254 254 watchdog_set_drvdata(&sh_wdt_dev, wdt); 255 + sh_wdt_dev.parent = &pdev->dev; 255 256 256 257 spin_lock_init(&wdt->lock); 257 258
+1
drivers/watchdog/sirfsoc_wdt.c
··· 154 154 155 155 watchdog_init_timeout(&sirfsoc_wdd, timeout, &pdev->dev); 156 156 watchdog_set_nowayout(&sirfsoc_wdd, nowayout); 157 + sirfsoc_wdd.parent = &pdev->dev; 157 158 158 159 ret = watchdog_register_device(&sirfsoc_wdd); 159 160 if (ret)
+1
drivers/watchdog/sp805_wdt.c
··· 226 226 wdt->adev = adev; 227 227 wdt->wdd.info = &wdt_info; 228 228 wdt->wdd.ops = &wdt_ops; 229 + wdt->wdd.parent = &adev->dev; 229 230 230 231 spin_lock_init(&wdt->lock); 231 232 watchdog_set_nowayout(&wdt->wdd, nowayout);
+1
drivers/watchdog/st_lpc_wdt.c
··· 241 241 return -EINVAL; 242 242 } 243 243 st_wdog_dev.max_timeout = 0xFFFFFFFF / st_wdog->clkrate; 244 + st_wdog_dev.parent = &pdev->dev; 244 245 245 246 ret = clk_prepare_enable(clk); 246 247 if (ret) {
+1
drivers/watchdog/stmp3xxx_rtc_wdt.c
··· 76 76 watchdog_set_drvdata(&stmp3xxx_wdd, &pdev->dev); 77 77 78 78 stmp3xxx_wdd.timeout = clamp_t(unsigned, heartbeat, 1, STMP3XXX_MAX_TIMEOUT); 79 + stmp3xxx_wdd.parent = &pdev->dev; 79 80 80 81 ret = watchdog_register_device(&stmp3xxx_wdd); 81 82 if (ret < 0) {
+1 -1
drivers/watchdog/sunxi_wdt.c
··· 184 184 /* Set system reset function */ 185 185 reg = readl(wdt_base + regs->wdt_cfg); 186 186 reg &= ~(regs->wdt_reset_mask); 187 - reg |= ~(regs->wdt_reset_val); 187 + reg |= regs->wdt_reset_val; 188 188 writel(reg, wdt_base + regs->wdt_cfg); 189 189 190 190 /* Enable watchdog */
+1
drivers/watchdog/tegra_wdt.c
··· 218 218 wdd->ops = &tegra_wdt_ops; 219 219 wdd->min_timeout = MIN_WDT_TIMEOUT; 220 220 wdd->max_timeout = MAX_WDT_TIMEOUT; 221 + wdd->parent = &pdev->dev; 221 222 222 223 watchdog_set_drvdata(wdd, wdt); 223 224
+1
drivers/watchdog/twl4030_wdt.c
··· 83 83 wdt->timeout = 30; 84 84 wdt->min_timeout = 1; 85 85 wdt->max_timeout = 30; 86 + wdt->parent = &pdev->dev; 86 87 87 88 watchdog_set_nowayout(wdt, nowayout); 88 89 platform_set_drvdata(pdev, wdt);
+1
drivers/watchdog/txx9wdt.c
··· 131 131 txx9wdt.timeout = timeout; 132 132 txx9wdt.min_timeout = 1; 133 133 txx9wdt.max_timeout = WD_MAX_TIMEOUT; 134 + txx9wdt.parent = &dev->dev; 134 135 watchdog_set_nowayout(&txx9wdt, nowayout); 135 136 136 137 ret = watchdog_register_device(&txx9wdt);
+1
drivers/watchdog/ux500_wdt.c
··· 96 96 ux500_wdt.max_timeout = WATCHDOG_MAX28; 97 97 } 98 98 99 + ux500_wdt.parent = &pdev->dev; 99 100 watchdog_set_nowayout(&ux500_wdt, nowayout); 100 101 101 102 /* disable auto off on sleep */
+1
drivers/watchdog/via_wdt.c
··· 206 206 timeout = WDT_TIMEOUT; 207 207 208 208 wdt_dev.timeout = timeout; 209 + wdt_dev.parent = &pdev->dev; 209 210 watchdog_set_nowayout(&wdt_dev, nowayout); 210 211 if (readl(wdt_mem) & VIA_WDT_FIRED) 211 212 wdt_dev.bootstatus |= WDIOF_CARDRESET;
+1
drivers/watchdog/wm831x_wdt.c
··· 215 215 216 216 wm831x_wdt->info = &wm831x_wdt_info; 217 217 wm831x_wdt->ops = &wm831x_wdt_ops; 218 + wm831x_wdt->parent = &pdev->dev; 218 219 watchdog_set_nowayout(wm831x_wdt, nowayout); 219 220 watchdog_set_drvdata(wm831x_wdt, driver_data); 220 221
+1
drivers/watchdog/wm8350_wdt.c
··· 151 151 152 152 watchdog_set_nowayout(&wm8350_wdt, nowayout); 153 153 watchdog_set_drvdata(&wm8350_wdt, wm8350); 154 + wm8350_wdt.parent = &pdev->dev; 154 155 155 156 /* Default to 4s timeout */ 156 157 wm8350_wdt_set_timeout(&wm8350_wdt, 4);