linux-watchdog 6.5-rc1 tag

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.14 (GNU/Linux)
 
 iEYEABECAAYFAmSlXqAACgkQ+iyteGJfRsp5AQCfdgPxG/Jp1HQv0X5XCwIDEtc5
 eCoAoLl3U1RvBPZnOCQxJC0Vt7eSnaL1
 =iIFi
 -----END PGP SIGNATURE-----

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

Pull watchdog updates from Wim Van Sebroeck:

 - add Xilinx Versal watchdog

 - support Hygon FCH/SCH (Server Controller Hub)

 - convert GPL notices to SPDX identifiers

 - other improvements

* tag 'linux-watchdog-6.5-rc1' of git://www.linux-watchdog.org/linux-watchdog:
  watchdog: sp5100_tco: support Hygon FCH/SCH (Server Controller Hub)
  dt-bindings: watchdog: restrict node name suffixes
  MAINTAINERS: Add support for Xilinx versal watchdog
  watchdog: xilinx_wwdt: Add Versal window watchdog support
  dt-bindings: watchdog: xlnx,versal-wwdt: Add versal watchdog
  watchdog: ziirave_wdt: Switch i2c driver back to use .probe()
  watchdog: ibmasr: Replace GPL license notice with SPDX identifier
  watchdog: Convert GPL 2.0 notice to SPDX identifier
  watchdog: loongson1_wdt: Add DT support
This commit is contained in:
Linus Torvalds 2023-07-06 09:44:33 -07:00
commit c91e587be8
19 changed files with 299 additions and 36 deletions

View file

@ -0,0 +1,50 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/watchdog/xlnx,versal-wwdt.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Xilinx Versal window watchdog timer controller
maintainers:
- Neeli Srinivas <srinivas.neeli@amd.com>
description:
Versal watchdog intellectual property uses window watchdog mode.
Window watchdog timer(WWDT) contains closed(first) and open(second)
window with 32 bit width. Write to the watchdog timer within
predefined window periods of time. This means a period that is not
too soon and a period that is not too late. The WWDT has to be
restarted within the open window time. If software tries to restart
WWDT outside of the open window time period, it generates a reset.
allOf:
- $ref: watchdog.yaml#
properties:
compatible:
enum:
- xlnx,versal-wwdt
reg:
maxItems: 1
clocks:
maxItems: 1
required:
- compatible
- reg
- clocks
unevaluatedProperties: false
examples:
- |
watchdog@fd4d0000 {
compatible = "xlnx,versal-wwdt";
reg = <0xfd4d0000 0x10000>;
clocks = <&clock25>;
timeout-sec = <30>;
};
...

View file

@ -23460,8 +23460,10 @@ M: Srinivas Neeli <srinivas.neeli@amd.com>
R: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
R: Michal Simek <michal.simek@amd.com>
S: Maintained
F: Documentation/devicetree/bindings/watchdog/xlnx,versal-wwdt.yaml
F: Documentation/devicetree/bindings/watchdog/xlnx,xps-timebase-wdt.yaml
F: drivers/watchdog/of_xilinx_wdt.c
F: drivers/watchdog/xilinx_wwdt.c
XILINX XDMA DRIVER
M: Lizhi Hou <lizhi.hou@amd.com>

View file

@ -304,6 +304,24 @@ config XILINX_WATCHDOG
To compile this driver as a module, choose M here: the
module will be called of_xilinx_wdt.
config XILINX_WINDOW_WATCHDOG
tristate "Xilinx window watchdog timer"
depends on HAS_IOMEM
depends on ARM64
select WATCHDOG_CORE
help
Window watchdog driver for the versal_wwdt IP core.
Window watchdog timer(WWDT) contains closed(first) and
open(second) window with 32 bit width. Write to the watchdog
timer within predefined window periods of time. This means
a period that is not too soon and a period that is not too
late. The WWDT has to be restarted within the open window time.
If software tries to restart WWDT outside of the open window
time period, it generates a reset.
To compile this driver as a module, choose M here: the
module will be called xilinx_wwdt.
config ZIIRAVE_WATCHDOG
tristate "Zodiac RAVE Watchdog Timer"
depends on I2C

View file

@ -157,6 +157,7 @@ obj-$(CONFIG_M54xx_WATCHDOG) += m54xx_wdt.o
# MicroBlaze Architecture
obj-$(CONFIG_XILINX_WATCHDOG) += of_xilinx_wdt.o
obj-$(CONFIG_XILINX_WINDOW_WATCHDOG) += xilinx_wwdt.o
# MIPS Architecture
obj-$(CONFIG_ATH79_WDT) += ath79_wdt.o

View file

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Watchdog driver for Cirrus Logic EP93xx family of devices.
*
@ -11,10 +12,6 @@
* Copyright (c) 2012 H Hartley Sweeten <hsweeten@visionengravers.com>
* Convert to a platform device and use the watchdog framework API
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*
* This watchdog fires after 250msec, which is a too short interval
* for us to rely on the user space daemon alone. So we ping the
* wdt each ~200msec and eventually stop doing it if the user space

View file

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-1.0+
/*
* IBM Automatic Server Restart driver.
*
@ -6,8 +7,6 @@
* Based on driver written by Pete Reynolds.
* Copyright (c) IBM Corporation, 1998-2004.
*
* This software may be used and distributed according to the terms
* of the GNU Public License, incorporated herein by reference.
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

View file

@ -5,6 +5,7 @@
#include <linux/clk.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/watchdog.h>
@ -112,7 +113,7 @@ static int ls1x_wdt_probe(struct platform_device *pdev)
if (IS_ERR(drvdata->base))
return PTR_ERR(drvdata->base);
drvdata->clk = devm_clk_get_enabled(dev, pdev->name);
drvdata->clk = devm_clk_get_enabled(dev, NULL);
if (IS_ERR(drvdata->clk))
return PTR_ERR(drvdata->clk);
@ -144,10 +145,20 @@ static int ls1x_wdt_probe(struct platform_device *pdev)
return 0;
}
#ifdef CONFIG_OF
static const struct of_device_id ls1x_wdt_dt_ids[] = {
{ .compatible = "loongson,ls1b-wdt", },
{ .compatible = "loongson,ls1c-wdt", },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, ls1x_wdt_dt_ids);
#endif
static struct platform_driver ls1x_wdt_driver = {
.probe = ls1x_wdt_probe,
.driver = {
.name = "ls1x-wdt",
.of_match_table = of_match_ptr(ls1x_wdt_dt_ids),
},
};

View file

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* drivers/watchdog/m54xx_wdt.c
*
@ -11,9 +12,6 @@
* Copyright 2004 (c) MontaVista, Software, Inc.
* Based on sa1100 driver, Copyright (C) 2000 Oleg Drokin <green@crimea.edu>
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

View file

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* drivers/char/watchdog/max63xx_wdt.c
*
@ -5,10 +6,6 @@
*
* Copyright (C) 2009 Marc Zyngier <maz@misterjones.org>
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*
* This driver assumes the watchdog pins are memory mapped (as it is
* the case for the Arcom Zeus). Should it be connected over GPIOs or
* another interface, some abstraction will have to be introduced.

View file

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* MOXA ART SoCs watchdog driver.
*
@ -5,9 +6,6 @@
*
* Jonas Jensen <jonas.jensen@gmail.com>
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
#include <linux/clk.h>

View file

@ -1,8 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2007-2017 Cavium, Inc.
*/
#include <asm/asm.h>

View file

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* drivers/watchdog/orion_wdt.c
*
@ -5,9 +6,6 @@
*
* Author: Sylver Bruneau <sylver.bruneau@googlemail.com>
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

View file

@ -1,9 +1,9 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Realtek RTD129x watchdog
*
* Copyright (c) 2017 Andreas Färber
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <linux/bitops.h>

View file

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Watchdog driver for SBC-FITPC2 board
*
@ -5,9 +6,6 @@
*
* Adapted from the IXP2000 watchdog driver by Deepak Saxena.
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
#define pr_fmt(fmt) KBUILD_MODNAME " WATCHDOG: " fmt

View file

