Skip to contentSkip to conversation

Add watchdog timer support for Tegra186/194/234 SoCs

PATCH Superseded Kartik 3 participants 10 messages Apr 14, 2022 – Jun 20, 2022

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Kartik

author
#0 lore raw

cover Add watchdog timer support for Tegra186/194/234 SoCs

The native timers IP block found on Tegra SoCs implements a watchdog timer that can be used to recover from system hangs. This series of patches adds support for watchdog timers available on Tegra186, Tegra194 and Tegra234 SOC's.

To keep the history intact, I added Tegra234 driver change as separate. The original patchset is an old one authored by Thierry.

Kartik (4):
dt-bindings: timer: Add Tegra186 & Tegra234 Timer clocksource/drivers/timer-tegra186: Add support for Tegra234 SoC
arm64: tegra: Enable native timers on Tegra186
arm64: tegra: Enable native timers on Tegra234

Thierry Reding (2):
clocksource: Add Tegra186 timers support
arm64: tegra: Enable native timers on Tegra194

 .../bindings/timer/nvidia,tegra186-timer.yaml | 116 ++++
 arch/arm64/boot/dts/nvidia/tegra186.dtsi      |   2 +-
 arch/arm64/boot/dts/nvidia/tegra194.dtsi      |  16 +
 arch/arm64/boot/dts/nvidia/tegra234.dtsi      |  22 +
 drivers/clocksource/Kconfig                   |   8 +
 drivers/clocksource/Makefile                  |   1 +
 drivers/clocksource/timer-tegra186.c          | 514 ++++++++++++++++++
 7 files changed, 678 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml
 create mode 100644 drivers/clocksource/timer-tegra186.c
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/6 dt-bindings: timer: Add Tegra186 & Tegra234 Timer

The Tegra186 timer provides ten 29-bit timer counters and one 32-bit timestamp counter. The Tegra234 timer provides sixteen 29-bit timer counters and one 32-bit timestamp counter. Each NV timer selects its timing reference signal from the 1 MHz reference generated by USEC, TSC or either clk_m or OSC. Each TMR can be programmed to generate one-shot, periodic, or watchdog interrupts.

---
 .../bindings/timer/nvidia,tegra186-timer.yaml | 116 ++++++++++++++++++
 1 file changed, 116 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml
Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml new file +116 -0
new file mode 100644
index 000000000000..7841a68d19f3
@@ -0,0 +1,116 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/timer/nvidia,tegra186-timer.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: NVIDIA Tegra186 timer
+
+maintainers:
+  - Thierry Reding <[email protected]>
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: nvidia,tegra186-timer
+    then:
+      properties:
+        interrupts:
+          # Either a single combined interrupt or up to 14 individual interrupts
+          minItems: 1
+          maxItems: 10
+          description: >
+            A list of 10 interrupts; one per each timer channels 0 through 9.
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: nvidia,tegra234-timer
+    then:
+      properties:
+        interrupts:
+          # Either a single combined interrupt or up to 16 individual interrupts
+          minItems: 1
+          maxItems: 16
+          description: >
+            A list of 16 interrupts; one per each timer channels 0 through 15.
+
+properties:
+  compatible:
+    oneOf:
+      - const: nvidia,tegra186-timer
+        description: >
+          The Tegra186 timer provides ten 29-bit timer counters and one 32-bit
+          timestamp counter. Each NV timer selects its timing reference signal
+          from the 1 MHz reference generated by USEC, TSC or either clk_m or
+          OSC. Each TMR can be programmed to generate one-shot, periodic, or
+          watchdog interrupts.
+      - const: nvidia,tegra234-timer
+        description: >
+          The Tegra234 timer provides sixteen 29-bit timer counters and one 32-bit
+          timestamp counter. Each NV timer selects its timing reference signal
+          from the 1 MHz reference generated by USEC, TSC or either clk_m or
+          OSC. Each TMR can be programmed to generate one-shot, periodic, or
+          watchdog interrupts.
+
+  reg:
+    maxItems: 1
+
+  interrupts: true
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    timer@3010000 {
+        compatible = "nvidia,tegra186-timer";
+        reg = <0x03010000 0x000e0000>;
+        interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
+        status = "disabled";
+    };
+
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    timer@2080000 {
+        compatible = "nvidia,tegra234-timer";
+        reg = <0x02080000 0x00121000>;
+        interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
+        status = "disabled";
+    };
Signature · 1 line
2.17.1
author
#4 lore raw

