Commit b34f01f7 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'linux-watchdog-5.6-rc1' of git://www.linux-watchdog.org/linux-watchdog

Pull watchdog updates from Wim Van Sebroeck:

 - add IT8786 chipset ID

 - addition of sam9x60 compatible watchdog

 - da9062 improvements

 - fix UAF in reboot notifier handling in watchdog core code

 - other fixes and small improvements

* tag 'linux-watchdog-5.6-rc1' of git://www.linux-watchdog.org/linux-watchdog:
  watchdog: da9062: make restart handler atomic safe
  watchdog: mtk_wdt: mt2712: Add reset controller
  watchdog: mtk_wdt: mt8183: Add reset controller
  dt-bindings: mediatek: mt2712: Add #reset-cells
  dt-bindings: mediatek: mt8183: Add #reset-cells
  dt-bindings: watchdog: da9062: add suspend disable option
  watchdog: it87_wdt: add IT8786 ID
  watchdog: dw_wdt: ping watchdog to reset countdown before start
  watchdog: fix UAF in reboot notifier handling in watchdog core code
  watchdog: cadence: Skip printing pointer value
  watchdog: qcom: Use platform_get_irq_optional() for bark irq
  watchdog: da9062: add power management ops
  watchdog: make DesignWare watchdog allow users to set bigger timeout value
  drivers: watchdog: stm32_iwdg: set WDOG_HW_RUNNING at probe
  watchdog: sama5d4_wdt: addition of sam9x60 compatible watchdog
parents e0f121c5 057b52b4
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -6,6 +6,11 @@ Required properties:
	"dlg,da9061-watchdog", "dlg,da9062-watchdog"
	"dlg,da9062-watchdog"

Optional properties:
- dlg,use-sw-pm: Add this property to disable the watchdog during suspend.
	Only use this option if you can't use the watchdog automatic suspend
	function during a suspend (see register CONTROL_B).

