Commit 61f4c3e6 authored by Linus Torvalds's avatar Linus Torvalds

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

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
  ...
parents 5dfec3cf 9546b21e
......@@ -6,13 +6,13 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: Allwinner A10 Watchdog
allOf:
- $ref: watchdog.yaml#
maintainers:
- Chen-Yu Tsai <wens@csie.org>
- Maxime Ripard <mripard@kernel.org>
allOf:
- $ref: watchdog.yaml#
properties:
compatible:
oneOf:
......
......@@ -6,12 +6,12 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: Alphascale asm9260 Watchdog timer
allOf:
- $ref: watchdog.yaml#
maintainers:
- Oleksij Rempel <linux@rempel-privat.de>
allOf:
- $ref: watchdog.yaml#
properties:
compatible:
const: alphascale,asm9260-wdt
......
......@@ -6,12 +6,12 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: Apple SoC Watchdog
allOf:
- $ref: watchdog.yaml#
maintainers:
- Sven Peter <sven@svenpeter.dev>
allOf:
- $ref: watchdog.yaml#
properties:
compatible:
items:
......
......@@ -6,12 +6,12 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: ARM Secure Monitor Call based watchdog
allOf:
- $ref: watchdog.yaml#
maintainers:
- Julius Werner <jwerner@chromium.org>
allOf:
- $ref: watchdog.yaml#
properties:
compatible:
enum:
......
......@@ -6,14 +6,14 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: BCM63xx and BCM7038 watchdog timer
allOf:
- $ref: watchdog.yaml#
maintainers:
- Florian Fainelli <f.fainelli@gmail.com>
- Justin Chen <justinpopo6@gmail.com>
- Rafał Miłecki <rafal@milecki.pl>
allOf:
- $ref: watchdog.yaml#
properties:
compatible:
enum:
......@@ -29,11 +29,11 @@ properties:
The clock running the watchdog. If no clock is found the driver will
default to 27000000 Hz.
unevaluatedProperties: false
required:
- reg
unevaluatedProperties: false
examples:
- |
watchdog@f040a7e8 {
......
......@@ -12,12 +12,12 @@ description: |
timer counters. The first timer (called "Timer A") is the only one that can be
used as watchdog.
allOf:
- $ref: watchdog.yaml#
maintainers:
- Baruch Siach <baruch@tkos.co.il>
allOf:
- $ref: watchdog.yaml#
properties:
compatible:
const: cnxt,cx92755-wdt
......
......@@ -4,7 +4,7 @@
$id: http://devicetree.org/schemas/watchdog/dlg,da9062-watchdog.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Dialog Semiconductor DA9062/61 Watchdog Timer
title: Dialog Semiconductor DA906{1,2,3} Watchdog Timer
maintainers:
- Steve Twiss <stwiss.opensource@diasemi.com>
......@@ -14,9 +14,13 @@ allOf:
properties:
compatible:
enum:
- dlg,da9061-watchdog
oneOf:
- enum:
- dlg,da9062-watchdog
- dlg,da9063-watchdog
- items:
- const: dlg,da9061-watchdog
- const: dlg,da9062-watchdog
dlg,use-sw-pm:
type: boolean
......
......@@ -9,6 +9,9 @@ title: Intel Keem Bay SoC non-secure Watchdog Timer
maintainers:
- Wan Ahmad Zainie <wan.ahmad.zainie.wan.mohamad@intel.com>
allOf:
- $ref: watchdog.yaml#
properties:
compatible:
enum:
......@@ -37,7 +40,7 @@ required:
- interrupt-names
- clocks
additionalProperties: false
unevaluatedProperties: false
examples:
- |
......
......@@ -6,14 +6,14 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: Maxim 63xx Watchdog Timers
allOf:
- $ref: watchdog.yaml#
- $ref: /schemas/memory-controllers/mc-peripheral-props.yaml#
maintainers:
- Marc Zyngier <maz@kernel.org>
- Linus Walleij <linus.walleij@linaro.org>
allOf:
- $ref: watchdog.yaml#
- $ref: /schemas/memory-controllers/mc-peripheral-props.yaml#
properties:
compatible:
enum:
......
......@@ -25,6 +25,7 @@ properties:
- mediatek,mt6735-wdt
- mediatek,mt6795-wdt
- mediatek,mt7986-wdt
- mediatek,mt7988-wdt
- mediatek,mt8183-wdt
- mediatek,mt8186-wdt
- mediatek,mt8188-wdt
......
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/watchdog/nxp,pnx4008-wdt.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: NXP PNX watchdog timer
maintainers:
- Roland Stigge <stigge@antcom.de>
allOf:
- $ref: watchdog.yaml#
properties:
compatible:
const: nxp,pnx4008-wdt
reg:
maxItems: 1
required:
- compatible
- reg
unevaluatedProperties: false
examples:
- |
watchdog@4003c000 {
compatible = "nxp,pnx4008-wdt";
reg = <0x4003c000 0x1000>;
timeout-sec = <10>;
};
* NXP PNX watchdog timer
Required properties:
- compatible: must be "nxp,pnx4008-wdt"
- reg: physical base address of the controller and length of memory mapped
region.
Optional properties:
- timeout-sec: contains the watchdog timeout in seconds.
Example:
watchdog@4003c000 {
compatible = "nxp,pnx4008-wdt";
reg = <0x4003C000 0x1000>;
timeout-sec = <10>;
};
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/watchdog/qca,ar7130-wdt.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Qualcomm Atheros AR7130 Watchdog Timer (WDT) Controller
maintainers:
- Gabor Juhos <juhosg@openwrt.org>
allOf:
- $ref: watchdog.yaml#
properties:
compatible:
const: qca,ar7130-wdt
reg:
maxItems: 1
required:
- compatible
- reg
unevaluatedProperties: false
examples:
- |
watchdog@18060008 {
compatible = "qca,ar7130-wdt";
reg = <0x18060008 0x8>;
};
* Qualcomm Atheros AR7130 Watchdog Timer (WDT) Controller
Required properties:
- compatible: must be "qca,ar7130-wdt"
- reg: physical base address of the controller and length of memory mapped
region.
Example:
wdt@18060008 {
compatible = "qca,ar9330-wdt", "qca,ar7130-wdt";
reg = <0x18060008 0x8>;
};
......@@ -30,6 +30,10 @@ examples:
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/spmi/spmi.h>
spmi {
#address-cells = <2>;
#size-cells = <0>;
pmic@0 {
compatible = "qcom,pm8916", "qcom,spmi-pmic";
reg = <0x0 SPMI_USID>;
......@@ -49,3 +53,4 @@ examples:
};
};
};
};
......@@ -123,7 +123,7 @@ examples:
compatible = "qcom,apss-wdt-sm8150", "qcom,kpss-wdt";
reg = <0x17c10000 0x1000>;
clocks = <&sleep_clk>;
interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
interrupts = <GIC_SPI 0 IRQ_TYPE_EDGE_RISING>;
timeout-sec = <10>;
};
......
Realtek RTD1295 Watchdog
========================
Required properties:
- compatible : Should be "realtek,rtd1295-watchdog"
- reg : Specifies the physical base address and size of registers
- clocks : Specifies one clock input
Example:
watchdog@98007680 {
compatible = "realtek,rtd1295-watchdog";
reg = <0x98007680 0x100>;
clocks = <&osc27M>;
};
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/watchdog/realtek,rtd1295-watchdog.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Realtek RTD1295 Watchdog
maintainers:
- Andreas Färber <afaerber@suse.de>
allOf:
- $ref: watchdog.yaml#
properties:
compatible:
const: realtek,rtd1295-watchdog
reg:
maxItems: 1
clocks:
maxItems: 1
required:
- compatible
- reg
- clocks
unevaluatedProperties: false
examples:
- |
watchdog@98007680 {
compatible = "realtek,rtd1295-watchdog";
reg = <0x98007680 0x100>;
clocks = <&osc27M>;
};
......@@ -6,12 +6,12 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: Synopsys Designware Watchdog Timer
allOf:
- $ref: watchdog.yaml#
maintainers:
- Jamie Iles <jamie@jamieiles.com>
allOf:
- $ref: watchdog.yaml#
properties:
compatible:
oneOf:
......@@ -73,13 +73,13 @@ properties:
minItems: 16
maxItems: 16
unevaluatedProperties: false
required:
- compatible
- reg
- clocks
unevaluatedProperties: false
examples:
- |
watchdog@ffd02000 {
......
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/watchdog/technologic,ts7200-wdt.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Technologic Systems TS-72xx based SBCs watchdog
maintainers:
- Nikita Shubin <nikita.shubin@maquefel.me>
allOf:
- $ref: watchdog.yaml#
properties:
compatible:
oneOf:
- const: technologic,ts7200-wdt
- items:
- enum:
- technologic,ts7300-wdt
- technologic,ts7260-wdt
- technologic,ts7250-wdt
- const: technologic,ts7200-wdt
reg:
items:
- description: control register
- description: feed register
required:
- compatible
- reg
unevaluatedProperties: false
examples:
- |
watchdog@23800000 {
compatible = "technologic,ts7200-wdt";
reg = <0x23800000 0x01>, <0x23c00000 0x01>;
timeout-sec = <30>;
};
...
......@@ -6106,7 +6106,7 @@ F: Documentation/devicetree/bindings/regulator/dlg,da9*.yaml
F: Documentation/devicetree/bindings/regulator/dlg,slg51000.yaml
F: Documentation/devicetree/bindings/sound/da[79]*.txt
F: Documentation/devicetree/bindings/thermal/da90??-thermal.txt
F: Documentation/devicetree/bindings/watchdog/da90??-wdt.txt
F: Documentation/devicetree/bindings/watchdog/dlg,da90??-watchdog.yaml
F: Documentation/hwmon/da90??.rst
F: drivers/gpio/gpio-da90??.c
F: drivers/hwmon/da90??-hwmon.c
......
......@@ -324,7 +324,7 @@ static inline int of_at91wdt_init(struct device_node *np, struct at91wdt *wdt)
}
#endif
static int __init at91wdt_probe(struct platform_device *pdev)
static int at91wdt_probe(struct platform_device *pdev)
{
int err;
struct at91wdt *wdt;
......@@ -372,15 +372,13 @@ static int __init at91wdt_probe(struct platform_device *pdev)
return 0;
}
static int __exit at91wdt_remove(struct platform_device *pdev)
static void at91wdt_remove(struct platform_device *pdev)
{
struct at91wdt *wdt = platform_get_drvdata(pdev);
watchdog_unregister_device(&wdt->wdd);
pr_warn("I quit now, hardware will probably reboot!\n");
del_timer(&wdt->timer);
return 0;
}
#if defined(CONFIG_OF)
......@@ -393,14 +391,14 @@ MODULE_DEVICE_TABLE(of, at91_wdt_dt_ids);
#endif
static struct platform_driver at91wdt_driver = {
.remove = __exit_p(at91wdt_remove),
.probe = at91wdt_probe,
.remove_new = at91wdt_remove,
.driver = {
.name = "at91_wdt",
.of_match_table = of_match_ptr(at91_wdt_dt_ids),
},
};
module_platform_driver_probe(at91wdt_driver, at91wdt_probe);
module_platform_driver(at91wdt_driver);
MODULE_AUTHOR("Renaud CERRATO <r.cerrato@til-technologies.fr>");
MODULE_DESCRIPTION("Watchdog driver for Atmel AT91SAM9x processors");
......
......@@ -42,6 +42,7 @@
#define SECS_TO_WDOG_TICKS(x) ((x) << 16)
#define WDOG_TICKS_TO_SECS(x) ((x) >> 16)
#define WDOG_TICKS_TO_MSECS(x) ((x) * 1000 >> 16)
struct bcm2835_wdt {
void __iomem *base;
......@@ -140,7 +141,7 @@ static struct watchdog_device bcm2835_wdt_wdd = {
.info = &bcm2835_wdt_info,
.ops = &bcm2835_wdt_ops,
.min_timeout = 1,
.max_timeout = WDOG_TICKS_TO_SECS(PM_WDOG_TIME_SET),
.max_hw_heartbeat_ms = WDOG_TICKS_TO_MSECS(PM_WDOG_TIME_SET),
.timeout = WDOG_TICKS_TO_SECS(PM_WDOG_TIME_SET),
};
......
......@@ -33,7 +33,6 @@
#define DEFAULT_MARGIN 30
#define PRETIMEOUT_SEC 9
static bool ilo5;
static unsigned int soft_margin = DEFAULT_MARGIN; /* in seconds */
static bool nowayout = WATCHDOG_NOWAYOUT;
static bool pretimeout = IS_ENABLED(CONFIG_HPWDT_NMI_DECODING);
......@@ -178,10 +177,7 @@ static int hpwdt_pretimeout(unsigned int ulReason, struct pt_regs *regs)
"3. OA Forward Progress Log\n"
"4. iLO Event Log";
if (ilo5 && ulReason == NMI_UNKNOWN && !mynmi)
return NMI_DONE;
if (ilo5 && !pretimeout && !mynmi)
if (ulReason == NMI_UNKNOWN && !mynmi)
return NMI_DONE;
if (kdumptimeout < 0)
......@@ -363,9 +359,6 @@ static int hpwdt_init_one(struct pci_dev *dev,
pretimeout ? "on" : "off");
dev_info(&dev->dev, "kdumptimeout: %d.\n", kdumptimeout);
if (dev->subsystem_vendor == PCI_VENDOR_ID_HP_3PAR)
ilo5 = true;
return 0;
error_wd_register:
......
......@@ -13,9 +13,9 @@
* http://www.ite.com.tw/
*
* Support of the watchdog timers, which are available on
* IT8607, IT8613, IT8620, IT8622, IT8625, IT8628, IT8655, IT8665,
* IT8686, IT8702, IT8712, IT8716, IT8718, IT8720, IT8721, IT8726,
* IT8728, IT8772, IT8783 and IT8784.
* IT8607, IT8613, IT8620, IT8622, IT8625, IT8628, IT8655, IT8659,
* IT8665, IT8686, IT8702, IT8712, IT8716, IT8718, IT8720, IT8721,
* IT8726, IT8728, IT8772, IT8783, IT8784 and IT8786.
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
......@@ -56,6 +56,7 @@
#define IT8625_ID 0x8625
#define IT8628_ID 0x8628
#define IT8655_ID 0x8655
#define IT8659_ID 0x8659
#define IT8665_ID 0x8665
#define IT8686_ID 0x8686
#define IT8702_ID 0x8702
......@@ -146,6 +147,7 @@ static inline void superio_outb(int val, int reg)
static inline int superio_inw(int reg)
{
int val;
outb(reg++, REG);
val = inb(VAL) << 8;
outb(reg, REG);
......@@ -256,6 +258,7 @@ static struct watchdog_device wdt_dev = {
static int __init it87_wdt_init(void)
{
u8 chip_rev;
u8 ctrl;
int rc;
rc = superio_enter();
......@@ -273,10 +276,6 @@ static int __init it87_wdt_init(void)
case IT8712_ID:
max_units = (chip_rev < 8) ? 255 : 65535;
break;
case IT8716_ID:
case IT8726_ID:
max_units = 65535;
break;
case IT8607_ID:
case IT8613_ID:
case IT8620_ID:
......@@ -284,11 +283,14 @@ static int __init it87_wdt_init(void)
case IT8625_ID:
case IT8628_ID:
case IT8655_ID:
case IT8659_ID:
case IT8665_ID:
case IT8686_ID:
case IT8716_ID:
case IT8718_ID:
case IT8720_ID:
case IT8721_ID:
case IT8726_ID:
case IT8728_ID:
case IT8772_ID:
case IT8783_ID:
......@@ -315,7 +317,18 @@ static int __init it87_wdt_init(void)
superio_select(GPIO);
superio_outb(WDT_TOV1, WDTCFG);
switch (chip_type) {
case IT8784_ID:
case IT8786_ID:
ctrl = superio_inb(WDTCTRL);
ctrl &= 0x08;
superio_outb(ctrl, WDTCTRL);
break;
default:
superio_outb(0x00, WDTCTRL);
}
superio_exit();
if (timeout < 1 || timeout > max_units * 60) {
......
......@@ -30,17 +30,15 @@
* struct mlxreg_wdt - wd private data:
*
* @wdd: watchdog device;
* @device: basic device;
* @pdata: data received from platform driver;
* @regmap: register map of parent device;
* @timeout: defined timeout in sec.;
* @action_idx: index for direct access to action register;
* @timeout_idx:index for direct access to TO register;
* @tleft_idx: index for direct access to time left register;
* @ping_idx: index for direct access to ping register;
* @reset_idx: index for direct access to reset cause register;
* @regmap_val_sz: size of value in register map;
* @wd_type: watchdog HW type;
* @wdt_type: watchdog HW type;
*/
struct mlxreg_wdt {
struct watchdog_device wdd;
......
......@@ -58,9 +58,13 @@
#define WDT_SWSYSRST 0x18U
#define WDT_SWSYS_RST_KEY 0x88000000
#define WDT_SWSYSRST_EN 0xfc
#define DRV_NAME "mtk-wdt"
#define DRV_VERSION "1.0"
#define MT7988_TOPRGU_SW_RST_NUM 24
static bool nowayout = WATCHDOG_NOWAYOUT;
static unsigned int timeout;
......@@ -71,10 +75,12 @@ struct mtk_wdt_dev {
struct reset_controller_dev rcdev;
bool disable_wdt_extrst;
bool reset_by_toprgu;
bool has_swsysrst_en;
};
struct mtk_wdt_data {
int toprgu_sw_rst_num;
bool has_swsysrst_en;
};
static const struct mtk_wdt_data mt2712_data = {
......@@ -89,6 +95,11 @@ static const struct mtk_wdt_data mt7986_data = {
.toprgu_sw_rst_num = MT7986_TOPRGU_SW_RST_NUM,
};
static const struct mtk_wdt_data mt7988_data = {
.toprgu_sw_rst_num = MT7988_TOPRGU_SW_RST_NUM,
.has_swsysrst_en = true,
};
static const struct mtk_wdt_data mt8183_data = {
.toprgu_sw_rst_num = MT8183_TOPRGU_SW_RST_NUM,
};
......@@ -109,6 +120,28 @@ static const struct mtk_wdt_data mt8195_data = {
.toprgu_sw_rst_num = MT8195_TOPRGU_SW_RST_NUM,
};
/**
* toprgu_reset_sw_en_unlocked() - enable/disable software control for reset bit
* @data: Pointer to instance of driver data.
* @id: Bit number identifying the reset to be enabled or disabled.
* @enable: If true, enable software control for that bit, disable otherwise.
*
* Context: The caller must hold lock of struct mtk_wdt_dev.
*/
static void toprgu_reset_sw_en_unlocked(struct mtk_wdt_dev *data,
unsigned long id, bool enable)
{
u32 tmp;
tmp = readl(data->wdt_base + WDT_SWSYSRST_EN);
if (enable)
tmp |= BIT(id);
else
tmp &= ~BIT(id);
writel(tmp, data->wdt_base + WDT_SWSYSRST_EN);
}
static int toprgu_reset_update(struct reset_controller_dev *rcdev,
unsigned long id, bool assert)
{
......@@ -119,6 +152,9 @@ static int toprgu_reset_update(struct reset_controller_dev *rcdev,
spin_lock_irqsave(&data->lock, flags);
if (assert && data->has_swsysrst_en)
toprgu_reset_sw_en_unlocked(data, id, true);
tmp = readl(data->wdt_base + WDT_SWSYSRST);
if (assert)
tmp |= BIT(id);
......@@ -127,6 +163,9 @@ static int toprgu_reset_update(struct reset_controller_dev *rcdev,
tmp |= WDT_SWSYS_RST_KEY;
writel(tmp, data->wdt_base + WDT_SWSYSRST);
if (!assert && data->has_swsysrst_en)
toprgu_reset_sw_en_unlocked(data, id, false);
spin_unlock_irqrestore(&data->lock, flags);
return 0;
......@@ -406,6 +445,8 @@ static int mtk_wdt_probe(struct platform_device *pdev)
wdt_data->toprgu_sw_rst_num);
if (err)
return err;
mtk_wdt->has_swsysrst_en = wdt_data->has_swsysrst_en;
}
mtk_wdt->disable_wdt_extrst =
......@@ -444,6 +485,7 @@ static const struct of_device_id mtk_wdt_dt_ids[] = {
{ .compatible = "mediatek,mt6589-wdt" },
{ .compatible = "mediatek,mt6795-wdt", .data = &mt6795_data },
{ .compatible = "mediatek,mt7986-wdt", .data = &mt7986_data },
{ .compatible = "mediatek,mt7988-wdt", .data = &mt7988_data },
{ .compatible = "mediatek,mt8183-wdt", .data = &mt8183_data },
{ .compatible = "mediatek,mt8186-wdt", .data = &mt8186_data },
{ .compatible = "mediatek,mt8188-wdt", .data = &mt8188_data },
......
......@@ -77,6 +77,11 @@ static int rti_wdt_start(struct watchdog_device *wdd)
{
u32 timer_margin;
struct rti_wdt_device *wdt = watchdog_get_drvdata(wdd);
int ret;
ret = pm_runtime_resume_and_get(wdd->parent);
if (ret)
return ret;
/* set timeout period */
timer_margin = (u64)wdd->timeout * wdt->freq;
......@@ -343,6 +348,9 @@ static int rti_wdt_probe(struct platform_device *pdev)
if (last_ping)
watchdog_set_last_hw_keepalive(wdd, last_ping);
if (!watchdog_hw_running(wdd))
pm_runtime_put_sync(&pdev->dev);
return 0;
err_iomap:
......@@ -357,7 +365,10 @@ static void rti_wdt_remove(struct platform_device *pdev)
struct rti_wdt_device *wdt = platform_get_drvdata(pdev);
watchdog_unregister_device(&wdt->wdd);
if (!pm_runtime_suspended(&pdev->dev))
pm_runtime_put(&pdev->dev);
pm_runtime_disable(&pdev->dev);
}
......
......@@ -202,12 +202,14 @@ static u32 starfive_wdt_ticks_to_sec(struct starfive_wdt *wdt, u32 ticks)
/* Write unlock-key to unlock. Write other value to lock. */
static void starfive_wdt_unlock(struct starfive_wdt *wdt)
__acquires(&wdt->lock)
{
spin_lock(&wdt->lock);
writel(wdt->variant->unlock_key, wdt->base + wdt->variant->unlock);
}
static void starfive_wdt_lock(struct starfive_wdt *wdt)
__releases(&wdt->lock)
{
writel(~wdt->variant->unlock_key, wdt->base + wdt->variant->unlock);
spin_unlock(&wdt->lock);
......@@ -504,7 +506,7 @@ static int starfive_wdt_probe(struct platform_device *pdev)
return ret;
}
static int starfive_wdt_remove(struct platform_device *pdev)
static void starfive_wdt_remove(struct platform_device *pdev)
{
struct starfive_wdt *wdt = platform_get_drvdata(pdev);
......@@ -516,8 +518,6 @@ static int starfive_wdt_remove(struct platform_device *pdev)
else
/* disable clock without PM */
starfive_wdt_disable_clock(wdt);
return 0;
}
static void starfive_wdt_shutdown(struct platform_device *pdev)
......@@ -587,7 +587,7 @@ MODULE_DEVICE_TABLE(of, starfive_wdt_match);
static struct platform_driver starfive_wdt_driver = {
.probe = starfive_wdt_probe,
.remove = starfive_wdt_remove,
.remove_new = starfive_wdt_remove,
.shutdown = starfive_wdt_shutdown,
.driver = {
.name = "starfive-wdt",
......
......@@ -98,7 +98,7 @@ static struct watchdog_device txx9wdt = {
.ops = &txx9wdt_ops,
};
static int __init txx9wdt_probe(struct platform_device *dev)
static int txx9wdt_probe(struct platform_device *dev)
{
int ret;
......@@ -145,12 +145,11 @@ static int __init txx9wdt_probe(struct platform_device *dev)
return ret;
}
static int __exit txx9wdt_remove(struct platform_device *dev)
static void txx9wdt_remove(struct platform_device *dev)
{
watchdog_unregister_device(&txx9wdt);
clk_disable_unprepare(txx9_imclk);
clk_put(txx9_imclk);
return 0;
}
static void txx9wdt_shutdown(struct platform_device *dev)
......@@ -159,14 +158,14 @@ static void txx9wdt_shutdown(struct platform_device *dev)
}
static struct platform_driver txx9wdt_driver = {
.remove = __exit_p(txx9wdt_remove),
.probe = txx9wdt_probe,
.remove_new = txx9wdt_remove,
.shutdown = txx9wdt_shutdown,
.driver = {
.name = "txx9wdt",
},
};
module_platform_driver_probe(txx9wdt_driver, txx9wdt_probe);
module_platform_driver(txx9wdt_driver);
MODULE_DESCRIPTION("TXx9 Watchdog Driver");
MODULE_LICENSE("GPL");
......
......@@ -1073,6 +1073,7 @@ static int watchdog_cdev_register(struct watchdog_device *wdd)
/* Fill in the data structures */
cdev_init(&wd_data->cdev, &watchdog_fops);
wd_data->cdev.owner = wdd->ops->owner;
/* Add the device */
err = cdev_device_add(&wd_data->cdev, &wd_data->dev);
......@@ -1087,8 +1088,6 @@ static int watchdog_cdev_register(struct watchdog_device *wdd)
return err;
}
wd_data->cdev.owner = wdd->ops->owner;
/* Record time of most recent heartbeat as 'just before now'. */
wd_data->last_hw_keepalive = ktime_sub(ktime_get(), 1);
watchdog_set_open_deadline(wd_data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment