Skip to content

Commit 696c45b

Browse files
committed
Merge tag 'linux-watchdog-6.15-rc1' of git://www.linux-watchdog.org/linux-watchdog
Pull watchdog updates from Wim Van Sebroeck: - Add watchdog driver for Lenovo SE30 platform - Add support for Allwinner A523 - Add i.MX94 support - watchdog framework: Convert to use device property - renesas,wdt: Document RZ/G3E support - Various other fixes and improvemenents * tag 'linux-watchdog-6.15-rc1' of git://www.linux-watchdog.org/linux-watchdog: watchdog: sunxi_wdt: Add support for Allwinner A523 dt-bindings: watchdog: sunxi: add Allwinner A523 compatible string watchdog: aspeed: fix 64-bit division watchdog: npcm: Remove unnecessary NULL check before clk_prepare_enable/clk_disable_unprepare dt-bindings: watchdog: renesas,wdt: Document RZ/G3E support watchdog: Convert to use device property watchdog: lenovo_se30_wdt: include io.h for devm_ioremap() dt-bindings: watchdog: fsl-imx7ulp-wdt: Add i.MX94 support watchdog: nic7018_wdt: tidy up ACPI ID table watchdog: s3c2410_wdt: Fix PMU register bits for ExynosAutoV920 SoC watchdog: lenovo_se30_wdt: Watchdog driver for Lenovo SE30 platform watchdog: Enable RZV2HWDT driver depend on ARCH_RENESAS watchdog: cros-ec: Add newlines to printks watchdog: aspeed: Update bootstatus handling
2 parents 28a1b05 + 9bc64d3 commit 696c45b

13 files changed

+535
-28
lines changed

Documentation/devicetree/bindings/watchdog/allwinner,sun4i-a10-wdt.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ properties:
3232
- items:
3333
- const: allwinner,sun20i-d1-wdt-reset
3434
- const: allwinner,sun20i-d1-wdt
35+
- const: allwinner,sun55i-a523-wdt
3536

3637
reg:
3738
maxItems: 1
@@ -60,6 +61,7 @@ if:
6061
- allwinner,sun20i-d1-wdt-reset
6162
- allwinner,sun50i-r329-wdt
6263
- allwinner,sun50i-r329-wdt-reset
64+
- allwinner,sun55i-a523-wdt
6365

6466
then:
6567
properties:

Documentation/devicetree/bindings/watchdog/fsl-imx7ulp-wdt.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ properties:
2222
- const: fsl,imx8ulp-wdt
2323
- const: fsl,imx7ulp-wdt
2424
- const: fsl,imx93-wdt
25+
- items:
26+
- enum:
27+
- fsl,imx94-wdt
28+
- const: fsl,imx93-wdt
2529

2630
reg:
2731
maxItems: 1

Documentation/devicetree/bindings/watchdog/renesas,wdt.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ properties:
7575
- renesas,r8a779h0-wdt # R-Car V4M
7676
- const: renesas,rcar-gen4-wdt # R-Car Gen4
7777

78+
- items:
79+
- const: renesas,r9a09g047-wdt # RZ/G3E
80+
- const: renesas,r9a09g057-wdt # RZ/V2H(P)
81+
7882
- const: renesas,r9a09g057-wdt # RZ/V2H(P)
7983

8084
reg:

drivers/watchdog/Kconfig

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,18 @@ config LENOVO_SE10_WDT
279279
This driver can also be built as a module. If so, the module
280280
will be called lenovo-se10-wdt.
281281

282+
config LENOVO_SE30_WDT
283+
tristate "Lenovo SE30 Watchdog"
284+
depends on (X86 && DMI) || COMPILE_TEST
285+
depends on HAS_IOPORT
286+
select WATCHDOG_CORE
287+
help
288+
If you say yes here you get support for the watchdog
289+
functionality for the Lenovo SE30 platform.
290+
291+
This driver can also be built as a module. If so, the module
292+
will be called lenovo-se30-wdt.
293+
282294
config MENF21BMC_WATCHDOG
283295
tristate "MEN 14F021P00 BMC Watchdog"
284296
depends on MFD_MENF21BMC || COMPILE_TEST
@@ -963,13 +975,14 @@ config RENESAS_RZG2LWDT
963975
Renesas RZ/G2L SoCs. These watchdogs can be used to reset a system.
964976

965977
config RENESAS_RZV2HWDT
966-
tristate "Renesas RZ/V2H(P) WDT Watchdog"
967-
depends on ARCH_R9A09G057 || COMPILE_TEST
978+
tristate "Renesas RZ/{G3E,V2H(P)} WDT Watchdog"
979+
depends on ARCH_RENESAS || COMPILE_TEST
968980
depends on PM || COMPILE_TEST
969981
select WATCHDOG_CORE
970982
help
971983
This driver adds watchdog support for the integrated watchdogs in the
972-
Renesas RZ/V2H(P) SoCs. These watchdogs can be used to reset a system.
984+
Renesas RZ/{G3E,V2H(P)} SoCs. These watchdogs can be used to reset a
985+
system.
973986