Example: DA9062

	pmic0: da9062@58 {
+8 −3
Original line number Diff line number Diff line
@@ -4,22 +4,27 @@ Required properties:

- compatible should contain:
	"mediatek,mt2701-wdt", "mediatek,mt6589-wdt": for MT2701
	"mediatek,mt2712-wdt", "mediatek,mt6589-wdt": for MT2712
	"mediatek,mt6589-wdt": for MT6589
	"mediatek,mt6797-wdt", "mediatek,mt6589-wdt": for MT6797
	"mediatek,mt7622-wdt", "mediatek,mt6589-wdt": for MT7622
	"mediatek,mt7623-wdt", "mediatek,mt6589-wdt": for MT7623
	"mediatek,mt7629-wdt", "mediatek,mt6589-wdt": for MT7629
	"mediatek,mt8183-wdt", "mediatek,mt6589-wdt": for MT8183
	"mediatek,mt8516-wdt", "mediatek,mt6589-wdt": for MT8516

- reg : Specifies base physical address and size of the registers.

Optional properties:
- timeout-sec: contains the watchdog timeout in seconds.
- #reset-cells: Should be 1.

Example:

wdt: watchdog@10000000 {
	compatible = "mediatek,mt6589-wdt";
	reg = <0x10000000 0x18>;
watchdog: watchdog@10007000 {
	compatible = "mediatek,mt8183-wdt",
		     "mediatek,mt6589-wdt";
	reg = <0 0x10007000 0 0x100>;
	timeout-sec = <10>;
	#reset-cells = <1>;
};
+21 −0
Original line number Diff line number Diff line
@@ -24,7 +24,10 @@
#define AT91_WDT_MR		0x04			/* Watchdog Mode Register */
#define  AT91_WDT_WDV		(0xfffUL << 0)		/* Counter Value */
#define  AT91_WDT_SET_WDV(x)	((x) & AT91_WDT_WDV)
#define  AT91_SAM9X60_PERIODRST	BIT(4)		/* Period Reset */
#define  AT91_SAM9X60_RPTHRST	BIT(5)		/* Minimum Restart Period */
#define  AT91_WDT_WDFIEN	BIT(12)		/* Fault Interrupt Enable */
#define  AT91_SAM9X60_WDDIS	BIT(12)		/* Watchdog Disable */
#define  AT91_WDT_WDRSTEN	BIT(13)		/* Reset Processor */
#define  AT91_WDT_WDRPROC	BIT(14)		/* Timer Restart */
#define  AT91_WDT_WDDIS		BIT(15)		/* Watchdog Disable */
@@ -37,4 +40,22 @@
#define  AT91_WDT_WDUNF		BIT(0)		/* Watchdog Underflow */
#define  AT91_WDT_WDERR		BIT(1)		/* Watchdog Error */

/* Watchdog Timer Value Register */
#define AT91_SAM9X60_VR		0x08

/* Watchdog Window Level Register */
#define AT91_SAM9X60_WLR	0x0c
/* Watchdog Period Value */
#define  AT91_SAM9X60_COUNTER	(0xfffUL << 0)
#define  AT91_SAM9X60_SET_COUNTER(x)	((x) & AT91_SAM9X60_COUNTER)

/* Interrupt Enable Register */
#define AT91_SAM9X60_IER	0x14
/* Period Interrupt Enable */
#define  AT91_SAM9X60_PERINT	BIT(0)
/* Interrupt Disable Register */
#define AT91_SAM9X60_IDR	0x18
/* Interrupt Status Register */
#define AT91_SAM9X60_ISR	0x1c

#endif
+2 −3
Original line number Diff line number Diff line
@@ -369,9 +369,8 @@ static int cdns_wdt_probe(struct platform_device *pdev)
		return ret;
	platform_set_drvdata(pdev, wdt);

	dev_info(dev, "Xilinx Watchdog Timer at %p with timeout %ds%s\n",
		 wdt->regs, cdns_wdt_device->timeout,
		 nowayout ? ", nowayout" : "");
	dev_info(dev, "Xilinx Watchdog Timer with timeout %ds%s\n",
		 cdns_wdt_device->timeout, nowayout ? ", nowayout" : "");

	return 0;
}
+31 −4
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
#include <linux/platform_device.h>
#include <linux/uaccess.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/delay.h>
#include <linux/jiffies.h>
#include <linux/mfd/da9062/registers.h>
@@ -147,12 +148,13 @@ static int da9062_wdt_restart(struct watchdog_device *wdd, unsigned long action,
			      void *data)
{
	struct da9062_watchdog *wdt = watchdog_get_drvdata(wdd);
	struct i2c_client *client = to_i2c_client(wdt->hw->dev);
	int ret;

	ret = regmap_write(wdt->hw->regmap,
			   DA9062AA_CONTROL_F,
	/* Don't use regmap because it is not atomic safe */
	ret = i2c_smbus_write_byte_data(client, DA9062AA_CONTROL_F,
					DA9062AA_SHUTDOWN_MASK);
	if (ret)
	if (ret < 0)
		dev_alert(wdt->hw->dev, "Failed to shutdown (err = %d)\n",
			  ret);

@@ -212,6 +214,7 @@ static int da9062_wdt_probe(struct platform_device *pdev)
	watchdog_set_restart_priority(&wdt->wdtdev, 128);

	watchdog_set_drvdata(&wdt->wdtdev, wdt);
	dev_set_drvdata(dev, &wdt->wdtdev);

	ret = devm_watchdog_register_device(dev, &wdt->wdtdev);
	if (ret < 0)
@@ -220,10 +223,34 @@ static int da9062_wdt_probe(struct platform_device *pdev)
	return da9062_wdt_ping(&wdt->wdtdev);
}

static int __maybe_unused da9062_wdt_suspend(struct device *dev)
{
	struct watchdog_device *wdd = dev_get_drvdata(dev);

	if (watchdog_active(wdd))
		return da9062_wdt_stop(wdd);

	return 0;
}

static int __maybe_unused da9062_wdt_resume(struct device *dev)
{
	struct watchdog_device *wdd = dev_get_drvdata(dev);

	if (watchdog_active(wdd))
		return da9062_wdt_start(wdd);

	return 0;
}

static SIMPLE_DEV_PM_OPS(da9062_wdt_pm_ops,
			 da9062_wdt_suspend, da9062_wdt_resume);

static struct platform_driver da9062_wdt_driver = {
	.probe = da9062_wdt_probe,
	.driver = {
		.name = "da9062-watchdog",
		.pm = &da9062_wdt_pm_ops,
		.of_match_table = da9062_compatible_id_table,
	},
};
Loading