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

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * SMsC 37B787 Watchdog Timer driver for Linux 2.6.x.x
9 * any of this software. This material is provided "AS-IS" in
12 * (C) Copyright 2003-2006 Sven Anders <anders@anduras.de>
15 * 2003 - Created version 1.0 for Linux 2.4.x.
16 * 2006 - Ported to Linux 2.6, added nowayout and MAGICCLOSE
21 * A Watchdog Timer (WDT) is a hardware circuit that can
26 * via the /dev/watchdog special device file that userspace is
28 * occurs, the driver will usually tell the hardware watchdog
29 * that everything is in order, and that the watchdog should wait
32 * notifications cease to occur, and the hardware watchdog will
36 * mknod /dev/watchdog c 10 130
38 * For an example userspace keep-alive daemon, see:
39 * Documentation/watchdog/wdt.rst
48 #include <linux/watchdog.h>
60 /* enable support for minutes as units? */
82 static DEFINE_SPINLOCK(io_lock);/* to guard the watchdog from io races */
86 /* -- Low level function ----------------------------------------*/
124 /* -- Medium level functions ------------------------------------*/
128 /* -- General Purpose I/O Bit 1.2 -- in gpio_bit12()
131 * Bit 2, Group Enable Intr.: 0 = Disable, 1 = Enable in gpio_bit12()
142 /* -- General Purpose I/O Bit 1.3 -- in gpio_bit13()
145 * Bit 2, Group Enable Intr.: 0 = Disable, 1 = Enable in gpio_bit13()
147 * Bit 4-6 (Reserved) in gpio_bit13()
155 /* -- Watchdog timer units -- in wdt_timer_units()
156 * Bit 0-6 (Reserved) in wdt_timer_units()
157 * Bit 7, WDT Time-out Value Units Select in wdt_timer_units()
165 /* -- Watchdog Timer Time-out Value -- in wdt_timeout_value()
166 * Bit 0-7 Binary coded units (0=Disabled, 1..255) in wdt_timeout_value()
173 /* -- Watchdog timer configuration -- in wdt_timer_conf()
174 * Bit 0 Joystick enable: 0* = No Reset, 1 = Reset WDT upon in wdt_timer_conf()
176 * Bit 1 Keyboard enable: 0* = No Reset, 1 = Reset WDT upon KBD Intr. in wdt_timer_conf()
177 * Bit 2 Mouse enable: 0* = No Reset, 1 = Reset WDT upon Mouse Intr in wdt_timer_conf()
181 * Bit 4-7 WDT Interrupt Mapping: (0000* = Disabled, in wdt_timer_conf()
189 /* -- Watchdog timer control -- in wdt_timer_ctrl()
192 * Bit 2 Force Timeout: 1 = Forces WD timeout event (self-cleaning) in wdt_timer_ctrl()
198 * -- Soft power management -- in wdt_timer_ctrl()
200 * set via register 0xB8, (self-cleaning) in wdt_timer_ctrl()
203 * set via register 0xB8, (self-cleaning) in wdt_timer_ctrl()
204 * Bit 7 SPOFF: 1 = Force software power down (self-cleaning) in wdt_timer_ctrl()
209 /* -- Higher level functions ------------------------------------*/
211 /* initialize watchdog */
221 /* enable the watchdog */ in wb_smsc_wdt_initialize()
239 /* set the watchdog timer units */ in wb_smsc_wdt_initialize()
246 /* shutdown the watchdog */
254 /* disable the watchdog */ in wb_smsc_wdt_shutdown()
258 /* reset watchdog config register */ in wb_smsc_wdt_shutdown()
261 /* reset watchdog control register */ in wb_smsc_wdt_shutdown()
271 /* set timeout => enable watchdog */
279 /* set Power LED to blink, if we enable the timeout */ in wb_smsc_wdt_set_timeout()
305 /* disable watchdog */
309 /* set the timeout to 0 to disable the watchdog */ in wb_smsc_wdt_disable()
313 /* enable watchdog by setting the current timeout */
337 /* return, if the watchdog is enabled (timeout is set...) */
345 /* -- File operations -------------------------------------------*/
347 /* open => enable watchdog and set initial timeout */
351 /* /dev/watchdog can only be opened once */ in wb_smsc_wdt_open()
354 return -EBUSY; in wb_smsc_wdt_open()
362 pr_info("Watchdog enabled. Timeout set to %d %s\n", in wb_smsc_wdt_open()
376 pr_info("Watchdog disabled, sleeping again...\n"); in wb_smsc_wdt_release()
378 pr_crit("Unexpected close, not stopping watchdog!\n"); in wb_smsc_wdt_release()
405 return -EFAULT; in wb_smsc_wdt_write()
434 .identity = "SMsC 37B787 Watchdog", in wb_smsc_wdt_ioctl()
442 ? -EFAULT : 0; in wb_smsc_wdt_ioctl()
449 int options, retval = -EINVAL; in wb_smsc_wdt_ioctl()
452 return -EFAULT; in wb_smsc_wdt_ioctl()
469 return -EFAULT; in wb_smsc_wdt_ioctl()
474 return -EINVAL; in wb_smsc_wdt_ioctl()
484 return -ENOTTY; in wb_smsc_wdt_ioctl()
488 /* -- Notifier funtions -----------------------------------------*/
494 /* set timeout to 0, to avoid possible race-condition */ in wb_smsc_wdt_notify_sys()
501 /* -- Module's structures ---------------------------------------*/
518 .name = "watchdog",
522 /* -- Module init functions -------------------------------------*/
530 pr_info("SMsC 37B787 watchdog component driver " in wb_smsc_wdt_init()
533 if (!request_region(IOPORT, IOPORT_SIZE, "SMsC 37B787 watchdog")) { in wb_smsc_wdt_init()
535 ret = -EBUSY; in wb_smsc_wdt_init()
543 /* init the watchdog timer */ in wb_smsc_wdt_init()
562 pr_info("Watchdog initialized and sleeping (nowayout=%d)...\n", in wb_smsc_wdt_init()
584 pr_info("Watchdog disabled\n"); in wb_smsc_wdt_exit()
591 pr_info("SMsC 37B787 watchdog component driver removed\n"); in wb_smsc_wdt_exit()
598 MODULE_DESCRIPTION("Driver for SMsC 37B787 watchdog component (Version "
609 MODULE_PARM_DESC(timeout, "range is 1-255 units, default is 60");
613 "Watchdog cannot be stopped once started (default="