Skip to content

Commit 68b86a2

Browse files
committed
Pull watchdog updates from Wim Van Sebroeck: "This contains: - fixes and improvements - devicetree bindings - conversion to watchdog generic framework of the following drivers: - booke_wdt - bcm47xx_wdt.c - at91sam9_wdt - Removal of old STMP3xxx driver - Addition of following new drivers: - new driver for STMP3xxx and i.MX23/28 - Retu watchdog driver" * git://www.linux-watchdog.org/linux-watchdog: (30 commits) watchdog: sp805_wdt depends on ARM watchdog: davinci_wdt: update to devm_* API watchdog: davinci_wdt: use devm managed clk get watchdog: at91rm9200: add DT support watchdog: add timeout-sec property binding watchdog: at91sam9_wdt: Convert to use the watchdog framework watchdog: omap_wdt: Add option nowayout watchdog: core: dt: add support for the timeout-sec dt property watchdog: bcm47xx_wdt.c: add hard timer watchdog: bcm47xx_wdt.c: rename wdt_time to timeout watchdog: bcm47xx_wdt.c: rename ops methods watchdog: bcm47xx_wdt.c: use platform device watchdog: bcm47xx_wdt.c: convert to watchdog core api watchdog: Convert BookE watchdog driver to watchdog infrastructure watchdog: s3c2410_wdt: Use devm_* functions watchdog: remove old STMP3xxx driver watchdog: add new driver for STMP3xxx and i.MX23/28 rtc: stmp3xxx: add wdt-accessor function watchdog: introduce retu_wdt driver watchdog: intel_scu_watchdog: fix Kconfig dependency ...
2 parents 527c680 + 41e9f3f commit 68b86a2

31 files changed

Lines changed: 888 additions & 856 deletions
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Atmel AT91RM9200 System Timer Watchdog
2+
3+
Required properties:
4+
- compatible: must be "atmel,at91sam9260-wdt".
5+
6+
Example:
7+
watchdog@fffffd00 {
8+
compatible = "atmel,at91rm9200-wdt";
9+
};

‎Documentation/devicetree/bindings/watchdog/atmel-wdt.txt‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ Required properties:
77
- reg: physical base address of the controller and length of memory mapped
88
region.
99

10+
Optional properties:
11+
- timeout-sec: contains the watchdog timeout in seconds.
12+
1013
Example:
1114

1215
watchdog@fffffd40 {
1316
compatible = "atmel,at91sam9260-wdt";
1417
reg = <0xfffffd40 0x10>;
18+
timeout-sec = <10>;
1519
};

‎Documentation/devicetree/bindings/watchdog/marvel.txt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ Required Properties:
55
- Compatibility : "marvell,orion-wdt"
66
- reg : Address of the timer registers
77

8+
Optional properties:
9+
10+
- timeout-sec : Contains the watchdog timeout in seconds
11+
812
Example:
913

1014
wdt@20300 {
1115
compatible = "marvell,orion-wdt";
1216
reg = <0x20300 0x28>;
17+
timeout-sec = <10>;
1318
status = "okay";
1419
};

‎Documentation/devicetree/bindings/watchdog/pnx4008-wdt.txt‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ Required properties:
55
- reg: physical base address of the controller and length of memory mapped
66
region.
77

8+
Optional properties:
9+
- timeout-sec: contains the watchdog timeout in seconds.
10+
811
Example:
912

