Skip to contentSkip to conversation

watchdog: histb: Add HiSilicon STB watchdog driver

PATCH In review David Yang 3 participants 7 messages Nov 24

Subsystems (3)
lore
Share & tools
lore

David Yang

author
#0 lore raw

v2 cover watchdog: histb: Add HiSilicon STB watchdog driver

The watchdog integrated on HiSilicon STB SoCs reuses the register layout of sp805, but deviates from the standard sp805 in several ways that make the existing sp805 driver unusable on these SoCs. Add a dedicated platform driver to handle these SoC-specific semantics natively without regressing generic SP805 users.

v2:
- fix issues reported by sashiko
v1: https://lore.kernel.org/r/[email protected]

David Yang (4):
dt-bindings: watchdog: hisilicon,histb-wdt: Add HiSilicon STB watchdog
watchdog: histb: Add HiSilicon STB watchdog driver
arm64: dts: hisilicon: hi3798cv200: Add watchdog node
MAINTAINERS: Add HiSilicon STB drivers entry

 .../watchdog/hisilicon,histb-wdt.yaml         |  56 ++++
 MAINTAINERS                                   |   8 +
 .../arm64/boot/dts/hisilicon/hi3798cv200.dtsi |   8 +
 drivers/watchdog/Kconfig                      |   8 +
 drivers/watchdog/Makefile                     |   1 +
 drivers/watchdog/histb_wdt.c                  | 305 ++++++++++++++++++
 6 files changed, 386 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/watchdog/hisilicon,histb-wdt.yaml
 create mode 100644 drivers/watchdog/histb_wdt.c
Signature · 1 line
2.53.0
author
#1 lore raw

PATCH v2 1/4 dt-bindings: watchdog: hisilicon,histb-wdt: Add HiSilicon STB watchdog

Add Device Tree binding schema for the watchdog controller found on HiSilicon STB SoCs.

---
 .../watchdog/hisilicon,histb-wdt.yaml         | 56 +++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/watchdog/hisilicon,histb-wdt.yaml
Documentation/devicetree/bindings/watchdog/hisilicon,histb-wdt.yaml new file +56 -0
new file mode 100644
index 000000000000..427225c9aa46
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/watchdog/hisilicon,histb-wdt.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: HiSilicon STB SoC Watchdog
+
+maintainers:
+  - David Yang <[email protected]>
+
+description:
+  HiSilicon STB SoCs (Hi3716, Hi3796, Hi3798, etc.) integrate a watchdog device,
+  which triggers an interrupt after a configurable time period. If that
+  interrupt has not been serviced when the next interrupt would be triggered,
+  the reset signal is asserted.
+
+allOf:
+  - $ref: watchdog.yaml#
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - hisilicon,hi3798cv200-wdt
+      - const: hisilicon,histb-wdt
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  clock-frequency:
+    description: Frequency of clock in Hz
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/histb-clock.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    watchdog@8a2c000 {
+        compatible = "hisilicon,hi3798cv200-wdt", "hisilicon,histb-wdt";
+        reg = <0x8a2c000 0x1000>;
+        interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&crg HISTB_OSC_CLK>;
+    };
Signature · 1 line
2.53.0
#2 lore raw

Re: [PATCH v2 1/4] dt-bindings: watchdog: hisilicon,histb-wdt: Add HiSilicon STB watchdog

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] dt-bindings: watchdog: non-canonical property order in hisilicon,histb-wdt --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] dt-bindings: watchdog: non-canonical property order in hisilicon,histb-wdt
--

commit cd75fa6a3636ea21f523ddd842b008cc17e1bb93
Author: David Yang <[email protected]>

dt-bindings: watchdog: hisilicon,histb-wdt: Add HiSilicon STB watchdog

This commit adds the Device Tree binding schema for the watchdog controller found on HiSilicon STB SoCs.

Quoted 5 lines
Documentation/devicetree/bindings/watchdog/hisilicon,histb-wdt.yaml new file +0 -0
new file mode 100644
index 0000000000000..427225c9aa46e

[ ... ]

Quoted 26 lines
Documentation/devicetree/bindings/watchdog/hisilicon,histb-wdt.yaml new file +26 -0
+properties:
+  compatible:
+    items:
+      - enum:
+          - hisilicon,hi3798cv200-wdt
+      - const: hisilicon,histb-wdt
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  clock-frequency:
+    description: Frequency of clock in Hz
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:

Documentation/devicetree/bindings/watchdog/hisilicon,histb-wdt.yaml line 56

Quoted 10 lines
Documentation/devicetree/bindings/watchdog/hisilicon,histb-wdt.yaml new file +10 -0
+  - |
+    #include <dt-bindings/clock/histb-clock.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    watchdog@8a2c000 {
+        compatible = "hisilicon,hi3798cv200-wdt", "hisilicon,histb-wdt";
+        reg = <0x8a2c000 0x1000>;
+        interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&crg HISTB_OSC_CLK>;
+    };

[Severity: Low]
Could clocks be placed before interrupts in both the properties block and the example node to follow the standard DT binding property order (compatible, reg, clocks, interrupts)?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
author
#3 lore raw

PATCH v2 2/4 watchdog: histb: Add HiSilicon STB watchdog driver

In reply to David Yang

The watchdog integrated on HiSilicon STB SoCs reuses the register layout of sp805, but deviates from the standard sp805 in several ways that make the existing sp805 driver unusable on these SoCs. Add a dedicated platform driver to handle these SoC-specific semantics natively without regressing generic SP805 users.

