Skip to contentSkip to conversation

Add Tegra234 HTE support

PATCH Superseded Dipen Patel 5 participants 20 messages Mar 10, 2023 – Mar 15, 2023

Subsystems (5)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Dipen Patel

author maintainer
#0 lore raw

v3 cover Add Tegra234 HTE support

This patch series mainly adds support for the Tegra234 HTE provider. In addition, it addresses dt binding comments which prompted code changes in the existing HTE provider driver for the Tegra194 chips. The comments raised concern how existing code retrieves gpio controller node (the node is used to help namespace conversion between HTE and GPIOLIB). To help simplify that process, new DT property is suggested which adds gpio
controller node in the HTE provider binding as phandle property. To conlude this patch series:
- adds Tegra234 HTE provider
- modifies existing Tegra194 and Tegra234 provider code to add address provider dt binding changes.

The V1 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.

The V2 patch series:
- Changes in dt bindings to remove slices property
- Adds nvidia,gpio-controller dt property
- Add GTE node for the Tegra234

The V3 patch series:
- Re-arranged patches to have dt bindings first before its usage
- Addressed review comments regarding dt bindings

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

 .../timestamp/nvidia,tegra194-hte.yaml        |  31 ++--
 Documentation/driver-api/hte/tegra194-hte.rst |  33 ++--
 MAINTAINERS                                   |   3 +
 arch/arm64/boot/dts/nvidia/tegra194.dtsi      |   3 +-
 arch/arm64/boot/dts/nvidia/tegra234.dtsi      |  17 ++
 drivers/gpio/gpio-tegra186.c                  |   1 +
 drivers/hte/hte-tegra194-test.c               |   2 +-
 drivers/hte/hte-tegra194.c                    | 152 ++++++++++++++++--
 8 files changed, 196 insertions(+), 46 deletions(-)

base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6

Signature · 1 line
2.17.1
author maintainer
#1 lore raw

PATCH v3 1/6 MAINTAINERS: Add HTE/timestamp subsystem details

Add tree, mailing list and patchwork details.

---
 MAINTAINERS | 3 +++
 1 file changed, 3 insertions(+)
MAINTAINERS +3 -0
index 8d5bc223f305..65b58963f0d2 100644
@@ -9425,6 +9425,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
author maintainer
#2 lore raw

PATCH v3 2/6 dt-bindings: timestamp: Add Tegra234 support

In reply to Dipen Patel

Added timestamp provider support for the Tegra234 in devicetree bindings. In addition, it addresses review comments from the previous review round as follows:
- Removes nvidia,slices property. This was not necessary as it is a constant value and can be hardcoded inside the driver code.
- Adds nvidia,gpio-controller property. This simplifies how GTE driver retrieves GPIO controller instance, see below explanation.

Without this property code would look like:
if (of_device_is_compatible(dev->of_node, "nvidia,tegra194-gte-aon"))

	hte_dev->c = gpiochip_find("tegra194-gpio-aon",
				   tegra_get_gpiochip_from_name);
else if (of_device_is_compatible(dev->of_node, "nvidia,tegra234-gte-aon"))
	hte_dev->c = gpiochip_find("tegra234-gpio-aon",
				   tegra_get_gpiochip_from_name);
else
	return -ENODEV;

This means for every future addition of the compatible string, if else condition statements have to be expanded.

With the property:
gpio_ctrl = of_parse_phandle(dev->of_node, "nvidia,gpio-controller", 0);
....
hte_dev->c = gpiochip_find(gpio_ctrl, tegra_get_gpiochip_from_of_node);

We haven't technically started making use of these bindings, so backwards-compatibility shouldn't be an issue yet.

---
v2:
- Removed nvidia,slices property
- Added nvidia,gpio-controller based on review comments from Thierry, this will help simplify the hte provider driver.

v3:
- Explained changes in detail in commit message
- Added allOf section per review comment

 .../timestamp/nvidia,tegra194-hte.yaml        | 31 ++++++++++++-------
 1 file changed, 20 insertions(+), 11 deletions(-)
Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml +20 -11
index c31e207d1652..eb904ac2f331 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
@@ -38,14 +40,11 @@ properties:
     minimum: 1
     maximum: 256
 
-  nvidia,slices:
-    $ref: /schemas/types.yaml#/definitions/uint32
+  nvidia,gpio-controller:
+    $ref: /schemas/types.yaml#/definitions/phandle
     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]
+      The phandle to AON gpio controller instance. This is required to handle
+      namespace conversion between GPIO and GTE.
 
   '#timestamp-cells':
     description:
@@ -59,9 +58,20 @@ required:
   - compatible
   - reg
   - interrupts
-  - nvidia,slices
   - "#timestamp-cells"
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - nvidia,tegra194-gte-aon
+              - nvidia,tegra234-gte-aon
+    then:
+      required:
+        - nvidia,gpio-controller
+
 additionalProperties: false
 
 examples:
@@ -71,7 +81,7 @@ examples:
               reg = <0xc1e0000 0x10000>;
               interrupts = <0 13 0x4>;
               nvidia,int-threshold = <1>;
-              nvidia,slices = <3>;
+              nvidia,gpio-controller = <&gpio_aon>;
               #timestamp-cells = <1>;
     };
 
@@ -81,7 +91,6 @@ examples:
               reg = <0x3aa0000 0x10000>;
               interrupts = <0 11 0x4>;
               nvidia,int-threshold = <1>;
-              nvidia,slices = <11>;
               #timestamp-cells = <1>;
     };
 
Signature · 1 line
2.17.1
#3 lore raw

Re: [PATCH V3 2/6] dt-bindings: timestamp: Add Tegra234 support

Quoted 21 lines · Dipen Patel

Added timestamp provider support for the Tegra234 in devicetree bindings. In addition, it addresses review comments from the previous review round as follows:
- Removes nvidia,slices property. This was not necessary as it is a constant value and can be hardcoded inside the driver code.
- Adds nvidia,gpio-controller property. This simplifies how GTE driver retrieves GPIO controller instance, see below explanation.

Without this property code would look like:
if (of_device_is_compatible(dev->of_node, "nvidia,tegra194-gte-aon"))

	hte_dev->c = gpiochip_find("tegra194-gpio-aon",
				   tegra_get_gpiochip_from_name);
else if (of_device_is_compatible(dev->of_node, "nvidia,tegra234-gte-aon"))
	hte_dev->c = gpiochip_find("tegra234-gpio-aon",
				   tegra_get_gpiochip_from_name);
else
	return -ENODEV;

This means for every future addition of the compatible string, if else condition statements have to be expanded.

Quoted 7 lines

With the property:
gpio_ctrl = of_parse_phandle(dev->of_node, "nvidia,gpio-controller", 0);
....
hte_dev->c = gpiochip_find(gpio_ctrl, tegra_get_gpiochip_from_of_node);

We haven't technically started making use of these bindings, so backwards-compatibility shouldn't be an issue yet.

Unfortunately, I don't understand this statement. The nvidia,tegra194-gte-aon with removed property is in a released kernel v6.2. What does it mean "technically"? It's a released kernel thus it is a released ABI.

And since DTS always go to separate branch, your patch #4 breaks existing DTS (return -ENODEV;) - it is not bisectable.

Quoted 3 lines

---

Best regards,
Krzysztof

author maintainer
#4 lore raw

Re: [PATCH V3 2/6] dt-bindings: timestamp: Add Tegra234 support

Quoted 27 lines · Krzysztof Kozlowski
Quoted 26 lines · Dipen Patel

Added timestamp provider support for the Tegra234 in devicetree bindings. In addition, it addresses review comments from the previous review round as follows:
- Removes nvidia,slices property. This was not necessary as it is a constant value and can be hardcoded inside the driver code.
- Adds nvidia,gpio-controller property. This simplifies how GTE driver retrieves GPIO controller instance, see below explanation.

Without this property code would look like:
if (of_device_is_compatible(dev->of_node, "nvidia,tegra194-gte-aon"))

	hte_dev->c = gpiochip_find("tegra194-gpio-aon",
				   tegra_get_gpiochip_from_name);
else if (of_device_is_compatible(dev->of_node, "nvidia,tegra234-gte-aon"))
	hte_dev->c = gpiochip_find("tegra234-gpio-aon",
				   tegra_get_gpiochip_from_name);
else
	return -ENODEV;

This means for every future addition of the compatible string, if else condition statements have to be expanded.

With the property:
gpio_ctrl = of_parse_phandle(dev->of_node, "nvidia,gpio-controller", 0);
....
hte_dev->c = gpiochip_find(gpio_ctrl, tegra_get_gpiochip_from_of_node);

Quoted 7 lines
Quoted 2 lines

We haven't technically started making use of these bindings, so backwards-compatibility shouldn't be an issue yet.

Unfortunately, I don't understand this statement. The nvidia,tegra194-gte-aon with removed property is in a released kernel v6.2. What does it mean "technically"? It's a released kernel thus it is a released ABI.