1013
watchdog@4003C000 {
1114
compatible = "nxp,pnx4008-wdt";
1215
reg = <0x4003C000 0x1000>;
16+
timeout-sec = <10>;
1317
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
* Qualcomm Atheros AR7130 Watchdog Timer (WDT) Controller
2+
3+
Required properties:
4+
- compatible: must be "qca,ar7130-wdt"
5+
- reg: physical base address of the controller and length of memory mapped
6+
region.
7+
8+
Example:
9+
10+
wdt@18060008 {
11+
compatible = "qca,ar9330-wdt", "qca,ar7130-wdt";
12+
reg = <0x18060008 0x8>;
13+
};

‎Documentation/devicetree/bindings/watchdog/samsung-wdt.txt‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ Required properties:
99
- reg : base physical address of the controller and length of memory mapped
1010
region.
1111
- interrupts : interrupt number to the cpu.
12+
13+
Optional properties:
14+
- timeout-sec : contains the watchdog timeout in seconds.

‎Documentation/watchdog/watchdog-kernel-api.txt‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The Linux WatchDog Timer Driver Core kernel API.
22
===============================================
3-
Last reviewed: 22-May-2012
3+
Last reviewed: 12-Feb-2013
44

55
Wim Van Sebroeck <wim@iguana.be>
66

@@ -212,3 +212,15 @@ driver specific data to and a pointer to the data itself.
212212
The watchdog_get_drvdata function allows you to retrieve driver specific data.
213213
The argument of this function is the watchdog device where you want to retrieve
214214
data from. The function returns the pointer to the driver specific data.
215+
216+
To initialize the timeout field, the following function can be used:
217+
218+
extern int watchdog_init_timeout(struct watchdog_device *wdd,
219+
unsigned int timeout_parm, struct device *dev);
220+
221+
The watchdog_init_timeout function allows you to initialize the timeout field
222+
using the module timeout parameter or by retrieving the timeout-sec property from
223+
the device tree (if the module timeout parameter is invalid). Best practice is
224+
to set the default timeout value as timeout value in the watchdog_device and
225+
then use this function to set the user "preferred" timeout value.
226+
This routine returns zero on success and a negative errno code for failure.

‎arch/mips/ath79/dev-common.c‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,15 @@ void __init ath79_register_uart(void)
102102
}
103103
}
104104

105-
static struct platform_device ath79_wdt_device = {
106-
.name = "ath79-wdt",
107-
.id = -1,
108-
};
109-
110105
void __init ath79_register_wdt(void)
111106
{
112-
platform_device_register(&ath79_wdt_device);
107+
struct resource res;
108+
109+
memset(&res, 0, sizeof(res));
110+
111+
res.flags = IORESOURCE_MEM;
112+
res.start = AR71XX_RESET_BASE + AR71XX_RESET_REG_WDOG_CTRL;
113+
res.end = res.start + 0x8 - 1;
114+
115+
platform_device_register_simple("ath79-wdt", -1, &res, 1);
113116
}

‎drivers/rtc/rtc-stmp3xxx.c‎

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#include <linux/slab.h>
2828
#include <linux/of_device.h>
2929
#include <linux/of.h>
30+
#include <linux/stmp_device.h>
31+
#include <linux/stmp3xxx_rtc_wdt.h>
3032

3133
#include <mach/common.h>
3234

@@ -36,6 +38,7 @@
3638
#define STMP3XXX_RTC_CTRL_ALARM_IRQ_EN 0x00000001
3739
#define STMP3XXX_RTC_CTRL_ONEMSEC_IRQ_EN 0x00000002
3840
#define STMP3XXX_RTC_CTRL_ALARM_IRQ 0x00000004
41+
#define STMP3XXX_RTC_CTRL_WATCHDOGEN 0x00000010
3942

4043
#define STMP3XXX_RTC_STAT 0x10
4144
#define STMP3XXX_RTC_STAT_STALE_SHIFT 16
@@ -45,19 +48,79 @@
4548

4649
#define STMP3XXX_RTC_ALARM 0x40
4750

51+
#define STMP3XXX_RTC_WATCHDOG 0x50
52+
4853
#define STMP3XXX_RTC_PERSISTENT0 0x60
4954
#define STMP3XXX_RTC_PERSISTENT0_SET 0x64
5055
#define STMP3XXX_RTC_PERSISTENT0_CLR 0x68
5156
#define STMP3XXX_RTC_PERSISTENT0_ALARM_WAKE_EN 0x00000002
5257
#define STMP3XXX_RTC_PERSISTENT0_ALARM_EN 0x00000004
5358
#define STMP3XXX_RTC_PERSISTENT0_ALARM_WAKE 0x00000080
5459

