Skip to content

Commit f34c512

Browse files
committed
Merge tag 'linux-watchdog-6.12-rc1' of git://www.linux-watchdog.org/linux-watchdog
Pull watchdog updates from Wim Van Sebroeck: - Add Watchdog Timer driver for RZ/V2H(P) - Add Cirrus EP93x - Some small fixes and improvements * tag 'linux-watchdog-6.12-rc1' of git://www.linux-watchdog.org/linux-watchdog: watchdog: Convert comma to semicolon watchdog: rzv2h_wdt: Add missing MODULE_LICENSE tag to fix modpost error dt-bindings: watchdog: Add Cirrus EP93x dt-bindings: watchdog: stm32-iwdg: Document interrupt and wakeup properties drivers: watchdog: marvell_gti: Convert comma to semicolon watchdog: iTCO_wdt: Convert comma to semicolon watchdog: Add Watchdog Timer driver for RZ/V2H(P) dt-bindings: watchdog: renesas,wdt: Document RZ/V2H(P) SoC watchdog: imx_sc_wdt: detect if already running watchdog: imx2_wdt: Remove __maybe_unused notations watchdog: imx_sc_wdt: Don't disable WDT in suspend watchdog: imx7ulp_wdt: move post_rcs_wait into struct imx_wdt_hw_feature
2 parents 962ad08 + 134d253 commit f34c512

File tree

12 files changed

+388
-47
lines changed

12 files changed

+388
-47
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/watchdog/cirrus,ep9301-wdt.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Cirrus Logic EP93xx Watchdog Timer
8+
9+
maintainers:
10+
- Nikita Shubin <[email protected]>
11+
- Alexander Sverdlin <[email protected]>
12+
13+
allOf:
14+
- $ref: watchdog.yaml#
15+
16+
properties:
17+
compatible:
18+
oneOf:
19+
- const: cirrus,ep9301-wdt
20+
- items:
21+
- enum:
22+
- cirrus,ep9302-wdt
23+
- cirrus,ep9307-wdt
24+
- cirrus,ep9312-wdt
25+
- cirrus,ep9315-wdt
26+
- const: cirrus,ep9301-wdt
27+
28+
reg:
29+
maxItems: 1
30+
31+
required:
32+
- compatible
33+
- reg
34+
35+
unevaluatedProperties: false
36+
37+
examples:
38+
- |
39+
watchdog@80940000 {
40+
compatible = "cirrus,ep9301-wdt";
41+
reg = <0x80940000 0x08>;
42+
};

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ properties:
7575
- renesas,r8a779h0-wdt # R-Car V4M
7676
- const: renesas,rcar-gen4-wdt # R-Car Gen4
7777

78+
- const: renesas,r9a09g057-wdt # RZ/V2H(P)
79+
7880
reg:
7981
maxItems: 1
8082

@@ -113,7 +115,6 @@ properties:
113115
required:
114116
- compatible
115117
- reg
116-
- interrupts
117118
- clocks
118119

119120
allOf:
@@ -137,6 +138,7 @@ allOf:
137138
compatible:
138139
contains:
139140
enum:
141+
- renesas,r9a09g057-wdt
140142
- renesas,rzg2l-wdt
141143
- renesas,rzv2m-wdt
142144
then:
@@ -171,6 +173,19 @@ allOf:
171173
interrupts:
172174
maxItems: 1
173175

176+
- if:
177+
properties:
178+
compatible:
179+
contains:
180+
const: renesas,r9a09g057-wdt
181+
then:
182+
properties:
183+
interrupts: false
184+
interrupt-names: false
185+
else:
186+
required:
187+
- interrupts
188+
174189
additionalProperties: false
175190

176191
examples:

Documentation/devicetree/bindings/watchdog/st,stm32-iwdg.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ properties:
3636
minItems: 1
3737
maxItems: 2
3838

39+
interrupts:
40+
maxItems: 1
41+
description: Pre-timeout interrupt from the watchdog.
42+
43+
wakeup-source: true
44+
3945
required:
4046
- compatible
4147
- reg

drivers/watchdog/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -953,6 +953,15 @@ config RENESAS_RZG2LWDT
953953
This driver adds watchdog support for the integrated watchdogs in the
954954
Renesas RZ/G2L SoCs. These watchdogs can be used to reset a system.
955955

956+
config RENESAS_RZV2HWDT
957+
tristate "Renesas RZ/V2H(P) WDT Watchdog"
958+
depends on ARCH_R9A09G057 || COMPILE_TEST
959+
depends on PM || COMPILE_TEST
960+
select WATCHDOG_CORE
961+
help
962+
This driver adds watchdog support for the integrated watchdogs in the
963+
Renesas RZ/V2H(P) SoCs. These watchdogs can be used to reset a system.
964+
956965
config ASPEED_WATCHDOG
957966
tristate "Aspeed BMC watchdog support"
958967
depends on ARCH_ASPEED || COMPILE_TEST