There is no active user of that driver, so even if it breaks 6.2, it is fine as there is no one to complain about it.

Quoted 12 lines

And since DTS always go to separate branch, your patch #4 breaks existing DTS (return -ENODEV;) - it is not bisectable.

Quoted 3 lines

---

Best regards,
Krzysztof

#5 lore raw

Re: [PATCH V3 2/6] dt-bindings: timestamp: Add Tegra234 support

Quoted 31 lines · Dipen Patel
Quoted 30 lines · Krzysztof Kozlowski
Quoted 28 lines · Dipen Patel

Added timestamp provider support for the Tegra234 in devicetree bindings. In addition, it addresses review comments from the previous review round as follows:
- Removes nvidia,slices property. This was not necessary as it is a constant value and can be hardcoded inside the driver code.
- Adds nvidia,gpio-controller property. This simplifies how GTE driver retrieves GPIO controller instance, see below explanation.

Without this property code would look like:
if (of_device_is_compatible(dev->of_node, "nvidia,tegra194-gte-aon"))

	hte_dev->c = gpiochip_find("tegra194-gpio-aon",
				   tegra_get_gpiochip_from_name);
else if (of_device_is_compatible(dev->of_node, "nvidia,tegra234-gte-aon"))
	hte_dev->c = gpiochip_find("tegra234-gpio-aon",
				   tegra_get_gpiochip_from_name);
else
	return -ENODEV;

This means for every future addition of the compatible string, if else condition statements have to be expanded.

With the property:
gpio_ctrl = of_parse_phandle(dev->of_node, "nvidia,gpio-controller", 0);
....
hte_dev->c = gpiochip_find(gpio_ctrl, tegra_get_gpiochip_from_of_node);

We haven't technically started making use of these bindings, so backwards-compatibility shouldn't be an issue yet.

Quoted 7 lines
Quoted 4 lines

Unfortunately, I don't understand this statement. The nvidia,tegra194-gte-aon with removed property is in a released kernel v6.2. What does it mean "technically"? It's a released kernel thus it is a released ABI.

There is no active user of that driver, so even if it breaks 6.2, it is fine as there is no one to complain about it.

How do you know? It's a released kernel, thus how can you ask millions of people if they use it or not?

Best regards,
Krzysztof

author maintainer
#6 lore raw

Re: [PATCH V3 2/6] dt-bindings: timestamp: Add Tegra234 support

Quoted 37 lines · Krzysztof Kozlowski
Quoted 36 lines · Dipen Patel
Quoted 34 lines · Krzysztof Kozlowski
Quoted 21 lines · Dipen Patel

Added timestamp provider support for the Tegra234 in devicetree bindings. In addition, it addresses review comments from the previous review round as follows:
- Removes nvidia,slices property. This was not necessary as it is a constant value and can be hardcoded inside the driver code.
- Adds nvidia,gpio-controller property. This simplifies how GTE driver retrieves GPIO controller instance, see below explanation.

Without this property code would look like:
if (of_device_is_compatible(dev->of_node, "nvidia,tegra194-gte-aon"))

	hte_dev->c = gpiochip_find("tegra194-gpio-aon",
				   tegra_get_gpiochip_from_name);
else if (of_device_is_compatible(dev->of_node, "nvidia,tegra234-gte-aon"))
	hte_dev->c = gpiochip_find("tegra234-gpio-aon",
				   tegra_get_gpiochip_from_name);
else
	return -ENODEV;

This means for every future addition of the compatible string, if else condition statements have to be expanded.

Quoted 7 lines

With the property:
gpio_ctrl = of_parse_phandle(dev->of_node, "nvidia,gpio-controller", 0);
....
hte_dev->c = gpiochip_find(gpio_ctrl, tegra_get_gpiochip_from_of_node);

We haven't technically started making use of these bindings, so backwards-compatibility shouldn't be an issue yet.

Unfortunately, I don't understand this statement. The nvidia,tegra194-gte-aon with removed property is in a released kernel v6.2. What does it mean "technically"? It's a released kernel thus it is a released ABI.

Quoted 5 lines
Quoted 2 lines

There is no active user of that driver, so even if it breaks 6.2, it is fine as there is no one to complain about it.

How do you know? It's a released kernel, thus how can you ask millions of people if they use it or not?

Please help me understand, if I am targeting these set of changes for the kernel 6.4, wouldn't all the patches land on v6.4 at the same time no matter the tree it will go from? Also, if user is at v6.2, how this will break as at that version, it will have the old bindings and old driver, right?