PATCH 2/6 clocksource: Add Tegra186 timers support

In reply to Kartik

From: Thierry Reding <[email protected]>

Currently this only supports a single watchdog, which uses a timer in the background for countdown. Eventually the timers could be used for various time-keeping tasks, but by default the architected timer will already provide that functionality.

---
 drivers/clocksource/Kconfig          |   8 +
 drivers/clocksource/Makefile         |   1 +
 drivers/clocksource/timer-tegra186.c | 508 +++++++++++++++++++++++++++
 3 files changed, 517 insertions(+)
 create mode 100644 drivers/clocksource/timer-tegra186.c
drivers/clocksource/Kconfig +8 -0
index fe3f05dfafd9..c68ecafc6ad1 100644
@@ -150,6 +150,14 @@ config TEGRA_TIMER
 	help
 	  Enables support for the Tegra driver.
 
+config TEGRA186_TIMER
+	tristate "NVIDIA Tegra186 timer driver"
+	depends on ARCH_TEGRA || COMPILE_TEST
+	depends on WATCHDOG && WATCHDOG_CORE
+	help
+	  Enables support for the timers and watchdogs found on NVIDIA
+	  Tegra186 and later SoCs.
+
 config VT8500_TIMER
 	bool "VT8500 timer driver" if COMPILE_TEST
 	depends on HAS_IOMEM
drivers/clocksource/Makefile +1 -0
index 833cfb7a96c1..a917811443d1 100644
@@ -36,6 +36,7 @@ obj-$(CONFIG_SUN4I_TIMER)	+= timer-sun4i.o
 obj-$(CONFIG_SUN5I_HSTIMER)	+= timer-sun5i.o
 obj-$(CONFIG_MESON6_TIMER)	+= timer-meson6.o
 obj-$(CONFIG_TEGRA_TIMER)	+= timer-tegra.o
+obj-$(CONFIG_TEGRA186_TIMER)	+= timer-tegra186.o
 obj-$(CONFIG_VT8500_TIMER)	+= timer-vt8500.o
 obj-$(CONFIG_NSPIRE_TIMER)	+= timer-zevio.o
 obj-$(CONFIG_BCM_KONA_TIMER)	+= bcm_kona_timer.o
drivers/clocksource/timer-tegra186.c new file +508 -0

508 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#5 lore raw

PATCH 3/6 clocksource/drivers/timer-tegra186: Add support for Tegra234 SoC

In reply to Kartik

The timer IP block present on Tegra234 SoC supports watchdog timer functionality that can be used to recover from system hangs. The watchdog timer uses a timer in the background for countdown.

---
 drivers/clocksource/timer-tegra186.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/clocksource/timer-tegra186.c +6 -0
index 4515517c87a5..ea742889ee06 100644
@@ -486,8 +486,14 @@ static const struct tegra186_timer_soc tegra186_timer = {
 	.num_wdts = 3,
 };
 
+static const struct tegra186_timer_soc tegra234_timer = {
+	.num_timers = 16,
+	.num_wdts = 3,
+};
+
 static const struct of_device_id tegra186_timer_of_match[] = {
 	{ .compatible = "nvidia,tegra186-timer", .data = &tegra186_timer },
+	{ .compatible = "nvidia,tegra234-timer", .data = &tegra234_timer },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, tegra186_timer_of_match);
Signature · 1 line
2.17.1
author
#6 lore raw

PATCH 4/6 arm64: tegra: Enable native timers on Tegra186

In reply to Kartik

Enable the native timers on Tegra186 chips to allow using the watchdog functionality to recover from system hangs.

