Skip to contentSkip to conversation

Add watchdog for Mstar SoCs

PATCH Superseded Romain Perier 2 participants 6 messages May 30, 2021 – Jun 5, 2021

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Romain Perier

author maintainer
#0 lore raw

v2 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 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):
Documentation: watchdog: Add Mstar MSC313e WDT devicetree bindings
documentation
ARM: dts: mstar: Add watchdog device_node definition

 .../bindings/watchdog/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/msc313e-wdt.yaml
 create mode 100644 drivers/watchdog/msc313e_wdt.c
Signature · 1 line
2.30.2
author maintainer
#1 lore raw

PATCH v2 1/3 Documentation: 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/msc313e-wdt.yaml        | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/watchdog/msc313e-wdt.yaml
Documentation/devicetree/bindings/watchdog/msc313e-wdt.yaml new file +40 -0
new file mode 100644
index 000000000000..70b8e1be5e8e
@@ -0,0 +1,40 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/watchdog/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: watchdog@6000 {
+        compatible = "mstar,msc313e-wdt";
+        reg = <0x6000 0x1f>;
+        clocks = <&xtal_div2>;
+    };
Signature · 1 line
2.30.2
maintainer
#2 lore raw

Re: [PATCH v2 1/3] Documentation: watchdog: Add Mstar MSC313e WDT devicetree bindings documentation

Quoted 2 lines · Romain Perier

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

'dt-bindings: watchdog: ...' for the subject.

Quoted 4 lines
---
 .../bindings/watchdog/msc313e-wdt.yaml        | 40 +++++++++++++++++++

mstar,msc313e-wdt.yaml

Quoted 35 lines
 1 file changed, 40 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/watchdog/msc313e-wdt.yaml
Documentation/devicetree/bindings/watchdog/msc313e-wdt.yaml new file +26 -0
new file mode 100644
index 000000000000..70b8e1be5e8e
@@ -0,0 +1,40 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/watchdog/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
+

Documentation/devicetree/bindings/watchdog/msc313e-wdt.yaml line 36

Quoted 10 lines
Documentation/devicetree/bindings/watchdog/msc313e-wdt.yaml new file +10 -0
+required:
+  - compatible
+  - clocks
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    watchdog: watchdog@6000 {

Drop unused labels.

Quoted 6 lines
Documentation/devicetree/bindings/watchdog/msc313e-wdt.yaml new file +4 -0
+        compatible = "mstar,msc313e-wdt";
+        reg = <0x6000 0x1f>;
+        clocks = <&xtal_div2>;
+    };
Signature · 1 line
2.30.2
author maintainer
#3 lore raw

Re: [PATCH v2 1/3] Documentation: watchdog: Add Mstar MSC313e WDT devicetree bindings documentation

Quoted 53 lines · Rob Herring
Quoted 2 lines · Romain Perier

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

'dt-bindings: watchdog: ...' for the subject.

Quoted 4 lines
---
 .../bindings/watchdog/msc313e-wdt.yaml        | 40 +++++++++++++++++++

mstar,msc313e-wdt.yaml

Quoted 39 lines
 1 file changed, 40 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/watchdog/msc313e-wdt.yaml
Documentation/devicetree/bindings/watchdog/msc313e-wdt.yaml new file +30 -0
new file mode 100644
index 000000000000..70b8e1be5e8e
@@ -0,0 +1,40 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/watchdog/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
Quoted 15 lines

Documentation/devicetree/bindings/watchdog/msc313e-wdt.yaml line 36

Quoted 6 lines
Documentation/devicetree/bindings/watchdog/msc313e-wdt.yaml new file +6 -0
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    watchdog: watchdog@6000 {

Drop unused labels.

Quoted 6 lines
Documentation/devicetree/bindings/watchdog/msc313e-wdt.yaml new file +4 -1
+        compatible = "mstar,msc313e-wdt";
+        reg = <0x6000 0x1f>;
+        clocks = <&xtal_div2>;
+    };
--

2.30.2

Hi,

Ok I will send a v3

Regards,
Romain

author maintainer
#4 lore raw

PATCH v2 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 a0f37adb9e64..fcc10c57298c 100644
@@ -2177,6 +2177,7 @@ F:	arch/arm/mach-mstar/
 F:	drivers/clk/mstar/
 F:	drivers/gpio/gpio-msc313.c
 F:	drivers/pinctrl/pinctrl-msc313.c
+F:	drivers/watchdog/msc313e_wdt.c
 F:	include/dt-bindings/clock/mstar-*
 F:	include/dt-bindings/gpio/msc313-gpio.h
 F:	include/soc/mstar/
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
#5 lore raw

PATCH v2 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 3d5d8c634de3..23dff8fe4731 100644
@@ -62,6 +62,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 {
@@ -119,6 +127,12 @@ pm_irin_pins: pm_irin {
 				};
 			};
 
+			watchdog: 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