Quoted 4 lines

Best regards,
Krzysztof

#7 lore raw

Re: [PATCH V3 2/6] dt-bindings: timestamp: Add Tegra234 support

Quoted 38 lines · Dipen Patel
Quoted 37 lines · Krzysztof Kozlowski
Quoted 36 lines · Dipen Patel
Quoted 34 lines · Krzysztof Kozlowski
Quoted 21 lines · Dipen Patel

Added timestamp provider support for the Tegra234 in devicetree bindings. In addition, it addresses review comments from the previous review round as follows:
- Removes nvidia,slices property. This was not necessary as it is a constant value and can be hardcoded inside the driver code.
- Adds nvidia,gpio-controller property. This simplifies how GTE driver retrieves GPIO controller instance, see below explanation.

Without this property code would look like:
if (of_device_is_compatible(dev->of_node, "nvidia,tegra194-gte-aon"))

	hte_dev->c = gpiochip_find("tegra194-gpio-aon",
				   tegra_get_gpiochip_from_name);
else if (of_device_is_compatible(dev->of_node, "nvidia,tegra234-gte-aon"))
	hte_dev->c = gpiochip_find("tegra234-gpio-aon",
				   tegra_get_gpiochip_from_name);
else
	return -ENODEV;

This means for every future addition of the compatible string, if else condition statements have to be expanded.

Quoted 7 lines

With the property:
gpio_ctrl = of_parse_phandle(dev->of_node, "nvidia,gpio-controller", 0);
....
hte_dev->c = gpiochip_find(gpio_ctrl, tegra_get_gpiochip_from_of_node);

We haven't technically started making use of these bindings, so backwards-compatibility shouldn't be an issue yet.

Unfortunately, I don't understand this statement. The nvidia,tegra194-gte-aon with removed property is in a released kernel v6.2. What does it mean "technically"? It's a released kernel thus it is a released ABI.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

There is no active user of that driver, so even if it breaks 6.2, it is fine as there is no one to complain about it.

How do you know? It's a released kernel, thus how can you ask millions of people if they use it or not?

Please help me understand, if I am targeting these set of changes for the kernel 6.4, wouldn't all the patches land on v6.4 at the same time no matter the tree it

No, that's not how we do things. Changes *must be bisectable* and *DTS always* goes to separate branch, so how do you ensure this in your current flow? I don't see it. The patch #4 should break the bisectability.

Quoted 2 lines

will go from? Also, if user is at v6.2, how this will break as at that version, it will have the old bindings and old driver, right?

Bindings define ABI. You defined them like this in v6.2 thus someone is using them:
1. In other systems, bootloaders, firmwares, SW.
2. via DTS written for v6.2 ABI. Newer kernel should not break existing DTS and we do not talk about in-kernel DTS, just like we do not talk about in-kernel user-space applications when using same argument for their compatibility.

Best regards,
Krzysztof

#8 lore raw

Re: [PATCH V3 2/6] dt-bindings: timestamp: Add Tegra234 support

In reply to Dipen Patel

Hi Dipen,

thanks for maintaining HTE!

Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml properties: · line 42

Quoted 2 lines · Dipen Patel
Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml +0 -2
-  nvidia,slices:
-     $ref: /schemas/types.yaml#/definitions/uint32

I would not delete this, just mark it deprecated.

nvidia,slices:
$ref: /schemas/types.yaml#/definitions/uint32
deprecated: true

(And remove it from required, of course)

This way you do not need to explain about why it was deleted, it's just deprecated, which is fine.

Yours,
Linus Walleij

author maintainer
#9 lore raw

Re: [PATCH V3 2/6] dt-bindings: timestamp: Add Tegra234 support

Quoted 11 lines · Linus Walleij

Hi Dipen,

thanks for maintaining HTE!

Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml properties: · line 42

Quoted 2 lines · Dipen Patel
Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml +0 -2
-  nvidia,slices:
-     $ref: /schemas/types.yaml#/definitions/uint32

I would not delete this, just mark it deprecated.

Quoted 8 lines

nvidia,slices:
$ref: /schemas/types.yaml#/definitions/uint32
deprecated: true

(And remove it from required, of course)

This way you do not need to explain about why it was deleted, it's just deprecated, which is fine.

Great suggestion, thanks, will make changes in the next patch.

Quoted 3 lines

Yours,
Linus Walleij

author maintainer
#10 lore raw

