Skip to contentSkip to conversation

watchdog: loongson1: Add Loongson1 SoC watchdog driver

PATCH In review Yang Ling 2 participants 2 messages Dec 4, 2016

Subsystems (3)
lore
Share & tools
lore

Yang Ling

author
#0 lore raw

PATCH 2/3 watchdog: loongson1: Add Loongson1 SoC watchdog driver

Add watchdog timer specific driver for Loongson1 SoC.

---
V2.3:
Set DEFAULT_HEARTBEAT value to ls1x_wdt->timeout.
V2.2:
Remove the wide character.
Check the return value for clk_get_rate().
V2.1 from Kelvin Cheung:
Use max_hw_heartbeat_ms instead of max_timeout.
V2.0:
Increase the value of the default heartbeat. Modify the setup process for register. Order include files and Makefile alphabetically.
V1.1:
Add a little debugging information.

---
 drivers/watchdog/Kconfig         |   7 ++
 drivers/watchdog/Makefile        |   1 +
 drivers/watchdog/loongson1_wdt.c | 170 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 178 insertions(+)
 create mode 100644 drivers/watchdog/loongson1_wdt.c
drivers/watchdog/Kconfig +7 -0
index fdd3228..c5b9c6e 100644
@@ -1513,6 +1513,13 @@ config LANTIQ_WDT
 	help
 	  Hardware driver for the Lantiq SoC Watchdog Timer.
 
+config LOONGSON1_WDT
+	tristate "Loongson1 SoC hardware watchdog"
+	depends on MACH_LOONGSON32
+	select WATCHDOG_CORE
+	help
+	  Hardware driver for the Loongson1 SoC Watchdog Timer.
+
 config RALINK_WDT
 	tristate "Ralink SoC watchdog"
 	select WATCHDOG_CORE
drivers/watchdog/Makefile +1 -0
index caa9f4a..0c3d35e 100644
@@ -163,6 +163,7 @@ 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
+obj-$(CONFIG_LOONGSON1_WDT) += loongson1_wdt.o
 obj-$(CONFIG_RALINK_WDT) += rt2880_wdt.o
 obj-$(CONFIG_IMGPDC_WDT) += imgpdc_wdt.o
 obj-$(CONFIG_MT7621_WDT) += mt7621_wdt.o
drivers/watchdog/loongson1_wdt.c new file +170 -0

170 lines not on this page · raw message

Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 72 lines · Yang Ling

Add watchdog timer specific driver for Loongson1 SoC.

---
V2.3:
Set DEFAULT_HEARTBEAT value to ls1x_wdt->timeout.
V2.2:
Remove the wide character.
Check the return value for clk_get_rate().
V2.1 from Kelvin Cheung:
Use max_hw_heartbeat_ms instead of max_timeout.
V2.0:
Increase the value of the default heartbeat. Modify the setup process for register. Order include files and Makefile alphabetically.
V1.1:
Add a little debugging information.

---
 drivers/watchdog/Kconfig         |   7 ++
 drivers/watchdog/Makefile        |   1 +
 drivers/watchdog/loongson1_wdt.c | 170 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 178 insertions(+)
 create mode 100644 drivers/watchdog/loongson1_wdt.c
drivers/watchdog/Kconfig +7 -0
index fdd3228..c5b9c6e 100644
@@ -1513,6 +1513,13 @@ config LANTIQ_WDT
 	help
 	  Hardware driver for the Lantiq SoC Watchdog Timer.
 
+config LOONGSON1_WDT
+	tristate "Loongson1 SoC hardware watchdog"
+	depends on MACH_LOONGSON32
+	select WATCHDOG_CORE
+	help
+	  Hardware driver for the Loongson1 SoC Watchdog Timer.
+
 config RALINK_WDT
 	tristate "Ralink SoC watchdog"
 	select WATCHDOG_CORE
drivers/watchdog/Makefile +1 -0
index caa9f4a..0c3d35e 100644
@@ -163,6 +163,7 @@ 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
+obj-$(CONFIG_LOONGSON1_WDT) += loongson1_wdt.o
 obj-$(CONFIG_RALINK_WDT) += rt2880_wdt.o
 obj-$(CONFIG_IMGPDC_WDT) += imgpdc_wdt.o
 obj-$(CONFIG_MT7621_WDT) += mt7621_wdt.o
drivers/watchdog/loongson1_wdt.c new file +11 -0
new file mode 100644
index 0000000..c43ad38
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2016 Yang Ling <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/clk.h>
+#include <linux/module.h>

drivers/watchdog/loongson1_wdt.c line 21

Quoted 10 lines
drivers/watchdog/loongson1_wdt.c new file +10 -0
+#include <linux/platform_device.h>
+#include <linux/watchdog.h>
+#include <loongson1.h>
+
+#define DEFAULT_HEARTBEAT	30
+
+static bool nowayout = WATCHDOG_NOWAYOUT;
+module_param(nowayout, bool, 0444);
+
+static unsigned int heartbeat = DEFAULT_HEARTBEAT;

heartbeat should be 0.

Guenter