aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/watchdog (follow)
AgeCommit message (Collapse)AuthorFilesLines
2024-03-17Merge tag 'linux-watchdog-6.9-rc1' of git://www.linux-watchdog.org/linux-watchdogLinus Torvalds8-16/+73
Pull watchdog updates from Wim Van Sebroeck: - Remove usage of the deprecated ida_simple_xx() API - Add kernel-doc for wdt_set_timeout() - Add support for R-Car V4M, StarFive's JH8100 and sam9x7-wdt - Fixes and small improvements * tag 'linux-watchdog-6.9-rc1' of git://www.linux-watchdog.org/linux-watchdog: watchdog: intel-mid_wdt: Get platform data via dev_get_platdata() watchdog: intel-mid_wdt: Don't use "proxy" headers watchdog: intel-mid_wdt: Remove unused intel-mid.h dt-bindings: watchdog: sama5d4-wdt: add compatible for sam9x7-wdt dt-bindings: watchdog: sprd,sp9860-wdt: convert to YAML dt-bindings: watchdog: starfive,jh7100-wdt: Add compatible for JH8100 watchdog: stm32_iwdg: initialize default timeout dt-bindings: watchdog: arm,sp805: document the reset signal watchdog: sp805_wdt: deassert the reset if available watchdog/hpwdt: Support Suspend and Resume dt-bindings: watchdog: renesas-wdt: Add support for R-Car V4M watchdog: starfive: check watchdog status before enabling in system resume watchdog: starfive: Check pm_runtime_enabled() before decrementing usage counter watchdog: qcom: fine tune the max timeout value calculation watchdog: Add kernel-doc for wdt_set_timeout() watchdog: core: Remove usage of the deprecated ida_simple_xx() API
2024-03-14Merge tag 'mfd-next-6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfdLinus Torvalds3-0/+216
Pull MFD updates from Lee Jones: "New Device Support: - Add support for Watchdog to ChromeOS Embedded Controller - Add support for GPIOs to ChromeOS Embedded Controller - Add supprt for Sound to MediaTek MT6357 CODEC New Functionality: - Add power-off functionality to Texas Instruments TWL series CODECs Fix-ups: - Device Tree binding adaptions/conversions/creation - Use/convert to new/better APIs/helpers/MACROs instead of hand-rolling implementations - Trivial; spelling, whitespace, clean-ups, etc - Remove superfluous code and simplify overall - Fix include lists; alphabetise, remove unused, explicitly add used - Use dev_err_probe() to clean-up error paths - Convert used cache type over to the Maple Tree in many instances - Constify a bunch of static structs - Refrain from over-riding resources provided via the firmware Bug Fixes: - Fix a clock related firmware bug on Dell XPS 9530 et al. - Repair incorrect IRQ designations - Increase buffer sizes to omit various snprintf compiler errors - Ensure errors are handled properly - Balance references and prevent resource leaks - Rectify Power Key interrupt processing - Fix Kconfig related build errors - Correct a bunch of register start-up default values" * tag 'mfd-next-6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (65 commits) mfd: cs42l43: Fix wrong GPIO_FN_SEL and SPI_CLK_CONFIG1 defaults mfd: cs42l43: Fix wrong register defaults mfd: mt6397-core: Register mt6357 sound codec dt-bindings: mfd: syscon: Add ti,am62-usb-phy-ctrl compatible dt-bindings: mfd: dlg,da9063: Make #interrupt-cells required dt-bindings: mfd: Convert atmel-flexcom to json-schema mfd: kempld-core: Don't replace resources provided by ACPI mfd: cros_ec_dev: Add GPIO device if feature present on EC dt-bindings: mfd: cros-ec: Add properties for GPIO controller mfd: twl: Select MFD_CORE mfd: core: Constify the struct device_type usage mfd: rk8xx-core: Fix interrupt processing order for power key button mfd: twl4030-power: Accept standard property for power controller mfd: twl-core: Add power off implementation for twl603x dt-bindings: mfd: ti,twl: Document system-power-controller mfd: altera-sysmgr: Call of_node_put() only when of_parse_phandle() takes a ref mfd: syscon: Remove extern from function prototypes mfd: syscon: Call of_node_put() only when of_parse_phandle() takes a ref mfd: mc13xxx: Use bitfield helpers mfd: rc5t583: Convert to use maple tree register cache ...
2024-03-10watchdog: intel-mid_wdt: Get platform data via dev_get_platdata()Andy Shevchenko1-1/+1
Access to platform data via dev_get_platdata() getter to make code cleaner. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20240305165306.1366823-4-andriy.shevchenko@linux.intel.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2024-03-10watchdog: intel-mid_wdt: Don't use "proxy" headersAndy Shevchenko1-1/+7
Update header inclusions to follow IWYU (Include What You Use) principle. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20240305165306.1366823-3-andriy.shevchenko@linux.intel.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2024-03-10watchdog: intel-mid_wdt: Remove unused intel-mid.hAndy Shevchenko1-1/+0
intel-mid.h is providing some core parts of the South Complex PM, which are usually are not used by individual drivers. In particular, this driver doesn't use it, so simply remove the unused header. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20240305165306.1366823-2-andriy.shevchenko@linux.intel.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2024-03-03watchdog: stm32_iwdg: initialize default timeoutBen Wolsieffer1-0/+3
The driver never sets a default timeout value, therefore it is initialized to zero. When CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED is enabled, the watchdog is started during probe. The kernel is supposed to automatically ping the watchdog from this point until userspace takes over, but this does not happen if the configured timeout is zero. A zero timeout causes watchdog_need_worker() to return false, so the heartbeat worker does not run and the system therefore resets soon after the driver is probed. This patch fixes this by setting an arbitrary non-zero default timeout. The default could be read from the hardware instead, but I didn't see any reason to add this complexity. This has been tested on an STM32F746. Fixes: 85fdc63fe256 ("drivers: watchdog: stm32_iwdg: set WDOG_HW_RUNNING at probe") Signed-off-by: Ben Wolsieffer <ben.wolsieffer@hefring.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20240228182723.12855-1-ben.wolsieffer@hefring.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2024-03-03watchdog: sp805_wdt: deassert the reset if availableYang Xiwen1-0/+8
According to the datasheet, the core has an WDOGRESn input signal that needs to be deasserted before being operational. Implement it in the driver. Signed-off-by: Yang Xiwen <forbidden405@outlook.com> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20240221-hisi-wdt-v3-1-9642613dc2e6@outlook.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2024-03-03watchdog/hpwdt: Support Suspend and ResumeJerry Hoemann1-0/+25
Add call backs to support suspend and resume. Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20240214164941.630775-2-jerry.hoemann@hpe.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2024-03-03watchdog: starfive: check watchdog status before enabling in system resumeJi Sheng Teoh1-1/+4
System resume will start and enable watchdog regardless of whether the watchdog is enabled/disabled during a system suspend. Add a check to the watchdog status and only start and enable the watchdog if the watchdog status is running/active. Signed-off-by: Sia Jee Heng <jeeheng.sia@starfivetech.com> Signed-off-by: Ji Sheng Teoh <jisheng.teoh@starfivetech.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20240130055118.1917086-1-jisheng.teoh@starfivetech.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2024-03-03watchdog: starfive: Check pm_runtime_enabled() before decrementing usage counterJi Sheng Teoh1-2/+7
In the probe function, pm_runtime_put_sync() will fail on platform with runtime PM disabled. Check if runtime PM is enabled before calling pm_runtime_put_sync() to fix it. Fixes: db728ea9c7be ("drivers: watchdog: Add StarFive Watchdog driver") Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com> Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com> Signed-off-by: Ji Sheng Teoh <jisheng.teoh@starfivetech.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20240119082722.1133024-1-jisheng.teoh@starfivetech.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2024-03-03watchdog: qcom: fine tune the max timeout value calculationKathiravan Thirumoorthy1-2/+5
To determine the max_timeout value, the below calculation is used. max_timeout = 0x10000000 / clk_rate cat /sys/devices/platform/soc@0/b017000.watchdog/watchdog/watchdog0/max_timeout 8388 However, this is not valid for all the platforms. IPQ SoCs starting from IPQ40xx and recent Snapdragron SoCs also has the bark and bite time field length of 20bits, which can hold max up to 32 seconds if the clk_rate is 32KHz. If the user tries to configure the timeout more than 32s, then the value will be truncated and the actual value will not be reflected in the HW. To avoid this, lets add a variable called max_tick_count in the device data, which defines max counter value of the WDT controller. Using this, max-timeout will be calculated in runtime for various WDT contorllers. With this change, we get the proper max_timeout as below and restricts the user from configuring the timeout higher than this. cat /sys/devices/platform/soc@0/b017000.watchdog/watchdog/watchdog0/max_timeout 32 Signed-off-by: Kathiravan Thirumoorthy <quic_kathirav@quicinc.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20240116-wdt-v2-1-501c7694c3f0@quicinc.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2024-03-03watchdog: Add kernel-doc for wdt_set_timeout()Yang Li1-0/+4
The wdt_set_timeout function lacked a complete kernel-doc description. This patch adds missing parameter and return value descriptions in accordance with kernel-doc standards. Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> Reviewed-by: Guenter Roeck <linux@roeckus.net> Link: https://lore.kernel.org/r/20240206093857.62444-1-yang.lee@linux.alibaba.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2024-03-03watchdog: core: Remove usage of the deprecated ida_simple_xx() APIChristophe JAILLET1-8/+9
ida_alloc() and ida_free() should be preferred to the deprecated ida_simple_get() and ida_simple_remove(). Note that the upper limit of ida_simple_get() is exclusive, but the one of ida_alloc_range()/ida_alloc_max() is inclusive. So a -1 has been added when needed. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/bc5b82db59ccac69f2612ba104e2f5100401a862.1705009009.git.christophe.jaillet@wanadoo.fr Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2024-02-25watchdog: s3c2410_wdt: use exynos_get_pmu_regmap_by_phandle() for PMU regsPeter Griffin2-5/+4
Obtain the PMU regmap using the new API added to exynos-pmu driver rather than syscon_regmap_lookup_by_phandle(). As this driver no longer depends on mfd syscon remove that header and Kconfig dependency. Tested-by: Alexey Klimov <alexey.klimov@linaro.org> Tested-by: Sam Protsenko <semen.protsenko@linaro.org> Acked-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org> Signed-off-by: Peter Griffin <peter.griffin@linaro.org> Link: https://lore.kernel.org/r/20240220220613.797068-3-peter.griffin@linaro.org Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2024-02-01watchdog: Add ChromeOS EC-based watchdog driverLukasz Majczak3-0/+216
Embedded Controller (EC) present on Chromebook devices can be used as a watchdog. Implement a driver to support it. Signed-off-by: Lukasz Majczak <lma@chromium.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20240126095721.782782-3-lma@chromium.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-01-12Merge tag 'linux-watchdog-6.8-rc1' of git://www.linux-watchdog.org/linux-watchdogLinus Torvalds10-40/+94
Pull watchdog updates from Wim Van Sebroeck: - Add Mediatek MT7988 watchdog - Add IT8659 watchdog - watchdog: set cdev owner before adding - hpwdt: Only claim UNKNOWN NMI if from iLO - Various other fixes and improvements * tag 'linux-watchdog-6.8-rc1' of git://www.linux-watchdog.org/linux-watchdog: (30 commits) watchdog: mlx_wdt: fix all kernel-doc warnings dt-bindings: watchdog: qcom,pm8916-wdt: add parent spmi node to example dt-bindings: watchdog: nxp,pnx4008-wdt: convert txt to yaml dt-bindings: watchdog: qca,ar7130-wdt: convert txt to yaml dt-bindings: watchdog: intel,keembay: reference common watchdog schema dt-bindings: watchdog: re-order entries to match coding convention watchdog: it87_wdt: Keep WDTCTRL bit 3 unmodified for IT8784/IT8786 watchdog: it87_wdt: Add IT8659 ID watchdog: it87_wdt: Remove redundant max_units setting watchdog: it87_wdt: add blank line after variable declaration dt-bindings: wdt: Add ts72xx dt-bindings: watchdog: dlg,da9062-watchdog: Document DA9063 watchdog dt-bindings: watchdog: dlg,da9062-watchdog: Add fallback for DA9061 watchdog watchdog: rti_wdt: Drop runtime pm reference count when watchdog is unused watchdog: starfive: add lock annotations to fix context imbalances watchdog: mediatek: mt7988: add wdt support dt-bindings: watchdog: mediatek,mtk-wdt: add MT7988 watchdog and toprgu dt-bindings: watchdog: realtek,rtd1295-watchdog: convert txt to yaml watchdog: bcm2835_wdt: Fix WDIOC_SETTIMEOUT handling watchdog/hpwdt: Remove unused variable ...
2023-12-24watchdog: mlx_wdt: fix all kernel-doc warningsRandy Dunlap1-3/+1
Correct kernel-doc warnings as reported by kernel test robot: mlx_wdt.c:56: warning: Function parameter or member 'wdt_type' not described in 'mlxreg_wdt' mlx_wdt.c:56: warning: Excess struct member 'device' description in 'mlxreg_wdt' mlx_wdt.c:56: warning: Excess struct member 'timeout' description in 'mlxreg_wdt' mlx_wdt.c:56: warning: Excess struct member 'wd_type' description in 'mlxreg_wdt' Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202312171701.xNkzdgdi-lkp@intel.com/ Cc: Michael Shych <michaelsh@nvidia.com> Cc: Wim Van Sebroeck <wim@linux-watchdog.org> Cc: Guenter Roeck <linux@roeck-us.net> Cc: linux-watchdog@vger.kernel.org Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231218062659.26916-1-rdunlap@infradead.org Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-12-17watchdog: it87_wdt: Keep WDTCTRL bit 3 unmodified for IT8784/IT8786Werner Fischer1-1/+13
WDTCTRL bit 3 sets the mode choice for the clock input of IT8784/IT8786. Some motherboards require this bit to be set to 1 (= PCICLK mode), otherwise the watchdog functionality gets broken. The BIOS of those motherboards sets WDTCTRL bit 3 already to 1. Instead of setting all bits of WDTCTRL to 0 by writing 0x00 to it, keep bit 3 of it unchanged for IT8784/IT8786 chips. In this way, bit 3 keeps the status as set by the BIOS of the motherboard. Watchdog tests have been successful with this patch with the following systems: IT8784: Thomas-Krenn LES plus v2 (YANLING YL-KBRL2 V2) IT8786: Thomas-Krenn LES plus v3 (YANLING YL-CLU L2) IT8786: Thomas-Krenn LES network 6L v2 (YANLING YL-CLU6L) Link: https://lore.kernel.org/all/140b264d-341f-465b-8715-dacfe84b3f71@roeck-us.net/ Signed-off-by: Werner Fischer <devlists@wefi.net> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231213094525.11849-4-devlists@wefi.net Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-12-17watchdog: it87_wdt: Add IT8659 IDWerner Fischer1-3/+5
This patch adds watchdog support for the ITE IT8659 watchdog. IT8659 watchdog works in the same way as the other watchdogs supported by it87_wdt. Before this patch, IT8659 watchdog is not supported. After a modprobe, dmesg reports: it87_wdt: Unknown Chip found, Chip 8659 Revision 0007 With this patch, modprobe it87_wdt recognizes the watchdog as the dmesg output shows: it87_wdt: Chip IT8659 revision 7 initialized. timeout=60 sec (nowayout=0 testmode=0) Watchdog tests on a YANLING YL-ALP3L2C-1235U system have been successful, the watchdog works as expected with this patch. Signed-off-by: Werner Fischer <devlists@wefi.net> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231213094525.11849-3-devlists@wefi.net Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-12-17watchdog: it87_wdt: Remove redundant max_units settingWerner Fischer1-4/+2
Commit 893dc8b5c978 ("watchdog: it87: Drop support for resetting watchdog though CIR and Game port") removed the try_gameport variable, and left max_units setting redundant. To clean up the code, this patch removes this redundant setting. Signed-off-by: Werner Fischer <devlists@wefi.net> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231213094525.11849-2-devlists@wefi.net Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-12-17watchdog: it87_wdt: add blank line after variable declarationWerner Fischer1-0/+1
This patch fixes the following checkpatch.pl warning: WARNING: Missing a blank line after declarations Signed-off-by: Werner Fischer <devlists@wefi.net> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231213094525.11849-1-devlists@wefi.net Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-12-17watchdog: rti_wdt: Drop runtime pm reference count when watchdog is unusedVignesh Raghavendra1-1/+12
Call runtime_pm_put*() if watchdog is not already started during probe and re enable it in watchdog start as required. On K3 SoCs, watchdogs and their corresponding CPUs are under same power-domain, so if the reference count of unused watchdogs aren't dropped, it will lead to CPU hotplug failures as Device Management firmware won't allow to turn off the power-domain due to dangling reference count. Fixes: 2d63908bdbfb ("watchdog: Add K3 RTI watchdog support") Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com> Tested-by: Manorit Chawdhry <m-chawdhry@ti.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231213140110.938129-1-vigneshr@ti.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-12-17watchdog: starfive: add lock annotations to fix context imbalancesBen Dooks1-0/+2
Add the necessary __acquires() and __releases() to the functions that take and release the wdt lock to avoid the following sparse warnings: drivers/watchdog/starfive-wdt.c:204:13: warning: context imbalance in 'starfive_wdt_unlock' - wrong count at exit drivers/watchdog/starfive-wdt.c:212:9: warning: context imbalance in 'starfive_wdt_lock' - unexpected unlock Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231122085118.177589-1-ben.dooks@codethink.co.uk Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-12-17watchdog: mediatek: mt7988: add wdt supportDaniel Golle1-0/+42
Add support for watchdog and reset generator unit of the MediaTek MT7988 SoC. Signed-off-by: Daniel Golle <daniel@makrotopia.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/c0cf5f701801cce60470853fa15f1d9dced78c4f.1700504385.git.daniel@makrotopia.org Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-12-17watchdog: bcm2835_wdt: Fix WDIOC_SETTIMEOUT handlingStefan Wahren1-1/+2
Users report about the unexpected behavior for setting timeouts above 15 sec on Raspberry Pi. According to watchdog-api.rst the ioctl WDIOC_SETTIMEOUT shouldn't fail because of hardware limitations. But looking at the code shows that max_timeout based on the register value PM_WDOG_TIME_SET, which is the maximum. Since 664a39236e71 ("watchdog: Introduce hardware maximum heartbeat in watchdog core") the watchdog core is able to handle this problem. This fix has been tested with watchdog-test from selftests. Link: https://bugzilla.kernel.org/show_bug.cgi?id=217374 Fixes: 664a39236e71 ("watchdog: Introduce hardware maximum heartbeat in watchdog core") Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231112173251.4827-1-wahrenst@gmx.net Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-12-17watchdog/hpwdt: Remove unused variableJerry Hoemann1-4/+0
Remove the unused variable ilo5. Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231213215340.495734-4-jerry.hoemann@hpe.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-12-17watchdog/hpwdt: Remove redundant test.Jerry Hoemann1-3/+0
ProLiants of vintage to have an iLO 5, no longer send watchdog NMI as an IO CHECK. They are presented to hpwdt_pretimeout as NMI_UNKNOWN. The preceding if statement rejects if !mynmi irrespective of value of pretimeout making this if statement redundant. Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231213215340.495734-3-jerry.hoemann@hpe.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-12-17watchdog/hpwdt: Only claim UNKNOWN NMI if from iLOJerry Hoemann1-1/+1
Avoid unnecessary crashes by claiming only NMIs that are due to ERROR signalling or generated by the hpwdt hardware device. The code does this, but only for iLO5. The intent was to preserve legacy, Gen9 and earlier, semantics of using hpwdt for error containtment as hardware/firmware would signal fatal IO errors as an NMI with the expectation of hpwdt crashing the system. Howerver, these IO errors should be received by hpwdt as an NMI_IO_CHECK. So the test is overly permissive and should not be limited to only ilo5. We need to enable this protection for future iLOs not matching the current PCI IDs. Fixes: 62290a5c194b ("watchdog: hpwdt: Claim NMIs generated by iLO5") Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231213215340.495734-2-jerry.hoemann@hpe.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-12-17watchdog: txx9wdt: Convert to platform remove callback returning voidUwe Kleine-König1-3/+2
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231106154807.3866712-6-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-12-17watchdog: starfive-wdt: Convert to platform remove callback returning voidUwe Kleine-König1-4/+2
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231106154807.3866712-5-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-12-17watchdog: at91sam9_wdt: Convert to platform remove callback returning voidUwe Kleine-König1-4/+2
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231106154807.3866712-4-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-12-17watchdog: txx9: Stop using module_platform_driver_probe()Uwe Kleine-König1-5/+5
On today's platforms the benefit of platform_driver_probe() isn't that relevant any more. It allows to drop some code after booting (or module loading) for .probe() and discard the .remove() function completely if the driver is built-in. This typically saves a few 100k. The downside of platform_driver_probe() is that the driver cannot be bound and unbound at runtime which is ancient and also slightly complicates testing. There are also thoughts to deprecate platform_driver_probe() because it adds some complexity in the driver core for little gain. Also many drivers don't use it correctly. This driver for example misses to mark the driver struct with __refdata which is needed to suppress a (W=1) modpost warning: WARNING: modpost: drivers/watchdog/txx9wdt: section mismatch in reference: txx9wdt_driver+0x4 (section: .data) -> txx9wdt_remove (section: .exit.text) Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231106154807.3866712-3-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-12-17watchdog: at91sam9: Stop using module_platform_driver_probe()Uwe Kleine-König1-5/+5
On today's platforms the benefit of platform_driver_probe() isn't that relevant any more. It allows to drop some code after booting (or module loading) for .probe() and discard the .remove() function completely if the driver is built-in. This typically saves a few 100k. The downside of platform_driver_probe() is that the driver cannot be bound and unbound at runtime which is ancient and also slightly complicates testing. There are also thoughts to deprecate platform_driver_probe() because it adds some complexity in the driver core for little gain. Also many drivers don't use it correctly. This driver for example misses to mark the driver struct with __refdata which is needed to suppress a (W=1) modpost warning: WARNING: modpost: drivers/watchdog/at91sam9_wdt: section mismatch in reference: at91wdt_driver+0x4 (section: .data) -> at91wdt_remove (section: .exit.text) Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231106154807.3866712-2-u.kleine-koenig@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-12-17watchdog: set cdev owner before addingCurtis Klein1-2/+1
When the new watchdog character device is registered, it becomes available for opening. This creates a race where userspace may open the device before the character device's owner is set. This results in an imbalance in module_get calls as the cdev_get in cdev_open will not increment the reference count on the watchdog driver module. This causes problems when the watchdog character device is released as the module loader's reference will also be released. This makes it impossible to open the watchdog device later on as it now appears that the module is being unloaded. The open will fail with -ENXIO from chrdev_open. The legacy watchdog device will fail with -EBUSY from the try_module_get in watchdog_open because it's module owner is the watchdog core module so it can still be opened but it will fail to get a refcount on the underlying watchdog device driver. Fixes: 72139dfa2464 ("watchdog: Fix the race between the release of watchdog_core_data and cdev") Signed-off-by: Curtis Klein <curtis.klein@hpe.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231205190522.55153-1-curtis.klein@hpe.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-12-13watchdog: s3c2410_wdt: Add support for Google gs101 SoCPeter Griffin1-4/+43
This patch adds the compatibles and drvdata for the Google gs101 SoC found in Pixel 6, Pixel 6a & Pixel 6 pro phones. Similar to Exynos850 it has two watchdog instances, one for each cluster and has some control bits in PMU registers. gs101 also has the dbgack_mask bit in wtcon register, so we also enable QUIRK_HAS_DBGACK_BIT. Tested-by: Will McVicker <willmcvicker@google.com> Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org> Signed-off-by: Peter Griffin <peter.griffin@linaro.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231211162331.435900-13-peter.griffin@linaro.org Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2023-12-13watchdog: s3c2410_wdt: Update QUIRK macros to use BIT macroPeter Griffin1-5/+5
Update the remaining QUIRK macros to use the BIT macro. Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org> Signed-off-by: Peter Griffin <peter.griffin@linaro.org> Link: https://lore.kernel.org/r/20231211162331.435900-12-peter.griffin@linaro.org Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2023-12-13watchdog: s3c2410_wdt: Add support for WTCON register DBGACK_MASK bitPeter Griffin1-3/+25
The WDT uses the CPU core signal DBGACK to determine whether the SoC is running in debug mode or not. If the DBGACK signal is asserted and DBGACK_MASK bit is enabled, then WDT output and interrupt is masked (disabled). Presence of the DBGACK_MASK bit is determined by adding a new QUIRK_HAS_DBGACK_BIT quirk. Also update to use BIT macro to avoid checkpatch --strict warnings. Tested-by: Will McVicker <willmcvicker@google.com> Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org> Signed-off-by: Peter Griffin <peter.griffin@linaro.org> Link: https://lore.kernel.org/r/20231211162331.435900-11-peter.griffin@linaro.org Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2023-11-10Merge tag 'mips_6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linuxLinus Torvalds3-322/+0
Pull MIPS updates from Thomas Bogendoerfer: - removed AR7 platform support - cleanups and fixes * tag 'mips_6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: MIPS: AR7: remove platform watchdog: ar7_wdt: remove driver to prepare for platform removal vlynq: remove bus driver mtd: parsers: ar7: remove support serial: 8250: remove AR7 support arch: mips: remove ReiserFS from defconfig MIPS: lantiq: Remove unnecessary include of <linux/of_irq.h> MIPS: lantiq: Fix pcibios_plat_dev_init() "no previous prototype" warning MIPS: KVM: Fix a build warning about variable set but not used MIPS: Remove dead code in relocate_new_kernel mips: dts: ralink: mt7621: rename to GnuBee GB-PC1 and GnuBee GB-PC2 mips: dts: ralink: mt7621: define each reset as an item mips: dts: ingenic: Remove unneeded probe-type properties MIPS: loongson32: Remove dma.h and nand.h
2023-11-09Merge tag 'linux-watchdog-6.7-rc1' of git://www.linux-watchdog.org/linux-watchdogLinus Torvalds16-79/+123
Pull watchdog updates from Wim Van Sebroeck: - add support for Amlogic C3 and S4 SoCs - add IT8613 ID - add MSM8226 and MSM8974 compatibles - other small fixes and improvements * tag 'linux-watchdog-6.7-rc1' of git://www.linux-watchdog.org/linux-watchdog: (24 commits) dt-bindings: watchdog: Add support for Amlogic C3 and S4 SoCs watchdog: mlx-wdt: Parameter desctiption warning fix watchdog: aspeed: Add support for aspeed,reset-mask DT property dt-bindings: watchdog: aspeed-wdt: Add aspeed,reset-mask property watchdog: apple: Deactivate on suspend dt-bindings: watchdog: qcom-wdt: Add MSM8226 and MSM8974 compatibles dt-bindings: watchdog: fsl-imx7ulp-wdt: Add 'fsl,ext-reset-output' wdog: imx7ulp: Enable wdog int_en bit for watchdog any reset drivers: watchdog: marvell_gti: Program the max_hw_heartbeat_ms drivers: watchdog: marvell_gti: fix zero pretimeout handling watchdog: marvell_gti: Replace of_platform.h with explicit includes watchdog: imx_sc_wdt: continue if the wdog already enabled watchdog: st_lpc: Use device_get_match_data() watchdog: wdat_wdt: Add timeout value as a param in ping method watchdog: gpio_wdt: Make use of device properties sbsa_gwdt: Calculate timeout with 64-bit math watchdog: ixp4xx: Make sure restart always works watchdog: it87_wdt: add IT8613 ID watchdog: marvell_gti_wdt: Fix error code in probe() Watchdog: marvell_gti_wdt: Remove redundant dev_err_probe() for platform_get_irq() ...
2023-10-29watchdog: mlx-wdt: Parameter desctiption warning fixMichael Shych1-0/+1
Add parameter desription to fix warning. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202310241044.lvqeOGli-lkp@intel.com Signed-off-by: Michael Shych <michaelsh@nvidia.com> Signed-off-by: Vadim Pasternak <vadimp@nvidia.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231026082558.12142-1-michaelsh@nvidia.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-10-29watchdog: aspeed: Add support for aspeed,reset-mask DT propertyZev Weiss1-0/+11
This property allows the device-tree to specify how the Aspeed watchdog timer's reset mask register(s) should be set, so that peripherals can be individually exempted from (or opted in to) being reset when the watchdog timer expires. Signed-off-by: Zev Weiss <zev@bewilderbeest.net> Reviewed-by: Joel Stanley <joel@jms.id.au> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20230922104231.1434-6-zev@bewilderbeest.net Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-10-29watchdog: apple: Deactivate on suspendJanne Grunau1-0/+25
The watchdog remains active after putting the system into suspend. Add PM callbacks to deactivate the watchdog on suspend an re-activate it on resume. Signed-off-by: Janne Grunau <j@jannau.net> Reviewed-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Neal Gompa <neal@gompa.dev> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231016-apple-watchdog-suspend-v2-1-7ffff8042dbc@jannau.net Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-10-29wdog: imx7ulp: Enable wdog int_en bit for watchdog any resetJacky Bai1-0/+8
The wdog INT_EN bit in CS register should be set to '1' to trigger WDOG_ANY external reset on i.MX93. Signed-off-by: Jacky Bai <ping.bai@nxp.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231010081909.2899101-1-ping.bai@nxp.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-10-29drivers: watchdog: marvell_gti: Program the max_hw_heartbeat_msGeorge Cherian1-0/+1
Program the max_hw_heartbeat_ms value so that the watchdog_pretimeout worker is activated. This kernel worker thread makes sure to ping the watchdog in case the userspace is unable to do so. This kernel worker ping will be done only till the full watchdog timeout there by maintaining the watchdog functionality in case of a real hang. Signed-off-by: George Cherian <george.cherian@marvell.com> Signed-off-by: Bharat Bhushan <bbhushan2@marvell.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231009044037.514570-2-bbhushan2@marvell.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-10-29drivers: watchdog: marvell_gti: fix zero pretimeout handlingBharat Bhushan1-0/+7
When pretimeout is set to 0 then do not reprogram timer with zero timeout, this will reset device immediately. Also disable interrupt to stop pretimeout notification. Signed-off-by: Bharat Bhushan <bbhushan2@marvell.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231009044037.514570-1-bbhushan2@marvell.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-10-29watchdog: marvell_gti: Replace of_platform.h with explicit includesRob Herring1-1/+1
The DT of_device.h and of_platform.h date back to the separate of_platform_bus_type before it was merged into the regular platform bus. As part of that merge prepping Arm DT support 13 years ago, they "temporarily" include each other and pull in various other headers. In preparation to fix this, adjust the includes for what is actually needed. of_platform.h isn't needed, but of.h was implicitly included by it (via of_device.h). Signed-off-by: Rob Herring <robh@kernel.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231010205636.1584480-1-robh@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-10-29watchdog: imx_sc_wdt: continue if the wdog already enabledJacky Bai1-1/+4
if the wdog is already enabled, and try to enabled it again, we should ignore the error and continue, rather than return error. Signed-off-by: Jacky Bai <ping.bai@nxp.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231010074626.2787383-1-ping.bai@nxp.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-10-29watchdog: st_lpc: Use device_get_match_data()Rob Herring1-9/+2
Use preferred device_get_match_data() instead of of_match_device() to get the driver match data. With this, adjust the includes to explicitly include the correct headers. Signed-off-by: Rob Herring <robh@kernel.org> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231009211356.3242037-18-robh@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-10-29watchdog: wdat_wdt: Add timeout value as a param in ping methodXing Tong Wu1-1/+1
According to the WDAT spec that states about WATCHDOG_ACTION_SET_COUNTDOWN_PERIOD: "This action is required if WATCHDOG_ACTION_RESET does not explicitly write a new countdown value to a register during a reset." And that implies, WATCHDOG_ACTION_RESET may write a countdown value, thus may come with a WATCHDOG_INSTRUCTION_WRITE_COUNTDOWN, thus need the timeout value as parameter or would otherwise write 0. The watchdog for SIONCT6126 need a entry WATCHDOG_INSTRUCTION_WRITE_COUNTDOWN for WATCHDOG_ACTION_RESET action, I send this patch to support it. Signed-off-by: Xing Tong Wu <xingtong.wu@siemens.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231007082125.4699-1-xingtong_wu@163.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2023-10-29watchdog: gpio_wdt: Make use of device propertiesAndy Shevchenko1-9/+7
Convert the module to be property provider agnostic and allow it to be used on non-OF platforms. Include mod_devicetable.h explicitly to replace the dropped of.h which included mod_devicetable.h indirectly. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20230925123543.2945710-1-andriy.shevchenko@linux.intel.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>