@ -96,7 +96,7 @@ static enum tco_reg_layout tco_reg_layout(struct pci_dev *dev)
sp5100_tco_pci->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS &&
sp5100_tco_pci->revision >= AMD_ZEN_SMBUS_PCI_REV) {
return efch_mmio;
} else if (dev->vendor == PCI_VENDOR_ID_AMD &&
} else if ((dev->vendor == PCI_VENDOR_ID_AMD || dev->vendor == PCI_VENDOR_ID_HYGON) &&
((dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS &&
dev->revision >= 0x41) ||
(dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS &&
@ -579,6 +579,8 @@ static const struct pci_device_id sp5100_tco_pci_tbl[] = {
PCI_ANY_ID, },
{ PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_KERNCZ_SMBUS, PCI_ANY_ID,
PCI_ANY_ID, },
{ PCI_VENDOR_ID_HYGON, PCI_DEVICE_ID_AMD_KERNCZ_SMBUS, PCI_ANY_ID,
PCI_ANY_ID, },
{ 0, }, /* End of list */
};
MODULE_DEVICE_TABLE(pci, sp5100_tco_pci_tbl);

View file

@ -1,11 +1,9 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Watchdog driver for TS-4800 based boards
*
* Copyright (c) 2015 - Savoir-faire Linux
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
#include <linux/kernel.h>

View file

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Watchdog driver for Technologic Systems TS-72xx based SBCs
* (TS-7200, TS-7250 and TS-7260). These boards have external
@ -8,9 +9,6 @@
*
* This driver is based on ep93xx_wdt and wm831x_wdt drivers.
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
#include <linux/platform_device.h>

View file

@ -0,0 +1,201 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Window watchdog device driver for Xilinx Versal WWDT
*
* Copyright (C) 2022 - 2023, Advanced Micro Devices, Inc.
*/
#include <linux/clk.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/ioport.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/of_address.h>
#include <linux/watchdog.h>
/* Max timeout is calculated at 100MHz source clock */
#define XWWDT_DEFAULT_TIMEOUT 42
#define XWWDT_MIN_TIMEOUT 1
/* Register offsets for the WWDT device */
#define XWWDT_MWR_OFFSET 0x00
#define XWWDT_ESR_OFFSET 0x04
#define XWWDT_FCR_OFFSET 0x08
#define XWWDT_FWR_OFFSET 0x0c
#define XWWDT_SWR_OFFSET 0x10
/* Master Write Control Register Masks */
#define XWWDT_MWR_MASK BIT(0)
/* Enable and Status Register Masks */
#define XWWDT_ESR_WINT_MASK BIT(16)
#define XWWDT_ESR_WSW_MASK BIT(8)
#define XWWDT_ESR_WEN_MASK BIT(0)
#define XWWDT_CLOSE_WINDOW_PERCENT 50
static int wwdt_timeout;
static int closed_window_percent;
module_param(wwdt_timeout, int, 0);
MODULE_PARM_DESC(wwdt_timeout,
"Watchdog time in seconds. (default="
__MODULE_STRING(XWWDT_DEFAULT_TIMEOUT) ")");
module_param(closed_window_percent, int, 0);
MODULE_PARM_DESC(closed_window_percent,
"Watchdog closed window percentage. (default="
__MODULE_STRING(XWWDT_CLOSE_WINDOW_PERCENT) ")");
/**
* struct xwwdt_device - Watchdog device structure
* @base: base io address of WDT device
* @spinlock: spinlock for IO register access
* @xilinx_wwdt_wdd: watchdog device structure
* @freq: source clock frequency of WWDT
* @close_percent: Closed window percent
*/
struct xwwdt_device {
void __iomem *base;
spinlock_t spinlock; /* spinlock for register handling */
struct watchdog_device xilinx_wwdt_wdd;
unsigned long freq;
u32 close_percent;
};
static int xilinx_wwdt_start(struct watchdog_device *wdd)
{
struct xwwdt_device *xdev = watchdog_get_drvdata(wdd);
struct watchdog_device *xilinx_wwdt_wdd = &xdev->xilinx_wwdt_wdd;
u64 time_out, closed_timeout, open_timeout;
u32 control_status_reg;
/* Calculate timeout count */
time_out = xdev->freq * wdd->timeout;
closed_timeout = (time_out * xdev->close_percent) / 100;
open_timeout = time_out - closed_timeout;
wdd->min_hw_heartbeat_ms = xdev->close_percent * 10 * wdd->timeout;
spin_lock(&xdev->spinlock);
iowrite32(XWWDT_MWR_MASK, xdev->base + XWWDT_MWR_OFFSET);
iowrite32(~(u32)XWWDT_ESR_WEN_MASK, xdev->base + XWWDT_ESR_OFFSET);
iowrite32((u32)closed_timeout, xdev->base + XWWDT_FWR_OFFSET);
iowrite32((u32)open_timeout, xdev->base + XWWDT_SWR_OFFSET);
/* Enable the window watchdog timer */
control_status_reg = ioread32(xdev->base + XWWDT_ESR_OFFSET);
control_status_reg |= XWWDT_ESR_WEN_MASK;
iowrite32(control_status_reg, xdev->base + XWWDT_ESR_OFFSET);
spin_unlock(&xdev->spinlock);
dev_dbg(xilinx_wwdt_wdd->parent, "Watchdog Started!\n");
return 0;
}
static int xilinx_wwdt_keepalive(struct watchdog_device *wdd)
{
struct xwwdt_device *xdev = watchdog_get_drvdata(wdd);
u32 control_status_reg;
spin_lock(&xdev->spinlock);
/* Enable write access control bit for the window watchdog */
iowrite32(XWWDT_MWR_MASK, xdev->base + XWWDT_MWR_OFFSET);
/* Trigger restart kick to watchdog */
control_status_reg = ioread32(xdev->base + XWWDT_ESR_OFFSET);
control_status_reg |= XWWDT_ESR_WSW_MASK;
iowrite32(control_status_reg, xdev->base + XWWDT_ESR_OFFSET);
spin_unlock(&xdev->spinlock);
return 0;
}
static const struct watchdog_info xilinx_wwdt_ident = {
.options = WDIOF_KEEPALIVEPING |
WDIOF_SETTIMEOUT,
.firmware_version = 1,
.identity = "xlnx_window watchdog",
};
static const struct watchdog_ops xilinx_wwdt_ops = {
.owner = THIS_MODULE,
.start = xilinx_wwdt_start,
.ping = xilinx_wwdt_keepalive,
};
static int xwwdt_probe(struct platform_device *pdev)
{
struct watchdog_device *xilinx_wwdt_wdd;
struct device *dev = &pdev->dev;
struct xwwdt_device *xdev;
struct clk *clk;
int ret;
xdev = devm_kzalloc(dev, sizeof(*xdev), GFP_KERNEL);
if (!xdev)
return -ENOMEM;
xilinx_wwdt_wdd = &xdev->xilinx_wwdt_wdd;
xilinx_wwdt_wdd->info = &xilinx_wwdt_ident;
xilinx_wwdt_wdd->ops = &xilinx_wwdt_ops;
xilinx_wwdt_wdd->parent = dev;
xdev->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(xdev->base))
return PTR_ERR(xdev->base);
clk = devm_clk_get_enabled(dev, NULL);
if (IS_ERR(clk))
return PTR_ERR(clk);
xdev->freq = clk_get_rate(clk);
if (!xdev->freq)
return -EINVAL;
xilinx_wwdt_wdd->min_timeout = XWWDT_MIN_TIMEOUT;
xilinx_wwdt_wdd->timeout = XWWDT_DEFAULT_TIMEOUT;
xilinx_wwdt_wdd->max_hw_heartbeat_ms = 1000 * xilinx_wwdt_wdd->timeout;
if (closed_window_percent == 0 || closed_window_percent >= 100)
xdev->close_percent = XWWDT_CLOSE_WINDOW_PERCENT;
else
xdev->close_percent = closed_window_percent;
watchdog_init_timeout(xilinx_wwdt_wdd, wwdt_timeout, &pdev->dev);
spin_lock_init(&xdev->spinlock);
watchdog_set_drvdata(xilinx_wwdt_wdd, xdev);
watchdog_set_nowayout(xilinx_wwdt_wdd, 1);
ret = devm_watchdog_register_device(dev, xilinx_wwdt_wdd);
if (ret)
return ret;
dev_info(dev, "Xilinx window watchdog Timer with timeout %ds\n",
xilinx_wwdt_wdd->timeout);
return 0;
}
static const struct of_device_id xwwdt_of_match[] = {
{ .compatible = "xlnx,versal-wwdt", },
{},
};
MODULE_DEVICE_TABLE(of, xwwdt_of_match);
static struct platform_driver xwwdt_driver = {
.probe = xwwdt_probe,
.driver = {
.name = "Xilinx window watchdog",
.of_match_table = xwwdt_of_match,
},
};
module_platform_driver(xwwdt_driver);
MODULE_AUTHOR("Neeli Srinivas <srinivas.neeli@amd.com>");
MODULE_DESCRIPTION("Xilinx window watchdog driver");
MODULE_LICENSE("GPL");

View file

@ -731,7 +731,7 @@ static struct i2c_driver ziirave_wdt_driver = {
.name = "ziirave_wdt",
.of_match_table = zrv_wdt_of_match,
},
.probe_new = ziirave_wdt_probe,
.probe = ziirave_wdt_probe,
.remove = ziirave_wdt_remove,
.id_table = ziirave_wdt_id,
};