Lines Matching +full:watchdog +full:- +full:enable

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * i6300esb: Watchdog timer driver for Intel 6300ESB chipset
8 * based on i810-tco.c which is in turn based on softdog.c
12 * 6300ESB chip : document number 300641-004
21 * Change driver to use the watchdog subsystem
35 #include <linux/watchdog.h>
49 #define ESB_TIMER1_REG(w) ((w)->base + 0x00)/* Timer1 value after each reset */
50 #define ESB_TIMER2_REG(w) ((w)->base + 0x04)/* Timer2 value after each reset */
51 #define ESB_GINTSR_REG(w) ((w)->base + 0x08)/* General Interrupt Status Reg */
52 #define ESB_RELOAD_REG(w) ((w)->base + 0x0c)/* Reload register */
55 #define ESB_WDT_FUNC (0x01 << 2) /* Watchdog functionality */
56 #define ESB_WDT_ENABLE (0x01 << 1) /* Enable WDT */
60 #define ESB_WDT_REBOOT (0x01 << 5) /* Enable reboot on timeout */
65 #define ESB_WDT_TIMEOUT (0x01 << 9) /* Watchdog timed out */
82 "Watchdog heartbeat in seconds. (" ESB_HEARTBEAT_RANGE
88 "Watchdog cannot be stopped once started (default="
119 int _wdd_nowayout = test_bit(WDOG_NO_WAY_OUT, &wdd->status); in esb_timer_start()
124 /* Enable or Enable + Lock? */ in esb_timer_start()
126 pci_write_config_byte(edev->pdev, ESB_LOCK_REG, val); in esb_timer_start()
139 pci_write_config_byte(edev->pdev, ESB_LOCK_REG, 0x0); in esb_timer_stop()
140 pci_read_config_byte(edev->pdev, ESB_LOCK_REG, &val); in esb_timer_stop()
142 /* Returns 0 if the timer was disabled, non-zero otherwise */ in esb_timer_stop()
183 wdd->timeout = time; in esb_timer_set_heartbeat()
188 * Watchdog Subsystem Interfaces
219 if (pci_enable_device(edev->pdev)) { in esb_getdevice()
220 dev_err(&edev->pdev->dev, "failed to enable device\n"); in esb_getdevice()
224 if (pci_request_region(edev->pdev, 0, ESB_MODULE_NAME)) { in esb_getdevice()
225 dev_err(&edev->pdev->dev, "failed to request region\n"); in esb_getdevice()
229 edev->base = pci_ioremap_bar(edev->pdev, 0); in esb_getdevice()
230 if (edev->base == NULL) { in esb_getdevice()
232 dev_err(&edev->pdev->dev, "failed to get BASEADDR\n"); in esb_getdevice()
237 dev_set_drvdata(&edev->pdev->dev, edev); in esb_getdevice()
241 pci_release_region(edev->pdev, 0); in esb_getdevice()
243 pci_disable_device(edev->pdev); in esb_getdevice()
255 * Bit 5 : 0 = Enable WDT_OUTPUT in esb_initdevice()
259 * The watchdog has two timers, it can be setup so that the in esb_initdevice()
265 pci_write_config_word(edev->pdev, ESB_CONFIG_REG, 0x0003); in esb_initdevice()
268 pci_read_config_byte(edev->pdev, ESB_LOCK_REG, &val1); in esb_initdevice()
270 dev_warn(&edev->pdev->dev, "nowayout already set\n"); in esb_initdevice()
272 /* Set the timer to watchdog mode and disable it for now */ in esb_initdevice()
273 pci_write_config_byte(edev->pdev, ESB_LOCK_REG, 0x00); in esb_initdevice()
275 /* Check if the watchdog was previously triggered */ in esb_initdevice()
279 edev->wdd.bootstatus = WDIOF_CARDRESET; in esb_initdevice()
286 esb_timer_set_heartbeat(&edev->wdd, edev->wdd.timeout); in esb_initdevice()
295 edev = devm_kzalloc(&pdev->dev, sizeof(*edev), GFP_KERNEL); in esb_probe()
297 return -ENOMEM; in esb_probe()
299 /* Check whether or not the hardware watchdog is there */ in esb_probe()
300 edev->pdev = pdev; in esb_probe()
302 return -ENODEV; in esb_probe()
304 /* Initialize the watchdog and make sure it does not run */ in esb_probe()
305 edev->wdd.info = &esb_info; in esb_probe()
306 edev->wdd.ops = &esb_ops; in esb_probe()
307 edev->wdd.min_timeout = ESB_HEARTBEAT_MIN; in esb_probe()
308 edev->wdd.max_timeout = ESB_HEARTBEAT_MAX; in esb_probe()
309 edev->wdd.timeout = ESB_HEARTBEAT_DEFAULT; in esb_probe()
310 watchdog_init_timeout(&edev->wdd, heartbeat, NULL); in esb_probe()
311 watchdog_set_nowayout(&edev->wdd, nowayout); in esb_probe()
312 watchdog_stop_on_reboot(&edev->wdd); in esb_probe()
313 watchdog_stop_on_unregister(&edev->wdd); in esb_probe()
316 /* Register the watchdog so that userspace has access to it */ in esb_probe()
317 ret = watchdog_register_device(&edev->wdd); in esb_probe()
320 dev_info(&pdev->dev, in esb_probe()
322 edev->wdd.timeout, nowayout); in esb_probe()
326 iounmap(edev->base); in esb_probe()
327 pci_release_region(edev->pdev, 0); in esb_probe()
328 pci_disable_device(edev->pdev); in esb_probe()
334 struct esb_dev *edev = dev_get_drvdata(&pdev->dev); in esb_remove()
336 watchdog_unregister_device(&edev->wdd); in esb_remove()
337 iounmap(edev->base); in esb_remove()
338 pci_release_region(edev->pdev, 0); in esb_remove()
339 pci_disable_device(edev->pdev); in esb_remove()
352 MODULE_DESCRIPTION("Watchdog driver for Intel 6300ESB chipsets");