Skip to content

Commit 12418ec

Browse files
committed
Merge tag 'linux-watchdog-6.7-rc1' of git://www.linux-watchdog.org/linux-watchdog
Pull watchdog updates from Wim Van Sebroeck: - add support for Amlogic C3 and S4 SoCs - add IT8613 ID - add MSM8226 and MSM8974 compatibles - other small fixes and improvements * tag 'linux-watchdog-6.7-rc1' of git://www.linux-watchdog.org/linux-watchdog: (24 commits) dt-bindings: watchdog: Add support for Amlogic C3 and S4 SoCs watchdog: mlx-wdt: Parameter desctiption warning fix watchdog: aspeed: Add support for aspeed,reset-mask DT property dt-bindings: watchdog: aspeed-wdt: Add aspeed,reset-mask property watchdog: apple: Deactivate on suspend dt-bindings: watchdog: qcom-wdt: Add MSM8226 and MSM8974 compatibles dt-bindings: watchdog: fsl-imx7ulp-wdt: Add 'fsl,ext-reset-output' wdog: imx7ulp: Enable wdog int_en bit for watchdog any reset drivers: watchdog: marvell_gti: Program the max_hw_heartbeat_ms drivers: watchdog: marvell_gti: fix zero pretimeout handling watchdog: marvell_gti: Replace of_platform.h with explicit includes watchdog: imx_sc_wdt: continue if the wdog already enabled watchdog: st_lpc: Use device_get_match_data() watchdog: wdat_wdt: Add timeout value as a param in ping method watchdog: gpio_wdt: Make use of device properties sbsa_gwdt: Calculate timeout with 64-bit math watchdog: ixp4xx: Make sure restart always works watchdog: it87_wdt: add IT8613 ID watchdog: marvell_gti_wdt: Fix error code in probe() Watchdog: marvell_gti_wdt: Remove redundant dev_err_probe() for platform_get_irq() ...
2 parents f3bfe64 + 9d08e59 commit 12418ec

21 files changed

+248
-83
lines changed

Documentation/devicetree/bindings/watchdog/amlogic,meson-gxbb-wdt.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,15 @@ allOf:
1515

1616
properties:
1717
compatible:
18-
enum:
19-
- amlogic,meson-gxbb-wdt
20-
- amlogic,t7-wdt
18+
oneOf:
19+
- enum:
20+
- amlogic,meson-gxbb-wdt
21+
- amlogic,t7-wdt
22+
- items:
23+
- enum:
24+
- amlogic,c3-wdt
25+
- amlogic,s4-wdt
26+
- const: amlogic,t7-wdt
2127

2228
reg:
2329
maxItems: 1

Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,27 @@ Optional properties for AST2500-compatible watchdogs:
4747
is configured as push-pull, then set the pulse
4848
polarity to active-high. The default is active-low.
4949

50-
Example:
50+
Optional properties for AST2500- and AST2600-compatible watchdogs:
51+
- aspeed,reset-mask: A bitmask indicating which peripherals will be reset if
52+
the watchdog timer expires. On AST2500 this should be a
53+
single word defined using the AST2500_WDT_RESET_* macros;
54+
on AST2600 this should be a two-word array with the first
55+
word defined using the AST2600_WDT_RESET1_* macros and the
56+
second word defined using the AST2600_WDT_RESET2_* macros.
57+
58+
Examples:
5159

5260
wdt1: watchdog@1e785000 {
5361
compatible = "aspeed,ast2400-wdt";
5462
reg = <0x1e785000 0x1c>;
5563
aspeed,reset-type = "system";
5664
aspeed,external-signal;
5765
};
66+
67+
#include <dt-bindings/watchdog/aspeed-wdt.h>
68+
wdt2: watchdog@1e785040 {
69+
compatible = "aspeed,ast2600-wdt";
70+
reg = <0x1e785040 0x40>;
71+
aspeed,reset-mask = <AST2600_WDT_RESET1_DEFAULT
72+
(AST2600_WDT_RESET2_DEFAULT & ~AST2600_WDT_RESET2_LPC)>;
73+
};

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ properties:
3030
clocks:
3131
maxItems: 1
3232

33+
fsl,ext-reset-output:
34+
description:
35+
When set, wdog can generate external reset from the wdog_any pin.
36+
type: boolean
37+
3338
required:
3439
- compatible
3540
- interrupts

Documentation/devicetree/bindings/watchdog/qcom-wdt.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ properties:
2121
- qcom,apss-wdt-ipq5018
2222
- qcom,apss-wdt-ipq5332
2323
- qcom,apss-wdt-ipq9574
24+
- qcom,apss-wdt-msm8226
25+
- qcom,apss-wdt-msm8974
2426
- qcom,apss-wdt-msm8994
2527
- qcom,apss-wdt-qcm2290
2628
- qcom,apss-wdt-qcs404