974987
config ASPEED_WATCHDOG
975988
tristate "Aspeed BMC watchdog support"
@@ -1730,7 +1743,8 @@ config NI903X_WDT
17301743

17311744
config NIC7018_WDT
17321745
tristate "NIC7018 Watchdog"
1733-
depends on X86 && ACPI
1746+
depends on HAS_IOPORT
1747+
depends on ACPI || COMPILE_TEST
17341748
select WATCHDOG_CORE
17351749
help
17361750
Support for National Instruments NIC7018 Watchdog.

drivers/watchdog/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ obj-$(CONFIG_I6300ESB_WDT) += i6300esb.o
124124
obj-$(CONFIG_IE6XX_WDT) += ie6xx_wdt.o
125125
obj-$(CONFIG_ITCO_WDT) += iTCO_wdt.o
126126
obj-$(CONFIG_LENOVO_SE10_WDT) += lenovo_se10_wdt.o
127+
obj-$(CONFIG_LENOVO_SE30_WDT) += lenovo_se30_wdt.o
127128
ifeq ($(CONFIG_ITCO_VENDOR_SUPPORT),y)
128129
obj-$(CONFIG_ITCO_WDT) += iTCO_vendor_support.o
129130
endif

drivers/watchdog/aspeed_wdt.c

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,30 @@
1111
#include <linux/io.h>
1212
#include <linux/kernel.h>
1313
#include <linux/kstrtox.h>
14+
#include <linux/mfd/syscon.h>
1415
#include <linux/module.h>
1516
#include <linux/of.h>
1617
#include <linux/of_irq.h>
1718
#include <linux/platform_device.h>
19+
#include <linux/regmap.h>
1820
#include <linux/watchdog.h>
1921

2022
static bool nowayout = WATCHDOG_NOWAYOUT;
2123
module_param(nowayout, bool, 0);
2224
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
2325
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
26+
struct aspeed_wdt_scu {
27+
const char *compatible;
28+
u32 reset_status_reg;
29+
u32 wdt_reset_mask;
30+
u32 wdt_reset_mask_shift;
31+
};
2432

2533
struct aspeed_wdt_config {
2634
u32 ext_pulse_width_mask;
2735
u32 irq_shift;
2836
u32 irq_mask;
37+
struct aspeed_wdt_scu scu;
2938
};
3039