---
 drivers/watchdog/Kconfig     |   8 +
 drivers/watchdog/Makefile    |   1 +
 drivers/watchdog/histb_wdt.c | 305 +++++++++++++++++++++++++++++++++++
 3 files changed, 314 insertions(+)
 create mode 100644 drivers/watchdog/histb_wdt.c
drivers/watchdog/Kconfig +8 -0
index f7d0a0c2c0ef..d3421bb76326 100644
@@ -1183,6 +1183,14 @@ config SUNPLUS_WATCHDOG
 	  To compile this driver as a module, choose M here: the
 	  module will be called sunplus_wdt.
 
+config HISTB_WATCHDOG
+	tristate "HiSilicon STB Watchdog"
+	depends on (ARCH_HISI || COMPILE_TEST) && OF
+	select WATCHDOG_CORE
+	help
+	  Say Y here to include support for the watchdog timer in HiSilicon STB
+	  SoCs.
+
 # X86 (i386 + ia64 + x86_64) Architecture
 
 config ACQUIRE_WDT
drivers/watchdog/Makefile +1 -0
index 9ac406677aba..d2455e54ab23 100644
@@ -106,6 +106,7 @@ obj-$(CONFIG_SUNPLUS_WATCHDOG) += sunplus_wdt.o
 obj-$(CONFIG_MARVELL_GTI_WDT) += marvell_gti_wdt.o
 obj-$(CONFIG_GUNYAH_WATCHDOG) += gunyah_wdt.o
 obj-$(CONFIG_MA35D1_WDT) += ma35d1_wdt.o
+obj-$(CONFIG_HISTB_WATCHDOG) += histb_wdt.o
 
 # X86 (i386 + ia64 + x86_64) Architecture
 obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o
drivers/watchdog/histb_wdt.c new file +305 -0

305 lines not on this page · raw message

Signature · 1 line
2.53.0
author
#4 lore raw

PATCH v2 3/4 arm64: dts: hisilicon: hi3798cv200: Add watchdog node

In reply to David Yang

Add the on-chip watchdog controller node to hi3798cv200.dtsi, backed by the new hisilicon,histb-wdt platform driver.

---
 arch/arm64/boot/dts/hisilicon/hi3798cv200.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm64/boot/dts/hisilicon/hi3798cv200.dtsi +8 -0
index e5010c9d4c39..169a919bb282 100644
@@ -254,6 +254,14 @@ range: gpio-range {
 			};
 		};
 
+		watchdog0: watchdog@8a2c000 {
+			compatible = "hisilicon,hi3798cv200-wdt", "hisilicon,histb-wdt";
+			reg = <0x8a2c000 0x1000>;
+			interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&crg HISTB_OSC_CLK>;
+			status = "disabled";
+		};
+
 		uart0: serial@8b00000 {
 			compatible = "arm,pl011", "arm,primecell";
 			reg = <0x8b00000 0x1000>;
Signature · 1 line
2.53.0
author
#5 lore raw

PATCH v2 4/4 MAINTAINERS: Add HiSilicon STB drivers entry

In reply to David Yang

Add a MAINTAINERS entry for the HiSilicon STB platform drivers, covering the histb-wdt watchdog driver and the existing histb-rng hardware RNG driver.

---
 MAINTAINERS | 8 ++++++++
 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
index 2ac5128b756e..117823c25f2d 100644
@@ -12187,6 +12187,14 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/mfd/hisilicon,hi6421-spmi-pmic.yaml
 F:	drivers/mfd/hi6421-spmi-pmic.c
 
+HISILICON STB DRIVERS
+M:	David Yang <[email protected]>
+S:	Maintained
+W:	https://github.com/histb-mainline
+F:	Documentation/devicetree/bindings/watchdog/hisilicon,histb-wdt.yaml
+F:	drivers/char/hw_random/histb-rng.c
+F:	drivers/watchdog/histb_wdt.c
+
 HISILICON TRUE RANDOM NUMBER GENERATOR V2 SUPPORT
 M:	Weili Qian <[email protected]>
 S:	Maintained
Signature · 1 line
2.53.0
maintainer
#6 lore raw
In reply to David Yang
Quoted 8 lines · David Yang

The watchdog integrated on HiSilicon STB SoCs reuses the register layout of sp805, but deviates from the standard sp805 in several ways that make the existing sp805 driver unusable on these SoCs. Add a dedicated platform driver to handle these SoC-specific semantics natively without regressing generic SP805 users.

v2:
- fix issues reported by sashiko

Please spell those out in future revisions.

Thanks,
Guenter

Quoted 18 lines

v1: https://lore.kernel.org/r/[email protected]

David Yang (4):
dt-bindings: watchdog: hisilicon,histb-wdt: Add HiSilicon STB watchdog
watchdog: histb: Add HiSilicon STB watchdog driver
arm64: dts: hisilicon: hi3798cv200: Add watchdog node
MAINTAINERS: Add HiSilicon STB drivers entry

  .../watchdog/hisilicon,histb-wdt.yaml         |  56 ++++
  MAINTAINERS                                   |   8 +
  .../arm64/boot/dts/hisilicon/hi3798cv200.dtsi |   8 +
  drivers/watchdog/Kconfig                      |   8 +
  drivers/watchdog/Makefile                     |   1 +
  drivers/watchdog/histb_wdt.c                  | 305 ++++++++++++++++++
  6 files changed, 386 insertions(+)

create mode 100644 Documentation/devicetree/bindings/watchdog/hisilicon,histb-wdt.yaml create mode 100644 drivers/watchdog/histb_wdt.c