linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V4 00/10] Add Tegra234 HTE support
@ 2023-03-23  1:29 Dipen Patel
  2023-03-23  1:29 ` [PATCH V4 01/10] MAINTAINERS: Add HTE/timestamp subsystem details Dipen Patel
                   ` (9 more replies)
  0 siblings, 10 replies; 34+ messages in thread
From: Dipen Patel @ 2023-03-23  1:29 UTC (permalink / raw)
  To: thierry.reding, jonathanh, linux-kernel, linux-tegra, linux-gpio,
	linus.walleij, devicetree, linux-doc, robh+dt, timestamp,
	krzysztof.kozlowski+dt, brgl, corbet, gregkh
  Cc: Dipen Patel

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 without breaking the
Tegra194 provider. 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 provider code to address new dt binding for Tegra234
without breaking it for the Tegra194 chip. 

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

The V4 patch series:
- Logically divides dt binding and tegra HTE provider patches from v3
- Maintains backward compatibilty for the Tegra194

Dipen Patel (10):
  MAINTAINERS: Add HTE/timestamp subsystem details
  dt-bindings: timestamp: Add Tegra234 support
  dt-bindings: timestamp: Deprecate nvidia,slices property
  dt-bindings: timestamp: Add nvidia,gpio-controller
  arm64: tegra: Add Tegra234 GTE nodes
  hte: Re-phrase tegra API document
  hte: Add Tegra234 provider
  hte: Deprecate nvidia,slices property
  hte: handle nvidia,gpio-controller property
  gpio: tegra186: Add Tegra234 hte support

 .../timestamp/nvidia,tegra194-hte.yaml        |  46 ++++-
 Documentation/driver-api/hte/tegra194-hte.rst |  33 ++--
 MAINTAINERS                                   |   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                    | 167 ++++++++++++++++--
 7 files changed, 229 insertions(+), 40 deletions(-)


base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6
-- 
2.17.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH V4 01/10] MAINTAINERS: Add HTE/timestamp subsystem details
  2023-03-23  1:29 [PATCH V4 00/10] Add Tegra234 HTE support Dipen Patel
@ 2023-03-23  1:29 ` Dipen Patel
  2023-03-23  1:29 ` [PATCH V4 02/10] dt-bindings: timestamp: Add Tegra234 support Dipen Patel
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 34+ messages in thread
From: Dipen Patel @ 2023-03-23  1:29 UTC (permalink / raw)
  To: thierry.reding, jonathanh, linux-kernel, linux-tegra, linux-gpio,
	linus.walleij, devicetree, linux-doc, robh+dt, timestamp,
	krzysztof.kozlowski+dt, brgl, corbet, gregkh
  Cc: Dipen Patel

Add tree, mailing list and patchwork details.

Signed-off-by: Dipen Patel <dipenp@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
---
 MAINTAINERS | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 8d5bc223f305..65b58963f0d2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9425,6 +9425,9 @@ F:	drivers/input/touchscreen/htcpen.c
 
 HTE SUBSYSTEM
 M:	Dipen Patel <dipenp@nvidia.com>
+L:	timestamp@lists.linux.dev
+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/
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH V4 02/10] dt-bindings: timestamp: Add Tegra234 support
  2023-03-23  1:29 [PATCH V4 00/10] Add Tegra234 HTE support Dipen Patel
  2023-03-23  1:29 ` [PATCH V4 01/10] MAINTAINERS: Add HTE/timestamp subsystem details Dipen Patel
@ 2023-03-23  1:29 ` Dipen Patel
  2023-03-25 11:04   ` Krzysztof Kozlowski
  2023-03-25 11:06   ` Krzysztof Kozlowski
  2023-03-23  1:29 ` [PATCH V4 03/10] dt-bindings: timestamp: Deprecate nvidia,slices property Dipen Patel
                   ` (7 subsequent siblings)
  9 siblings, 2 replies; 34+ messages in thread
From: Dipen Patel @ 2023-03-23  1:29 UTC (permalink / raw)
  To: thierry.reding, jonathanh, linux-kernel, linux-tegra, linux-gpio,
	linus.walleij, devicetree, linux-doc, robh+dt, timestamp,
	krzysztof.kozlowski+dt, brgl, corbet, gregkh
  Cc: Dipen Patel

Added timestamp provider support for the Tegra234 in devicetree
bindings.

Signed-off-by: Dipen Patel <dipenp@nvidia.com>
---
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

v4:
- Logically divide the v3 patch as follows
- Created Tegra234 support patch
- Created depracate nvidia,slices property patch
- Created addition of the nvidia,gpio-controller property patch

 .../timestamp/nvidia,tegra194-hte.yaml        | 44 +++++++++++++++++--
 1 file changed, 40 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
index c31e207d1652..158dbe58c49f 100644
--- a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
+++ b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
@@ -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 <dipenp@nvidia.com>
@@ -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
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH V4 03/10] dt-bindings: timestamp: Deprecate nvidia,slices property
  2023-03-23  1:29 [PATCH V4 00/10] Add Tegra234 HTE support Dipen Patel
  2023-03-23  1:29 ` [PATCH V4 01/10] MAINTAINERS: Add HTE/timestamp subsystem details Dipen Patel
  2023-03-23  1:29 ` [PATCH V4 02/10] dt-bindings: timestamp: Add Tegra234 support Dipen Patel
@ 2023-03-23  1:29 ` Dipen Patel
  2023-03-23  8:34   ` Linus Walleij
  2023-03-25 11:05   ` Krzysztof Kozlowski
  2023-03-23  1:29 ` [PATCH V4 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller Dipen Patel
                   ` (6 subsequent siblings)
  9 siblings, 2 replies; 34+ messages in thread
From: Dipen Patel @ 2023-03-23  1:29 UTC (permalink / raw)
  To: thierry.reding, jonathanh, linux-kernel, linux-tegra, linux-gpio,
	linus.walleij, devicetree, linux-doc, robh+dt, timestamp,
	krzysztof.kozlowski+dt, brgl, corbet, gregkh
  Cc: Dipen Patel

The property is not necessary as it is a constant value and can be
hardcoded in the driver code.

Signed-off-by: Dipen Patel <dipenp@nvidia.com>
---
 .../timestamp/nvidia,tegra194-hte.yaml        | 43 ++-----------------
 1 file changed, 4 insertions(+), 39 deletions(-)

diff --git a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
index 158dbe58c49f..eafc33e9ae2e 100644
--- a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
+++ b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
@@ -42,10 +42,13 @@ properties:
 
   nvidia,slices:
     $ref: /schemas/types.yaml#/definitions/uint32
+    deprecated: true
     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 the value depends on the HTE instance in the chip.
+      property and the value depends on the HTE instance in the chip. The AON
+      GTE instances for both Tegra194 and Tegra234 has 3 slices. The Tegra194
+      LIC instance has 11 slices and Tegra234 LIC has 17 slices.
     enum: [3, 11, 17]
 
   '#timestamp-cells':
@@ -56,46 +59,10 @@ 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
   - interrupts
-  - nvidia,slices
   - "#timestamp-cells"
 
 additionalProperties: false
@@ -107,7 +74,6 @@ examples:
               reg = <0xc1e0000 0x10000>;
               interrupts = <0 13 0x4>;
               nvidia,int-threshold = <1>;
-              nvidia,slices = <3>;
               #timestamp-cells = <1>;
     };
 
@@ -117,7 +83,6 @@ examples:
               reg = <0x3aa0000 0x10000>;
               interrupts = <0 11 0x4>;
               nvidia,int-threshold = <1>;
-              nvidia,slices = <11>;
               #timestamp-cells = <1>;
     };
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH V4 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller
  2023-03-23  1:29 [PATCH V4 00/10] Add Tegra234 HTE support Dipen Patel
                   ` (2 preceding siblings ...)
  2023-03-23  1:29 ` [PATCH V4 03/10] dt-bindings: timestamp: Deprecate nvidia,slices property Dipen Patel
@ 2023-03-23  1:29 ` Dipen Patel
  2023-03-23  8:36   ` Linus Walleij
                     ` (3 more replies)
  2023-03-23  1:29 ` [PATCH V4 05/10] arm64: tegra: Add Tegra234 GTE nodes Dipen Patel
                   ` (5 subsequent siblings)
  9 siblings, 4 replies; 34+ messages in thread
From: Dipen Patel @ 2023-03-23  1:29 UTC (permalink / raw)
  To: thierry.reding, jonathanh, linux-kernel, linux-tegra, linux-gpio,
	linus.walleij, devicetree, linux-doc, robh+dt, timestamp,
	krzysztof.kozlowski+dt, brgl, corbet, gregkh
  Cc: Dipen Patel

Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards.
This is done to help below case.

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);

This simplifies the code significantly. The introdunction of this
property/binding does not break existing Tegra194 provider driver.

Signed-off-by: Dipen Patel <dipenp@nvidia.com>
---
 .../timestamp/nvidia,tegra194-hte.yaml        | 31 +++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
index eafc33e9ae2e..841273a3d8ae 100644
--- a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
+++ b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
@@ -51,6 +51,12 @@ properties:
       LIC instance has 11 slices and Tegra234 LIC has 17 slices.
     enum: [3, 11, 17]
 
+  nvidia,gpio-controller:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      The phandle to AON gpio controller instance. This is required to handle
+      namespace conversion between GPIO and GTE.
+
   '#timestamp-cells':
     description:
       This represents number of line id arguments as specified by the
