Skip to contentSkip to conversation

Add Tegra234 HTE support

PATCH Superseded Dipen Patel 2 participants 14 messages Apr 6, 2023 – Apr 12, 2023

Subsystems (5)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Dipen Patel

author maintainer
#0 lore raw

v5 cover Add Tegra234 HTE support

This patch series mainly adds support for the Tegra234 HTE provider. In addition, it addresses dt binding comments which prompted code changes in the existing HTE provider driver 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

The V5 patch series:
- Reflect review comments for the patch "dt-bindings: timestamp: Add nvidia,gpio-controller"
- Documentation changes including renaming of the file

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        |  76 +++++++-
 Documentation/driver-api/hte/index.rst        |   2 +-
 .../hte/{tegra194-hte.rst => tegra-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 ++++++++++++++++--
 8 files changed, 262 insertions(+), 39 deletions(-)
 rename Documentation/driver-api/hte/{tegra194-hte.rst => tegra-hte.rst} (50%)

base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6

Signature · 1 line
2.17.1
author maintainer
#3 lore raw

PATCH v5 3/10 dt-bindings: timestamp: Deprecate nvidia,slices property

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

---
 .../bindings/timestamp/nvidia,tegra194-hte.yaml           | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml +4 -4
index 158dbe58c49f..855dad3f2023 100644
@@ -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':
@@ -95,7 +98,6 @@ required:
   - compatible
   - reg
   - interrupts
-  - nvidia,slices
   - "#timestamp-cells"
 
 additionalProperties: false
@@ -107,7 +109,6 @@ examples:
               reg = <0xc1e0000 0x10000>;
               interrupts = <0 13 0x4>;
               nvidia,int-threshold = <1>;
-              nvidia,slices = <3>;
               #timestamp-cells = <1>;
     };
 
@@ -117,7 +118,6 @@ examples:
               reg = <0x3aa0000 0x10000>;
               interrupts = <0 11 0x4>;
               nvidia,int-threshold = <1>;
-              nvidia,slices = <11>;
               #timestamp-cells = <1>;
     };
 
Signature · 1 line
2.17.1
author maintainer
#8 lore raw

PATCH v5 5/10 arm64: tegra: Add Tegra234 GTE nodes

In reply to Dipen Patel

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

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

PATCH v5 7/10 hte: Add Tegra234 provider

In reply to 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.

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

154 lines not on this page · raw message

Signature · 1 line
2.17.1
author maintainer
#12 lore raw

PATCH v5 9/10 hte: handle nvidia,gpio-controller property

In reply to 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.

---
 drivers/hte/hte-tegra194.c | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)
drivers/hte/hte-tegra194.c +21 -7
index 945c68c5e476..2c485ff5be22 100644
@@ -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,
Signature · 1 line
2.17.1
author maintainer
#1 lore raw

PATCH v5 1/10 MAINTAINERS: Add HTE/timestamp subsystem details

In reply to Dipen Patel

Add tree, mailing list and patchwork details.

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

PATCH v5 2/10 dt-bindings: timestamp: Add Tegra234 support

In reply to Dipen Patel

Added timestamp provider support for the Tegra234 in devicetree bindings.

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

PATCH v5 4/10 dt-bindings: timestamp: Add nvidia,gpio-controller

In reply to Dipen Patel

The tegra always-on (AON) GPIO HTE/GTE provider depends on the AON GPIO controller where it needs to do namespace conversion between GPIO line number (belonging to AON GPIO controller instance) and the GTE slice bits. The patch introduces nvidia,gpio-controller property to represent that dependency.

---
 .../timestamp/nvidia,tegra194-hte.yaml        | 36 ++++++++++++++++---
 1 file changed, 31 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml +31 -5
index 855dad3f2023..66eaa3fab8cc 100644
@@ -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
@@ -59,6 +65,12 @@ properties:
       mentioned in the nvidia GPIO device tree binding document.
     const: 1
 
+required:
+  - compatible
+  - reg
+  - interrupts
+  - "#timestamp-cells"
+
 allOf:
   - if:
       properties:
@@ -94,11 +106,15 @@ allOf:
         nvidia,slices:
           const: 17
 
-required:
-  - compatible
-  - reg
-  - interrupts
-  - "#timestamp-cells"
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - nvidia,tegra234-gte-aon
+    then:
+      required:
+        - nvidia,gpio-controller
 
 additionalProperties: false
 
@@ -112,6 +128,16 @@ examples:
               #timestamp-cells = <1>;
     };
 
+  - |
+    tegra234_hte_aon: timestamp@c1e0000 {
+              compatible = "nvidia,tegra234-gte-aon";
+              reg = <0xc1e0000 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";
Signature · 1 line
2.17.1
author maintainer
#9 lore raw

PATCH v5 6/10 hte: Re-phrase tegra API document

In reply to Dipen Patel

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

---
v5:
- rename tegra194-hte.rst to tegra-hte.rst

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

PATCH v5 8/10 hte: Deprecate nvidia,slices property

In reply to Dipen Patel

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

---
 drivers/hte/hte-tegra194.c | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)
drivers/hte/hte-tegra194.c +21 -10
index 5d1f947db0f6..945c68c5e476 100644
@@ -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);
Signature · 1 line
2.17.1
author maintainer
#13 lore raw

PATCH v5 10/10 gpio: tegra186: Add Tegra234 hte support

In reply to Dipen Patel

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

---
 drivers/gpio/gpio-tegra186.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpio/gpio-tegra186.c +1 -0
index 14c872b6ad05..b904de0b1784 100644
@@ -1134,6 +1134,7 @@ static const struct tegra_gpio_soc tegra234_aon_soc = {
 	.name = "tegra234-gpio-aon",
 	.instance = 1,
 	.num_irqs_per_bank = 8,
+	.has_gte = true,
 };
 
 #define TEGRA241_MAIN_GPIO_PORT(_name, _bank, _port, _pins)	\