drivers/watchdog/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ obj-$(CONFIG_RENESAS_WDT) += renesas_wdt.o
8686
obj-$(CONFIG_RENESAS_RZAWDT) += rza_wdt.o
8787
obj-$(CONFIG_RENESAS_RZN1WDT) += rzn1_wdt.o
8888
obj-$(CONFIG_RENESAS_RZG2LWDT) += rzg2l_wdt.o
89+
obj-$(CONFIG_RENESAS_RZV2HWDT) += rzv2h_wdt.o
8990
obj-$(CONFIG_ASPEED_WATCHDOG) += aspeed_wdt.o
9091
obj-$(CONFIG_STM32_WATCHDOG) += stm32_iwdg.o
9192
obj-$(CONFIG_UNIPHIER_WATCHDOG) += uniphier_wdt.o

drivers/watchdog/iTCO_wdt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,8 @@ static int iTCO_wdt_probe(struct platform_device *pdev)
563563
}
564564

565565
ident.firmware_version = p->iTCO_version;
566-
p->wddev.info = &ident,
567-
p->wddev.ops = &iTCO_wdt_ops,
566+
p->wddev.info = &ident;
567+
p->wddev.ops = &iTCO_wdt_ops;
568568
p->wddev.bootstatus = 0;
569569
p->wddev.timeout = WATCHDOG_TIMEOUT;
570570
watchdog_set_nowayout(&p->wddev, nowayout);

drivers/watchdog/imx2_wdt.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ static void imx2_wdt_shutdown(struct platform_device *pdev)
379379
}
380380

381381
/* Disable watchdog if it is active or non-active but still running */
382-
static int __maybe_unused imx2_wdt_suspend(struct device *dev)
382+
static int imx2_wdt_suspend(struct device *dev)
383383
{
384384
struct watchdog_device *wdog = dev_get_drvdata(dev);
385385
struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog);
@@ -404,7 +404,7 @@ static int __maybe_unused imx2_wdt_suspend(struct device *dev)
404404
}
405405

406406
/* Enable watchdog and configure it if necessary */
407-
static int __maybe_unused imx2_wdt_resume(struct device *dev)
407+
static int imx2_wdt_resume(struct device *dev)
408408
{
409409
struct watchdog_device *wdog = dev_get_drvdata(dev);
410410
struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog);
@@ -435,8 +435,8 @@ static int __maybe_unused imx2_wdt_resume(struct device *dev)
435435
return 0;
436436
}
437437

438-
static SIMPLE_DEV_PM_OPS(imx2_wdt_pm_ops, imx2_wdt_suspend,
439-
imx2_wdt_resume);
438+
static DEFINE_SIMPLE_DEV_PM_OPS(imx2_wdt_pm_ops, imx2_wdt_suspend,
439+
imx2_wdt_resume);
440440