drivers/watchdog/apple_wdt.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ static int apple_wdt_probe(struct platform_device *pdev)
173173
if (!wdt->clk_rate)
174174
return -EINVAL;
175175

176+
platform_set_drvdata(pdev, wdt);
177+
176178
wdt->wdd.ops = &apple_wdt_ops;
177179
wdt->wdd.info = &apple_wdt_info;
178180
wdt->wdd.max_timeout = U32_MAX / wdt->clk_rate;
@@ -190,6 +192,28 @@ static int apple_wdt_probe(struct platform_device *pdev)
190192
return devm_watchdog_register_device(dev, &wdt->wdd);
191193
}
192194

195+
static int apple_wdt_resume(struct device *dev)
196+
{
197+
struct apple_wdt *wdt = dev_get_drvdata(dev);
198+
199+
if (watchdog_active(&wdt->wdd) || watchdog_hw_running(&wdt->wdd))
200+
apple_wdt_start(&wdt->wdd);
201+
202+
return 0;
203+
}
204+
205+
static int apple_wdt_suspend(struct device *dev)
206+
{
207+
struct apple_wdt *wdt = dev_get_drvdata(dev);
208+
209+
if (watchdog_active(&wdt->wdd) || watchdog_hw_running(&wdt->wdd))
210+
apple_wdt_stop(&wdt->wdd);
211+
212+
return 0;
213+
}
214+
215+
static DEFINE_SIMPLE_DEV_PM_OPS(apple_wdt_pm_ops, apple_wdt_suspend, apple_wdt_resume);
216+
193217
static const struct of_device_id apple_wdt_of_match[] = {
194218
{ .compatible = "apple,wdt" },
195219
{},
@@ -200,6 +224,7 @@ static struct platform_driver apple_wdt_driver = {
200224
.driver = {
201225
.name = "apple-watchdog",
202226
.of_match_table = apple_wdt_of_match,
227+
.pm = pm_sleep_ptr(&apple_wdt_pm_ops),
203228
},
204229
.probe = apple_wdt_probe,
205230
};

drivers/watchdog/aspeed_wdt.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ MODULE_DEVICE_TABLE(of, aspeed_wdt_of_table);
7979
#define WDT_TIMEOUT_STATUS_BOOT_SECONDARY BIT(1)
8080
#define WDT_CLEAR_TIMEOUT_STATUS 0x14
8181
#define WDT_CLEAR_TIMEOUT_AND_BOOT_CODE_SELECTION BIT(0)
82+
#define WDT_RESET_MASK1 0x1c
83+
#define WDT_RESET_MASK2 0x20
8284

8385
/*
8486
* WDT_RESET_WIDTH controls the characteristics of the external pulse (if
@@ -402,6 +404,8 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
402404

403405
if ((of_device_is_compatible(np, "aspeed,ast2500-wdt")) ||
404406
(of_device_is_compatible(np, "aspeed,ast2600-wdt"))) {
407+
u32 reset_mask[2];
408+
size_t nrstmask = of_device_is_compatible(np, "aspeed,ast2600-wdt") ? 2 : 1;
405409
u32 reg = readl(wdt->base + WDT_RESET_WIDTH);
406410

407411
reg &= wdt->cfg->ext_pulse_width_mask;
@@ -419,6 +423,13 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
419423
reg |= WDT_OPEN_DRAIN_MAGIC;
420424

421425
writel(reg, wdt->base + WDT_RESET_WIDTH);
426+
427+
ret = of_property_read_u32_array(np, "aspeed,reset-mask", reset_mask, nrstmask);
428+
if (!ret) {
429+
writel(reset_mask[0], wdt->base + WDT_RESET_MASK1);
430+
if (nrstmask > 1)
431+
writel(reset_mask[1], wdt->base + WDT_RESET_MASK2);
432+
}
422433
}
423434

424435
if (!of_property_read_u32(np, "aspeed,ext-pulse-duration", &duration)) {

drivers/watchdog/at91sam9_wdt.c

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -348,37 +348,28 @@ static int __init at91wdt_probe(struct platform_device *pdev)
348348
if (IS_ERR(wdt->base))
349349
return PTR_ERR(wdt->base);
350350

351-
wdt->sclk = devm_clk_get(&pdev->dev, NULL);
352-
if (IS_ERR(wdt->sclk))
353-
return PTR_ERR(wdt->sclk);
354-
355-
err = clk_prepare_enable(wdt->sclk);
356-
if (err) {
351+
wdt->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
352+
if (IS_ERR(wdt->sclk)) {
357353
dev_err(&pdev->dev, "Could not enable slow clock\n");
358-
return err;
354+
return PTR_ERR(wdt->sclk);
359355
}
360356

361357
if (pdev->dev.of_node) {
362358
err = of_at91wdt_init(pdev->dev.of_node, wdt);
363359
if (err)
364-
goto err_clk;
360+
return err;
365361
}
366362

367363
err = at91_wdt_init(pdev, wdt);
368364
if (err)
369-
goto err_clk;
365+
return err;
370366

371367
platform_set_drvdata(pdev, wdt);
372368

373369
pr_info("enabled (heartbeat=%d sec, nowayout=%d)\n",
374370
wdt->wdd.timeout, wdt->nowayout);
375371

376372
return 0;
377-
378-
err_clk:
379-
clk_disable_unprepare(wdt->sclk);
380-
381-
return err;
382373
}
383374

384375
static int __exit at91wdt_remove(struct platform_device *pdev)
@@ -388,7 +379,6 @@ static int __exit at91wdt_remove(struct platform_device *pdev)
388379

389380
pr_warn("I quit now, hardware will probably reboot!\n");
390381
del_timer(&wdt->timer);
391-
clk_disable_unprepare(wdt->sclk);
392382

393383
return 0;
394384
}

drivers/watchdog/ath79_wdt.c

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -257,19 +257,13 @@ static int ath79_wdt_probe(struct platform_device *pdev)
257257
if (IS_ERR(wdt_base))
258258
return PTR_ERR(wdt_base);
259259

260-
wdt_clk = devm_clk_get(&pdev->dev, "wdt");
260+
wdt_clk = devm_clk_get_enabled(&pdev->dev, "wdt");
261261
if (IS_ERR(wdt_clk))
262262
return PTR_ERR(wdt_clk);
263263

264-
err = clk_prepare_enable(wdt_clk);
265-
if (err)
266-
return err;
267-
268264
wdt_freq = clk_get_rate(wdt_clk);
269-
if (!wdt_freq) {
270-
err = -EINVAL;
271-
goto err_clk_disable;
272-
}
265+
if (!wdt_freq)
266+
return -EINVAL;
273267

274268
max_timeout = (0xfffffffful / wdt_freq);
275269
if (timeout < 1 || timeout > max_timeout) {
@@ -286,20 +280,15 @@ static int ath79_wdt_probe(struct platform_device *pdev)
286280
if (err) {
287281
dev_err(&pdev->dev,
288282
"unable to register misc device, err=%d\n", err);
289-
goto err_clk_disable;
283+
return err;
290284
}
291285

292286
return 0;
293-
294-
err_clk_disable:
295-
clk_disable_unprepare(wdt_clk);
296-
return err;
297287
}
298288

299289
static void ath79_wdt_remove(struct platform_device *pdev)
300290
{
301291
misc_deregister(&ath79_wdt_miscdev);
302-
clk_disable_unprepare(wdt_clk);
303292
}
304293

305294
static void ath79_wdt_shutdown(struct platform_device *pdev)

drivers/watchdog/gpio_wdt.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
* Author: 2013, Alexander Shiyan <[email protected]>
66
*/
77

8-
#include <linux/err.h>
98
#include <linux/delay.h>
10-
#include <linux/module.h>
9+
#include <linux/err.h>
1110
#include <linux/gpio/consumer.h>
12-
#include <linux/of.h>
11+
#include <linux/mod_devicetable.h>
12+
#include <linux/module.h>
1313
#include <linux/platform_device.h>
14+
#include <linux/property.h>
1415
#include <linux/watchdog.h>
1516

1617
static bool nowayout = WATCHDOG_NOWAYOUT;
@@ -106,7 +107,6 @@ static const struct watchdog_ops gpio_wdt_ops = {
106107
static int gpio_wdt_probe(struct platform_device *pdev)
107108
{
108109
struct device *dev = &pdev->dev;
109-
struct device_node *np = dev->of_node;
110110
struct gpio_wdt_priv *priv;
111111
enum gpiod_flags gflags;
112112
unsigned int hw_margin;
@@ -119,7 +119,7 @@ static int gpio_wdt_probe(struct platform_device *pdev)
119119

120120
platform_set_drvdata(pdev, priv);
121121

122-
ret = of_property_read_string(np, "hw_algo", &algo);
122+
ret = device_property_read_string(dev, "hw_algo", &algo);
123123
if (ret)
124124
return ret;
125125
if (!strcmp(algo, "toggle")) {
@@ -136,16 +136,14 @@ static int gpio_wdt_probe(struct platform_device *pdev)
136136
if (IS_ERR(priv->gpiod))
137137
return PTR_ERR(priv->gpiod);
138138

139-
ret = of_property_read_u32(np,
140-
"hw_margin_ms", &hw_margin);
139+
ret = device_property_read_u32(dev, "hw_margin_ms", &hw_margin);
141140
if (ret)
142141
return ret;
143142
/* Disallow values lower than 2 and higher than 65535 ms */
144143
if (hw_margin < 2 || hw_margin > 65535)
145144
return -EINVAL;
146145

147-
priv->always_running = of_property_read_bool(np,
148-
"always-running");
146+
priv->always_running = device_property_read_bool(dev, "always-running");
149147

150148
watchdog_set_drvdata(&priv->wdd, priv);
151149

drivers/watchdog/imx7ulp_wdt.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#define LPO_CLK_SHIFT 8
2424
#define WDOG_CS_CLK (LPO_CLK << LPO_CLK_SHIFT)
2525
#define WDOG_CS_EN BIT(7)
26+
#define WDOG_CS_INT_EN BIT(6)
2627
#define WDOG_CS_UPDATE BIT(5)
2728
#define WDOG_CS_WAIT BIT(1)
2829
#define WDOG_CS_STOP BIT(0)
@@ -62,6 +63,7 @@ struct imx7ulp_wdt_device {
6263
void __iomem *base;
6364
struct clk *clk;
6465
bool post_rcs_wait;
66+
bool ext_reset;
6567
const struct imx_wdt_hw_feature *hw;
6668
};
6769

@@ -285,6 +287,9 @@ static int imx7ulp_wdt_init(struct imx7ulp_wdt_device *wdt, unsigned int timeout
285287
if (wdt->hw->prescaler_enable)
286288
val |= WDOG_CS_PRES;
287289

290+
if (wdt->ext_reset)
291+
val |= WDOG_CS_INT_EN;
292+
288293
do {
289294
ret = _imx7ulp_wdt_init(wdt, timeout, val);
290295
toval = readl(wdt->base + WDOG_TOVAL);
@@ -321,6 +326,9 @@ static int imx7ulp_wdt_probe(struct platform_device *pdev)
321326
return PTR_ERR(imx7ulp_wdt->clk);
322327
}
323328

329+
/* The WDOG may need to do external reset through dedicated pin */
330+
imx7ulp_wdt->ext_reset = of_property_read_bool(dev->of_node, "fsl,ext-reset-output");
331+
324332
imx7ulp_wdt->post_rcs_wait = true;
325333
if (of_device_is_compatible(dev->of_node,
326334
"fsl,imx8ulp-wdt")) {

drivers/watchdog/imx_sc_wdt.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
#define SC_IRQ_WDOG 1
3636
#define SC_IRQ_GROUP_WDOG 1
37+
#define SC_TIMER_ERR_BUSY 10
3738

3839
static bool nowayout = WATCHDOG_NOWAYOUT;
3940
module_param(nowayout, bool, 0000);
@@ -61,7 +62,9 @@ static int imx_sc_wdt_start(struct watchdog_device *wdog)
6162

6263
arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_START_WDOG,
6364
0, 0, 0, 0, 0, 0, &res);
64-
if (res.a0)
65+
66+
/* Ignore if already enabled(SC_TIMER_ERR_BUSY) */
67+
if (res.a0 && res.a0 != SC_TIMER_ERR_BUSY)
6568
return -EACCES;
6669

6770
arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_SET_WDOG_ACT,

drivers/watchdog/it87_wdt.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
* http://www.ite.com.tw/
1414
*
1515
* Support of the watchdog timers, which are available on
16-
* IT8607, IT8620, IT8622, IT8625, IT8628, IT8655, IT8665, IT8686,
17-
* IT8702, IT8712, IT8716, IT8718, IT8720, IT8721, IT8726, IT8728,
18-
* IT8772, IT8783 and IT8784.
16+
* IT8607, IT8613, IT8620, IT8622, IT8625, IT8628, IT8655, IT8665,
17+
* IT8686, IT8702, IT8712, IT8716, IT8718, IT8720, IT8721, IT8726,
18+
* IT8728, IT8772, IT8783 and IT8784.
1919
*/
2020

2121
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -50,6 +50,7 @@
5050
/* Chip Id numbers */
5151
#define NO_DEV_ID 0xffff
5252
#define IT8607_ID 0x8607
53+
#define IT8613_ID 0x8613
5354
#define IT8620_ID 0x8620
5455
#define IT8622_ID 0x8622
5556
#define IT8625_ID 0x8625
@@ -277,6 +278,7 @@ static int __init it87_wdt_init(void)
277278
max_units = 65535;
278279
break;
279280
case IT8607_ID:
281+
case IT8613_ID:
280282
case IT8620_ID:
281283
case IT8622_ID:
282284
case IT8625_ID:

0 commit comments

Comments
 (0)