Signature · 1 line
2.17.1
maintainer Acked-by on v5 3/10
#4 lore raw

Re: [V5 03/10] dt-bindings: timestamp: Deprecate nvidia,slices property

In reply to Dipen Patel
Quoted 9 lines · Dipen Patel

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

---
 .../bindings/timestamp/nvidia,tegra194-hte.yaml           | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
maintainer
#6 lore raw

Re: [V5 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller

In reply to Dipen Patel
Quoted 50 lines · Dipen Patel

The tegra always-on (AON) GPIO HTE/GTE provider depends on the AON GPIO controller where it needs to do namespace conversion between GPIO line number (belonging to AON GPIO controller instance) and the GTE slice bits. The patch introduces nvidia,gpio-controller property to represent that dependency.

---
 .../timestamp/nvidia,tegra194-hte.yaml        | 36 ++++++++++++++++---
 1 file changed, 31 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml +12 -4
index 855dad3f2023..66eaa3fab8cc 100644
@@ -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
@@ -59,6 +65,12 @@ properties:
       mentioned in the nvidia GPIO device tree binding document.
     const: 1
 
+required:
+  - compatible
+  - reg
+  - interrupts
+  - "#timestamp-cells"
+
 allOf:
   - if:
       properties:
@@ -94,11 +106,15 @@ allOf:
         nvidia,slices:
           const: 17
 
-required:
-  - compatible
-  - reg
-  - interrupts

Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml allOf: · line 117

Quoted 10 lines
Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml +9 -1
-  - "#timestamp-cells"
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - nvidia,tegra234-gte-aon
+    then:
+      required:
+        - nvidia,gpio-controller

Adding a new required property is an ABI break. But you just added this in patch 2. If this is required as part of nvidia,tegra234-gte-aon support, then it should all be 1 patch.

Quoted 7 lines
Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml +0 -0
 additionalProperties: false
 
@@ -112,6 +128,16 @@ examples:
               #timestamp-cells = <1>;
     };
 

Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml examples: · line 140

Quoted 10 lines
Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml +10 -0
+  - |
+    tegra234_hte_aon: timestamp@c1e0000 {
+              compatible = "nvidia,tegra234-gte-aon";
+              reg = <0xc1e0000 0x10000>;
+              interrupts = <0 13 0x4>;
+              nvidia,int-threshold = <1>;
+              nvidia,gpio-controller = <&gpio_aon>;
+              #timestamp-cells = <1>;
+    };
+

Really need a whole other example for 1 property?

Quoted 6 lines
Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml +0 -0
   - |
     tegra_hte_lic: timestamp@3aa0000 {
               compatible = "nvidia,tegra194-gte-lic";
Signature · 1 line
2.17.1
author maintainer
#7 lore raw

Re: [V5 04/10] dt-bindings: timestamp: Add nvidia,gpio-controller

Quoted 57 lines · Rob Herring
Quoted 56 lines · Dipen Patel

The tegra always-on (AON) GPIO HTE/GTE provider depends on the AON GPIO controller where it needs to do namespace conversion between GPIO line number (belonging to AON GPIO controller instance) and the GTE slice bits. The patch introduces nvidia,gpio-controller property to represent that dependency.

---
 .../timestamp/nvidia,tegra194-hte.yaml        | 36 ++++++++++++++++---
 1 file changed, 31 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml +17 -5
index 855dad3f2023..66eaa3fab8cc 100644
@@ -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
@@ -59,6 +65,12 @@ properties:
       mentioned in the nvidia GPIO device tree binding document.
     const: 1
 
+required:
+  - compatible
+  - reg
+  - interrupts
+  - "#timestamp-cells"
+
 allOf:
   - if:
       properties:
@@ -94,11 +106,15 @@ allOf:
         nvidia,slices:
           const: 17
 
-required:
-  - compatible
-  - reg
-  - interrupts
-  - "#timestamp-cells"
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
Quoted 8 lines

Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml allOf: · line 117

Quoted 4 lines
Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml +4 -0
+              - nvidia,tegra234-gte-aon
+    then:
+      required:
+        - nvidia,gpio-controller

Adding a new required property is an ABI break. But you just added this in patch 2. If this is required as part of nvidia,tegra234-gte-aon support, then it should all be 1 patch.

Ok, will move this to one patch. For the ABI break, I have added appropriate code in the concerned driver to continue to be backward compatible.

Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml +0 -0
 additionalProperties: false
 
@@ -112,6 +128,16 @@ examples:
               #timestamp-cells = <1>;
     };
 
Quoted 12 lines

Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml examples: · line 140

Quoted 10 lines
Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml +10 -0
+  - |
+    tegra234_hte_aon: timestamp@c1e0000 {
+              compatible = "nvidia,tegra234-gte-aon";
+              reg = <0xc1e0000 0x10000>;
+              interrupts = <0 13 0x4>;
+              nvidia,int-threshold = <1>;
+              nvidia,gpio-controller = <&gpio_aon>;
+              #timestamp-cells = <1>;
+    };
+

Really need a whole other example for 1 property?

The property affects Tegra234 Soc and beyond, This example is provided to showcase that and it also implies that old SoC Tegra194 is not affected by this new property. Havind said, that I have not issue removing this example.

Quoted 7 lines
Quoted 7 lines
Documentation/devicetree/bindings/timestamp/nvidia,tegra194-hte.yaml +0 -0
   - |
     tegra_hte_lic: timestamp@3aa0000 {
               compatible = "nvidia,tegra194-gte-lic";
Signature · 1 line
2.17.1