Skip to contentSkip to conversation

ARM: mediatek: Add watchdog driver

PATCH Superseded Matthias Brugger 4 participants 6 messages Jan 12, 2015 – Jan 13, 2015

Subsystems (3)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Matthias Brugger

author maintainer
#0 lore raw

v4 cover ARM: mediatek: Add watchdog driver

Mediatek SoCs have a watchdog driver. This patch set adds driver and DTS binding. The driver also implements a restart handler to reboot the SoC.

Changes for v4:
- fix indentation errors
- delete unused include
- reorganize while loop to eliminate code duplication
- eliminate indirection to watchdog_device structure
- delete unnecessary brackets

Changes for v3:
- fix based on file name
- fix style problems
- fix error return value and warning message
- delete unnecessary watchdog_set_drvdata
- delete unused variable

Changes for v2:
- we don't need to have the watchdog enabled to do a software reset
- disable dual mode and irq mode when starting the watchdog
- update commit message to name the SoCs the driver supports

Matthias Brugger (2):
watchdog: Add driver for Mediatek watchdog
ARM: mediatek: dts: Add bindings for watchdog

 .../devicetree/bindings/watchdog/mtk-wdt.txt       |  13 ++
 drivers/watchdog/Kconfig                           |  10 +
 drivers/watchdog/Makefile                          |   1 +
 drivers/watchdog/mtk_wdt.c                         | 252 +++++++++++++++++++++
 4 files changed, 276 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/watchdog/mtk-wdt.txt
 create mode 100644 drivers/watchdog/mtk_wdt.c
Signature · 1 line
1.9.1
author maintainer
#1 lore raw

PATCH v4 1/2 watchdog: Add driver for Mediatek watchdog

This patch adds a driver for the Mediatek SoC integrated watchdog. This driver supports watchdog and software reset for mt65xx and mt81xx SoCs.

---
 drivers/watchdog/Kconfig   |  10 ++
 drivers/watchdog/Makefile  |   1 +
 drivers/watchdog/mtk_wdt.c | 252 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 263 insertions(+)
 create mode 100644 drivers/watchdog/mtk_wdt.c
drivers/watchdog/Kconfig +10 -0
index 08f41ad..9957a34 100644
@@ -505,6 +505,16 @@ config MESON_WATCHDOG
 	  To compile this driver as a module, choose M here: the
 	  module will be called meson_wdt.
 
+config MEDIATEK_WATCHDOG
+	tristate "Mediatek SoCs watchdog support"
+	depends on ARCH_MEDIATEK
+	select WATCHDOG_CORE
+	help
+	  Say Y here to include support for the watchdog timer
+	  in Mediatek SoCs.
+	  To compile this driver as a module, choose M here: the
+	  module will be called mtk_wdt.
+
 # AVR32 Architecture
 
 config AT32AP700X_WDT
drivers/watchdog/Makefile +1 -0
index c569ec8..0d4821f 100644
@@ -63,6 +63,7 @@ obj-$(CONFIG_QCOM_WDT) += qcom-wdt.o
 obj-$(CONFIG_BCM_KONA_WDT) += bcm_kona_wdt.o
 obj-$(CONFIG_TEGRA_WATCHDOG) += tegra_wdt.o
 obj-$(CONFIG_MESON_WATCHDOG) += meson_wdt.o
+obj-$(CONFIG_MEDIATEK_WATCHDOG) += mtk_wdt.o
 
 # AVR32 Architecture
 obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o
drivers/watchdog/mtk_wdt.c new file +252 -0

252 lines not on this page · raw message

Signature · 1 line
1.9.1
#2 lore raw

Re: [PATCH v4 1/2] watchdog: Add driver for Mediatek watchdog

Quoted 3 lines · Matthias Brugger

This patch adds a driver for the Mediatek SoC integrated watchdog. This driver supports watchdog and software reset for mt65xx and mt81xx SoCs.

trivia:

drivers/watchdog/mtk_wdt.c

Quoted 1 line
drivers/watchdog/mtk_wdt.c +0 -0

[]

drivers/watchdog/mtk_wdt.c

Quoted 2 lines
drivers/watchdog/mtk_wdt.c +2 -0
+static int mtk_wdt_probe(struct platform_device *pdev)
+{

[]

drivers/watchdog/mtk_wdt.c line 207

Quoted 1 line
drivers/watchdog/mtk_wdt.c +1 -0
+	dev_info(&pdev->dev, "Watchdog enabled (timeout=%d sec, nowayout=%d)",

missing terminating \n newline

maintainer Reviewed-by on v4 1/2
#3 lore raw

Re: [PATCH v4 1/2] watchdog: Add driver for Mediatek watchdog

In reply to Matthias Brugger
Quoted 5 lines · Matthias Brugger

This patch adds a driver for the Mediatek SoC integrated watchdog. This driver supports watchdog and software reset for mt65xx and mt81xx SoCs.

Assuming you fix the missing newline, as pointed out by Joe:

author maintainer
#4 lore raw

PATCH v4 2/2 ARM: mediatek: dts: Add bindings for watchdog

In reply to Matthias Brugger
---
 Documentation/devicetree/bindings/watchdog/mtk-wdt.txt | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/watchdog/mtk-wdt.txt
Documentation/devicetree/bindings/watchdog/mtk-wdt.txt new file +13 -0
new file mode 100644
index 0000000..af9eb5b
@@ -0,0 +1,13 @@
+Mediatek SoCs Watchdog timer
+
+Required properties:
+
+- compatible : should be "mediatek,mt6589-wdt"
+- reg : Specifies base physical address and size of the registers.
+
+Example:
+
+wdt: watchdog at 010000000 {
+	compatible = "mediatek,mt6589-wdt";
+	reg = <0x10000000 0x18>;
+};
Signature · 1 line
1.9.1
Tested-by on the v4 series
#5 lore raw
In reply to Matthias Brugger

Hi Matthias,

Quoted 26 lines · Matthias Brugger

Mediatek SoCs have a watchdog driver. This patch set adds driver and DTS binding. The driver also implements a restart handler to reboot the SoC.

Changes for v4:
- fix indentation errors
- delete unused include
- reorganize while loop to eliminate code duplication
- eliminate indirection to watchdog_device structure
- delete unnecessary brackets

Changes for v3:
- fix based on file name
- fix style problems
- fix error return value and warning message
- delete unnecessary watchdog_set_drvdata
- delete unused variable

Changes for v2:
- we don't need to have the watchdog enabled to do a software reset
- disable dual mode and irq mode when starting the watchdog
- update commit message to name the SoCs the driver supports

Matthias Brugger (2):
watchdog: Add driver for Mediatek watchdog
ARM: mediatek: dts: Add bindings for watchdog

Quoted 8 lines
 .../devicetree/bindings/watchdog/mtk-wdt.txt       |  13 ++
 drivers/watchdog/Kconfig                           |  10 +
 drivers/watchdog/Makefile                          |   1 +
 drivers/watchdog/mtk_wdt.c                         | 252 +++++++++++++++++++++
 4 files changed, 276 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/watchdog/mtk-wdt.txt
 create mode 100644 drivers/watchdog/mtk_wdt.c

Test OK on mt8173 platform.