summaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
Commit message (Collapse)AuthorAgeFilesLines
* poller: Give pollers a nameSascha Hauer2020-05-201-1/+1
| | | | | | It helps debugging when pollers have a name, so give them one. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mxs'Sascha Hauer2020-05-141-0/+9
|\
| * watchdog: i.MX28: Add device tree supportSascha Hauer2020-05-061-0/+9
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | drivers: mark first batch of compilable drivers for COMPILE_TESTAhmad Fatoum2020-05-081-9/+9
|/ | | | | | | | | All of these drivers have a runtime dependency on SoC peripherals, but can nevertheless be compile-tested. Add COMPILE_TEST as an alternate dependency. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: kvx: Add kvx watchdog supportClement Leger2020-04-153-0/+101
| | | | | | | Add a watchdog for kvx architecture based on core watchdog. Signed-off-by: Clement Leger <cleger@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* reset: stm32: migrate restart reason and handler from stm32_iwdgAhmad Fatoum2020-02-191-99/+0
| | | | | | | | | | | | | The watchdog driver will remain unprobed if the driver or the OF node is disabled, but the reset reason is useful even then. System reset and reset source determination is achieved with the RCC peripheral for which we have a reset controller driver. Move the code over there, so reset reason and reset are available always. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* reset_source: migrate from reset_source_name to reset_source_to_stringAhmad Fatoum2020-02-192-2/+2
| | | | | | | | | | Whether reset_source_name() returns the just set reset_source is dependent on probe order and the priorities of prior reset sources in relation to the current one. Make this more robust by using the new reset_source_to_string. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: f71808e: only print reset reason if one's indicatedAhmad Fatoum2020-02-191-4/+4
| | | | | | | | | | On most resets, a "reset reason: unknown" would clutter the console, because the watchdog doesn't support differentiating between POR and RST. Reduce the clutter by only printing the message when we have something interesting to say (i.e. watchdog reset). Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: dw_wdt: remove duplicated error messageAhmad Fatoum2020-02-121-1/+1
| | | | | | | | | The wd command already warns that "Watchdog cannot be disabled", when the stop operation returns -ENOSYS. We do that now, so telling the user that it will not stop is superfluous. Remove it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: dw_wdt: inform user on missing reset control lineAhmad Fatoum2020-02-121-4/+6
| | | | | | | | | | | | | | | The driver has an error message on probe and one on each watchdog stop attempt that warns the user if the reset line is missing. Missing reset line (because the "reset"-property is missing) is indicated by a NULL pointer though, so these warnings were only triggered when the reset controller specification is malformed. Fix this by propagating malformed reset pointer specification and continuing only if it's either valid or completely missing. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: dw_wdt: populate driver_d.nameAhmad Fatoum2020-02-121-0/+1
| | | | | | | | | | | | | | Apparently, somewhere between v2017.01.0 and v2020.01.0, barebox became dependent on drivers having a name as having this driver enabled in v2020.01.0 has barebox crash due to a null pointer dereference in the device_match's second strcmp. A previous commit introduced a palatable warning for this case. Now in order to be able to use the driver again, give it a name. Cc: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: Fix error pathChristian Eggers2020-01-221-9/+21
| | | | | | | | In case of an error (e.g. dev_add_param_tristate_ro() returns -ENOSYS), device registration must be reverted. Signed-off-by: Christian Eggers <ceggers@arri.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/watchdog'Sascha Hauer2019-12-104-18/+52
|\
| * watchdog: core: use new dev_add_param_tristate helper for .running paramAhmad Fatoum2019-12-051-8/+1
| | | | | | | | | | | | | | | | | | 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: stm32_iwdg: explicitly set .running to UNSUPPORTEDAhmad Fatoum2019-11-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've spent some time trying to get the ONF (Watchdog enable status) bit in the IWDG_SR register to read as something other than zero. It has since been confirmed to be non-functional[1]. To avoid someone else spending time on this, document that running status is unsupported on this hardware explicitly. No functional change as UNSUPPORTED is already the default. [1]: https://www.spinics.net/lists/arm-kernel/msg770527.html Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * watchdog: f71808e: support .running device parameterAhmad Fatoum2019-11-111-1/+6
| | | | | | | | | | | | | | | | | | The American Megatrends BIOS I am using can be configured to start the Fintek watchdog prior to the UEFI payloads. To avoid BIOS updates that reset this functionality going unnoticed, implement support for WDOG_HW_RUNNING. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * watchdog: imxwd: support .running device parameter on i.MX2+Ahmad Fatoum2019-11-111-0/+14
| | | | | | | | | | | | | | | | | | The i.MX can be fused to start the watchdog on power-on reset. To give users an easy way to determine whether the watchdog is running, implement support for WDOG_HW_RUNNING. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * watchdog: implement generic support for .running device parameterAhmad Fatoum2019-11-111-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-16/+18
| | | | | | | | | | | | | | | | | | | | | | 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: stm32_iwdg: return -ENOSYS on attempt to disableAhmad Fatoum2019-11-131-1/+1
| | | | | | | | | | | | | | | | | | | | The stm32_iwdg watchdog can't be disabled. To have the wd commant report this fact correctly to the user, the ->set_timeout needs to return -ENOSYS which is interpreted as "Watchdog cannot be disabled" instead of -EINVAL which means "Timeout value out of range". Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mfd: stpmic1: use register define from headerAhmad Fatoum2019-11-131-16/+12
|/ | | | | | | | | A previous commit has copied over the upstream <linux/mfd/stpmic1.h> header. Use it instead of replicating register definitions in the MFD and watchdog cell driver. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/watchdog'Sascha Hauer2019-11-074-26/+50
|\
| * watchdog: add timeout_cur parameter only when poller is enabledAhmad Fatoum2019-10-291-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | timeout_curr is the timeout programmed into the watchdog hardware every 500 milliseconds. If watchdog poller support is disabled, it still shows up as a configurable device parameter, but has no effect. Improve user experience by having it show up only if watchdog poller support was compiled in. This is already the case for the autoping parameter. The timeout_max parameter is a generic parameter and will remain unchanged. 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-5/+5
| | | | | | | | | | | | | | | | | | | | | | 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: remove wrong uses of timeout_curAhmad Fatoum2019-10-292-2/+0
| | | | | | | | | | | | | | | | | | | | | | The barebox watchdog poller uses the struct watchdog.timeout_cur as the timeout value to configure the watchdog with. There's no need for the device driver to set this. I didn't know that when I wrote the drivers, but I do now, hence this commit. 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-16/+24
| | | | | | | | | | | | | | | | | | | | | | | | 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: export priority as device parameterAhmad Fatoum2019-10-241-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 8f4cf30903 ("watchdog: Allow multiple watchdogs") introduced the ability to set a per-watchdog priority from within drivers, which is usually populated with of_get_watchdog_priority. For debugging, it can be useful to query and override this priority on the fly. Provide a device parameter to do so. As watchdog_get_default only considers priorities > 0, it makes sense to have a newly set priority of 0 disable the watchdog. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * watchdog: efi: bump down priority below defaultAhmad Fatoum2019-10-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The barebox EFI documentation notes: > Current linux kernel (v5.0) will execute ExitBootServices() during the > early boot stage and thus will automatically disable the (U)EFI watchdog. > Since it is the proper behavior according to the (U)EFI specification, it > is impossible to protect full boot chain by using this watchdog only. > It is recommended to use an alternative hardware watchdog Heed the advice and bump down the EFI watchdog priority below the watchdog priority default. This ensures the EFI watchdog isn't inadvertently used if other watchdogs are registered. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mfd: stpmic1: use dev_get_regmap instead of priv memberAhmad Fatoum2019-11-061-1/+4
|/ | | | | | | | | When we call regmap_init, the regmap is associated with the device supplied and can be queried with dev_get_regmap. This is more natural than expecting cell drivers to cast dev->parent->priv. Do it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: add support for Fintek F718xx and, F818xx Super I/OAhmad Fatoum2019-10-143-0/+389
| | | | | | | | This is an adaptation of the Linux v5.3 f71808e_wdt driver for the watchdog component of the Fintek Super I/O chips. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/stm32'Sascha Hauer2019-09-123-0/+231
|\
| * watchdog: add support for STPMIC1 integrated watchdogAhmad Fatoum2019-09-093-0/+231
| | | | | | | | | | | | | | | | The driver adds support for the PMIC's watchdog, reset, poweroff and reset reason query capabilities. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | reset_source: drop reset_source_set_instance()Uwe Kleine-König2019-08-281-2/+1
|/ | | | | | | | | | | | The semantic of reset_source_set_instance() required a separate call to reset_source_set() (or reset_source_set_priority()) and checked right usage only using the type. Make the set of functions a bit easier to use by dropping reset_source_set_instance() and instead introduce a function that can set all relevant parameters (source, priority and instance) in one go. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: stm32_iwdg: remove left-over commentAhmad Fatoum2019-07-111-5/+0
| | | | | | | | The reset reason part of the code is based on the i.MX6's and duplicated a comment from there, which isn't applicable to the STM32. Delete it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: add stm32 watchdog and reset driverAhmad Fatoum2019-06-193-0/+307
| | | | | | | | | | The driver supports setting watchdog timeout, system reset and querying reset reason. Disabling watchdog isn't possible in hardware, thus users should either only enable it before boot or have the poller take care of feeding it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: imx: Add big endian register access supportSascha Hauer2019-03-133-3/+12
| | | | | | | Layerscape SoCs feature the same watchdog as the i.MX SoCs, but in big endian mode. Add support for it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: imx: Add register accessor functionsSascha Hauer2019-03-131-14/+24
| | | | | | In preparation of adding big endian support in the next step. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/rpi'Sascha Hauer2019-03-071-0/+5
|\
| * watchdog: bcm2835: set timeout_max.Tomaz Solc2019-02-181-0/+5
| | | | | | | | | | | | BCM2835 watchdog timeout can be set to maximum 15 seconds (0xffffff >> 16). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2019-03-071-1/+1
|\ \
| * | watchdog: fix WATCHDOG_POLLER menuconfigOleksij Rempel2019-02-271-1/+1
| |/ | | | | | | | | | | | | make it properly represented by menuconfig Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / watchdog: add (U)EFI driverOleksij Rempel2019-02-183-0/+71
|/ | | | | | | | This driver is using SetWatchdogTimer() UEFI interface and was tested on iBASE MI991AF Mini-ITX motherboard. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX: When SRSR shows wdog then lookup reset source in wdogSascha Hauer2018-11-161-3/+7
| | | | | | | | | | | | | On i.MX6 when the watchdog has resetted the system then the SRSR register correctly shows that the watchdog has resetted the system. This is not the desired result though, a "reset" in barebox or "reboot" in Linux should result in "RST" as reset source. So instead of making the SRSR register value overwrite the reset source read from the watchdog registers, interpret the SRSR value corresponding to watchdog reset as "lookup details in the watchdog registers". Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
* drivers: Introduce dev_set_name()Andrey Smirnov2018-10-181-1/+1
| | | | | | | | Introduce dev_set_name() in order to hide implementation details of setting device's name so it'd be easier to change it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: rave-sp-wdt: Explicitly access EEPROM for bootsourceAndrey Smirnov2018-06-261-38/+41
| | | | | | | | | | | | | | | | RAVE SP firmware versions found on RDU2 provide decicated bootsource manipulation commands, which, under the hood, are just thin wrappers around write/read to a particular location in EEPROM. Unfortunately, RAVE SP firmware found on RDU1, does not provide any dedicated bootsource commands and its users are expected to access EEPROM directly. In order to avoid having separate code paths for handling those two cases, convert the code to access EEPROM directly via NVMEM API. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* watchdog: rave-sp-wdt: Remove bogus leftover codeAndrey Smirnov2018-06-261-4/+1
| | | | | | | | This code should've been removed when the driver was rebased against latest watchdog plumbing in Barebox. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2018-05-093-0/+432
|\
| * watchdog: Port RAVE SP watchdog driver from Linux kernelAndrey Smirnov2018-05-043-0/+432
| | | | | | | | | | | | | | Port RAVE SP watchdog driver from Linux kernel Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | watchdog: omap: set hwdev before call watchdog_registerAndreas Schmidt2018-04-251-0/+1
| | | | | | | | | | | | | | | | | | Since watchdog_register access to hwdev (see commit 65a644388e845bde01215bf378d4df2a6a260a6a) hwdev has to be initiate/set before calling watchdog_register. Signed-off-by: Andreas Schmidt <mail@schmidt-andreas.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | watchdog: core: check hwdev before use itAndreas Schmidt2018-04-251-2/+4
|/ | | | | | | | Avoid null pointer access, if hwdev was not set before call watchdog_register. Signed-off-by: Andreas Schmidt <mail@schmidt-andreas.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>