Skip to content

Commit 3a77fa8

Browse files
committed
Merge tag 'watchdog-for-linus-v4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull watchdog updates from Wim Van Sebroeck and Guenter Roeck: - new driver for Add Loongson1 SoC - minor cleanup and fixes in various drivers * tag 'watchdog-for-linus-v4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: watchdog: it87_wdt: add IT8620E ID watchdog: mpc8xxx: Remove unneeded linux/miscdevice.h include watchdog: octeon: Remove unneeded linux/miscdevice.h include watchdog: bcm2835_wdt: set WDOG_HW_RUNNING bit when appropriate watchdog: loongson1: Add Loongson1 SoC watchdog driver watchdog: cpwd: remove memory allocate failure message watchdog: da9062/61: watchdog driver intel-mid_wdt: Error code is just an integer intel-mid_wdt: make sure watchdog is not running at startup watchdog: mei_wdt: request stop on reboot to prevent false positive event watchdog: hpwdt: changed maintainer information watchdog: jz4740: Fix modular build watchdog: qcom: fix kernel panic due to external abort on non-linefetch watchdog: davinci: add support for deferred probing watchdog: meson: Remove unneeded platform MODULE_ALIAS watchdog: Standardize leading tabs and spaces in Kconfig file watchdog: max77620_wdt: fix module autoload watchdog: bcm7038_wdt: fix module autoload
2 parents 01e0d60 + 0671612 commit 3a77fa8

18 files changed

+262
-58
lines changed

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5735,7 +5735,7 @@ S: Maintained
57355735
F: drivers/media/dvb-frontends/hd29l2*
57365736

57375737
HEWLETT PACKARD ENTERPRISE ILO NMI WATCHDOG DRIVER
5738-
M: Brian Boylston <brian.boylston@hpe.com>
5738+
M: Jimmy Vance <jimmy.vance@hpe.com>
57395739
S: Supported
57405740
F: Documentation/watchdog/hpwdt.txt
57415741
F: drivers/watchdog/hpwdt.c

drivers/watchdog/Kconfig

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,16 @@ config SOFT_WATCHDOG
7272
module will be called softdog.
7373

7474
config DA9052_WATCHDOG
75-
tristate "Dialog DA9052 Watchdog"
76-
depends on PMIC_DA9052
77-
select WATCHDOG_CORE
78-
help
79-
Support for the watchdog in the DA9052 PMIC. Watchdog trigger
80-
cause system reset.
75+
tristate "Dialog DA9052 Watchdog"
76+
depends on PMIC_DA9052
77+
select WATCHDOG_CORE
78+
help
79+
Support for the watchdog in the DA9052 PMIC. Watchdog trigger
80+
cause system reset.
8181

82-
Say Y here to include support for the DA9052 watchdog.
83-
Alternatively say M to compile the driver as a module,
84-
which will be called da9052_wdt.
82+
Say Y here to include support for the DA9052 watchdog.
83+
Alternatively say M to compile the driver as a module,
84+
which will be called da9052_wdt.
8585

8686
config DA9055_WATCHDOG
8787
tristate "Dialog Semiconductor DA9055 Watchdog"
@@ -104,11 +104,11 @@ config DA9063_WATCHDOG
104104
This driver can be built as a module. The module name is da9063_wdt.
105105

106106
config DA9062_WATCHDOG
107-
tristate "Dialog DA9062 Watchdog"
107+
tristate "Dialog DA9062/61 Watchdog"
108108
depends on MFD_DA9062
109109
select WATCHDOG_CORE
110110
help
111-
Support for the watchdog in the DA9062 PMIC.
111+
Support for the watchdog in the DA9062 and DA9061 PMICs.
112112

113113
This driver can be built as a module. The module name is da9062_wdt.
114114

@@ -1008,8 +1008,8 @@ config IT87_WDT
10081008
tristate "IT87 Watchdog Timer"
10091009
depends on X86
10101010
---help---
1011-
This is the driver for the hardware watchdog on the ITE IT8702,
1012-
IT8712, IT8716, IT8718, IT8720, IT8721, IT8726 and IT8728
1011+
This is the driver for the hardware watchdog on the ITE IT8620,
1012+
IT8702, IT8712, IT8716, IT8718, IT8720, IT8721, IT8726 and IT8728
10131013
Super I/O chips.
10141014

10151015
If the driver does not work, then make sure that the game port in
@@ -1514,6 +1514,13 @@ config LANTIQ_WDT
15141514
help
15151515
Hardware driver for the Lantiq SoC Watchdog Timer.
15161516