Re: [PATCH V3 2/6] dt-bindings: timestamp: Add Tegra234 support

Quoted 16 lines · Dipen Patel
Quoted 15 lines · Linus Walleij

Hi Dipen,

thanks for maintaining HTE!

Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml properties: · line 42

Quoted 2 lines · Dipen Patel
Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml +0 -2
-  nvidia,slices:
-     $ref: /schemas/types.yaml#/definitions/uint32

I would not delete this, just mark it deprecated.

nvidia,slices:
$ref: /schemas/types.yaml#/definitions/uint32
deprecated: true

Quoted 6 lines
Quoted 4 lines

(And remove it from required, of course)

This way you do not need to explain about why it was deleted, it's just deprecated, which is fine.

Great suggestion, thanks, will make changes in the next patch.

However, as I understood, current point of contention/discussion is addition of the nvidia,gpio-controller property.

Quoted 4 lines
Quoted 3 lines

Yours,
Linus Walleij

#11 lore raw

Re: [PATCH V3 2/6] dt-bindings: timestamp: Add Tegra234 support

Quoted 2 lines · Dipen Patel

However, as I understood, current point of contention/discussion is addition of the nvidia,gpio-controller property.

No I think you are talking past each other. Krzysztof talks about a "removed property":

Quoted 4 lines

Unfortunately, I don't understand this statement. The nvidia,tegra194-gte-aon with removed property is in a released kernel v6.2. What does it mean "technically"? It's a released kernel thus it is a released ABI.

The only property you remove is nvidia,slices, so deprecate it instead, problem solved.

I don't think the added phandle is a problem, it can't cause backward compatibility issues since it is new.

Yours,
Linus Walleij

maintainer
#12 lore raw

Re: [PATCH V3 2/6] dt-bindings: timestamp: Add Tegra234 support

In reply to Dipen Patel
Quoted 16 lines · Dipen Patel
Quoted 15 lines · Linus Walleij

Hi Dipen,

thanks for maintaining HTE!

Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml properties: · line 42

Quoted 2 lines · Dipen Patel
Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml +0 -2
-  nvidia,slices:
-     $ref: /schemas/types.yaml#/definitions/uint32

I would not delete this, just mark it deprecated.

nvidia,slices:
$ref: /schemas/types.yaml#/definitions/uint32
deprecated: true

Quoted 6 lines
Quoted 4 lines

(And remove it from required, of course)

This way you do not need to explain about why it was deleted, it's just deprecated, which is fine.

Great suggestion, thanks, will make changes in the next patch.

When you deprecate it, please make this a separate patch because it is separate from adding Tegra234 support. Similarly you will want to have a separate patch to remove support of the property from the driver as well.

Jon

Signature · 1 line
nvpublic
author maintainer
#13 lore raw

PATCH v3 3/6 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
#14 lore raw

PATCH v3 4/6 hte: Add Tegra234 provider

In reply to Dipen Patel

This patch adds HTE provider support for the Tegra234 and reflects the changes made in the device tree as follow.
- Add slices field in the SoC specific structure
- Remove gpio chip find by name function instead make use of the phandle parsed from the DT node

---
v2:
- Changed how gpio_chip could be aquired for the mapping

v3:
- Renamed gpio_chip matching function
- Used of_node to fwnode field in gpio_chip matching function as data as gpio_chip struct does not have of_node member anymore.

 drivers/hte/hte-tegra194-test.c |   2 +-
 drivers/hte/hte-tegra194.c      | 152 ++++++++++++++++++++++++++++----
 2 files changed, 138 insertions(+), 16 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 +137 -15

214 lines not on this page · raw message

Signature · 1 line
2.17.1
#15 lore raw

Re: [PATCH V3 4/6] hte: Add Tegra234 provider

Quoted 7 lines · Dipen Patel

This patch adds HTE provider support for the Tegra234 and reflects the changes made in the device tree as follow.
- Add slices field in the SoC specific structure
- Remove gpio chip find by name function instead make use of the phandle parsed from the DT node

(...)

Quoted 4 lines
drivers/hte/hte-tegra194.c +0 -0
 	hte_dev->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(hte_dev->regs))
 		return PTR_ERR(hte_dev->regs);

drivers/hte/hte-tegra194.c static int tegra_hte_probe(struct platform_device *pdev) · line 757

Quoted 10 lines
drivers/hte/hte-tegra194.c +5 -2
@@ -635,8 +750,15 @@ static int tegra_hte_probe(struct platform_device *pdev)
 
 		gc->match_from_linedata = tegra_hte_match_from_linedata;
 
