Skip to contentSkip to conversation

Add watchdog for Mstar SoCs

PATCH In review Romain Perier 3 participants 6 messages Jun 11, 2021 – Jun 12, 2021

Subsystems (3)
lore
Share & tools
lore

Romain Perier

author maintainer
#0 lore raw

v4 cover Add watchdog for Mstar SoCs

This patches series adds a new driver for the watchdog found in the Mstar MSC313e SoCs and newer. It adds a basic watchdog driver, the corresponding devicetree bindings and its documentation.

This work has been co-developed with Daniel Palmer.

Changes since v3:
- Rebased onto v5.13-rc5
- Added Reviewed-by tags

Changes since v2:
- Renamed the dt-bindings documentation to mstar,msc313e-wdt.yaml
- Fixed the subject of the first commit
- Dropped unused dt labels

Changes since v1:
- Dropped "depends OF" from Kconfig (not required)
- Dropped unneeded include files
- Re-ordered include files
- Compute timeout_max dynamically from the probe function to avoid an overflow in _start().

Daniel Palmer (1):
watchdog: Add Mstar MSC313e WDT driver

Romain Perier (2):
dt-bindings: watchdog: Add Mstar MSC313e WDT devicetree bindings
documentation
ARM: dts: mstar: Add watchdog device_node definition

 .../bindings/watchdog/mstar,msc313e-wdt.yaml  |  40 +++++
 MAINTAINERS                                   |   1 +
 arch/arm/boot/dts/mstar-v7.dtsi               |  14 ++
 drivers/watchdog/Kconfig                      |  12 ++
 drivers/watchdog/Makefile                     |   1 +
 drivers/watchdog/msc313e_wdt.c                | 166 ++++++++++++++++++
 6 files changed, 234 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/watchdog/mstar,msc313e-wdt.yaml
 create mode 100644 drivers/watchdog/msc313e_wdt.c
Signature · 1 line
2.30.2
author maintainer
#1 lore raw

PATCH v4 1/3 dt-bindings: watchdog: Add Mstar MSC313e WDT devicetree bindings documentation

This adds the documentation for the devicetree bindings of the Mstar MSC313e watchdog driver, found from MSC313e SoCs and newer.

---
 .../bindings/watchdog/mstar,msc313e-wdt.yaml  | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/watchdog/mstar,msc313e-wdt.yaml
Documentation/devicetree/bindings/watchdog/mstar,msc313e-wdt.yaml new file +40 -0
new file mode 100644
index 000000000000..e3e8b86dbf63
@@ -0,0 +1,40 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/watchdog/mstar,msc313e-wdt.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MStar Watchdog Device Tree Bindings
+
+maintainers:
+  - Daniel Palmer <[email protected]>
+  - Romain Perier <[email protected]>
+
+allOf:
+  - $ref: watchdog.yaml#
+
+properties:
+  compatible:
+    enum:
+      - mstar,msc313e-wdt
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+required:
+  - compatible
+  - clocks
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    watchdog@6000 {
+        compatible = "mstar,msc313e-wdt";
+        reg = <0x6000 0x1f>;
+        clocks = <&xtal_div2>;
+    };
Signature · 1 line
2.30.2
author maintainer
#2 lore raw

PATCH v4 2/3 watchdog: Add Mstar MSC313e WDT driver

In reply to Romain Perier

From: Daniel Palmer <[email protected]>

It adds a driver for the IP block handling the watchdog timer found for Mstar MSC313e SoCs and newer.

---
 MAINTAINERS                    |   1 +
 drivers/watchdog/Kconfig       |  12 +++
 drivers/watchdog/Makefile      |   1 +
 drivers/watchdog/msc313e_wdt.c | 166 +++++++++++++++++++++++++++++++++
 4 files changed, 180 insertions(+)
 create mode 100644 drivers/watchdog/msc313e_wdt.c
MAINTAINERS +1 -0
index b706dd20ff2b..50e9573494d2 100644
@@ -2175,6 +2175,7 @@ F:	arch/arm/boot/dts/mstar-*
 F:	arch/arm/mach-mstar/
 F:	drivers/clk/mstar/
 F:	drivers/gpio/gpio-msc313.c
+F:	drivers/watchdog/msc313e_wdt.c
 F:	include/dt-bindings/clock/mstar-*
 F:	include/dt-bindings/gpio/msc313-gpio.h
 
drivers/watchdog/Kconfig +12 -0
index 355100dad60a..4af84df1ce22 100644
@@ -980,6 +980,18 @@ config VISCONTI_WATCHDOG
 	  Say Y here to include support for the watchdog timer in Toshiba
 	  Visconti SoCs.
 