441441
static struct imx2_wdt_data imx_wdt = {
442442
.wdw_supported = true,
@@ -476,7 +476,7 @@ static struct platform_driver imx2_wdt_driver = {
476476
.shutdown = imx2_wdt_shutdown,
477477
.driver = {
478478
.name = DRIVER_NAME,
479-
.pm = &imx2_wdt_pm_ops,
479+
.pm = pm_sleep_ptr(&imx2_wdt_pm_ops),
480480
.of_match_table = imx2_wdt_dt_ids,
481481
},
482482
};

drivers/watchdog/imx7ulp_wdt.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
5555

5656
struct imx_wdt_hw_feature {
5757
bool prescaler_enable;
58+
bool post_rcs_wait;
5859
u32 wdog_clock_rate;
5960
};
6061

6162
struct imx7ulp_wdt_device {
6263
struct watchdog_device wdd;
6364
void __iomem *base;
6465
struct clk *clk;
65-
bool post_rcs_wait;
6666
bool ext_reset;
6767
const struct imx_wdt_hw_feature *hw;
6868
};
@@ -95,7 +95,7 @@ static int imx7ulp_wdt_wait_rcs(struct imx7ulp_wdt_device *wdt)
9595
ret = -ETIMEDOUT;
9696

9797
/* Wait 2.5 clocks after RCS done */
98-
if (wdt->post_rcs_wait)
98+
if (wdt->hw->post_rcs_wait)
9999
usleep_range(wait_min, wait_min + 2000);
100100

101101
return ret;
@@ -334,15 +334,6 @@ static int imx7ulp_wdt_probe(struct platform_device *pdev)
334334
/* The WDOG may need to do external reset through dedicated pin */
335335
imx7ulp_wdt->ext_reset = of_property_read_bool(dev->of_node, "fsl,ext-reset-output");
336336

337-
imx7ulp_wdt->post_rcs_wait = true;
338-
if (of_device_is_compatible(dev->of_node,
339-
"fsl,imx8ulp-wdt")) {
340-
dev_info(dev, "imx8ulp wdt probe\n");
341-
imx7ulp_wdt->post_rcs_wait = false;
342-
} else {
343-
dev_info(dev, "imx7ulp wdt probe\n");
344-
}
345-
346337
wdog = &imx7ulp_wdt->wdd;
347338
wdog->info = &imx7ulp_wdt_info;
348339
wdog->ops = &imx7ulp_wdt_ops;
@@ -403,6 +394,12 @@ static const struct dev_pm_ops imx7ulp_wdt_pm_ops = {
403394
static const struct imx_wdt_hw_feature imx7ulp_wdt_hw = {
404395
.prescaler_enable = false,
405396
.wdog_clock_rate = 1000,
397+
.post_rcs_wait = true,
398+
};
399+
400+
static const struct imx_wdt_hw_feature imx8ulp_wdt_hw = {
401+
.prescaler_enable = false,
402+
.wdog_clock_rate = 1000,
406403
};
407404

408405
static const struct imx_wdt_hw_feature imx93_wdt_hw = {
@@ -411,8 +408,8 @@ static const struct imx_wdt_hw_feature imx93_wdt_hw = {
411408
};
412409

413410
static const struct of_device_id imx7ulp_wdt_dt_ids[] = {
414-
{ .compatible = "fsl,imx8ulp-wdt", .data = &imx7ulp_wdt_hw, },
415411
{ .compatible = "fsl,imx7ulp-wdt", .data = &imx7ulp_wdt_hw, },
412+
{ .compatible = "fsl,imx8ulp-wdt", .data = &imx8ulp_wdt_hw, },
416413
{ .compatible = "fsl,imx93-wdt", .data = &imx93_wdt_hw, },
417414
{ /* sentinel */ }
418415
};

drivers/watchdog/imx_sc_wdt.c

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,25 @@ static int imx_sc_wdt_ping(struct watchdog_device *wdog)
5656
return 0;
5757
}
5858

59+
static bool imx_sc_wdt_is_running(void)
60+
{
61+
struct arm_smccc_res res;
62+
63+
arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_START_WDOG,
64+
0, 0, 0, 0, 0, 0, &res);
65+
66+
/* Already enabled (SC_TIMER_ERR_BUSY)? */
67+
if (res.a0 == SC_TIMER_ERR_BUSY)
68+
return true;
69+
70+
/* Undo only if that was us who has (successfully) enabled the WDT */
71+
if (!res.a0)
72+
arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_STOP_WDOG,
73+
0, 0, 0, 0, 0, 0, &res);
74+
75+
return false;
76+
}
77+
5978
static int imx_sc_wdt_start(struct watchdog_device *wdog)
6079
{
6180
struct arm_smccc_res res;
@@ -183,6 +202,9 @@ static int imx_sc_wdt_probe(struct platform_device *pdev)
183202
if (ret)
184203
return ret;
185204

205+
if (imx_sc_wdt_is_running())
206+
set_bit(WDOG_HW_RUNNING, &wdog->status);
207+
186208
watchdog_stop_on_reboot(wdog);
187209
watchdog_stop_on_unregister(wdog);
188210

@@ -216,29 +238,6 @@ static int imx_sc_wdt_probe(struct platform_device *pdev)
216238
return devm_watchdog_register_device(dev, wdog);
217239
}
218240

219-
static int __maybe_unused imx_sc_wdt_suspend(struct device *dev)
220-
{
221-
struct imx_sc_wdt_device *imx_sc_wdd = dev_get_drvdata(dev);
222-
223-
if (watchdog_active(&imx_sc_wdd->wdd))
224-
imx_sc_wdt_stop(&imx_sc_wdd->wdd);
225-
226-
return 0;
227-
}
228-
229-
static int __maybe_unused imx_sc_wdt_resume(struct device *dev)
230-
{
231-
struct imx_sc_wdt_device *imx_sc_wdd = dev_get_drvdata(dev);
232-
233-
if (watchdog_active(&imx_sc_wdd->wdd))
234-
imx_sc_wdt_start(&imx_sc_wdd->wdd);
235-
236-
return 0;
237-
}
238-
239-
static SIMPLE_DEV_PM_OPS(imx_sc_wdt_pm_ops,
240-
imx_sc_wdt_suspend, imx_sc_wdt_resume);
241-
242241
static const struct of_device_id imx_sc_wdt_dt_ids[] = {
243242
{ .compatible = "fsl,imx-sc-wdt", },
244243
{ /* sentinel */ }
@@ -250,7 +249,6 @@ static struct platform_driver imx_sc_wdt_driver = {
250249
.driver = {
251250
.name = "imx-sc-wdt",
252251
.of_match_table = imx_sc_wdt_dt_ids,
253-
.pm = &imx_sc_wdt_pm_ops,
254252
},
255253
};
256254
module_platform_driver(imx_sc_wdt_driver);

drivers/watchdog/marvell_gti_wdt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@ static int gti_wdt_probe(struct platform_device *pdev)
285285
}
286286

287287
wdog_dev = &priv->wdev;
288-
wdog_dev->info = &gti_wdt_ident,
289-
wdog_dev->ops = &gti_wdt_ops,
288+
wdog_dev->info = &gti_wdt_ident;
289+
wdog_dev->ops = &gti_wdt_ops;
290290
wdog_dev->parent = dev;
291291
/*
292292
* Watchdog counter is 24 bit where lower 8 bits are zeros

0 commit comments

Comments
 (0)