1517+
config LOONGSON1_WDT
1518+
tristate "Loongson1 SoC hardware watchdog"
1519+
depends on MACH_LOONGSON32
1520+
select WATCHDOG_CORE
1521+
help
1522+
Hardware driver for the Loongson1 SoC Watchdog Timer.
1523+
15171524
config RALINK_WDT
15181525
tristate "Ralink SoC watchdog"
15191526
select WATCHDOG_CORE
@@ -1624,16 +1631,16 @@ config BOOKE_WDT_DEFAULT_TIMEOUT
16241631
The value can be overridden by the wdt_period command-line parameter.
16251632

16261633
config MEN_A21_WDT
1627-
tristate "MEN A21 VME CPU Carrier Board Watchdog Timer"
1628-
select WATCHDOG_CORE
1629-
depends on GPIOLIB || COMPILE_TEST
1630-
help
1631-
Watchdog driver for MEN A21 VMEbus CPU Carrier Boards.
1634+
tristate "MEN A21 VME CPU Carrier Board Watchdog Timer"
1635+
select WATCHDOG_CORE
1636+
depends on GPIOLIB || COMPILE_TEST
1637+
help
1638+
Watchdog driver for MEN A21 VMEbus CPU Carrier Boards.
16321639

1633-
The driver can also be built as a module. If so, the module will be
1634-
called mena21_wdt.
1640+
The driver can also be built as a module. If so, the module will be
1641+
called mena21_wdt.
16351642

1636-
If unsure select N here.
1643+
If unsure select N here.
16371644

16381645
# PPC64 Architecture
16391646

drivers/watchdog/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ obj-$(CONFIG_TXX9_WDT) += txx9wdt.o
163163
obj-$(CONFIG_OCTEON_WDT) += octeon-wdt.o
164164
octeon-wdt-y := octeon-wdt-main.o octeon-wdt-nmi.o
165165
obj-$(CONFIG_LANTIQ_WDT) += lantiq_wdt.o
166+
obj-$(CONFIG_LOONGSON1_WDT) += loongson1_wdt.o
166167
obj-$(CONFIG_RALINK_WDT) += rt2880_wdt.o
167168
obj-$(CONFIG_IMGPDC_WDT) += imgpdc_wdt.o
168169
obj-$(CONFIG_MT7621_WDT) += mt7621_wdt.o