---
 arch/arm64/boot/dts/nvidia/tegra186.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/nvidia/tegra186.dtsi +1 -1
index e9b40f5d79ec..9969eaa39018 100644
@@ -563,7 +563,7 @@
 			     <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>,
 			     <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>,
 			     <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
-		status = "disabled";
+		status = "okay";
 	};
 
 	uarta: serial@3100000 {
Signature · 1 line
2.17.1
author
#7 lore raw

PATCH 5/6 arm64: tegra: Enable native timers on Tegra194

In reply to Kartik

From: Thierry Reding <[email protected]>

The native timers IP block found on NVIDIA Tegra SoCs implements a watchdog timer that can be used to recover from system hangs. Add and enable the device tree node on Tegra194.

---
 arch/arm64/boot/dts/nvidia/tegra194.dtsi | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/arm64/boot/dts/nvidia/tegra194.dtsi +16 -0
index 1d6be5774fac..fad2b1a634cb 100644
@@ -649,6 +649,22 @@
 			};
 		};
 
+		timer@3010000 {
+			compatible = "nvidia,tegra186-timer";
+			reg = <0x03010000 0x000e0000>;
+			interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
+			status = "okay";
+		};
+
 		uarta: serial@3100000 {
 			compatible = "nvidia,tegra194-uart", "nvidia,tegra20-uart";
 			reg = <0x03100000 0x40>;
Signature · 1 line
2.17.1
author
#8 lore raw

PATCH 6/6 arm64: tegra: Enable native timers on Tegra234

In reply to Kartik

The native timers IP block found on NVIDIA Tegra SoCs implements a watchdog timer that can be used to recover from system hangs. Add and enable the device tree node on Tegra234.

---
 arch/arm64/boot/dts/nvidia/tegra234.dtsi | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
arch/arm64/boot/dts/nvidia/tegra234.dtsi +22 -0
index 8767dbe2d066..47e0500a3838 100644
@@ -446,6 +446,28 @@
 			status = "okay";
 		};
 