3140
struct aspeed_wdt {
@@ -39,18 +48,36 @@ static const struct aspeed_wdt_config ast2400_config = {
3948
.ext_pulse_width_mask = 0xff,
4049
.irq_shift = 0,
4150
.irq_mask = 0,
51+
.scu = {
52+
.compatible = "aspeed,ast2400-scu",
53+
.reset_status_reg = 0x3c,
54+
.wdt_reset_mask = 0x1,
55+
.wdt_reset_mask_shift = 1,
56+
},
4257
};
4358

4459
static const struct aspeed_wdt_config ast2500_config = {
4560
.ext_pulse_width_mask = 0xfffff,
4661
.irq_shift = 12,
4762
.irq_mask = GENMASK(31, 12),
63+
.scu = {
64+
.compatible = "aspeed,ast2500-scu",
65+
.reset_status_reg = 0x3c,
66+
.wdt_reset_mask = 0x1,
67+
.wdt_reset_mask_shift = 2,
68+
},
4869
};
4970

5071
static const struct aspeed_wdt_config ast2600_config = {
5172
.ext_pulse_width_mask = 0xfffff,
5273
.irq_shift = 0,
5374
.irq_mask = GENMASK(31, 10),
75+
.scu = {
76+
.compatible = "aspeed,ast2600-scu",
77+
.reset_status_reg = 0x74,
78+
.wdt_reset_mask = 0xf,
79+
.wdt_reset_mask_shift = 16,
80+
},
5481
};
5582

5683
static const struct of_device_id aspeed_wdt_of_table[] = {
@@ -213,6 +240,56 @@ static int aspeed_wdt_restart(struct watchdog_device *wdd,
213240
return 0;
214241
}
215242

243+
static void aspeed_wdt_update_bootstatus(struct platform_device *pdev,
244+
struct aspeed_wdt *wdt)
245+
{
246+
const struct resource *res;
247+
struct aspeed_wdt_scu scu = wdt->cfg->scu;
248+
struct regmap *scu_base;
249+
u32 reset_mask_width;
250+
u32 reset_mask_shift;
251+
u32 idx = 0;
252+
u32 status;
253+
int ret;
254+
255+
if (!of_device_is_compatible(pdev->dev.of_node, "aspeed,ast2400-wdt")) {
256+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
257+
idx = ((intptr_t)wdt->base & 0x00000fff) / (uintptr_t)resource_size(res);
258+
}
259+
260+
scu_base = syscon_regmap_lookup_by_compatible(scu.compatible);
261+
if (IS_ERR(scu_base)) {
262+
wdt->wdd.bootstatus = WDIOS_UNKNOWN;
263+
return;
264+
}
265+
266+
ret = regmap_read(scu_base, scu.reset_status_reg, &status);
267+
if (ret) {
268+
wdt->wdd.bootstatus = WDIOS_UNKNOWN;
269+
return;
270+
}
271+
272+
reset_mask_width = hweight32(scu.wdt_reset_mask);
273+
reset_mask_shift = scu.wdt_reset_mask_shift +
274+
reset_mask_width * idx;
275+
276+
if (status & (scu.wdt_reset_mask << reset_mask_shift))
277+
wdt->wdd.bootstatus = WDIOF_CARDRESET;
278+
279+
/* clear wdt reset event flag */
280+
if (of_device_is_compatible(pdev->dev.of_node, "aspeed,ast2400-wdt") ||
281+
of_device_is_compatible(pdev->dev.of_node, "aspeed,ast2500-wdt")) {
282+
ret = regmap_read(scu_base, scu.reset_status_reg, &status);
283+
if (!ret) {
284+
status &= ~(scu.wdt_reset_mask << reset_mask_shift);
285+
regmap_write(scu_base, scu.reset_status_reg, status);
286+
}
287+
} else {
288+
regmap_write(scu_base, scu.reset_status_reg,
289+
scu.wdt_reset_mask << reset_mask_shift);
290+
}
291+
}
292+
216293
/* access_cs0 shows if cs0 is accessible, hence the reverted bit */
217294
static ssize_t access_cs0_show(struct device *dev,
218295
struct device_attribute *attr, char *buf)
@@ -458,10 +535,10 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
458535
writel(duration - 1, wdt->base + WDT_RESET_WIDTH);
459536
}
460537

538+
aspeed_wdt_update_bootstatus(pdev, wdt);
539+
461540
status = readl(wdt->base + WDT_TIMEOUT_STATUS);
462541
if (status & WDT_TIMEOUT_STATUS_BOOT_SECONDARY) {
463-
wdt->wdd.bootstatus = WDIOF_CARDRESET;
464-
465542
if (of_device_is_compatible(np, "aspeed,ast2400-wdt") ||
466543
of_device_is_compatible(np, "aspeed,ast2500-wdt"))
467544
wdt->wdd.groups = bswitch_groups;

drivers/watchdog/cros_ec_wdt.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static int cros_ec_wdt_ping(struct watchdog_device *wdd)
5858
arg.req.command = EC_HANG_DETECT_CMD_RELOAD;
5959
ret = cros_ec_wdt_send_cmd(cros_ec, &arg);
6060
if (ret < 0)
61-
dev_dbg(wdd->parent, "Failed to ping watchdog (%d)", ret);
61+
dev_dbg(wdd->parent, "Failed to ping watchdog (%d)\n", ret);
6262

6363
return ret;
6464
}
@@ -74,7 +74,7 @@ static int cros_ec_wdt_start(struct watchdog_device *wdd)
7474
arg.req.reboot_timeout_sec = wdd->timeout;
7575
ret = cros_ec_wdt_send_cmd(cros_ec, &arg);
7676
if (ret < 0)
77-
dev_dbg(wdd->parent, "Failed to start watchdog (%d)", ret);
77+
dev_dbg(wdd->parent, "Failed to start watchdog (%d)\n", ret);
7878

7979
return ret;
8080
}
@@ -88,7 +88,7 @@ static int cros_ec_wdt_stop(struct watchdog_device *wdd)
8888
arg.req.command = EC_HANG_DETECT_CMD_CANCEL;
8989
ret = cros_ec_wdt_send_cmd(cros_ec, &arg);
9090
if (ret < 0)
91-
dev_dbg(wdd->parent, "Failed to stop watchdog (%d)", ret);
91+
dev_dbg(wdd->parent, "Failed to stop watchdog (%d)\n", ret);
9292

9393
return ret;
9494
}
@@ -136,7 +136,7 @@ static int cros_ec_wdt_probe(struct platform_device *pdev)
136136
arg.req.command = EC_HANG_DETECT_CMD_GET_STATUS;
137137
ret = cros_ec_wdt_send_cmd(cros_ec, &arg);
138138
if (ret < 0)
139-
return dev_err_probe(dev, ret, "Failed to get watchdog bootstatus");
139+
return dev_err_probe(dev, ret, "Failed to get watchdog bootstatus\n");
140140

141141
wdd->parent = &pdev->dev;
142142
wdd->info = &cros_ec_wdt_ident;
@@ -150,7 +150,7 @@ static int cros_ec_wdt_probe(struct platform_device *pdev)
150150
arg.req.command = EC_HANG_DETECT_CMD_CLEAR_STATUS;
151151
ret = cros_ec_wdt_send_cmd(cros_ec, &arg);
152152
if (ret < 0)
153-
return dev_err_probe(dev, ret, "Failed to clear watchdog bootstatus");
153+
return dev_err_probe(dev, ret, "Failed to clear watchdog bootstatus\n");
154154

155155
watchdog_stop_on_reboot(wdd);
156156
watchdog_stop_on_unregister(wdd);

0 commit comments

Comments
 (0)