Skip to contentSkip to conversation

watchdog: Add watchdog timer support for the WinSystems EBC-C384

PATCH RESEND Superseded William Breathitt Gray 2 participants 2 messages Feb 29, 2016

Subsystems (2)

v7 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH RESEND v7 1/1 watchdog: Add watchdog timer support for the WinSystems EBC-C384

The WinSystems EBC-C384 has an onboard watchdog timer. The timeout range supported by the watchdog timer is 1 second to 255 minutes. Timeouts under 256 seconds have a 1 second granularity, while the rest have a 1 minute granularity.

This driver adds watchdog timer support for this onboard watchdog timer. The timeout may be configured via the timeout module parameter.

---
 MAINTAINERS                     |   6 ++
 drivers/watchdog/Kconfig        |   9 ++
 drivers/watchdog/Makefile       |   1 +
 drivers/watchdog/ebc-c384_wdt.c | 188 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 204 insertions(+)
 create mode 100644 drivers/watchdog/ebc-c384_wdt.c
MAINTAINERS +6 -0
index 28eb61b..66107fd 100644
@@ -11860,6 +11860,12 @@ M:	David Härdeman <[email protected]>
 S:	Maintained
 F:	drivers/media/rc/winbond-cir.c
 
+WINSYSTEMS EBC-C384 WATCHDOG DRIVER
+M:	William Breathitt Gray <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/watchdog/ebc-c384_wdt.c
+
 WIMAX STACK
 M:	Inaky Perez-Gonzalez <[email protected]>
 M:	[email protected]
drivers/watchdog/Kconfig +9 -0
index 0f6d851..11f3a3d 100644
@@ -713,6 +713,15 @@ config ALIM7101_WDT
 
 	  Most people will say N.
 
+config EBC_C384_WDT
+	tristate "WinSystems EBC-C384 Watchdog Timer"
+	depends on X86
+	select WATCHDOG_CORE
+	help
+	  Enables watchdog timer support for the watchdog timer on the
+	  WinSystems EBC-C384 motherboard. The timeout may be configured via
+	  the timeout module parameter.
+
 config F71808E_WDT
 	tristate "Fintek F71808E, F71862FG, F71869, F71882FG and F71889FG Watchdog"
 	depends on X86
drivers/watchdog/Makefile +1 -0
index f566753..15762c8 100644
@@ -88,6 +88,7 @@ obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o
 obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o
 obj-$(CONFIG_ALIM1535_WDT) += alim1535_wdt.o
 obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o
+obj-$(CONFIG_EBC_C384_WDT) += ebc-c384_wdt.o
 obj-$(CONFIG_F71808E_WDT) += f71808e_wdt.o
 obj-$(CONFIG_SP5100_TCO) += sp5100_tco.o
 obj-$(CONFIG_GEODE_WDT) += geodewdt.o
drivers/watchdog/ebc-c384_wdt.c new file +188 -0

188 lines not on this page · raw message

Signature · 1 line
2.4.10
maintainer
#1 lore raw

Hi William,

Quoted 16 lines · William Breathitt Gray

The WinSystems EBC-C384 has an onboard watchdog timer. The timeout range supported by the watchdog timer is 1 second to 255 minutes. Timeouts under 256 seconds have a 1 second granularity, while the rest have a 1 minute granularity.

This driver adds watchdog timer support for this onboard watchdog timer. The timeout may be configured via the timeout module parameter.

---
 MAINTAINERS                     |   6 ++
 drivers/watchdog/Kconfig        |   9 ++
 drivers/watchdog/Makefile       |   1 +
 drivers/watchdog/ebc-c384_wdt.c | 188 ++++++++++++++++++++++++++++++++++++++++

[ ... ]

drivers/watchdog/ebc-c384_wdt.c line 73

Quoted 7 lines
drivers/watchdog/ebc-c384_wdt.c new file +7 -0
+
+static int ebc_c384_wdt_set_timeout(struct watchdog_device *wdev, unsigned t)
+{
+	/* resolution is in minutes for timeouts greater than 255 seconds */
+	if (t > 255) {
+		/* round second resolution up to minute granularity */
+		wdev->timeout = DIV_ROUND_UP(t, 60) * 60;

Good catch.

Turns out there is a much better macro for this:

		wdev->timeout = roundup(t, 60);

Guenter