Skip to contentSkip to conversation

Add Tegra234 HTE support

PATCH Superseded Dipen Patel 1 participant 8 messages Nov 3, 2022

Subsystems (5)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
author maintainer
#1 lore raw

PATCH 1/7 MAINTAINERS: Add HTE/timestamp subsystem details

In reply to Dipen Patel

Add tree, mailing list and patchwork details.

---
 MAINTAINERS | 3 +++
 1 file changed, 3 insertions(+)
MAINTAINERS +3 -0
index cf0f18502372..37b17c1f1388 100644
@@ -9414,6 +9414,9 @@ F:	drivers/input/touchscreen/htcpen.c
 
 HTE SUBSYSTEM
 M:	Dipen Patel <[email protected]>
+L:	[email protected]
+T:	git git://git.kernel.org/pub/scm/linux/kernel/git/pateldipen1984/linux.git
+Q:	https://patchwork.kernel.org/project/timestamp/list/
 S:	Maintained
 F:	Documentation/devicetree/bindings/timestamp/
 F:	Documentation/driver-api/hte/
Signature · 1 line
2.17.1

Dipen Patel

author maintainer
#0 lore raw

cover Add Tegra234 HTE support

The patch series:
- Adds tegra Tegra234 HTE(timestamp) provider supports.
- Updates MAINTAINERS file for git tree, mail list fields.
- Updates devicetree and API documentations.
- Enables HTE subsystem, Tegra194 and Tegra234 HTE providers by default in arm64 defconfig and dts files.

Dipen Patel (7):
MAINTAINERS: Add HTE/timestamp subsystem details
hte: Add Tegra234 provider
gpio: tegra186: Add Tegra234 hte support
dt-bindings: timestamp: Add Tegra234 support
hte: Re-phrase tegra API document
arm64: tegra: Enable GTE nodes
arm64: defconfig: Enable HTE config

 .../timestamp/nvidia,tegra194-hte.yaml        |  44 ++++++-
 Documentation/driver-api/hte/tegra194-hte.rst |  33 +++--
 MAINTAINERS                                   |   3 +
 arch/arm64/boot/dts/nvidia/tegra194.dtsi      |  20 +++
 arch/arm64/boot/dts/nvidia/tegra234.dtsi      |  20 +++
 arch/arm64/configs/defconfig                  |   3 +
 drivers/gpio/gpio-tegra186.c                  |   1 +
 drivers/hte/hte-tegra194-test.c               |   2 +-
 drivers/hte/hte-tegra194.c                    | 124 +++++++++++++++++-
 9 files changed, 224 insertions(+), 26 deletions(-)

base-commit: 9abf2313adc1ca1b6180c508c25f22f9395cc780

Signature · 1 line
2.17.1
author maintainer
#2 lore raw

PATCH 2/7 hte: Add Tegra234 provider

The Tegra234 AON GPIO instance and LIC IRQ support HTE. For the GPIO HTE support, it requires to add mapping between GPIO and HTE framework.

---
 drivers/hte/hte-tegra194-test.c |   2 +-
 drivers/hte/hte-tegra194.c      | 124 ++++++++++++++++++++++++++++++--
 2 files changed, 121 insertions(+), 5 deletions(-)