+config MSC313E_WATCHDOG
+	tristate "MStar MSC313e watchdog"
+	depends on ARCH_MSTARV7 || COMPILE_TEST
+	select WATCHDOG_CORE
+	help
+	  Say Y here to include support for the Watchdog timer embedded
+	  into MStar MSC313e chips. This will reboot your system when the
+	  timeout is reached.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called msc313e_wdt.
+
 # X86 (i386 + ia64 + x86_64) Architecture
 
 config ACQUIRE_WDT
drivers/watchdog/Makefile +1 -0
index a7eade8b4d45..7fa392ae3000 100644
@@ -92,6 +92,7 @@ obj-$(CONFIG_SPRD_WATCHDOG) += sprd_wdt.o
 obj-$(CONFIG_PM8916_WATCHDOG) += pm8916_wdt.o
 obj-$(CONFIG_ARM_SMC_WATCHDOG) += arm_smc_wdt.o
 obj-$(CONFIG_VISCONTI_WATCHDOG) += visconti_wdt.o
+obj-$(CONFIG_MSC313E_WATCHDOG) += msc313e_wdt.o
 
 # X86 (i386 + ia64 + x86_64) Architecture
 obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o
drivers/watchdog/msc313e_wdt.c new file +166 -0

166 lines not on this page · raw message

Signature · 1 line
2.30.2
author maintainer
#3 lore raw

PATCH v4 3/3 ARM: dts: mstar: Add watchdog device_node definition

In reply to Romain Perier

This adds the definition of both an oscillator at 12Mhz required by the the watchdog and the watchdog device_node.

---
 arch/arm/boot/dts/mstar-v7.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm/boot/dts/mstar-v7.dtsi +14 -0
index 075d583d6f40..2273295e140f 100644
@@ -60,6 +60,14 @@ rtc_xtal: rtc_xtal {
 			clock-frequency = <32768>;
 			status = "disabled";
 		};
+
+		xtal_div2: xtal_div2 {
+			#clock-cells = <0>;
+			compatible = "fixed-factor-clock";
+			clocks = <&xtal>;
+			clock-div = <2>;
+			clock-mult = <1>;
+		};
 	};
 
 	soc: soc {
@@ -101,6 +109,12 @@ reboot {
 				mask = <0x79>;
 			};
 
+			watchdog@6000 {
+				compatible = "mstar,msc313e-wdt";
+				reg = <0x6000 0x1f>;
+				clocks = <&xtal_div2>;
+			};
+
 			intc_fiq: interrupt-controller@201310 {
 				compatible = "mstar,mst-intc";
 				reg = <0x201310 0x40>;
Signature · 1 line
2.30.2
maintainer
#4 lore raw
In reply to Romain Perier
Quoted 9 lines · Romain Perier

This patches series adds a new driver for the watchdog found in the Mstar MSC313e SoCs and newer. It adds a basic watchdog driver, the corresponding devicetree bindings and its documentation.

This work has been co-developed with Daniel Palmer.

Changes since v3:
- Rebased onto v5.13-rc5
- Added Reviewed-by tags

This works better. I applied patches 1 & 2 to my watchdog-next branch for hand-off to Wim. Note that the arm dts patch needs to be pushed through the arm tree.

Thanks,
Guenter

Quoted 34 lines

Changes since v2:
- Renamed the dt-bindings documentation to mstar,msc313e-wdt.yaml
- Fixed the subject of the first commit
- Dropped unused dt labels

Changes since v1:
- Dropped "depends OF" from Kconfig (not required)
- Dropped unneeded include files
- Re-ordered include files
- Compute timeout_max dynamically from the probe function to avoid an overflow in _start().

Daniel Palmer (1):
watchdog: Add Mstar MSC313e WDT driver

Romain Perier (2):
dt-bindings: watchdog: Add Mstar MSC313e WDT devicetree bindings
documentation
ARM: dts: mstar: Add watchdog device_node definition

 .../bindings/watchdog/mstar,msc313e-wdt.yaml  |  40 +++++
 MAINTAINERS                                   |   1 +
 arch/arm/boot/dts/mstar-v7.dtsi               |  14 ++
 drivers/watchdog/Kconfig                      |  12 ++
 drivers/watchdog/Makefile                     |   1 +
 drivers/watchdog/msc313e_wdt.c                | 166 ++++++++++++++++++
 6 files changed, 234 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/watchdog/mstar,msc313e-wdt.yaml
 create mode 100644 drivers/watchdog/msc313e_wdt.c
Signature · 1 line
2.30.2
#5 lore raw

Hi Guenter, Romain,

Quoted 3 lines · Guenter Roeck

This works better. I applied patches 1 & 2 to my watchdog-next branch for hand-off to Wim. Note that the arm dts patch needs to be pushed through the arm tree.

I will take the dts patch and send a PR with it to the arm tree.

Cheers,

Daniel