drivers/watchdog/bcm2835_wdt.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ struct bcm2835_wdt {
5555
static unsigned int heartbeat;
5656
static bool nowayout = WATCHDOG_NOWAYOUT;
5757

58+
static bool bcm2835_wdt_is_running(struct bcm2835_wdt *wdt)
59+
{
60+
uint32_t cur;
61+
62+
cur = readl(wdt->base + PM_RSTC);
63+
64+
return !!(cur & PM_RSTC_WRCFG_FULL_RESET);
65+
}
66+
5867
static int bcm2835_wdt_start(struct watchdog_device *wdog)
5968
{
6069
struct bcm2835_wdt *wdt = watchdog_get_drvdata(wdog);
@@ -181,6 +190,17 @@ static int bcm2835_wdt_probe(struct platform_device *pdev)
181190
watchdog_init_timeout(&bcm2835_wdt_wdd, heartbeat, dev);
182191
watchdog_set_nowayout(&bcm2835_wdt_wdd, nowayout);
183192
bcm2835_wdt_wdd.parent = &pdev->dev;
193+
if (bcm2835_wdt_is_running(wdt)) {
194+
/*
195+
* The currently active timeout value (set by the
196+
* bootloader) may be different from the module
197+
* heartbeat parameter or the value in device
198+
* tree. But we just need to set WDOG_HW_RUNNING,
199+
* because then the framework will "immediately" ping
200+
* the device, updating the timeout.
201+
*/
202+
set_bit(WDOG_HW_RUNNING, &bcm2835_wdt_wdd.status);
203+
}
184204
err = watchdog_register_device(&bcm2835_wdt_wdd);
185205
if (err) {
186206
dev_err(dev, "Failed to register watchdog device");

drivers/watchdog/bcm7038_wdt.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ static const struct of_device_id bcm7038_wdt_match[] = {
216216
{ .compatible = "brcm,bcm7038-wdt" },
217217
{},
218218
};
219+
MODULE_DEVICE_TABLE(of, bcm7038_wdt_match);
219220

220221
static struct platform_driver bcm7038_wdt_driver = {
221222
.probe = bcm7038_wdt_probe,

drivers/watchdog/cpwd.c

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -538,12 +538,9 @@ static int cpwd_probe(struct platform_device *op)
538538
if (cpwd_device)
539539
return -EINVAL;
540540

541-
p = kzalloc(sizeof(*p), GFP_KERNEL);
542-
err = -ENOMEM;
543-
if (!p) {
544-
pr_err("Unable to allocate struct cpwd\n");
545-
goto out;
546-
}
541+
p = devm_kzalloc(&op->dev, sizeof(*p), GFP_KERNEL);
542+
if (!p)
543+
return -ENOMEM;
547544

548545
p->irq = op->archdata.irqs[0];
549546

@@ -553,12 +550,12 @@ static int cpwd_probe(struct platform_device *op)
553550
4 * WD_TIMER_REGSZ, DRIVER_NAME);
554551
if (!p->regs) {
555552
pr_err("Unable to map registers\n");
556-
goto out_free;
553+
return -ENOMEM;
557554
}
558555

559556
options = of_find_node_by_path("/options");
560-
err = -ENODEV;
561557
if (!options) {
558+
err = -ENODEV;
562559
pr_err("Unable to find /options node\n");
563560
goto out_iounmap;
564561
}
@@ -620,10 +617,7 @@ static int cpwd_probe(struct platform_device *op)
620617

621618
platform_set_drvdata(op, p);
622619
cpwd_device = p;
623-
err = 0;
624-
625-
out:
626-
return err;
620+
return 0;
627621

628622
out_unregister:
629623
for (i--; i >= 0; i--)
@@ -632,9 +626,7 @@ static int cpwd_probe(struct platform_device *op)
632626
out_iounmap:
633627
of_iounmap(&op->resource[0], p->regs, 4 * WD_TIMER_REGSZ);
634628

635-
out_free:
636-
kfree(p);
637-
goto out;
629+
return err;
638630
}
639631

640632
static int cpwd_remove(struct platform_device *op)
@@ -659,7 +651,6 @@ static int cpwd_remove(struct platform_device *op)
659651
free_irq(p->irq, p);
660652

661653
of_iounmap(&op->resource[0], p->regs, 4 * WD_TIMER_REGSZ);
662-
kfree(p);
663654

664655
cpwd_device = NULL;
665656

drivers/watchdog/da9062_wdt.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* da9062_wdt.c - WDT device driver for DA9062
2+
* Watchdog device driver for DA9062 and DA9061 PMICs
33
* Copyright (C) 2015 Dialog Semiconductor Ltd.
44
*
55
* This program is free software; you can redistribute it and/or
@@ -188,6 +188,13 @@ static const struct watchdog_ops da9062_watchdog_ops = {
188188
.set_timeout = da9062_wdt_set_timeout,
189189
};
190190

191+
static const struct of_device_id da9062_compatible_id_table[] = {
192+
{ .compatible = "dlg,da9062-watchdog", },
193+
{ },
194+
};
195+
196+
MODULE_DEVICE_TABLE(of, da9062_compatible_id_table);
197+
191198
static int da9062_wdt_probe(struct platform_device *pdev)
192199
{
193200
int ret;
@@ -244,11 +251,12 @@ static struct platform_driver da9062_wdt_driver = {
244251
.remove = da9062_wdt_remove,
245252
.driver = {
246253
.name = "da9062-watchdog",
254+
.of_match_table = da9062_compatible_id_table,
247255
},
248256
};
249257
module_platform_driver(da9062_wdt_driver);
250258

251259
MODULE_AUTHOR("S Twiss <stwiss.opensource@diasemi.com>");
252-
MODULE_DESCRIPTION("WDT device driver for Dialog DA9062");
260+
MODULE_DESCRIPTION("WDT device driver for Dialog DA9062 and DA9061");
253261
MODULE_LICENSE("GPL");
254262
MODULE_ALIAS("platform:da9062-watchdog");

drivers/watchdog/davinci_wdt.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,12 @@ static int davinci_wdt_probe(struct platform_device *pdev)
166166
return -ENOMEM;
167167

168168
davinci_wdt->clk = devm_clk_get(dev, NULL);
169-
if (WARN_ON(IS_ERR(davinci_wdt->clk)))
169+
170+
if (IS_ERR(davinci_wdt->clk)) {
171+
if (PTR_ERR(davinci_wdt->clk) != -EPROBE_DEFER)
172+
dev_err(&pdev->dev, "failed to get clock node\n");
170173
return PTR_ERR(davinci_wdt->clk);
174+
}
171175

172176
clk_prepare_enable(davinci_wdt->clk);
173177

drivers/watchdog/intel-mid_wdt.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ static inline int wdt_command(int sub, u32 *in, int inlen)
4343

4444
static int wdt_start(struct watchdog_device *wd)
4545
{
46+
struct device *dev = watchdog_get_drvdata(wd);
4647
int ret, in_size;
4748
int timeout = wd->timeout;
4849
struct ipc_wd_start {
@@ -57,36 +58,32 @@ static int wdt_start(struct watchdog_device *wd)
5758
in_size = DIV_ROUND_UP(sizeof(ipc_wd_start), 4);
5859

5960
ret = wdt_command(SCU_WATCHDOG_START, (u32 *)&ipc_wd_start, in_size);
60-
if (ret) {
61-
struct device *dev = watchdog_get_drvdata(wd);
61+
if (ret)
6262
dev_crit(dev, "error starting watchdog: %d\n", ret);
63-
}
6463

6564
return ret;
6665
}
6766

6867
static int wdt_ping(struct watchdog_device *wd)
6968
{
69+
struct device *dev = watchdog_get_drvdata(wd);
7070
int ret;
7171

7272
ret = wdt_command(SCU_WATCHDOG_KEEPALIVE, NULL, 0);
73-
if (ret) {
74-
struct device *dev = watchdog_get_drvdata(wd);
75-
dev_crit(dev, "Error executing keepalive: 0x%x\n", ret);
76-
}
73+
if (ret)
74+
dev_crit(dev, "Error executing keepalive: %d\n", ret);
7775

7876
return ret;
7977
}
8078

8179
static int wdt_stop(struct watchdog_device *wd)
8280
{
81+
struct device *dev = watchdog_get_drvdata(wd);
8382
int ret;
8483

8584
ret = wdt_command(SCU_WATCHDOG_STOP, NULL, 0);
86-
if (ret) {
87-
struct device *dev = watchdog_get_drvdata(wd);
88-
dev_crit(dev, "Error stopping watchdog: 0x%x\n", ret);
89-
}
85+
if (ret)
86+
dev_crit(dev, "Error stopping watchdog: %d\n", ret);
9087

9188
return ret;
9289
}
@@ -151,6 +148,9 @@ static int mid_wdt_probe(struct platform_device *pdev)
151148
return ret;
152149
}
153150

151+
/* Make sure the watchdog is not running */
152+
wdt_stop(wdt_dev);
153+
154154
ret = watchdog_register_device(wdt_dev);
155155
if (ret) {
156156
dev_err(&pdev->dev, "error registering watchdog device\n");

drivers/watchdog/it87_wdt.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* http://www.ite.com.tw/
1313
*
1414
* Support of the watchdog timers, which are available on
15-
* IT8702, IT8712, IT8716, IT8718, IT8720, IT8721, IT8726,
15+
* IT8620, IT8702, IT8712, IT8716, IT8718, IT8720, IT8721, IT8726,
1616
* IT8728 and IT8783.
1717
*
1818
* This program is free software; you can redistribute it and/or
@@ -78,6 +78,7 @@
7878

7979
/* Chip Id numbers */
8080
#define NO_DEV_ID 0xffff
81+
#define IT8620_ID 0x8620
8182
#define IT8702_ID 0x8702
8283
#define IT8705_ID 0x8705
8384
#define IT8712_ID 0x8712
@@ -630,6 +631,7 @@ static int __init it87_wdt_init(void)
630631
case IT8726_ID:
631632
max_units = 65535;
632633
break;
634+
case IT8620_ID:
633635
case IT8718_ID:
634636
case IT8720_ID:
635637
case IT8721_ID:

drivers/watchdog/jz4740_wdt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ static const struct of_device_id jz4740_wdt_of_matches[] = {
148148
{ .compatible = "ingenic,jz4740-watchdog", },
149149
{ /* sentinel */ }
150150
};
151-
MODULE_DEVICE_TABLE(of, jz4740_wdt_of_matches)
151+
MODULE_DEVICE_TABLE(of, jz4740_wdt_of_matches);
152152
#endif
153153

154154
static int jz4740_wdt_probe(struct platform_device *pdev)

0 commit comments

Comments
 (0)