+		timer@2080000 {
+			compatible = "nvidia,tegra234-timer";
+			reg = <0x02080000 0x00121000>;
+			interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
+			status = "okay";
+		};
+
 		gpio: gpio@2200000 {
 			compatible = "nvidia,tegra234-gpio";
 			reg-names = "security", "gpio";
Signature · 1 line
2.17.1
maintainer
#2 lore raw

Re: [PATCH 1/6] dt-bindings: timer: Add Tegra186 & Tegra234 Timer

In reply to Kartik
Quoted 8 lines · Kartik

The Tegra186 timer provides ten 29-bit timer counters and one 32-bit timestamp counter. The Tegra234 timer provides sixteen 29-bit timer counters and one 32-bit timestamp counter. Each NV timer selects its timing reference signal from the 1 MHz reference generated by USEC, TSC or either clk_m or OSC. Each TMR can be programmed to generate one-shot, periodic, or watchdog interrupts.

Full name please.

Quoted 22 lines
---
 .../bindings/timer/nvidia,tegra186-timer.yaml | 116 ++++++++++++++++++
 1 file changed, 116 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml
Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml new file +11 -0
new file mode 100644
index 000000000000..7841a68d19f3
@@ -0,0 +1,116 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/timer/nvidia,tegra186-timer.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: NVIDIA Tegra186 timer
+
+maintainers:
+  - Thierry Reding <[email protected]>
+

Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml line 21

Quoted 10 lines
Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml new file +10 -0
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: nvidia,tegra186-timer
+    then:
+      properties:
+        interrupts:
+          # Either a single combined interrupt or up to 14 individual interrupts

This can be part of 'description'

Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml line 25

Quoted 4 lines
Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml new file +4 -0
+          minItems: 1
+          maxItems: 10
+          description: >
+            A list of 10 interrupts; one per each timer channels 0 through 9.

Is it 10 or 14? I'm confused.

Quoted 22 lines
Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml new file +22 -0
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: nvidia,tegra234-timer
+    then:
+      properties:
+        interrupts:
+          # Either a single combined interrupt or up to 16 individual interrupts
+          minItems: 1
+          maxItems: 16
+          description: >
+            A list of 16 interrupts; one per each timer channels 0 through 15.
+
+properties:
+  compatible:
+    oneOf:
+      - const: nvidia,tegra186-timer
+        description: >
+          The Tegra186 timer provides ten 29-bit timer counters and one 32-bit
+          timestamp counter. Each NV timer selects its timing reference signal

Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml line 57

Quoted 10 lines
Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml new file +10 -0
+          from the 1 MHz reference generated by USEC, TSC or either clk_m or
+          OSC. Each TMR can be programmed to generate one-shot, periodic, or
+          watchdog interrupts.
+      - const: nvidia,tegra234-timer
+        description: >
+          The Tegra234 timer provides sixteen 29-bit timer counters and one 32-bit
+          timestamp counter. Each NV timer selects its timing reference signal
+          from the 1 MHz reference generated by USEC, TSC or either clk_m or
+          OSC. Each TMR can be programmed to generate one-shot, periodic, or
+          watchdog interrupts.

Move all this description to top-level description leaving out the exact number of counters (as the schema defines that).

Quoted 22 lines
Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml new file +22 -0
+
+  reg:
+    maxItems: 1
+
+  interrupts: true
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    timer@3010000 {
+        compatible = "nvidia,tegra186-timer";
+        reg = <0x03010000 0x000e0000>;
+        interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,

Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml line 89

Quoted 10 lines
Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml new file +10 -0
+                     <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
+        status = "disabled";

Drop status.

Quoted 31 lines
Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml new file +27 -0
+    };
+
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    timer@2080000 {
+        compatible = "nvidia,tegra234-timer";
+        reg = <0x02080000 0x00121000>;
+        interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
+        status = "disabled";
+    };
Signature · 1 line
2.17.1
author
#3 lore raw

Re: [PATCH 1/6] dt-bindings: timer: Add Tegra186 & Tegra234 Timer

Quoted 9 lines · Rob Herring
Quoted 7 lines

timestamp counter. The Tegra234 timer provides sixteen 29-bit timer counters and one 32-bit timestamp counter. Each NV timer selects its timing reference signal from the 1 MHz reference generated by USEC, TSC or either clk_m or OSC. Each TMR can be programmed to generate one-shot, periodic, or watchdog interrupts.

Full name please.

This is my legal name.

Quoted 27 lines
Quoted 27 lines
---
 .../bindings/timer/nvidia,tegra186-timer.yaml | 116 ++++++++++++++++++
 1 file changed, 116 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml
Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml new file +15 -0
new file mode 100644
index 000000000000..7841a68d19f3
@@ -0,0 +1,116 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/timer/nvidia,tegra186-timer.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: NVIDIA Tegra186 timer
+
+maintainers:
+  - Thierry Reding <[email protected]>
+
+allOf:
+  - if:
+      properties:
+        compatible:
Quoted 8 lines

Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml line 21

Quoted 6 lines
Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml new file +6 -0
+          contains:
+            const: nvidia,tegra186-timer
+    then:
+      properties:
+        interrupts:
+          # Either a single combined interrupt or up to 14 individual interrupts

This can be part of 'description'

I will include this in the description in v2.

Quoted 7 lines

Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml line 25

Quoted 5 lines
Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml new file +4 -0
+          minItems: 1
+          maxItems: 10
+          description: >
+            A list of 10 interrupts; one per each timer channels 0 through 9.

Is it 10 or 14? I'm confused.

My bad, it is 10.

Quoted 28 lines
Quoted 28 lines
Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml new file +27 -0
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: nvidia,tegra234-timer
+    then:
+      properties:
+        interrupts:
+          # Either a single combined interrupt or up to 16 individual interrupts
+          minItems: 1
+          maxItems: 16
+          description: >
+            A list of 16 interrupts; one per each timer channels 0 through 15.
+
+properties:
+  compatible:
+    oneOf:
+      - const: nvidia,tegra186-timer
+        description: >
+          The Tegra186 timer provides ten 29-bit timer counters and one 32-bit
+          timestamp counter. Each NV timer selects its timing reference signal
+          from the 1 MHz reference generated by USEC, TSC or either clk_m or
+          OSC. Each TMR can be programmed to generate one-shot, periodic, or
+          watchdog interrupts.
+      - const: nvidia,tegra234-timer
+        description: >
Quoted 9 lines

Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml line 57

Quoted 5 lines
Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml new file +5 -0
+          The Tegra234 timer provides sixteen 29-bit timer counters and one 32-bit
+          timestamp counter. Each NV timer selects its timing reference signal
+          from the 1 MHz reference generated by USEC, TSC or either clk_m or
+          OSC. Each TMR can be programmed to generate one-shot, periodic, or
+          watchdog interrupts.

Move all this description to top-level description leaving out the exact number of counters (as the schema defines that).

Do you mean it to be this way?

title: NVIDIA Tegra186 timer

maintainers:
- Thierry Reding <[email protected]>

description: >
The Tegra timer provides 29-bit timer counters and a 32-bit timestamp counter. Each NV timer selects its timing reference signal from the 1 MHz reference generated by USEC, TSC or either clk_m or OSC. Each TMR can be programmed to generate one-shot, periodic, or watchdog interrupts.

properties:
compatible:
oneOf:
- const: nvidia,tegra186-timer
description: >
The Tegra186 timer provides ten 29-bit timer counters.
- const: nvidia,tegra234-timer
description: >
The Tegra234 timer provides sixteen 29-bit timer counters.

Quoted 26 lines
Quoted 26 lines
Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml new file +26 -0
+
+  reg:
+    maxItems: 1
+
+  interrupts: true
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    timer@3010000 {
+        compatible = "nvidia,tegra186-timer";
+        reg = <0x03010000 0x000e0000>;
+        interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
Quoted 9 lines

Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml line 89

Quoted 6 lines
Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml new file +6 -0
+                     <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
+        status = "disabled";

Drop status.

I will remove this in v2.

Quoted 31 lines
Quoted 31 lines
Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml new file +27 -0
+    };
+
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    timer@2080000 {
+        compatible = "nvidia,tegra234-timer";
+        reg = <0x02080000 0x00121000>;
+        interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
+        status = "disabled";
+    };
Signature · 1 line
2.17.1
#9 lore raw
In reply to Kartik
Quoted 18 lines · Kartik

The native timers IP block found on Tegra SoCs implements a watchdog timer that can be used to recover from system hangs. This series of patches adds support for watchdog timers available on Tegra186, Tegra194 and Tegra234 SOC's.

To keep the history intact, I added Tegra234 driver change as separate. The original patchset is an old one authored by Thierry.

Kartik (4):
dt-bindings: timer: Add Tegra186 & Tegra234 Timer clocksource/drivers/timer-tegra186: Add support for Tegra234 SoC
arm64: tegra: Enable native timers on Tegra186
arm64: tegra: Enable native timers on Tegra234

Thierry Reding (2):
clocksource: Add Tegra186 timers support
arm64: tegra: Enable native timers on Tegra194

Quoted 10 lines
 .../bindings/timer/nvidia,tegra186-timer.yaml | 116 ++++
 arch/arm64/boot/dts/nvidia/tegra186.dtsi      |   2 +-
 arch/arm64/boot/dts/nvidia/tegra194.dtsi      |  16 +
 arch/arm64/boot/dts/nvidia/tegra234.dtsi      |  22 +
 drivers/clocksource/Kconfig                   |   8 +
 drivers/clocksource/Makefile                  |   1 +
 drivers/clocksource/timer-tegra186.c          | 514 ++++++++++++++++++
 7 files changed, 678 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/timer/nvidia,tegra186-timer.yaml
 create mode 100644 drivers/clocksource/timer-tegra186.c

Hi Daniel, Thomas,

any comments on this from the clocksource side of things? So far the only comments have been on the bindings, so if there's nothing else on the driver bits, Kartik could go ahead and send a v2 so that we can hopefully get this into v5.20.

Thanks,
Thierry