drivers/hte/hte-tegra194-test.c +1 -1
index 5d776a185bd6..d79c28a80517 100644
@@ -16,7 +16,7 @@
 #include <linux/hte.h>
 
 /*
- * This sample HTE GPIO test driver demonstrates HTE API usage by enabling
+ * This sample HTE test driver demonstrates HTE API usage by enabling
  * hardware timestamp on gpio_in and specified LIC IRQ lines.
  *
  * Note: gpio_out and gpio_in need to be shorted externally in order for this
drivers/hte/hte-tegra194.c +120 -4

154 lines not on this page · raw message

Signature · 1 line
2.17.1
author maintainer
#4 lore raw

PATCH 4/7 dt-bindings: timestamp: Add Tegra234 support

In reply to Dipen Patel

Added timestamp provider support for the Tegra234 in devicetree bindings.

---
 .../timestamp/nvidia,tegra194-hte.yaml        | 44 +++++++++++++++++--
 1 file changed, 40 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml +40 -4
index c31e207d1652..158dbe58c49f 100644
@@ -4,7 +4,7 @@
 $id: http://devicetree.org/schemas/timestamp/nvidia,tegra194-hte.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: Tegra194 on chip generic hardware timestamping engine (HTE)
+title: Tegra on chip generic hardware timestamping engine (HTE) provider
 
 maintainers:
   - Dipen Patel <[email protected]>
@@ -23,6 +23,8 @@ properties:
     enum:
       - nvidia,tegra194-gte-aon
       - nvidia,tegra194-gte-lic
+      - nvidia,tegra234-gte-aon
+      - nvidia,tegra234-gte-lic
 
   reg:
     maxItems: 1
@@ -43,9 +45,8 @@ properties:
     description:
       HTE lines are arranged in 32 bit slice where each bit represents different
       line/signal that it can enable/configure for the timestamp. It is u32
-      property and depends on the HTE instance in the chip. The value 3 is for
-      GPIO GTE and 11 for IRQ GTE.
-    enum: [3, 11]
+      property and the value depends on the HTE instance in the chip.
+    enum: [3, 11, 17]
 
   '#timestamp-cells':
     description:
@@ -55,6 +56,41 @@ properties:
       mentioned in the nvidia GPIO device tree binding document.
     const: 1
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - nvidia,tegra194-gte-aon
+              - nvidia,tegra234-gte-aon
+    then:
+      properties:
+        nvidia,slices:
+          const: 3
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - nvidia,tegra194-gte-lic
+    then:
+      properties:
+        nvidia,slices:
+          const: 11
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - nvidia,tegra234-gte-lic
+    then:
+      properties:
+        nvidia,slices:
+          const: 17
+
 required:
   - compatible
   - reg
Signature · 1 line
2.17.1
author maintainer
#3 lore raw

PATCH 3/7 gpio: tegra186: Add Tegra234 hte support

In reply to Dipen Patel

To enable timestamp support for the Tegra234, has_gte variable needs to be set true.

---
 drivers/gpio/gpio-tegra186.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpio/gpio-tegra186.c +1 -0
index 54d9fa7da9c1..c2ccfee52608 100644
@@ -1136,6 +1136,7 @@ static const struct tegra_gpio_soc tegra234_aon_soc = {
 	.name = "tegra234-gpio-aon",
 	.instance = 1,
 	.num_irqs_per_bank = 8,
+	.has_gte = true,
 };
 
 #define TEGRA241_MAIN_GPIO_PORT(_name, _bank, _port, _pins)	\
Signature · 1 line
2.17.1
author maintainer
#5 lore raw

PATCH 5/7 hte: Re-phrase tegra API document

In reply to Dipen Patel

Make Tegra194 API document generic to make it applicable for current and future tegra hte providers.

---
 Documentation/driver-api/hte/tegra194-hte.rst | 33 +++++++++----------
 1 file changed, 16 insertions(+), 17 deletions(-)
Documentation/driver-api/hte/tegra194-hte.rst +16 -17
index f2d617265546..85e654772782 100644
@@ -5,25 +5,25 @@ HTE Kernel provider driver
 
 Description
 -----------
-The Nvidia tegra194 HTE provider driver implements two GTE
-(Generic Timestamping Engine) instances: 1) GPIO GTE and 2) LIC
-(Legacy Interrupt Controller) IRQ GTE. Both GTE instances get the
-timestamp from the system counter TSC which has 31.25MHz clock rate, and the
-driver converts clock tick rate to nanoseconds before storing it as timestamp
-value.
+The Nvidia tegra HTE provider also known as GTE (Generic Timestamping Engine)
+driver implements two GTE instances: 1) GPIO GTE and 2) LIC
+(Legacy Interrupt Controller) IRQ GTE. Both GTE instances get the timestamp
+from the system counter TSC which has 31.25MHz clock rate, and the driver
+converts clock tick rate to nanoseconds before storing it as timestamp value.
 
 GPIO GTE
 --------
 
 This GTE instance timestamps GPIO in real time. For that to happen GPIO
-needs to be configured as input. The always on (AON) GPIO controller instance
-supports timestamping GPIOs in real time and it has 39 GPIO lines. The GPIO GTE
-and AON GPIO controller are tightly coupled as it requires very specific bits
-to be set in GPIO config register before GPIO GTE can be used, for that GPIOLIB
-adds two optional APIs as below. The GPIO GTE code supports both kernel
-and userspace consumers. The kernel space consumers can directly talk to HTE
-subsystem while userspace consumers timestamp requests go through GPIOLIB CDEV
-framework to HTE subsystem.
+needs to be configured as input. Only the always on (AON) GPIO controller
+instance supports timestamping GPIOs in real time as it is tightly coupled with
+the GPIO GTE. To support this, GPIOLIB adds two optional APIs as mentioned
+below. The GPIO GTE code supports both kernel and userspace consumers. The
+kernel space consumers can directly talk to HTE subsystem while userspace
+consumers timestamp requests go through GPIOLIB CDEV framework to HTE
+subsystem. The hte devicetree binding described at
+``Documentation/devicetree/bindings/timestamp`` provides an example of how a
+consumer can request an GPIO line.
 
 See gpiod_enable_hw_timestamp_ns() and gpiod_disable_hw_timestamp_ns().
 
@@ -34,9 +34,8 @@ returns the timestamp in nanoseconds.
 LIC (Legacy Interrupt Controller) IRQ GTE
 -----------------------------------------
 
-This GTE instance timestamps LIC IRQ lines in real time. There are 352 IRQ
-lines which this instance can add timestamps to in real time. The hte
-devicetree binding described at ``Documentation/devicetree/bindings/timestamp``
+This GTE instance timestamps LIC IRQ lines in real time. The hte devicetree
+binding described at ``Documentation/devicetree/bindings/timestamp``
 provides an example of how a consumer can request an IRQ line. Since it is a
 one-to-one mapping with IRQ GTE provider, consumers can simply specify the IRQ
 number that they are interested in. There is no userspace consumer support for
Signature · 1 line
2.17.1
author maintainer
#6 lore raw

PATCH 6/7 arm64: tegra: Enable GTE nodes

In reply to Dipen Patel

Add and enable AON and LIC GTE nodes by default.

---
 arch/arm64/boot/dts/nvidia/tegra194.dtsi | 20 ++++++++++++++++++++
 arch/arm64/boot/dts/nvidia/tegra234.dtsi | 20 ++++++++++++++++++++
 2 files changed, 40 insertions(+)
arch/arm64/boot/dts/nvidia/tegra194.dtsi +20 -0
index 41f3a7e188d0..67927d97956e 100644
@@ -1366,6 +1366,16 @@
 			status = "disabled";
 		};
 
+                hte_lic: hardware-timestamp@3aa0000 {
+                        compatible = "nvidia,tegra194-gte-lic";
+                        reg = <0x3aa0000 0x10000>;
+                        interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
+                        nvidia,int-threshold = <1>;
+                        nvidia,slices = <11>;
+                        #timestamp-cells = <1>;
+                        status = "okay";
+                };
+
 		hsp_top0: hsp@3c00000 {
 			compatible = "nvidia,tegra194-hsp";
 			reg = <0x03c00000 0xa0000>;
@@ -1579,6 +1589,16 @@
 			#mbox-cells = <2>;
 		};
 
+                hte_aon: hardware-timestamp@c1e0000 {
+                        compatible = "nvidia,tegra194-gte-aon";
+                        reg = <0xc1e0000 0x10000>;
+                        interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
+                        nvidia,int-threshold = <1>;
+                        nvidia,slices = <3>;
+                        #timestamp-cells = <1>;
+                        status = "okay";
+                };
+
 		gen2_i2c: i2c@c240000 {
 			compatible = "nvidia,tegra194-i2c";
 			reg = <0x0c240000 0x10000>;
arch/arm64/boot/dts/nvidia/tegra234.dtsi +20 -0
index 0170bfa8a467..fecf9ab1bf17 100644
@@ -949,6 +949,16 @@
 			clock-names = "fuse";
 		};
 
+                hte_lic: hardware-timestamp@3aa0000 {
+                        compatible = "nvidia,tegra234-gte-lic";
+                        reg = <0x3aa0000 0x10000>;
+                        interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
+                        nvidia,int-threshold = <1>;
+                        nvidia,slices = <17>;
+                        #timestamp-cells = <1>;
+                        status = "okay";
+                };
+
 		hsp_top0: hsp@3c00000 {
 			compatible = "nvidia,tegra234-hsp", "nvidia,tegra194-hsp";
 			reg = <0x03c00000 0xa0000>;
@@ -1466,6 +1476,16 @@
 			#mbox-cells = <2>;
 		};
 
+                hte_aon: hardware-timestamp@c1e0000 {
+                        compatible = "nvidia,tegra234-gte-aon";
+                        reg = <0xc1e0000 0x10000>;
+                        interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
+                        nvidia,int-threshold = <1>;
+                        nvidia,slices = <3>;
+                        #timestamp-cells = <1>;
+                        status = "okay";
+                };
+
 		gen2_i2c: i2c@c240000 {
 			compatible = "nvidia,tegra194-i2c";
 			reg = <0xc240000 0x100>;
Signature · 1 line
2.17.1
author maintainer
#7 lore raw

PATCH 7/7 arm64: defconfig: Enable HTE config

In reply to Dipen Patel

Enable HTE core and tegra HTE provider by default as built in module.

---
 arch/arm64/configs/defconfig | 3 +++
 1 file changed, 3 insertions(+)
arch/arm64/configs/defconfig +3 -0
index 0b6af3348e79..c6e04a4f89d5 100644
@@ -1307,6 +1307,9 @@ CONFIG_INTERCONNECT_QCOM_SM8150=m
 CONFIG_INTERCONNECT_QCOM_SM8250=m
 CONFIG_INTERCONNECT_QCOM_SM8350=m
 CONFIG_INTERCONNECT_QCOM_SM8450=m
+CONFIG_HTE=y
+CONFIG_HTE_TEGRA194=y
+CONFIG_HTE_TEGRA194_TEST=m
 CONFIG_EXT2_FS=y
 CONFIG_EXT3_FS=y
 CONFIG_EXT4_FS_POSIX_ACL=y
Signature · 1 line
2.17.1