summaryrefslogtreecommitdiffstats
path: root/include/watchdog.h
Commit message (Collapse)AuthorAgeFilesLines
* watchdog: Print seconds to expireSascha Hauer2021-02-161-0/+3
| | | | | | | | | | This adds a parameter to the watchdog devices that shows what we think when the watchdog expires. The watchdog should reset the system once the counter hits zero. When the system resets earlier or the counter shows negative values then there might be problems with the watchdog. Useful for debugging watchdog related problems. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: implement watchdog_get_alias_id_fromAhmad Fatoum2020-11-301-0/+8
| | | | | | | | | | | | | | | On device-tree enabled platforms, the Linux kernel will first attempt to use watchdog%d as watchdog name, where %d is the alias id. Add a function that given a barebox struct watchdog and the device tree root node of the kernel device tree, computes the corresponding kernel alias id. This may then later be used to pass an appropriate argument on the kernel command line. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* startup: inhibit watchdogs on non-interactive autoboot abortAhmad Fatoum2020-06-231-0/+6
| | | | | | | | | | | | | | nv.autoboot=abort has been added as development aid to have barebox stop at the shell prompt automatically. It makes sense to inhibit all watchdogs in this mode, so the user can later use the shell in peace. This also applies to fastboot aborting the shell prompt. If this happens, watchdog will be automatically inhibited as well. Behavior on user aborting the shell prompt via keypad or uart input remains unchanged for backwards-compatibility. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: add SPDX GPL-2.0-or-later license tags where applicableRoland Hieber2020-02-171-11/+1
| | | | | | Signed-off-by: Roland Hieber <rohieb@rohieb.name> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: core: use new dev_add_param_tristate helper for .running paramAhmad Fatoum2019-12-051-1/+4
| | | | | | | | | Previous commit added a dev_add_param_tristate_ro that can be readily used instead of the enum parameter here. Use it. This also fixes the issue that running_names had external linkage. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: implement generic support for .running device parameterAhmad Fatoum2019-11-111-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux watchdog have an optional WDOG_HW_RUNNING bit that is used in conjunction with CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED to automatically ping running watchdogs until userspace takes over. So far, when we ported Linux drivers, we dropped this detection, but it would be useful to have this information in barebox as well: The American Megatrends BIOS I am using allows configuring the hardware watchdog from the BIOS. barebox enables the WDT as well, so in normal operation we would never notice if after a BIOS update, the watchdog is no longer enabled. If we maintain a running parameter on watchdog devices, board code can be written to check whether the watchdog device is indeed running. To achieve this, add the necessary bits to the watchdog API. How we go about it differs from Linux a little: - We use an enum instead of a single bit, so we can differentiate between watchdogs that are not running and watchdogs whose running status is unknown. - Because we can check whether watchdog_hw_running is supported, it now can fail and return a negative value in that case - We do the maintenance of the running parameter after barebox feeds/disables the watchdog in the core, so it doesn't need to be replicated across drivers. Drivers hould only initialize the running parameter once at probe time. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: always populate watchdog priority from device tree if possibleAhmad Fatoum2019-11-111-7/+0
| | | | | | | | | | | So far, only the da9063 and da9053 have made use of the optional barebox watchdog-priority binding. Move it into the core, so other device drivers automatically have their watchdog-priority property parsed as well. This patch doesn't introduce any functional changes for upstream boards. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: rename timeout_curr to poller_timeout_curr internallyAhmad Fatoum2019-10-291-1/+1
| | | | | | | | | | | timeout_curr is the timeout programmed into the watchdog hardware every 500 milliseconds. If watchdog poller support is disabled, it serves no purpose, prefix it with poller_ to better communicate this fact. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: export API to configure watchdogs by nameAhmad Fatoum2019-10-291-2/+16
| | | | | | | | | | | | So far watchdog users could only configure the watchdog with the highest priority. In preparation for having the wd command configure a watchdog by name, extend watchdog_set_timeout with a struct watchdog *parameter and export functions to query default watchdog and to find watchdog by name. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: add watchdog pollerOleksij Rempel2018-03-261-0/+4
| | | | | | | | | | In some cases it is practical to supervise as much as possible of the barebox execution with a watchdog (or multiple watchdogs). This patch provides an async poller for watchdog core framework which can be enabled by the user and stores this configuration to nv. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: provide timeout_cur valueOleksij Rempel2018-03-231-0/+1
| | | | | | | | | | timeout_cur will be used for watchdog poller. Provided values should be good enough for most users and still can be changed for separate projects and fit to needed requirements. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: move max timeout test in to wd_coreOleksij Rempel2018-03-231-0/+1
| | | | | | | this also will be needed for watchdog poller as well Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: register watchdog virtual device with short name wdogOleksij Rempel2018-03-231-0/+1
| | | | | | | | | | | | the watchdog hwdev is usually named with devicetree schema which is not practical for CLI. On device registration "wdog" will be extended with some index number extracted from devicetree (if awailable) or automatically assigned first available number. End result will be "wdog0" .. etc. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: rename dev to hwdevSascha Hauer2018-03-221-1/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* wd: add stub for of_get_watchdog_priorityLucas Stach2015-09-041-2/+6
| | | | | | | Allow drivers to build even if WD core isn't enabled. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/restart'Sascha Hauer2015-09-011-0/+8
|\
| * watchdog: Give watchdogs a nameSascha Hauer2015-08-271-0/+2
| | | | | | | | | | | | | | This adds a dev and name member to struct watchdog which helps distinguishing between different watchdogs. Also add some debugging aids. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * watchdog: Allow multiple watchdogsSascha Hauer2015-08-271-0/+6
| | | | | | | | | | | | | | | | | | Put watchdogs on a list to allow multiple watchdogs. Add a priority field to be able to pick the highest priority watchdog. This patch also provides a of_get_watchdog_priority() function to allow configuring the watchdog priority from the device tree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | watchdog: Fix static inline opsSascha Hauer2015-08-281-2/+2
|/ | | | | | ...by actually making them static inline. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: add static inline no-ops if WD is disabledMarc Kleine-Budde2015-05-151-0/+17
| | | | | Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add a simple watchdog frameworkJuergen Beisert2012-06-291-0/+24
| | | | | | | | This patch adds a simple wd command which can setup, trigger and stop a watchdog on the platform. Signed-off-by: Juergen Beisert <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* remove unused watchdog headerSascha Hauer2011-12-151-92/+0
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Cleanup (PPC4xx is AMCC now)Wolfgang Denk2005-09-231-1/+1
|
* * Patch by Peter Ryser, 20 Feb 2004:wdenk2004-02-231-0/+4
| | | | | | | | | | | | | Add support for the Xilinx ML300 platform * Patch by Stephan Linz, 17 Feb 2004: Fix watchdog support for NIOS * Patch by Josh Fryman, 16 Feb 2004: Fix byte-swapping for cfi_flash.c for different bus widths * Patch by Jon Diekema, 14 Jeb 2004: Remove duplicate "FPGA Support" notes from the README file
* Add I2C and RTC support for RMU board using software I2C driverwdenk2003-08-291-12/+0
| | | | | (because of better response to iprobe command); fix problem with "reset" command
* * Code cleanup:wdenk2003-06-271-1/+0
| | | | | | | | | - remove trailing white space, trailing empty lines, C++ comments, etc. - split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c) * Patches by Kenneth Johansson, 25 Jun 2003: - major rework of command structure (work done mostly by Michal Cendrowski and Joakim Kristiansen)
* * Patch by Martin Winistoerfer, 23 Mar 2003wdenk2003-03-311-0/+5
| | | | | | | | | - Add port to MPC555/556 microcontrollers - Add support for cmi customer board with Intel 28F128J3A, 28F320J3A or 28F640J3A flash. * Patch by Rick Bronson, 28 Mar 2003: - fix common/cmd_nand.c
* Initial revisionwdenk2002-03-081-0/+96