60+
#define STMP3XXX_RTC_PERSISTENT1 0x70
61+
/* missing bitmask in headers */
62+
#define STMP3XXX_RTC_PERSISTENT1_FORCE_UPDATER 0x80000000
63+
5564
struct stmp3xxx_rtc_data {
5665
struct rtc_device *rtc;
5766
void __iomem *io;
5867
int irq_alarm;
5968
};
6069

70+
#if IS_ENABLED(CONFIG_STMP3XXX_RTC_WATCHDOG)
71+
/**
72+
* stmp3xxx_wdt_set_timeout - configure the watchdog inside the STMP3xxx RTC
73+
* @dev: the parent device of the watchdog (= the RTC)
74+
* @timeout: the desired value for the timeout register of the watchdog.
75+
* 0 disables the watchdog
76+
*
77+
* The watchdog needs one register and two bits which are in the RTC domain.
78+
* To handle the resource conflict, the RTC driver will create another
79+
* platform_device for the watchdog driver as a child of the RTC device.
80+
* The watchdog driver is passed the below accessor function via platform_data
81+
* to configure the watchdog. Locking is not needed because accessing SET/CLR
82+
* registers is atomic.
83+
*/
84+
85+
static void stmp3xxx_wdt_set_timeout(struct device *dev, u32 timeout)
86+
{
87+
struct stmp3xxx_rtc_data *rtc_data = dev_get_drvdata(dev);
88+
89+
if (timeout) {
90+
writel(timeout, rtc_data->io + STMP3XXX_RTC_WATCHDOG);
91+
writel(STMP3XXX_RTC_CTRL_WATCHDOGEN,
92+
rtc_data->io + STMP3XXX_RTC_CTRL + STMP_OFFSET_REG_SET);
93+
writel(STMP3XXX_RTC_PERSISTENT1_FORCE_UPDATER,
94+
rtc_data->io + STMP3XXX_RTC_PERSISTENT1 + STMP_OFFSET_REG_SET);
95+
} else {
96+
writel(STMP3XXX_RTC_CTRL_WATCHDOGEN,
97+
rtc_data->io + STMP3XXX_RTC_CTRL + STMP_OFFSET_REG_CLR);
98+
writel(STMP3XXX_RTC_PERSISTENT1_FORCE_UPDATER,
99+
rtc_data->io + STMP3XXX_RTC_PERSISTENT1 + STMP_OFFSET_REG_CLR);
100+
}
101+
}
102+
103+
static struct stmp3xxx_wdt_pdata wdt_pdata = {
104+
.wdt_set_timeout = stmp3xxx_wdt_set_timeout,
105+
};
106+
107+
static void stmp3xxx_wdt_register(struct platform_device *rtc_pdev)
108+
{
109+
struct platform_device *wdt_pdev =
110+
platform_device_alloc("stmp3xxx_rtc_wdt", rtc_pdev->id);
111+
112+
if (wdt_pdev) {
113+
wdt_pdev->dev.parent = &rtc_pdev->dev;
114+
wdt_pdev->dev.platform_data = &wdt_pdata;
115+
platform_device_add(wdt_pdev);
116+
}
117+
}
118+
#else
119+
static void stmp3xxx_wdt_register(struct platform_device *rtc_pdev)
120+
{
121+
}
122+
#endif /* CONFIG_STMP3XXX_RTC_WATCHDOG */
123+
61124
static void stmp3xxx_wait_time(struct stmp3xxx_rtc_data *rtc_data)
62125
{
63126
/*
@@ -233,6 +296,7 @@ static int stmp3xxx_rtc_probe(struct platform_device *pdev)
233296
goto out_irq_alarm;
234297
}
235298

299+
stmp3xxx_wdt_register(pdev);
236300
return 0;
237301

238302
out_irq_alarm:

‎drivers/watchdog/Kconfig‎

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ config DA9052_WATCHDOG
7979
config DA9055_WATCHDOG
8080
tristate "Dialog Semiconductor DA9055 Watchdog"
8181
depends on MFD_DA9055
82+
select WATCHDOG_CORE
8283
help
8384
If you say yes here you get support for watchdog on the Dialog
8485
Semiconductor DA9055 PMIC.
@@ -108,22 +109,23 @@ config WM8350_WATCHDOG
108109

109110
config ARM_SP805_WATCHDOG
110111
tristate "ARM SP805 Watchdog"
111-
depends on ARM_AMBA
112+
depends on ARM && ARM_AMBA
112113
select WATCHDOG_CORE
113114
help
114115
ARM Primecell SP805 Watchdog timer. This will reboot your system when
115116
the timeout is reached.
116117

117118
config AT91RM9200_WATCHDOG
118119
tristate "AT91RM9200 watchdog"
119-
depends on ARCH_AT91RM9200
120+
depends on ARCH_AT91
120121
help
121122
Watchdog timer embedded into AT91RM9200 chips. This will reboot your
122123
system when the timeout is reached.
123124

124125
config AT91SAM9X_WATCHDOG
125126
tristate "AT91SAM9X / AT91CAP9 watchdog"
126127
depends on ARCH_AT91 && !ARCH_AT91RM9200
128+
select WATCHDOG_CORE
127129
help
128130
Watchdog timer embedded into AT91SAM9X and AT91CAP9 chips. This will
129131
reboot your system when the timeout is reached.
@@ -316,14 +318,15 @@ config TWL4030_WATCHDOG
316318
Support for TI TWL4030 watchdog. Say 'Y' here to enable the
317319
watchdog timer support for TWL4030 chips.
318320

319-
config STMP3XXX_WATCHDOG
320-
tristate "Freescale STMP3XXX watchdog"
321-
depends on ARCH_STMP3XXX
321+
config STMP3XXX_RTC_WATCHDOG
322+
tristate "Freescale STMP3XXX & i.MX23/28 watchdog"
323+
depends on RTC_DRV_STMP
324+
select WATCHDOG_CORE
322325
help
323-
Say Y here if to include support for the watchdog timer
324-
for the Sigmatel STMP37XX/378X SoC.
326+
Say Y here to include support for the watchdog timer inside
327+
the RTC for the STMP37XX/378X or i.MX23/28 SoC.
325328
To compile this driver as a module, choose M here: the
326-
module will be called stmp3xxx_wdt.
329+
module will be called stmp3xxx_rtc_wdt.
327330

328331
config NUC900_WATCHDOG
329332
tristate "Nuvoton NUC900 watchdog"
@@ -376,6 +379,18 @@ config UX500_WATCHDOG
376379
To compile this driver as a module, choose M here: the
377380
module will be called ux500_wdt.
378381

382+
config RETU_WATCHDOG
383+
tristate "Retu watchdog"
384+
depends on MFD_RETU
385+
select WATCHDOG_CORE
386+
help
387+
Retu watchdog driver for Nokia Internet Tablets (770, N800,
388+
N810). At least on N800 the watchdog cannot be disabled, so
389+
this driver is essential and you should enable it.
390+
391+
To compile this driver as a module, choose M here: the
392+
module will be called retu_wdt.
393+
379394
# AVR32 Architecture
380395

381396
config AT32AP700X_WDT
@@ -593,7 +608,7 @@ config IE6XX_WDT
593608

594609
config INTEL_SCU_WATCHDOG
595610
bool "Intel SCU Watchdog for Mobile Platforms"
596-
depends on X86_MRST
611+
depends on X86_INTEL_MID
597612
---help---
598613
Hardware driver for the watchdog time built into the Intel SCU
599614
for Intel Mobile Platforms.
@@ -983,6 +998,7 @@ config ATH79_WDT
983998
config BCM47XX_WDT
984999
tristate "Broadcom BCM47xx Watchdog Timer"
9851000
depends on BCM47XX
1001+
select WATCHDOG_CORE
9861002
help
9871003
Hardware driver for the Broadcom BCM47xx Watchdog Timer.
9881004

@@ -1131,6 +1147,7 @@ config PIKA_WDT
11311147
config BOOKE_WDT
11321148
tristate "PowerPC Book-E Watchdog Timer"
11331149
depends on BOOKE || 4xx
1150+
select WATCHDOG_CORE
11341151
---help---
11351152
Watchdog driver for PowerPC Book-E chips, such as the Freescale
11361153
MPC85xx SOCs and the IBM PowerPC 440.

0 commit comments

Comments
 (0)