-		hte_dev->c = gpiochip_find("tegra194-gpio-aon",
-					   tegra_get_gpiochip_from_name);
+		gpio_ctrl = of_parse_phandle(dev->of_node,
+					     "nvidia,gpio-controller", 0);
+		if (!gpio_ctrl) {
+			dev_err(dev, "gpio controller node not found\n");
+			return -ENODEV;

This is non-bisectable patchset. Remember that DTS cannot go with the code, thus your code should handle existing DTS (which is BTW already released with v6.2).

Any remarks to comments that no ABI was broken back then in 2022 are not valid now. They were valid that time, but sorry, the time passed.

Best regards,
Krzysztof

maintainer
#16 lore raw

Re: [PATCH V3 4/6] hte: Add Tegra234 provider

In reply to Dipen Patel
Quoted 5 lines · Dipen Patel

This patch adds HTE provider support for the Tegra234 and reflects the changes made in the device tree as follow.
- Add slices field in the SoC specific structure
- Remove gpio chip find by name function instead make use of the phandle parsed from the DT node

This patch appears to be 3 things. So this should be 3 patches.

Thanks!
Jon

Signature · 1 line
nvpublic
author maintainer
#17 lore raw

PATCH v3 5/6 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 14c872b6ad05..b904de0b1784 100644
@@ -1134,6 +1134,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
Acked-by on v3 5/6
#18 lore raw

Re: [PATCH V3 5/6] gpio: tegra186: Add Tegra234 hte support

Quoted 23 lines · 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 -1
index 14c872b6ad05..b904de0b1784 100644
@@ -1134,6 +1134,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)    \
--
Quoted 2 lines

2.17.1

author maintainer
#19 lore raw

PATCH v3 6/6 arm64: tegra: Add GTE nodes

In reply to Dipen Patel

Add GTE nodes for the tegra234. Also modify AON GTE nodes for the tegra194 to remove nvidia,slice property and add nvidia,gpio-controller property to specify AON GPIO controller node so that GTE driver can do namespace conversion between GPIO lines provided by the gpiolib framework and hardware timestamping engine subsystem.

---
 arch/arm64/boot/dts/nvidia/tegra194.dtsi |  3 +--
 arch/arm64/boot/dts/nvidia/tegra234.dtsi | 17 +++++++++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/nvidia/tegra194.dtsi +1 -2
index 133dbe5b429d..7065643af275 100644
@@ -1355,7 +1355,6 @@
 			reg = <0x0 0x3aa0000 0x0 0x10000>;
 			interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
 			nvidia,int-threshold = <1>;
-			nvidia,slices = <11>;
 			#timestamp-cells = <1>;
 			status = "okay";
 		};
@@ -1578,7 +1577,7 @@
 			reg = <0x0 0xc1e0000 0x0 0x10000>;
 			interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
 			nvidia,int-threshold = <1>;
-			nvidia,slices = <3>;
+			nvidia,gpio-controller = <&gpio_aon>;
 			#timestamp-cells = <1>;
 			status = "okay";
 		};
arch/arm64/boot/dts/nvidia/tegra234.dtsi +17 -0
index 8fe8eda7654d..54790c6b6a2c 100644
@@ -1156,6 +1156,14 @@
 			clock-names = "fuse";
 		};
 
+		hte_lic: hardware-timestamp@3aa0000 {
+			compatible = "nvidia,tegra234-gte-lic";
+			reg = <0x0 0x3aa0000 0x0 0x10000>;
+			interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
+			nvidia,int-threshold = <1>;
+			#timestamp-cells = <1>;
+		};
+
 		hsp_top0: hsp@3c00000 {
 			compatible = "nvidia,tegra234-hsp", "nvidia,tegra194-hsp";
 			reg = <0x0 0x03c00000 0x0 0xa0000>;
@@ -1673,6 +1681,15 @@
 			#mbox-cells = <2>;
 		};
 
+		hte_aon: hardware-timestamp@c1e0000 {
+			compatible = "nvidia,tegra234-gte-aon";
+			reg = <0x0 0xc1e0000 0x0 0x10000>;
+			interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
+			nvidia,int-threshold = <1>;
+			nvidia,gpio-controller = <&gpio_aon>;
+			#timestamp-cells = <1>;
+		};
+
 		gen2_i2c: i2c@c240000 {
 			compatible = "nvidia,tegra194-i2c";
 			reg = <0x0 0xc240000 0x0 0x100>;
Signature · 1 line
2.17.1