Skip to contentSkip to conversation

MIPS: lantiq: add watchdog support

PATCH Superseded John Crispin 2 participants 2 messages Apr 26, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 MIPS: lantiq: add watchdog support

This patch adds the driver for the watchdog found inside the Lantiq SoC family.

---

Changes in V2
* add comments to explain register access
* cleanup resource allocation
* cleanup clock handling
* whitespace fixes

Changes in V3
* whitespace
* change __iomem void to void __iomem
* typo fixes
* comment style
* fix exit path in init function

Changes in V4
* fixes register offsets (we use a smaller memory window)
* typo in the comments
* add __init to probe function

Changes in V6
* add support for WDIOC_GETBOOTSTATUS and WDIOC_GETSTATUS
* remove ifdefs and add a module parameter for the nowayout feature
* add a remove function
* fix typos

This patch should go via the MIPS tree.

 drivers/watchdog/Kconfig      |    6 +
 drivers/watchdog/Makefile     |    1 +
 drivers/watchdog/lantiq_wdt.c |  262 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 269 insertions(+), 0 deletions(-)
 create mode 100644 drivers/watchdog/lantiq_wdt.c
drivers/watchdog/Kconfig +6 -0
index 1b0f98b..022f9eb 100644
@@ -990,6 +990,12 @@ config BCM63XX_WDT
 	  To compile this driver as a loadable module, choose M here.
 	  The module will be called bcm63xx_wdt.
 
+config LANTIQ_WDT
+	tristate "Lantiq SoC watchdog"
+	depends on LANTIQ
+	help
+	  Hardware driver for the Lantiq SoC Watchdog Timer.
+
 # PARISC Architecture
 
 # POWERPC Architecture
drivers/watchdog/Makefile +1 -0
index 3f8608b..ed26f70 100644
@@ -123,6 +123,7 @@ obj-$(CONFIG_AR7_WDT) += ar7_wdt.o
 obj-$(CONFIG_TXX9_WDT) += txx9wdt.o
 obj-$(CONFIG_OCTEON_WDT) += octeon-wdt.o
 octeon-wdt-y := octeon-wdt-main.o octeon-wdt-nmi.o
+obj-$(CONFIG_LANTIQ_WDT) += lantiq_wdt.o
 
 # PARISC Architecture
 
drivers/watchdog/lantiq_wdt.c new file +262 -0

262 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#1 lore raw

Hi John,

drivers/watchdog/lantiq_wdt.c line 156

Quoted 10 lines
drivers/watchdog/lantiq_wdt.c new file +10 -0
+static int
+ltq_wdt_open(struct inode *inode, struct file *file)
+{
+	if (ltq_wdt_in_use)
+		return -EBUSY;
+	ltq_wdt_in_use = 1;
+	ltq_wdt_enable();
+
+	return nonseekable_open(inode, file);
+}

I prefer to see a test_and_set_bit(ltq_wdt_in_use) and a ...

drivers/watchdog/lantiq_wdt.c line 169

Quoted 12 lines
drivers/watchdog/lantiq_wdt.c new file +12 -0
+static int
+ltq_wdt_release(struct inode *inode, struct file *file)
+{
+	if (ltq_wdt_ok_to_close)
+		ltq_wdt_disable();
+	else
+		pr_err("ltq_wdt: watchdog closed without warning\n");
+	ltq_wdt_ok_to_close = 0;
+	ltq_wdt_in_use = 0;
+
+	return 0;
+}

... clear_bit(ltq_wdt_in_use);

For the rest is looks ok for me. So Signed-off-by: Wim Van Sebroeck <[email protected]>

Kind regards,
Wim.