@@ -65,22 +71,43 @@ required:
   - interrupts
   - "#timestamp-cells"
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - nvidia,tegra234-gte-aon
+    then:
+      required:
+        - nvidia,gpio-controller
+
 additionalProperties: false
 
 examples:
   - |
     tegra_hte_aon: timestamp@c1e0000 {
               compatible = "nvidia,tegra194-gte-aon";
-              reg = <0xc1e0000 0x10000>;
+              reg = <0x0 0xc1e0000 0x0 0x10000>;
+              interrupts = <0 13 0x4>;
+              nvidia,int-threshold = <1>;
+              #timestamp-cells = <1>;
+    };
+
+  - |
+    tegra234_hte_aon: timestamp@c1e0000 {
+              compatible = "nvidia,tegra234-gte-aon";
+              reg = <0x0 0xc1e0000 0x0 0x10000>;
               interrupts = <0 13 0x4>;
               nvidia,int-threshold = <1>;
+              nvidia,gpio-controller = <&gpio_aon>;
               #timestamp-cells = <1>;
     };
 
   - |
     tegra_hte_lic: timestamp@3aa0000 {
               compatible = "nvidia,tegra194-gte-lic";
-              reg = <0x3aa0000 0x10000>;
+              reg = <0x0 0x3aa0000 0x0 0x10000>;
               interrupts = <0 11 0x4>;
               nvidia,int-threshold = <1>;
               #timestamp-cells = <1>;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH V4 05/10] arm64: tegra: Add Tegra234 GTE nodes
  2023-03-23  1:29 [PATCH V4 00/10] Add Tegra234 HTE support Dipen Patel
                   ` (3 preceding siblings ...)
  2023-03-23  1:29 ` [PATCH V4 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller Dipen Patel
@ 2023-03-23  1:29 ` Dipen Patel
  2023-03-23  1:29 ` [PATCH V4 06/10] hte: Re-phrase tegra API document Dipen Patel
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 34+ messages in thread
From: Dipen Patel @ 2023-03-23  1:29 UTC (permalink / raw)
  To: thierry.reding, jonathanh, linux-kernel, linux-tegra, linux-gpio,
	linus.walleij, devicetree, linux-doc, robh+dt, timestamp,
	krzysztof.kozlowski+dt, brgl, corbet, gregkh
  Cc: Dipen Patel

Add GTE LIC and AON GPIO nodes for the tegra234 SoC.

Signed-off-by: Dipen Patel <dipenp@nvidia.com>
---
 arch/arm64/boot/dts/nvidia/tegra234.dtsi | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
index 8fe8eda7654d..54790c6b6a2c 100644
--- a/arch/arm64/boot/dts/nvidia/tegra234.dtsi
+++ b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
@@ -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>;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH V4 06/10] hte: Re-phrase tegra API document
  2023-03-23  1:29 [PATCH V4 00/10] Add Tegra234 HTE support Dipen Patel
                   ` (4 preceding siblings ...)
  2023-03-23  1:29 ` [PATCH V4 05/10] arm64: tegra: Add Tegra234 GTE nodes Dipen Patel
@ 2023-03-23  1:29 ` Dipen Patel
  2023-04-05  2:24   ` Bagas Sanjaya
  2023-03-23  1:29 ` [PATCH V4 07/10] hte: Add Tegra234 provider Dipen Patel
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 34+ messages in thread
From: Dipen Patel @ 2023-03-23  1:29 UTC (permalink / raw)
  To: thierry.reding, jonathanh, linux-kernel, linux-tegra, linux-gpio,
	linus.walleij, devicetree, linux-doc, robh+dt, timestamp,
	krzysztof.kozlowski+dt, brgl, corbet, gregkh
  Cc: Dipen Patel

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

Signed-off-by: Dipen Patel <dipenp@nvidia.com>
---
 Documentation/driver-api/hte/tegra194-hte.rst | 33 +++++++++----------
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/Documentation/driver-api/hte/tegra194-hte.rst b/Documentation/driver-api/hte/tegra194-hte.rst
index f2d617265546..85e654772782 100644
--- a/Documentation/driver-api/hte/tegra194-hte.rst
+++ b/Documentation/driver-api/hte/tegra194-hte.rst
@@ -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
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH V4 07/10] hte: Add Tegra234 provider
  2023-03-23  1:29 [PATCH V4 00/10] Add Tegra234 HTE support Dipen Patel
                   ` (5 preceding siblings ...)
  2023-03-23  1:29 ` [PATCH V4 06/10] hte: Re-phrase tegra API document Dipen Patel
@ 2023-03-23  1:29 ` Dipen Patel
  2023-03-23  1:29 ` [PATCH V4 08/10] hte: Deprecate nvidia,slices property Dipen Patel
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 34+ messages in thread
From: Dipen Patel @ 2023-03-23  1:29 UTC (permalink / raw)
  To: thierry.reding, jonathanh, linux-kernel, linux-tegra, linux-gpio,
	linus.walleij, devicetree, linux-doc, robh+dt, timestamp,
	krzysztof.kozlowski+dt, brgl, corbet, gregkh
  Cc: Dipen Patel

The Tegra234 AON GPIO instance and LIC IRQ support HTE. For the GPIO
HTE support, it also requires to add mapping between GPIO and HTE
framework same as it was done with Tegra194 SoC.

Signed-off-by: Dipen Patel <dipenp@nvidia.com>
---
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.

v4:
- Logically divide the original v3 patch as follows
- Created this Tegra234 support patch
- Created deprecated nvidia,slices patch
- Created handle nvidia,gpio-controller patch

 drivers/hte/hte-tegra194-test.c |   2 +-
 drivers/hte/hte-tegra194.c      | 124 ++++++++++++++++++++++++++++++--
 2 files changed, 121 insertions(+), 5 deletions(-)

diff --git a/drivers/hte/hte-tegra194-test.c b/drivers/hte/hte-tegra194-test.c
index 5d776a185bd6..d79c28a80517 100644
--- a/drivers/hte/hte-tegra194-test.c
+++ b/drivers/hte/hte-tegra194-test.c
@@ -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
diff --git a/drivers/hte/hte-tegra194.c b/drivers/hte/hte-tegra194.c
index 49a27af22742..5d1f947db0f6 100644
--- a/drivers/hte/hte-tegra194.c
+++ b/drivers/hte/hte-tegra194.c
@@ -62,6 +62,10 @@
 #define NV_AON_HTE_SLICE2_IRQ_GPIO_25	25
 #define NV_AON_HTE_SLICE2_IRQ_GPIO_26	26
 #define NV_AON_HTE_SLICE2_IRQ_GPIO_27	27
+#define NV_AON_HTE_SLICE2_IRQ_GPIO_28	28
+#define NV_AON_HTE_SLICE2_IRQ_GPIO_29	29
+#define NV_AON_HTE_SLICE2_IRQ_GPIO_30	30
+#define NV_AON_HTE_SLICE2_IRQ_GPIO_31	31
 
 #define HTE_TECTRL		0x0
 #define HTE_TETSCH		0x4
@@ -220,7 +224,100 @@ static const struct tegra_hte_line_mapped tegra194_aon_gpio_sec_map[] = {
 	[39] = {NV_AON_SLICE_INVALID, 0},
 };
 
-static const struct tegra_hte_data aon_hte = {
+static const struct tegra_hte_line_mapped tegra234_aon_gpio_map[] = {
+	/* gpio, slice, bit_index */
+	/* AA port */
+	[0]  = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_11},
+	[1]  = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_10},
+	[2]  = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_9},
+	[3]  = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_8},
+	[4]  = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_7},
+	[5]  = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_6},
+	[6]  = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_5},
+	[7]  = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_4},
+	/* BB port */
+	[8]  = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_3},
+	[9]  = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_2},
+	[10] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_1},
+	[11] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_0},
+	/* CC port */
+	[12] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_22},
+	[13] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_21},
+	[14] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_20},
+	[15] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_19},
+	[16] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_18},
+	[17] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_17},
+	[18] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_16},
+	[19] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_15},
+	/* DD port */
+	[20] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_14},
+	[21] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_13},
+	[22] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_12},
+	/* EE port */
+	[23] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_31},
+	[24] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_30},
+	[25] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_29},
+	[26] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_28},
+	[27] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_27},
+	[28] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_26},
+	[29] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_25},
+	[30] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_24},
+	/* GG port */
+	[31] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_23},
+};
+
+static const struct tegra_hte_line_mapped tegra234_aon_gpio_sec_map[] = {
+	/* gpio, slice, bit_index */
+	/* AA port */
+	[0]  = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_11},
+	[1]  = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_10},
+	[2]  = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_9},
+	[3]  = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_8},
+	[4]  = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_7},
+	[5]  = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_6},
+	[6]  = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_5},
+	[7]  = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_4},
+	/* BB port */
+	[8]  = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_3},
+	[9]  = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_2},
+	[10] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_1},
+	[11] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_0},
+	[12] = {NV_AON_SLICE_INVALID, 0},
+	[13] = {NV_AON_SLICE_INVALID, 0},
+	[14] = {NV_AON_SLICE_INVALID, 0},
+	[15] = {NV_AON_SLICE_INVALID, 0},
+	/* CC port */
+	[16] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_22},
+	[17] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_21},
+	[18] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_20},
+	[19] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_19},
+	[20] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_18},
+	[21] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_17},
+	[22] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_16},
+	[23] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_15},
+	/* DD port */
+	[24] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_14},
+	[25] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_13},
+	[26] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_12},
+	[27] = {NV_AON_SLICE_INVALID, 0},
+	[28] = {NV_AON_SLICE_INVALID, 0},
+	[29] = {NV_AON_SLICE_INVALID, 0},
+	[30] = {NV_AON_SLICE_INVALID, 0},
+	[31] = {NV_AON_SLICE_INVALID, 0},
+	/* EE port */
+	[32] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_31},
+	[33] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_30},
+	[34] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_29},
+	[35] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_28},
+	[36] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_27},
+	[37] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_26},
+	[38] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_25},
+	[39] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_24},
+	/* GG port */
+	[40] = {2, NV_AON_HTE_SLICE2_IRQ_GPIO_23},
+};
+
+static const struct tegra_hte_data t194_aon_hte = {
 	.map_sz = ARRAY_SIZE(tegra194_aon_gpio_map),
 	.map = tegra194_aon_gpio_map,
 	.sec_map_sz = ARRAY_SIZE(tegra194_aon_gpio_sec_map),
@@ -228,6 +325,14 @@ static const struct tegra_hte_data aon_hte = {
 	.type = HTE_TEGRA_TYPE_GPIO,
 };
 
+static const struct tegra_hte_data t234_aon_hte = {
+	.map_sz = ARRAY_SIZE(tegra234_aon_gpio_map),
+	.map = tegra234_aon_gpio_map,
+	.sec_map_sz = ARRAY_SIZE(tegra234_aon_gpio_sec_map),
+	.sec_map = tegra234_aon_gpio_sec_map,
+	.type = HTE_TEGRA_TYPE_GPIO,
+};
+
 static const struct tegra_hte_data lic_hte = {
 	.map_sz = 0,
 	.map = NULL,
@@ -535,7 +640,9 @@ static bool tegra_hte_match_from_linedata(const struct hte_chip *chip,
 
 static const struct of_device_id tegra_hte_of_match[] = {
 	{ .compatible = "nvidia,tegra194-gte-lic", .data = &lic_hte},
-	{ .compatible = "nvidia,tegra194-gte-aon", .data = &aon_hte},
+	{ .compatible = "nvidia,tegra194-gte-aon", .data = &t194_aon_hte},
+	{ .compatible = "nvidia,tegra234-gte-lic", .data = &lic_hte},
+	{ .compatible = "nvidia,tegra234-gte-aon", .data = &t234_aon_hte},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, tegra_hte_of_match);
@@ -635,8 +742,17 @@ 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);
+		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;
+
 		if (!hte_dev->c)
 			return dev_err_probe(dev, -EPROBE_DEFER,
 					     "wait for gpio controller\n");
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH V4 08/10] hte: Deprecate nvidia,slices property
  2023-03-23  1:29 [PATCH V4 00/10] Add Tegra234 HTE support Dipen Patel
                   ` (6 preceding siblings ...)
  2023-03-23  1:29 ` [PATCH V4 07/10] hte: Add Tegra234 provider Dipen Patel
@ 2023-03-23  1:29 ` Dipen Patel
  2023-03-23  1:29 ` [PATCH V4 09/10] hte: handle nvidia,gpio-controller property Dipen Patel
  2023-03-23  1:29 ` [PATCH V4 10/10] gpio: tegra186: Add Tegra234 hte support Dipen Patel
  9 siblings, 0 replies; 34+ messages in thread
From: Dipen Patel @ 2023-03-23  1:29 UTC (permalink / raw)
  To: thierry.reding, jonathanh, linux-kernel, linux-tegra, linux-gpio,
	linus.walleij, devicetree, linux-doc, robh+dt, timestamp,
	krzysztof.kozlowski+dt, brgl, corbet, gregkh
  Cc: Dipen Patel

The relevant DT bindings deprecates nvidia,slices property from
Tegra234 SoC onwards, moving the slices value per SoC data structure
instead.

Signed-off-by: Dipen Patel <dipenp@nvidia.com>
---
 drivers/hte/hte-tegra194.c | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/drivers/hte/hte-tegra194.c b/drivers/hte/hte-tegra194.c
index 5d1f947db0f6..945c68c5e476 100644
--- a/drivers/hte/hte-tegra194.c
+++ b/drivers/hte/hte-tegra194.c
@@ -118,6 +118,7 @@ struct tegra_hte_line_data {
 
 struct tegra_hte_data {
 	enum tegra_hte_type type;
+	u32 slices;
 	u32 map_sz;
 	u32 sec_map_sz;
 	const struct tegra_hte_line_mapped *map;
@@ -323,6 +324,7 @@ static const struct tegra_hte_data t194_aon_hte = {
 	.sec_map_sz = ARRAY_SIZE(tegra194_aon_gpio_sec_map),
 	.sec_map = tegra194_aon_gpio_sec_map,
 	.type = HTE_TEGRA_TYPE_GPIO,
+	.slices = 3,
 };
 
 static const struct tegra_hte_data t234_aon_hte = {
@@ -331,12 +333,21 @@ static const struct tegra_hte_data t234_aon_hte = {
 	.sec_map_sz = ARRAY_SIZE(tegra234_aon_gpio_sec_map),
 	.sec_map = tegra234_aon_gpio_sec_map,
 	.type = HTE_TEGRA_TYPE_GPIO,
+	.slices = 3,
 };
 
-static const struct tegra_hte_data lic_hte = {
+static const struct tegra_hte_data t194_lic_hte = {
 	.map_sz = 0,
 	.map = NULL,
 	.type = HTE_TEGRA_TYPE_LIC,
+	.slices = 11,
+};
+
+static const struct tegra_hte_data t234_lic_hte = {
+	.map_sz = 0,
+	.map = NULL,
+	.type = HTE_TEGRA_TYPE_LIC,
+	.slices = 17,
 };
 
 static inline u32 tegra_hte_readl(struct tegra_hte_soc *hte, u32 reg)
@@ -639,9 +650,9 @@ static bool tegra_hte_match_from_linedata(const struct hte_chip *chip,
 }
 
 static const struct of_device_id tegra_hte_of_match[] = {
-	{ .compatible = "nvidia,tegra194-gte-lic", .data = &lic_hte},
+	{ .compatible = "nvidia,tegra194-gte-lic", .data = &t194_lic_hte},
 	{ .compatible = "nvidia,tegra194-gte-aon", .data = &t194_aon_hte},
-	{ .compatible = "nvidia,tegra234-gte-lic", .data = &lic_hte},
+	{ .compatible = "nvidia,tegra234-gte-lic", .data = &t234_lic_hte},
 	{ .compatible = "nvidia,tegra234-gte-aon", .data = &t234_aon_hte},
 	{ }
 };
@@ -679,13 +690,6 @@ static int tegra_hte_probe(struct platform_device *pdev)
 
 	dev = &pdev->dev;
 
-	ret = of_property_read_u32(dev->of_node, "nvidia,slices", &slices);
-	if (ret != 0) {
-		dev_err(dev, "Could not read slices\n");
-		return -EINVAL;
-	}
-	nlines = slices << 5;
-
 	hte_dev = devm_kzalloc(dev, sizeof(*hte_dev), GFP_KERNEL);
 	if (!hte_dev)
 		return -ENOMEM;
@@ -697,6 +701,13 @@ static int tegra_hte_probe(struct platform_device *pdev)
 	dev_set_drvdata(&pdev->dev, hte_dev);
 	hte_dev->prov_data = of_device_get_match_data(&pdev->dev);
 
+	ret = of_property_read_u32(dev->of_node, "nvidia,slices", &slices);
+	if (ret != 0)
+		slices = hte_dev->prov_data->slices;
+
+	dev_dbg(dev, "slices:%d\n", slices);
+	nlines = slices << 5;
+
 	hte_dev->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(hte_dev->regs))
 		return PTR_ERR(hte_dev->regs);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH V4 09/10] hte: handle nvidia,gpio-controller property
  2023-03-23  1:29 [PATCH V4 00/10] Add Tegra234 HTE support Dipen Patel
                   ` (7 preceding siblings ...)
  2023-03-23  1:29 ` [PATCH V4 08/10] hte: Deprecate nvidia,slices property Dipen Patel
@ 2023-03-23  1:29 ` Dipen Patel
  2023-03-23  8:37   ` Linus Walleij
  2023-03-23  1:29 ` [PATCH V4 10/10] gpio: tegra186: Add Tegra234 hte support Dipen Patel
  9 siblings, 1 reply; 34+ messages in thread
From: Dipen Patel @ 2023-03-23  1:29 UTC (permalink / raw)
  To: thierry.reding, jonathanh, linux-kernel, linux-tegra, linux-gpio,
	linus.walleij, devicetree, linux-doc, robh+dt, timestamp,
	krzysztof.kozlowski+dt, brgl, corbet, gregkh
  Cc: Dipen Patel

The dt binding adds nvidia,gpio-controller property from Tegra234 SoC
onwards to simplify code handling gpio chip search. The gpio chip search
is needed for the AON GPIO GTE instances to map the hardware timestamp
GPIO request (coming from the GPIO framework) to the tegra HTE
providers. The patch also adds new gpio chip match function to match
from the fwnode instead of the gpio controller label. The addition
of the property does not break ABI for the existing Tegra194 code.

Signed-off-by: Dipen Patel <dipenp@nvidia.com>
---
 drivers/hte/hte-tegra194.c | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/drivers/hte/hte-tegra194.c b/drivers/hte/hte-tegra194.c
index 945c68c5e476..2c485ff5be22 100644
--- a/drivers/hte/hte-tegra194.c
+++ b/drivers/hte/hte-tegra194.c
@@ -679,6 +679,11 @@ static int tegra_get_gpiochip_from_name(struct gpio_chip *chip, void *data)
 	return !strcmp(chip->label, data);
 }
 
+static int tegra_gpiochip_match(struct gpio_chip *chip, void *data)
+{
+	return chip->fwnode == of_node_to_fwnode(data);
+}
+
 static int tegra_hte_probe(struct platform_device *pdev)
 {
 	int ret;
@@ -687,6 +692,7 @@ static int tegra_hte_probe(struct platform_device *pdev)
 	struct device *dev;
 	struct tegra_hte_soc *hte_dev;
 	struct hte_chip *gc;
+	struct device_node *gpio_ctrl;
 
 	dev = &pdev->dev;
 
@@ -754,15 +760,23 @@ static int tegra_hte_probe(struct platform_device *pdev)
 		gc->match_from_linedata = tegra_hte_match_from_linedata;
 
 		if (of_device_is_compatible(dev->of_node,
-					    "nvidia,tegra194-gte-aon"))
+					    "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;
+		} else {
+			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;
+			}
+
+			hte_dev->c = gpiochip_find(gpio_ctrl,
+						   tegra_gpiochip_match);
+			of_node_put(gpio_ctrl);
+		}
 
 		if (!hte_dev->c)
 			return dev_err_probe(dev, -EPROBE_DEFER,
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH V4 10/10] gpio: tegra186: Add Tegra234 hte support
  2023-03-23  1:29 [PATCH V4 00/10] Add Tegra234 HTE support Dipen Patel
                   ` (8 preceding siblings ...)
  2023-03-23  1:29 ` [PATCH V4 09/10] hte: handle nvidia,gpio-controller property Dipen Patel
@ 2023-03-23  1:29 ` Dipen Patel
  2023-03-23  8:38   ` Linus Walleij
  9 siblings, 1 reply; 34+ messages in thread
From: Dipen Patel @ 2023-03-23  1:29 UTC (permalink / raw)
  To: thierry.reding, jonathanh, linux-kernel, linux-tegra, linux-gpio,
	linus.walleij, devicetree, linux-doc, robh+dt, timestamp,
	krzysztof.kozlowski+dt, brgl, corbet, gregkh
  Cc: Dipen Patel

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

Signed-off-by: Dipen Patel <dipenp@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/gpio/gpio-tegra186.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpio/gpio-tegra186.c b/drivers/gpio/gpio-tegra186.c
index 14c872b6ad05..b904de0b1784 100644
--- a/drivers/gpio/gpio-tegra186.c
+++ b/drivers/gpio/gpio-tegra186.c
@@ -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)	\
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH V4 03/10] dt-bindings: timestamp: Deprecate nvidia,slices property
  2023-03-23  1:29 ` [PATCH V4 03/10] dt-bindings: timestamp: Deprecate nvidia,slices property Dipen Patel
@ 2023-03-23  8:34   ` Linus Walleij
  2023-03-25 11:05   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 34+ messages in thread
From: Linus Walleij @ 2023-03-23  8:34 UTC (permalink / raw)
  To: Dipen Patel
  Cc: thierry.reding, jonathanh, linux-kernel, linux-tegra, linux-gpio,
	devicetree, linux-doc, robh+dt, timestamp,
	krzysztof.kozlowski+dt, brgl, corbet, gregkh

On Thu, Mar 23, 2023 at 2:29 AM Dipen Patel <dipenp@nvidia.com> wrote:

> The property is not necessary as it is a constant value and can be
> hardcoded in the driver code.
>
> Signed-off-by: Dipen Patel <dipenp@nvidia.com>

Looks completely reasonable to me!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH V4 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller
  2023-03-23  1:29 ` [PATCH V4 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller Dipen Patel
@ 2023-03-23  8:36   ` Linus Walleij
  2023-03-23 13:58   ` Rob Herring
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 34+ messages in thread
From: Linus Walleij @ 2023-03-23  8:36 UTC (permalink / raw)
  To: Dipen Patel
  Cc: thierry.reding, jonathanh, linux-kernel, linux-tegra, linux-gpio,
	devicetree, linux-doc, robh+dt, timestamp,
	krzysztof.kozlowski+dt, brgl, corbet, gregkh

On Thu, Mar 23, 2023 at 2:29 AM Dipen Patel <dipenp@nvidia.com> wrote:

> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards.
> This is done to help below case.
>
> 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);
>
> This simplifies the code significantly. The introdunction of this
> property/binding does not break existing Tegra194 provider driver.
>
> Signed-off-by: Dipen Patel <dipenp@nvidia.com>

It is fair to assume that other operating systems will need this too
so I interpret the commit message as an example of the issues
faced by anyone making a driver for this HW.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH V4 09/10] hte: handle nvidia,gpio-controller property
  2023-03-23  1:29 ` [PATCH V4 09/10] hte: handle nvidia,gpio-controller property Dipen Patel
@ 2023-03-23  8:37   ` Linus Walleij
  0 siblings, 0 replies; 34+ messages in thread
From: Linus Walleij @ 2023-03-23  8:37 UTC (permalink / raw)
  To: Dipen Patel
  Cc: thierry.reding, jonathanh, linux-kernel, linux-tegra, linux-gpio,
	devicetree, linux-doc, robh+dt, timestamp,
	krzysztof.kozlowski+dt, brgl, corbet, gregkh

On Thu, Mar 23, 2023 at 2:29 AM Dipen Patel <dipenp@nvidia.com> wrote:

> The dt binding adds nvidia,gpio-controller property from Tegra234 SoC
> onwards to simplify code handling gpio chip search. The gpio chip search
> is needed for the AON GPIO GTE instances to map the hardware timestamp
> GPIO request (coming from the GPIO framework) to the tegra HTE
> providers. The patch also adds new gpio chip match function to match
> from the fwnode instead of the gpio controller label. The addition
> of the property does not break ABI for the existing Tegra194 code.
>
> Signed-off-by: Dipen Patel <dipenp@nvidia.com>

Yups just like this!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH V4 10/10] gpio: tegra186: Add Tegra234 hte support
  2023-03-23  1:29 ` [PATCH V4 10/10] gpio: tegra186: Add Tegra234 hte support Dipen Patel
@ 2023-03-23  8:38   ` Linus Walleij
  0 siblings, 0 replies; 34+ messages in thread
From: Linus Walleij @ 2023-03-23  8:38 UTC (permalink / raw)
  To: Dipen Patel
  Cc: thierry.reding, jonathanh, linux-kernel, linux-tegra, linux-gpio,
	devicetree, linux-doc, robh+dt, timestamp,
	krzysztof.kozlowski+dt, brgl, corbet, gregkh

On Thu, Mar 23, 2023 at 2:29 AM Dipen Patel <dipenp@nvidia.com> wrote:

> To enable timestamp support for the Tegra234, has_gte variable needs
> to be set true.
>
> Signed-off-by: Dipen Patel <dipenp@nvidia.com>
> Acked-by: Thierry Reding <treding@nvidia.com>
> Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH V4 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller
  2023-03-23  1:29 ` [PATCH V4 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller Dipen Patel
  2023-03-23  8:36   ` Linus Walleij
@ 2023-03-23 13:58   ` Rob Herring
  2023-03-24 17:13   ` Rob Herring
  2023-03-25 11:07   ` Krzysztof Kozlowski
  3 siblings, 0 replies; 34+ messages in thread
From: Rob Herring @ 2023-03-23 13:58 UTC (permalink / raw)
  To: Dipen Patel
  Cc: brgl, devicetree, timestamp, linux-doc, corbet, jonathanh,
	krzysztof.kozlowski+dt, gregkh, linux-gpio, robh+dt,
	thierry.reding, linux-kernel, linux-tegra, linus.walleij


On Wed, 22 Mar 2023 18:29:23 -0700, Dipen Patel wrote:
> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards.
> This is done to help below case.
> 
> 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);
> 
> This simplifies the code significantly. The introdunction of this
> property/binding does not break existing Tegra194 provider driver.
> 
> Signed-off-by: Dipen Patel <dipenp@nvidia.com>
> ---
>  .../timestamp/nvidia,tegra194-hte.yaml        | 31 +++++++++++++++++--
>  1 file changed, 29 insertions(+), 2 deletions(-)
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.example.dtb: timestamp@c1e0000: reg: [[0, 203292672], [0, 65536]] is too long
	From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.example.dtb: timestamp@c1e0000: reg: [[0, 203292672], [0, 65536]] is too long
	From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.example.dtb: timestamp@3aa0000: reg: [[0, 61472768], [0, 65536]] is too long
	From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20230323012929.10815-5-dipenp@nvidia.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH V4 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller
  2023-03-23  1:29 ` [PATCH V4 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller Dipen Patel
  2023-03-23  8:36   ` Linus Walleij
  2023-03-23 13:58   ` Rob Herring
@ 2023-03-24 17:13   ` Rob Herring
  2023-03-24 18:51     ` Dipen Patel
  2023-03-25 11:07   ` Krzysztof Kozlowski
  3 siblings, 1 reply; 34+ messages in thread
From: Rob Herring @ 2023-03-24 17:13 UTC (permalink / raw)
  To: Dipen Patel
  Cc: thierry.reding, jonathanh, linux-kernel, linux-tegra, linux-gpio,
	linus.walleij, devicetree, linux-doc, timestamp,
	krzysztof.kozlowski+dt, brgl, corbet, gregkh

On Wed, Mar 22, 2023 at 06:29:23PM -0700, Dipen Patel wrote:
> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards.
> This is done to help below case.
> 
> 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;

Or you just put the name in match data.

> 
> 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);
> 
> This simplifies the code significantly. The introdunction of this

typo 

> property/binding does not break existing Tegra194 provider driver.

Making a new property required is an ABI break.

> Signed-off-by: Dipen Patel <dipenp@nvidia.com>
> ---
>  .../timestamp/nvidia,tegra194-hte.yaml        | 31 +++++++++++++++++--
>  1 file changed, 29 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
> index eafc33e9ae2e..841273a3d8ae 100644
> --- a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
> +++ b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
> @@ -51,6 +51,12 @@ properties:
>        LIC instance has 11 slices and Tegra234 LIC has 17 slices.
>      enum: [3, 11, 17]
>  
> +  nvidia,gpio-controller:
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    description:
> +      The phandle to AON gpio controller instance. This is required to handle
> +      namespace conversion between GPIO and GTE.

Explain what the GPIO controller is needed for rather than how this 
changes the driver.

> +
>    '#timestamp-cells':
>      description:
>        This represents number of line id arguments as specified by the
> @@ -65,22 +71,43 @@ required:
>    - interrupts
>    - "#timestamp-cells"
>  
> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - nvidia,tegra234-gte-aon
> +    then:
> +      required:
> +        - nvidia,gpio-controller

> +
>  additionalProperties: false
>  
>  examples:
>    - |
>      tegra_hte_aon: timestamp@c1e0000 {
>                compatible = "nvidia,tegra194-gte-aon";
> -              reg = <0xc1e0000 0x10000>;
> +              reg = <0x0 0xc1e0000 0x0 0x10000>;
> +              interrupts = <0 13 0x4>;
> +              nvidia,int-threshold = <1>;
> +              #timestamp-cells = <1>;
> +    };
> +
> +  - |
> +    tegra234_hte_aon: timestamp@c1e0000 {
> +              compatible = "nvidia,tegra234-gte-aon";
> +              reg = <0x0 0xc1e0000 0x0 0x10000>;
>                interrupts = <0 13 0x4>;
>                nvidia,int-threshold = <1>;
> +              nvidia,gpio-controller = <&gpio_aon>;
>                #timestamp-cells = <1>;
>      };
>  
>    - |
>      tegra_hte_lic: timestamp@3aa0000 {
>                compatible = "nvidia,tegra194-gte-lic";
> -              reg = <0x3aa0000 0x10000>;
> +              reg = <0x0 0x3aa0000 0x0 0x10000>;
>                interrupts = <0 11 0x4>;
>                nvidia,int-threshold = <1>;
>                #timestamp-cells = <1>;
> -- 
> 2.17.1
> 

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH V4 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller
  2023-03-24 17:13   ` Rob Herring
@ 2023-03-24 18:51     ` Dipen Patel
  2023-03-25 11:09       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 34+ messages in thread
From: Dipen Patel @ 2023-03-24 18:51 UTC (permalink / raw)
  To: Rob Herring
  Cc: thierry.reding, jonathanh, linux-kernel, linux-tegra, linux-gpio,
	linus.walleij, devicetree, linux-doc, timestamp,
	krzysztof.kozlowski+dt, brgl, corbet, gregkh

On 3/24/23 10:13 AM, Rob Herring wrote:
> On Wed, Mar 22, 2023 at 06:29:23PM -0700, Dipen Patel wrote:
>> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards.
>> This is done to help below case.
>>
>> 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;
> 
> Or you just put the name in match data.

Not sure I have understood this comment, but "name" the first argument is
already there to supply to callback to match data. Also, this if else is
needed to know which "name" to provide.
> 
>>
>> 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);
>>
>> This simplifies the code significantly. The introdunction of this
> 
> typo

ACK...
> 
>> property/binding does not break existing Tegra194 provider driver.
> 
> Making a new property required is an ABI break.
The driver code for the Tegra194 binds by old binding and does not need
this new property, the relevant code is part of this patch series.
> 
>> Signed-off-by: Dipen Patel <dipenp@nvidia.com>
>> ---
>>  .../timestamp/nvidia,tegra194-hte.yaml        | 31 +++++++++++++++++--
>>  1 file changed, 29 insertions(+), 2 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
>> index eafc33e9ae2e..841273a3d8ae 100644
>> --- a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
>> +++ b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
>> @@ -51,6 +51,12 @@ properties:
>>        LIC instance has 11 slices and Tegra234 LIC has 17 slices.
>>      enum: [3, 11, 17]
>>  
>> +  nvidia,gpio-controller:
>> +    $ref: /schemas/types.yaml#/definitions/phandle
>> +    description:
>> +      The phandle to AON gpio controller instance. This is required to handle
>> +      namespace conversion between GPIO and GTE.
> 
> Explain what the GPIO controller is needed for rather than how this 
> changes the driver.
Doesn't "This is required..." statement addresses why GPIO controller is needed
for part? Or do you want detail explanation which is already part of the commit?
> 
>> +
>>    '#timestamp-cells':
>>      description:
>>        This represents number of line id arguments as specified by the
>> @@ -65,22 +71,43 @@ required:
>>    - interrupts
>>    - "#timestamp-cells"
>>  
>> +allOf:
>> +  - if:
>> +      properties:
>> +        compatible:
>> +          contains:
>> +            enum:
>> +              - nvidia,tegra234-gte-aon
>> +    then:
>> +      required:
>> +        - nvidia,gpio-controller
> 
>> +
>>  additionalProperties: false
>>  
>>  examples:
>>    - |
>>      tegra_hte_aon: timestamp@c1e0000 {
>>                compatible = "nvidia,tegra194-gte-aon";
>> -              reg = <0xc1e0000 0x10000>;
>> +              reg = <0x0 0xc1e0000 0x0 0x10000>;
>> +              interrupts = <0 13 0x4>;
>> +              nvidia,int-threshold = <1>;
>> +              #timestamp-cells = <1>;
>> +    };
>> +
>> +  - |
>> +    tegra234_hte_aon: timestamp@c1e0000 {
>> +              compatible = "nvidia,tegra234-gte-aon";
>> +              reg = <0x0 0xc1e0000 0x0 0x10000>;
>>                interrupts = <0 13 0x4>;
>>                nvidia,int-threshold = <1>;
>> +              nvidia,gpio-controller = <&gpio_aon>;
>>                #timestamp-cells = <1>;
>>      };
>>  
>>    - |
>>      tegra_hte_lic: timestamp@3aa0000 {
>>                compatible = "nvidia,tegra194-gte-lic";
>> -              reg = <0x3aa0000 0x10000>;
>> +              reg = <0x0 0x3aa0000 0x0 0x10000>;
>>                interrupts = <0 11 0x4>;
>>                nvidia,int-threshold = <1>;
>>                #timestamp-cells = <1>;
>> -- 
>> 2.17.1
>>


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH V4 02/10] dt-bindings: timestamp: Add Tegra234 support
  2023-03-23  1:29 ` [PATCH V4 02/10] dt-bindings: timestamp: Add Tegra234 support Dipen Patel
@ 2023-03-25 11:04   ` Krzysztof Kozlowski
  2023-03-25 11:06   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-03-25 11:04 UTC (permalink / raw)
  To: Dipen Patel, thierry.reding, jonathanh, linux-kernel,
	linux-tegra, linux-gpio, linus.walleij, devicetree, linux-doc,
	robh+dt, timestamp, krzysztof.kozlowski+dt, brgl, corbet, gregkh

On 23/03/2023 02:29, Dipen Patel wrote:
> Added timestamp provider support for the Tegra234 in devicetree
> bindings.
> 
> Signed-off-by: Dipen Patel <dipenp@nvidia.com>
> ---
> v2:

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH V4 03/10] dt-bindings: timestamp: Deprecate nvidia,slices property
  2023-03-23  1:29 ` [PATCH V4 03/10] dt-bindings: timestamp: Deprecate nvidia,slices property Dipen Patel
  2023-03-23  8:34   ` Linus Walleij
@ 2023-03-25 11:05   ` Krzysztof Kozlowski
  2023-04-03 18:49     ` Dipen Patel
  1 sibling, 1 reply; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-03-25 11:05 UTC (permalink / raw)
  To: Dipen Patel, thierry.reding, jonathanh, linux-kernel,
	linux-tegra, linux-gpio, linus.walleij, devicetree, linux-doc,
	robh+dt, timestamp, krzysztof.kozlowski+dt, brgl, corbet, gregkh

On 23/03/2023 02:29, Dipen Patel wrote:
> The property is not necessary as it is a constant value and can be
> hardcoded in the driver code.
> 
> Signed-off-by: Dipen Patel <dipenp@nvidia.com>
> ---
>  .../timestamp/nvidia,tegra194-hte.yaml        | 43 ++-----------------
>  1 file changed, 4 insertions(+), 39 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
> index 158dbe58c49f..eafc33e9ae2e 100644
> --- a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
> +++ b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
> @@ -42,10 +42,13 @@ properties:
>  
>    nvidia,slices:
>      $ref: /schemas/types.yaml#/definitions/uint32
> +    deprecated: true
>      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 the value depends on the HTE instance in the chip.
> +      property and the value depends on the HTE instance in the chip. The AON
> +      GTE instances for both Tegra194 and Tegra234 has 3 slices. The Tegra194
> +      LIC instance has 11 slices and Tegra234 LIC has 17 slices.
>      enum: [3, 11, 17]
>  
>    '#timestamp-cells':
> @@ -56,46 +59,10 @@ 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

You just added this entire block in previous patch. Adding it there and
immediately removing does not make much sense.
> -



Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH V4 02/10] dt-bindings: timestamp: Add Tegra234 support
  2023-03-23  1:29 ` [PATCH V4 02/10] dt-bindings: timestamp: Add Tegra234 support Dipen Patel
  2023-03-25 11:04   ` Krzysztof Kozlowski
@ 2023-03-25 11:06   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-03-25 11:06 UTC (permalink / raw)
  To: Dipen Patel, thierry.reding, jonathanh, linux-kernel,
	linux-tegra, linux-gpio, linus.walleij, devicetree, linux-doc,
	robh+dt, timestamp, krzysztof.kozlowski+dt, brgl, corbet, gregkh

On 23/03/2023 02:29, Dipen Patel wrote:
> Added timestamp provider support for the Tegra234 in devicetree
> bindings.
> 
> Signed-off-by: Dipen Patel <dipenp@nvidia.com>
> ---
> 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
> 
> v4:
> - Logically divide the v3 patch as follows
> - Created Tegra234 support patch
> - Created depracate nvidia,slices property patch
> - Created addition of the nvidia,gpio-controller property patch
> 
>  .../timestamp/nvidia,tegra194-hte.yaml        | 44 +++++++++++++++++--
>  1 file changed, 40 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
> index c31e207d1652..158dbe58c49f 100644
> --- a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
> +++ b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
> @@ -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 <dipenp@nvidia.com>
> @@ -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
> +

... and looking at your next patch - unreviewed...

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH V4 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller
  2023-03-23  1:29 ` [PATCH V4 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller Dipen Patel
                     ` (2 preceding siblings ...)
  2023-03-24 17:13   ` Rob Herring
@ 2023-03-25 11:07   ` Krzysztof Kozlowski
  2023-03-27 16:58     ` Dipen Patel
  3 siblings, 1 reply; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-03-25 11:07 UTC (permalink / raw)
  To: Dipen Patel, thierry.reding, jonathanh, linux-kernel,
	linux-tegra, linux-gpio, linus.walleij, devicetree, linux-doc,
	robh+dt, timestamp, krzysztof.kozlowski+dt, brgl, corbet, gregkh

On 23/03/2023 02:29, Dipen Patel wrote:
> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards.
> This is done to help below case.
> 
> 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);
> 
> This simplifies the code significantly. The introdunction of this
> property/binding does not break existing Tegra194 provider driver.
> 
> Signed-off-by: Dipen Patel <dipenp@nvidia.com>
> ---
>  .../timestamp/nvidia,tegra194-hte.yaml        | 31 +++++++++++++++++--
>  1 file changed, 29 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
> index eafc33e9ae2e..841273a3d8ae 100644
> --- a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
> +++ b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
> @@ -51,6 +51,12 @@ properties:
>        LIC instance has 11 slices and Tegra234 LIC has 17 slices.
>      enum: [3, 11, 17]
>  
> +  nvidia,gpio-controller:
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    description:
> +      The phandle to AON gpio controller instance. This is required to handle
> +      namespace conversion between GPIO and GTE.
> +
>    '#timestamp-cells':
>      description:
>        This represents number of line id arguments as specified by the
> @@ -65,22 +71,43 @@ required:
>    - interrupts
>    - "#timestamp-cells"
>  
> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - nvidia,tegra234-gte-aon
> +    then:
> +      required:
> +        - nvidia,gpio-controller
> +
>  additionalProperties: false
>  
>  examples:
>    - |
>      tegra_hte_aon: timestamp@c1e0000 {
>                compatible = "nvidia,tegra194-gte-aon";
> -              reg = <0xc1e0000 0x10000>;
> +              reg = <0x0 0xc1e0000 0x0 0x10000>;

This is not really explained in commit msg... are you sure you tested it?


Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH V4 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller
  2023-03-24 18:51     ` Dipen Patel
@ 2023-03-25 11:09       ` Krzysztof Kozlowski
  2023-04-04  4:24         ` Dipen Patel
  0 siblings, 1 reply; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-03-25 11:09 UTC (permalink / raw)
  To: Dipen Patel, Rob Herring
  Cc: thierry.reding, jonathanh, linux-kernel, linux-tegra, linux-gpio,
	linus.walleij, devicetree, linux-doc, timestamp,
	krzysztof.kozlowski+dt, brgl, corbet, gregkh

On 24/03/2023 19:51, Dipen Patel wrote:
> On 3/24/23 10:13 AM, Rob Herring wrote:
>> On Wed, Mar 22, 2023 at 06:29:23PM -0700, Dipen Patel wrote:
>>> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards.
>>> This is done to help below case.
>>>
>>> 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;
>>
>> Or you just put the name in match data.
> 
> Not sure I have understood this comment, but "name" the first argument is
> already there to supply to callback to match data. Also, this if else is
> needed to know which "name" to provide.

The point is that of_device_is_compatible() do not really scale and make
code more difficult to read. Your variant-customization should in
general entirely come from match/driver data.


>>
>>>
>>> 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);
>>>
>>> This simplifies the code significantly. The introdunction of this
>>
>> typo
> 
> ACK...
>>
>>> property/binding does not break existing Tegra194 provider driver.
>>
>> Making a new property required is an ABI break.
> The driver code for the Tegra194 binds by old binding and does not need
> this new property, the relevant code is part of this patch series.
>>
>>> Signed-off-by: Dipen Patel <dipenp@nvidia.com>
>>> ---
>>>  .../timestamp/nvidia,tegra194-hte.yaml        | 31 +++++++++++++++++--
>>>  1 file changed, 29 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
>>> index eafc33e9ae2e..841273a3d8ae 100644
>>> --- a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
>>> +++ b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
>>> @@ -51,6 +51,12 @@ properties:
>>>        LIC instance has 11 slices and Tegra234 LIC has 17 slices.
>>>      enum: [3, 11, 17]
>>>  
>>> +  nvidia,gpio-controller:
>>> +    $ref: /schemas/types.yaml#/definitions/phandle
>>> +    description:
>>> +      The phandle to AON gpio controller instance. This is required to handle
>>> +      namespace conversion between GPIO and GTE.
>>
>> Explain what the GPIO controller is needed for rather than how this 
>> changes the driver.
> Doesn't "This is required..." statement addresses why GPIO controller is needed
> for part? Or do you want detail explanation which is already part of the commit?

Your bindings commit msg focused on driver and it is not really what it
should be about.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH V4 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller
  2023-03-25 11:07   ` Krzysztof Kozlowski
@ 2023-03-27 16:58     ` Dipen Patel
  2023-04-04 10:30       ` Thierry Reding
  0 siblings, 1 reply; 34+ messages in thread
From: Dipen Patel @ 2023-03-27 16:58 UTC (permalink / raw)
  To: Krzysztof Kozlowski, thierry.reding, jonathanh, linux-kernel,
	linux-tegra, linux-gpio, linus.walleij, devicetree, linux-doc,
	robh+dt, timestamp, krzysztof.kozlowski+dt, brgl, corbet, gregkh

On 3/25/23 4:07 AM, Krzysztof Kozlowski wrote:
> On 23/03/2023 02:29, Dipen Patel wrote:
>> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards.
>> This is done to help below case.
>>
>> 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);
>>
>> This simplifies the code significantly. The introdunction of this
>> property/binding does not break existing Tegra194 provider driver.
>>
>> Signed-off-by: Dipen Patel <dipenp@nvidia.com>
>> ---
>>  .../timestamp/nvidia,tegra194-hte.yaml        | 31 +++++++++++++++++--
>>  1 file changed, 29 insertions(+), 2 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
>> index eafc33e9ae2e..841273a3d8ae 100644
>> --- a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
>> +++ b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
>> @@ -51,6 +51,12 @@ properties:
>>        LIC instance has 11 slices and Tegra234 LIC has 17 slices.
>>      enum: [3, 11, 17]
>>  
>> +  nvidia,gpio-controller:
>> +    $ref: /schemas/types.yaml#/definitions/phandle
>> +    description:
>> +      The phandle to AON gpio controller instance. This is required to handle
>> +      namespace conversion between GPIO and GTE.
>> +
>>    '#timestamp-cells':
>>      description:
>>        This represents number of line id arguments as specified by the
>> @@ -65,22 +71,43 @@ required:
>>    - interrupts
>>    - "#timestamp-cells"
>>  
>> +allOf:
>> +  - if:
>> +      properties:
>> +        compatible:
>> +          contains:
>> +            enum:
>> +              - nvidia,tegra234-gte-aon
>> +    then:
>> +      required:
>> +        - nvidia,gpio-controller
>> +
>>  additionalProperties: false
>>  
>>  examples:
>>    - |
>>      tegra_hte_aon: timestamp@c1e0000 {
>>                compatible = "nvidia,tegra194-gte-aon";
>> -              reg = <0xc1e0000 0x10000>;
>> +              reg = <0x0 0xc1e0000 0x0 0x10000>;
> 
> This is not really explained in commit msg... are you sure you tested it?
I have to revert this part back in next patch as when I upgraded dtsschema it gave me errors.
> 
> 
> Best regards,
> Krzysztof
> 


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH V4 03/10] dt-bindings: timestamp: Deprecate nvidia,slices property
  2023-03-25 11:05   ` Krzysztof Kozlowski
@ 2023-04-03 18:49     ` Dipen Patel
  0 siblings, 0 replies; 34+ messages in thread
From: Dipen Patel @ 2023-04-03 18:49 UTC (permalink / raw)
  To: Krzysztof Kozlowski, thierry.reding, jonathanh, linux-kernel,
	linux-tegra, linux-gpio, linus.walleij, devicetree, linux-doc,
	robh+dt, timestamp, krzysztof.kozlowski+dt, brgl, corbet, gregkh

On 3/25/23 4:05 AM, Krzysztof Kozlowski wrote:
> On 23/03/2023 02:29, Dipen Patel wrote:
>> The property is not necessary as it is a constant value and can be
>> hardcoded in the driver code.
>>
>> Signed-off-by: Dipen Patel <dipenp@nvidia.com>
>> ---
>>  .../timestamp/nvidia,tegra194-hte.yaml        | 43 ++-----------------
>>  1 file changed, 4 insertions(+), 39 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
>> index 158dbe58c49f..eafc33e9ae2e 100644
>> --- a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
>> +++ b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
>> @@ -42,10 +42,13 @@ properties:
>>  
>>    nvidia,slices:
>>      $ref: /schemas/types.yaml#/definitions/uint32
>> +    deprecated: true
>>      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 the value depends on the HTE instance in the chip.
>> +      property and the value depends on the HTE instance in the chip. The AON
>> +      GTE instances for both Tegra194 and Tegra234 has 3 slices. The Tegra194
>> +      LIC instance has 11 slices and Tegra234 LIC has 17 slices.
>>      enum: [3, 11, 17]
>>  
>>    '#timestamp-cells':
>> @@ -56,46 +59,10 @@ 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
> 
> You just added this entire block in previous patch. Adding it there and
> immediately removing does not make much sense.
Yes, probably I should just keep that block in this patch as it is since
there is a deprecate field already introduced by this patch which should be enough. 

>> -
> 
> 
> 
> Best regards,
> Krzysztof
> 


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH V4 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller
  2023-03-25 11:09       ` Krzysztof Kozlowski
@ 2023-04-04  4:24         ` Dipen Patel
  2023-04-04  5:33           ` Krzysztof Kozlowski
  2023-04-04 10:28           ` Thierry Reding
  0 siblings, 2 replies; 34+ messages in thread
From: Dipen Patel @ 2023-04-04  4:24 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring
  Cc: thierry.reding, jonathanh, linux-kernel, linux-tegra, linux-gpio,
	linus.walleij, devicetree, linux-doc, timestamp,
	krzysztof.kozlowski+dt, brgl, corbet, gregkh

On 3/25/23 4:09 AM, Krzysztof Kozlowski wrote:
> On 24/03/2023 19:51, Dipen Patel wrote:
>> On 3/24/23 10:13 AM, Rob Herring wrote:
>>> On Wed, Mar 22, 2023 at 06:29:23PM -0700, Dipen Patel wrote:
>>>> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards.
>>>> This is done to help below case.
>>>>
>>>> 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;
>>>
>>> Or you just put the name in match data.
>>
>> Not sure I have understood this comment, but "name" the first argument is
>> already there to supply to callback to match data. Also, this if else is
>> needed to know which "name" to provide.
> 
> The point is that of_device_is_compatible() do not really scale and make
> code more difficult to read. Your variant-customization should in
> general entirely come from match/driver data.

Perhaps I should not have mentioned driver related details here about how
this property will help, that detail will go in driver patch. In the next
patch series I will remove this commit and just focus on what this property
is.
> 
> 
>>>
>>>>
>>>> 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);
>>>>
>>>> This simplifies the code significantly. The introdunction of this
>>>
>>> typo
>>
>> ACK...
>>>
>>>> property/binding does not break existing Tegra194 provider driver.
>>>
>>> Making a new property required is an ABI break.
>> The driver code for the Tegra194 binds by old binding and does not need
>> this new property, the relevant code is part of this patch series.
>>>
>>>> Signed-off-by: Dipen Patel <dipenp@nvidia.com>
>>>> ---
>>>>  .../timestamp/nvidia,tegra194-hte.yaml        | 31 +++++++++++++++++--
>>>>  1 file changed, 29 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
>>>> index eafc33e9ae2e..841273a3d8ae 100644
>>>> --- a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
>>>> +++ b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
>>>> @@ -51,6 +51,12 @@ properties:
>>>>        LIC instance has 11 slices and Tegra234 LIC has 17 slices.
>>>>      enum: [3, 11, 17]
>>>>  
>>>> +  nvidia,gpio-controller:
>>>> +    $ref: /schemas/types.yaml#/definitions/phandle
>>>> +    description:
>>>> +      The phandle to AON gpio controller instance. This is required to handle
>>>> +      namespace conversion between GPIO and GTE.
>>>
>>> Explain what the GPIO controller is needed for rather than how this 
>>> changes the driver.
>> Doesn't "This is required..." statement addresses why GPIO controller is needed
>> for part? Or do you want detail explanation which is already part of the commit?
> 
> Your bindings commit msg focused on driver and it is not really what it
> should be about.
ACK...
> 
> Best regards,
> Krzysztof
> 


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH V4 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller
  2023-04-04  4:24         ` Dipen Patel
@ 2023-04-04  5:33           ` Krzysztof Kozlowski
  2023-04-04 17:31             ` Dipen Patel
  2023-04-04 10:28           ` Thierry Reding
  1 sibling, 1 reply; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-04-04  5:33 UTC (permalink / raw)
  To: Dipen Patel, Rob Herring
  Cc: thierry.reding, jonathanh, linux-kernel, linux-tegra, linux-gpio,
	linus.walleij, devicetree, linux-doc, timestamp,
	krzysztof.kozlowski+dt, brgl, corbet, gregkh

On 04/04/2023 06:24, Dipen Patel wrote:
> On 3/25/23 4:09 AM, Krzysztof Kozlowski wrote:
>> On 24/03/2023 19:51, Dipen Patel wrote:
>>> On 3/24/23 10:13 AM, Rob Herring wrote:
>>>> On Wed, Mar 22, 2023 at 06:29:23PM -0700, Dipen Patel wrote:
>>>>> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards.
>>>>> This is done to help below case.
>>>>>
>>>>> 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;
>>>>
>>>> Or you just put the name in match data.
>>>
>>> Not sure I have understood this comment, but "name" the first argument is
>>> already there to supply to callback to match data. Also, this if else is
>>> needed to know which "name" to provide.
>>
>> The point is that of_device_is_compatible() do not really scale and make
>> code more difficult to read. Your variant-customization should in
>> general entirely come from match/driver data.
> 
> Perhaps I should not have mentioned driver related details here about how
> this property will help, that detail will go in driver patch. In the next
> patch series I will remove this commit and just focus on what this property
> is.

Regardless of this commit, driver match data is the way to go, not
of_device_is_compatible().



Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH V4 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller
  2023-04-04  4:24         ` Dipen Patel
  2023-04-04  5:33           ` Krzysztof Kozlowski
@ 2023-04-04 10:28           ` Thierry Reding
  2023-04-04 17:30             ` Dipen Patel
  1 sibling, 1 reply; 34+ messages in thread
From: Thierry Reding @ 2023-04-04 10:28 UTC (permalink / raw)
  To: Dipen Patel
  Cc: Krzysztof Kozlowski, Rob Herring, jonathanh, linux-kernel,
	linux-tegra, linux-gpio, linus.walleij, devicetree, linux-doc,
	timestamp, krzysztof.kozlowski+dt, brgl, corbet, gregkh

[-- Attachment #1: Type: text/plain, Size: 2010 bytes --]

On Mon, Apr 03, 2023 at 09:24:17PM -0700, Dipen Patel wrote:
> On 3/25/23 4:09 AM, Krzysztof Kozlowski wrote:
> > On 24/03/2023 19:51, Dipen Patel wrote:
> >> On 3/24/23 10:13 AM, Rob Herring wrote:
> >>> On Wed, Mar 22, 2023 at 06:29:23PM -0700, Dipen Patel wrote:
> >>>> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards.
> >>>> This is done to help below case.
> >>>>
> >>>> 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;
> >>>
> >>> Or you just put the name in match data.
> >>
> >> Not sure I have understood this comment, but "name" the first argument is
> >> already there to supply to callback to match data. Also, this if else is
> >> needed to know which "name" to provide.
> > 
> > The point is that of_device_is_compatible() do not really scale and make
> > code more difficult to read. Your variant-customization should in
> > general entirely come from match/driver data.
> 
> Perhaps I should not have mentioned driver related details here about how
> this property will help, that detail will go in driver patch. In the next
> patch series I will remove this commit and just focus on what this property
> is.

I think the point that Rob and Krzysztof are trying to make that rather
than adding a new property for this, we can add a const char *gpio field
to struct tegra_hte_data and then set that to the compatible string of
the GPIO controller that we need this for.

To be honest, I slightly prefer the explicit phandle reference, but it
also complicates things a bit and looking up by compatible string isn't
all that bad.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH V4 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller
  2023-03-27 16:58     ` Dipen Patel
@ 2023-04-04 10:30       ` Thierry Reding
  2023-04-04 17:20         ` Dipen Patel
  0 siblings, 1 reply; 34+ messages in thread
From: Thierry Reding @ 2023-04-04 10:30 UTC (permalink / raw)
  To: Dipen Patel
  Cc: Krzysztof Kozlowski, jonathanh, linux-kernel, linux-tegra,
	linux-gpio, linus.walleij, devicetree, linux-doc, robh+dt,
	timestamp, krzysztof.kozlowski+dt, brgl, corbet, gregkh

[-- Attachment #1: Type: text/plain, Size: 3434 bytes --]

On Mon, Mar 27, 2023 at 09:58:19AM -0700, Dipen Patel wrote:
> On 3/25/23 4:07 AM, Krzysztof Kozlowski wrote:
> > On 23/03/2023 02:29, Dipen Patel wrote:
> >> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards.
> >> This is done to help below case.
> >>
> >> 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);
> >>
> >> This simplifies the code significantly. The introdunction of this
> >> property/binding does not break existing Tegra194 provider driver.
> >>
> >> Signed-off-by: Dipen Patel <dipenp@nvidia.com>
> >> ---
> >>  .../timestamp/nvidia,tegra194-hte.yaml        | 31 +++++++++++++++++--
> >>  1 file changed, 29 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
> >> index eafc33e9ae2e..841273a3d8ae 100644
> >> --- a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
> >> +++ b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
> >> @@ -51,6 +51,12 @@ properties:
> >>        LIC instance has 11 slices and Tegra234 LIC has 17 slices.
> >>      enum: [3, 11, 17]
> >>  
> >> +  nvidia,gpio-controller:
> >> +    $ref: /schemas/types.yaml#/definitions/phandle
> >> +    description:
> >> +      The phandle to AON gpio controller instance. This is required to handle
> >> +      namespace conversion between GPIO and GTE.
> >> +
> >>    '#timestamp-cells':
> >>      description:
> >>        This represents number of line id arguments as specified by the
> >> @@ -65,22 +71,43 @@ required:
> >>    - interrupts
> >>    - "#timestamp-cells"
> >>  
> >> +allOf:
> >> +  - if:
> >> +      properties:
> >> +        compatible:
> >> +          contains:
> >> +            enum:
> >> +              - nvidia,tegra234-gte-aon
> >> +    then:
> >> +      required:
> >> +        - nvidia,gpio-controller
> >> +
> >>  additionalProperties: false
> >>  
> >>  examples:
> >>    - |
> >>      tegra_hte_aon: timestamp@c1e0000 {
> >>                compatible = "nvidia,tegra194-gte-aon";
> >> -              reg = <0xc1e0000 0x10000>;
> >> +              reg = <0x0 0xc1e0000 0x0 0x10000>;
> > 
> > This is not really explained in commit msg... are you sure you tested it?
> I have to revert this part back in next patch as when I upgraded dtsschema it gave me errors.

We need the 0x0 in the DTS files because we have #address-cells = <2>
and #size-tells = <2>. For the examples, those default to just 1 cell,
so this can't be an exact copy of what we have in the DTS files.

Please make sure to always validate the bindings and examples.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH V4 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller
  2023-04-04 10:30       ` Thierry Reding
@ 2023-04-04 17:20         ` Dipen Patel
  0 siblings, 0 replies; 34+ messages in thread
From: Dipen Patel @ 2023-04-04 17:20 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Krzysztof Kozlowski, jonathanh, linux-kernel, linux-tegra,
	linux-gpio, linus.walleij, devicetree, linux-doc, robh+dt,
	timestamp, krzysztof.kozlowski+dt, brgl, corbet, gregkh

On 4/4/23 3:30 AM, Thierry Reding wrote:
> On Mon, Mar 27, 2023 at 09:58:19AM -0700, Dipen Patel wrote:
>> On 3/25/23 4:07 AM, Krzysztof Kozlowski wrote:
>>> On 23/03/2023 02:29, Dipen Patel wrote:
>>>> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards.
>>>> This is done to help below case.
>>>>
>>>> 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);
>>>>
>>>> This simplifies the code significantly. The introdunction of this
>>>> property/binding does not break existing Tegra194 provider driver.
>>>>
>>>> Signed-off-by: Dipen Patel <dipenp@nvidia.com>
>>>> ---
>>>>  .../timestamp/nvidia,tegra194-hte.yaml        | 31 +++++++++++++++++--
>>>>  1 file changed, 29 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
>>>> index eafc33e9ae2e..841273a3d8ae 100644
>>>> --- a/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
>>>> +++ b/Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml
>>>> @@ -51,6 +51,12 @@ properties:
>>>>        LIC instance has 11 slices and Tegra234 LIC has 17 slices.
>>>>      enum: [3, 11, 17]
>>>>  
>>>> +  nvidia,gpio-controller:
>>>> +    $ref: /schemas/types.yaml#/definitions/phandle
>>>> +    description:
>>>> +      The phandle to AON gpio controller instance. This is required to handle
>>>> +      namespace conversion between GPIO and GTE.
>>>> +
>>>>    '#timestamp-cells':
>>>>      description:
>>>>        This represents number of line id arguments as specified by the
>>>> @@ -65,22 +71,43 @@ required:
>>>>    - interrupts
>>>>    - "#timestamp-cells"
>>>>  
>>>> +allOf:
>>>> +  - if:
>>>> +      properties:
>>>> +        compatible:
>>>> +          contains:
>>>> +            enum:
>>>> +              - nvidia,tegra234-gte-aon
>>>> +    then:
>>>> +      required:
>>>> +        - nvidia,gpio-controller
>>>> +
>>>>  additionalProperties: false
>>>>  
>>>>  examples:
>>>>    - |
>>>>      tegra_hte_aon: timestamp@c1e0000 {
>>>>                compatible = "nvidia,tegra194-gte-aon";
>>>> -              reg = <0xc1e0000 0x10000>;
>>>> +              reg = <0x0 0xc1e0000 0x0 0x10000>;
>>>
>>> This is not really explained in commit msg... are you sure you tested it?
>> I have to revert this part back in next patch as when I upgraded dtsschema it gave me errors.
> 
> We need the 0x0 in the DTS files because we have #address-cells = <2>
> and #size-tells = <2>. For the examples, those default to just 1 cell,
> so this can't be an exact copy of what we have in the DTS files.
> 
> Please make sure to always validate the bindings and examples.

Ack...
> 
> Thierry


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH V4 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller
  2023-04-04 10:28           ` Thierry Reding
@ 2023-04-04 17:30             ` Dipen Patel
  0 siblings, 0 replies; 34+ messages in thread
From: Dipen Patel @ 2023-04-04 17:30 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Krzysztof Kozlowski, Rob Herring, jonathanh, linux-kernel,
	linux-tegra, linux-gpio, linus.walleij, devicetree, linux-doc,
	timestamp, krzysztof.kozlowski+dt, brgl, corbet, gregkh

On 4/4/23 3:28 AM, Thierry Reding wrote:
> On Mon, Apr 03, 2023 at 09:24:17PM -0700, Dipen Patel wrote:
>> On 3/25/23 4:09 AM, Krzysztof Kozlowski wrote:
>>> On 24/03/2023 19:51, Dipen Patel wrote:
>>>> On 3/24/23 10:13 AM, Rob Herring wrote:
>>>>> On Wed, Mar 22, 2023 at 06:29:23PM -0700, Dipen Patel wrote:
>>>>>> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards.
>>>>>> This is done to help below case.
>>>>>>
>>>>>> 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;
>>>>>
>>>>> Or you just put the name in match data.
>>>>
>>>> Not sure I have understood this comment, but "name" the first argument is
>>>> already there to supply to callback to match data. Also, this if else is
>>>> needed to know which "name" to provide.
>>>
>>> The point is that of_device_is_compatible() do not really scale and make
>>> code more difficult to read. Your variant-customization should in
>>> general entirely come from match/driver data.
>>
>> Perhaps I should not have mentioned driver related details here about how
>> this property will help, that detail will go in driver patch. In the next
>> patch series I will remove this commit and just focus on what this property
>> is.
> 
> I think the point that Rob and Krzysztof are trying to make that rather
> than adding a new property for this, we can add a const char *gpio field
> to struct tegra_hte_data and then set that to the compatible string of
> the GPIO controller that we need this for.

This means it will have to track the label of the gpio controller and for each
new provider, we have to touch the driver to set the char *field. Also, I think
having gpio controller property in the DT presents/describes the tegra HTE provider
perfectly as it does have hard dependency on the tegra gpio controller.

> 
> To be honest, I slightly prefer the explicit phandle reference, but it
> also complicates things a bit and looking up by compatible string isn't
> all that bad.
> 
> Thierry


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH V4 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller
  2023-04-04  5:33           ` Krzysztof Kozlowski
@ 2023-04-04 17:31             ` Dipen Patel
  0 siblings, 0 replies; 34+ messages in thread
From: Dipen Patel @ 2023-04-04 17:31 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring
  Cc: thierry.reding, jonathanh, linux-kernel, linux-tegra, linux-gpio,
	linus.walleij, devicetree, linux-doc, timestamp,
	krzysztof.kozlowski+dt, brgl, corbet, gregkh

On 4/3/23 10:33 PM, Krzysztof Kozlowski wrote:
> On 04/04/2023 06:24, Dipen Patel wrote:
>> On 3/25/23 4:09 AM, Krzysztof Kozlowski wrote:
>>> On 24/03/2023 19:51, Dipen Patel wrote:
>>>> On 3/24/23 10:13 AM, Rob Herring wrote:
>>>>> On Wed, Mar 22, 2023 at 06:29:23PM -0700, Dipen Patel wrote:
>>>>>> Introducing nvidia,gpio-controller property from Tegra234 SoCs onwards.
>>>>>> This is done to help below case.
>>>>>>
>>>>>> 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;
>>>>>
>>>>> Or you just put the name in match data.
>>>>
>>>> Not sure I have understood this comment, but "name" the first argument is
>>>> already there to supply to callback to match data. Also, this if else is
>>>> needed to know which "name" to provide.
>>>
>>> The point is that of_device_is_compatible() do not really scale and make
>>> code more difficult to read. Your variant-customization should in
>>> general entirely come from match/driver data.
>>
>> Perhaps I should not have mentioned driver related details here about how
>> this property will help, that detail will go in driver patch. In the next
>> patch series I will remove this commit and just focus on what this property
>> is.
> 
> Regardless of this commit, driver match data is the way to go, not
> of_device_is_compatible().

I agree...

> 
> 
> 
> Best regards,
> Krzysztof
> 


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH V4 06/10] hte: Re-phrase tegra API document
  2023-03-23  1:29 ` [PATCH V4 06/10] hte: Re-phrase tegra API document Dipen Patel
@ 2023-04-05  2:24   ` Bagas Sanjaya
  2023-04-06  0:03     ` Dipen Patel
  0 siblings, 1 reply; 34+ messages in thread
From: Bagas Sanjaya @ 2023-04-05  2:24 UTC (permalink / raw)
  To: Dipen Patel, thierry.reding, jonathanh, linux-kernel,
	linux-tegra, linux-gpio, linus.walleij, devicetree, linux-doc,
	robh+dt, timestamp, krzysztof.kozlowski+dt, brgl, corbet, gregkh

On 3/23/23 08:29, Dipen Patel wrote:
> Make Tegra194 API document generic to make it applicable for
> current and future tegra hte providers.
> 
> Signed-off-by: Dipen Patel <dipenp@nvidia.com>
> ---
>  Documentation/driver-api/hte/tegra194-hte.rst | 33 +++++++++----------
>  1 file changed, 16 insertions(+), 17 deletions(-)
> 

While generalizing the doc, the doc file name should also be renamed
(i.e. to tegra-hte.rst).

> diff --git a/Documentation/driver-api/hte/tegra194-hte.rst b/Documentation/driver-api/hte/tegra194-hte.rst
> index f2d617265546..85e654772782 100644
> --- a/Documentation/driver-api/hte/tegra194-hte.rst
> +++ b/Documentation/driver-api/hte/tegra194-hte.rst
> @@ -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

The wording LGTM, thanks!

Reviewed-by: Bagas Sanjaya <bagasdotme@gmail.com>

-- 
An old man doll... just what I always wanted! - Clara


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH V4 06/10] hte: Re-phrase tegra API document
  2023-04-05  2:24   ` Bagas Sanjaya
@ 2023-04-06  0:03     ` Dipen Patel
  0 siblings, 0 replies; 34+ messages in thread
From: Dipen Patel @ 2023-04-06  0:03 UTC (permalink / raw)
  To: Bagas Sanjaya, thierry.reding, jonathanh, linux-kernel,
	linux-tegra, linux-gpio, linus.walleij, devicetree, linux-doc,
	robh+dt, timestamp, krzysztof.kozlowski+dt, brgl, corbet, gregkh

On 4/4/23 7:24 PM, Bagas Sanjaya wrote:
> On 3/23/23 08:29, Dipen Patel wrote:
>> Make Tegra194 API document generic to make it applicable for
>> current and future tegra hte providers.
>>
>> Signed-off-by: Dipen Patel <dipenp@nvidia.com>
>> ---
>>  Documentation/driver-api/hte/tegra194-hte.rst | 33 +++++++++----------
>>  1 file changed, 16 insertions(+), 17 deletions(-)
>>
> 
> While generalizing the doc, the doc file name should also be renamed
> (i.e. to tegra-hte.rst).

make sense, I will do rename it in the next patch series.
> 
>> diff --git a/Documentation/driver-api/hte/tegra194-hte.rst b/Documentation/driver-api/hte/tegra194-hte.rst
>> index f2d617265546..85e654772782 100644
>> --- a/Documentation/driver-api/hte/tegra194-hte.rst
>> +++ b/Documentation/driver-api/hte/tegra194-hte.rst
>> @@ -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
> 
> The wording LGTM, thanks!
> 
> Reviewed-by: Bagas Sanjaya <bagasdotme@gmail.com>
> 


^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2023-04-06  0:05 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-23  1:29 [PATCH V4 00/10] Add Tegra234 HTE support Dipen Patel
2023-03-23  1:29 ` [PATCH V4 01/10] MAINTAINERS: Add HTE/timestamp subsystem details Dipen Patel
2023-03-23  1:29 ` [PATCH V4 02/10] dt-bindings: timestamp: Add Tegra234 support Dipen Patel
2023-03-25 11:04   ` Krzysztof Kozlowski
2023-03-25 11:06   ` Krzysztof Kozlowski
2023-03-23  1:29 ` [PATCH V4 03/10] dt-bindings: timestamp: Deprecate nvidia,slices property Dipen Patel
2023-03-23  8:34   ` Linus Walleij
2023-03-25 11:05   ` Krzysztof Kozlowski
2023-04-03 18:49     ` Dipen Patel
2023-03-23  1:29 ` [PATCH V4 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller Dipen Patel
2023-03-23  8:36   ` Linus Walleij
2023-03-23 13:58   ` Rob Herring
2023-03-24 17:13   ` Rob Herring
2023-03-24 18:51     ` Dipen Patel
2023-03-25 11:09       ` Krzysztof Kozlowski
2023-04-04  4:24         ` Dipen Patel
2023-04-04  5:33           ` Krzysztof Kozlowski
2023-04-04 17:31             ` Dipen Patel
2023-04-04 10:28           ` Thierry Reding
2023-04-04 17:30             ` Dipen Patel
2023-03-25 11:07   ` Krzysztof Kozlowski
2023-03-27 16:58     ` Dipen Patel
2023-04-04 10:30       ` Thierry Reding
2023-04-04 17:20         ` Dipen Patel
2023-03-23  1:29 ` [PATCH V4 05/10] arm64: tegra: Add Tegra234 GTE nodes Dipen Patel
2023-03-23  1:29 ` [PATCH V4 06/10] hte: Re-phrase tegra API document Dipen Patel
2023-04-05  2:24   ` Bagas Sanjaya
2023-04-06  0:03     ` Dipen Patel
2023-03-23  1:29 ` [PATCH V4 07/10] hte: Add Tegra234 provider Dipen Patel
2023-03-23  1:29 ` [PATCH V4 08/10] hte: Deprecate nvidia,slices property Dipen Patel
2023-03-23  1:29 ` [PATCH V4 09/10] hte: handle nvidia,gpio-controller property Dipen Patel
2023-03-23  8:37   ` Linus Walleij
2023-03-23  1:29 ` [PATCH V4 10/10] gpio: tegra186: Add Tegra234 hte support Dipen Patel
2023-03-23  8:38   ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).