linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V6 0/6] Add device-tree support for Cypress CYPD4226
@ 2023-01-19 12:16 Jon Hunter
  2023-01-19 12:16 ` [PATCH V6 1/6] dt-bindings: usb: Add Cypress cypd4226 Type-C controller Jon Hunter
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Jon Hunter @ 2023-01-19 12:16 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman, Rob Herring,
	Krzysztof Kozlowski, Thierry Reding
  Cc: linux-usb, devicetree, linux-tegra, Wayne Chang, Jon Hunter

Add device-tree support for Cypress CYPD4226 Type-C controller and
enable for the Jetson AGX Orin board. This series is derived from the
series to enable USB host and device support for Jetson AGX Orin [0].
I have split this out from that series because it was getting quite
big.

[0] https://lore.kernel.org/linux-tegra/20221114124053.1873316-1-waynec@nvidia.com/

Jon Hunter (1):
  arm64: tegra: Populate USB Type-C Controller for Jetson AGX Orin

Wayne Chang (5):
  dt-bindings: usb: Add Cypress cypd4226 Type-C controller
  i2c: nvidia-gpu: Add ACPI property to align with device-tree
  usb: typec: ucsi_ccg: Add OF support
  i2c: nvidia-gpu: Remove ccgx,firmware-build property
  usb: typec: ucsi_ccg: Remove ccgx,firmware-build property

 .../bindings/usb/cypress,cypd4226.yaml        | 86 +++++++++++++++++++
 .../nvidia/tegra234-p3737-0000+p3701-0000.dts | 14 +++
 drivers/i2c/busses/i2c-nvidia-gpu.c           |  4 +-
 drivers/usb/typec/ucsi/ucsi_ccg.c             | 23 ++++-
 4 files changed, 121 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml

-- 
2.25.1


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

* [PATCH V6 1/6] dt-bindings: usb: Add Cypress cypd4226 Type-C controller
  2023-01-19 12:16 [PATCH V6 0/6] Add device-tree support for Cypress CYPD4226 Jon Hunter
@ 2023-01-19 12:16 ` Jon Hunter
  2023-01-20  8:32   ` Krzysztof Kozlowski
  2023-01-19 12:16 ` [PATCH V6 2/6] i2c: nvidia-gpu: Add ACPI property to align with device-tree Jon Hunter
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 19+ messages in thread
From: Jon Hunter @ 2023-01-19 12:16 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman, Rob Herring,
	Krzysztof Kozlowski, Thierry Reding
  Cc: linux-usb, devicetree, linux-tegra, Wayne Chang, Jon Hunter

From: Wayne Chang <waynec@nvidia.com>

Add the device-tree binding documentation for Cypress cypd4226 dual
Type-C controller.

Signed-off-by: Wayne Chang <waynec@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
V5 -> V6: no changes
V4 -> V5: updated subject and updated binding to use 'firmware-name'.
V3 -> V4: no changes
V2 -> V3: fix additionalProperties warning on new schema
V1 -> V2: based on the review comments. Fix some addressed issues on

 .../bindings/usb/cypress,cypd4226.yaml        | 86 +++++++++++++++++++
 1 file changed, 86 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml

diff --git a/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml b/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml
new file mode 100644
index 000000000000..5d87c9f09913
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml
@@ -0,0 +1,86 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/cypress,cypd4226.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cypress cypd4226 Type-C Controller
+
+maintainers:
+  - Wayne Chang <waynec@nvidia.com>
+
+description:
+  The Cypress cypd4226 is a dual Type-C controller that is controlled
+  via an I2C interface.
+
+properties:
+  compatible:
+    const: cypress,cypd4226
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+  reg:
+    const: 0x08
+
+  interrupts:
+    items:
+      - description: cypd4226 host interrupt
+
+  firmware-name:
+    enum:
+      - nvidia,gpu
+      - nvidia,jetson-agx-xavier
+    description: |
+      The name of the CCGx firmware built for product series.
+      should be set one of following:
+      - "nvidia,gpu" for the NVIDIA RTX product series
+      - "nvidia,jetson-agx-xavier" for the NVIDIA Jetson product series
+
+patternProperties:
+  '^connector@[0-1]+$':
+    $ref: /schemas/connector/usb-connector.yaml#
+    properties:
+      reg:
+        maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/tegra194-gpio.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      #interrupt-cells = <2>;
+
+      ucsi-ccg@8 {
+        compatible = "cypress,cypd4226";
+        reg = <0x08>;
+        interrupt-parent = <&gpio_aon>;
+        interrupts = <TEGRA194_AON_GPIO(BB, 2) IRQ_TYPE_LEVEL_LOW>;
+        firmware-name = "nvidia,jetson-agx-xavier";
+        #address-cells = <1>;
+        #size-cells = <0>;
+        ccg_typec_con0: connector@0 {
+          compatible = "usb-c-connector";
+          reg = <0>;
+          label = "USB-C";
+          data-role = "dual";
+          port {
+            ucsi_ccg_p0: endpoint {
+              remote-endpoint = <&usb_role_switch0>;
+            };
+          };
+        };
+      };
+    };
-- 
2.25.1


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

* [PATCH V6 2/6] i2c: nvidia-gpu: Add ACPI property to align with device-tree
  2023-01-19 12:16 [PATCH V6 0/6] Add device-tree support for Cypress CYPD4226 Jon Hunter
  2023-01-19 12:16 ` [PATCH V6 1/6] dt-bindings: usb: Add Cypress cypd4226 Type-C controller Jon Hunter
@ 2023-01-19 12:16 ` Jon Hunter
  2023-01-20  9:18   ` Heikki Krogerus
  2023-01-19 12:16 ` [PATCH V6 3/6] usb: typec: ucsi_ccg: Add OF support Jon Hunter
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 19+ messages in thread
From: Jon Hunter @ 2023-01-19 12:16 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman, Rob Herring,
	Krzysztof Kozlowski, Thierry Reding
  Cc: linux-usb, devicetree, linux-tegra, Wayne Chang, Jon Hunter

From: Wayne Chang <waynec@nvidia.com>

Device-tree uses the 'firmware-name' string property to pass a name of
the firmware build to the Cypress CCGx driver. Add a new ACPI string
property to the NVIDIA GPU I2C driver to align with device-tree so that
we can migrate to using a common property name for both ACPI and
device-tree.

Signed-off-by: Wayne Chang <waynec@nvidia.com>
Co-developed-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
V6: no changes
V5: Added this patch from V3

 drivers/i2c/busses/i2c-nvidia-gpu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/i2c/busses/i2c-nvidia-gpu.c b/drivers/i2c/busses/i2c-nvidia-gpu.c
index 12e330cd7635..6d81ea530a83 100644
--- a/drivers/i2c/busses/i2c-nvidia-gpu.c
+++ b/drivers/i2c/busses/i2c-nvidia-gpu.c
@@ -261,6 +261,7 @@ MODULE_DEVICE_TABLE(pci, gpu_i2c_ids);
 static const struct property_entry ccgx_props[] = {
 	/* Use FW built for NVIDIA (nv) only */
 	PROPERTY_ENTRY_U16("ccgx,firmware-build", ('n' << 8) | 'v'),
+	PROPERTY_ENTRY_STRING("firmware-name", "nvidia,gpu"),
 	{ }
 };
 
-- 
2.25.1


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

* [PATCH V6 3/6] usb: typec: ucsi_ccg: Add OF support
  2023-01-19 12:16 [PATCH V6 0/6] Add device-tree support for Cypress CYPD4226 Jon Hunter
  2023-01-19 12:16 ` [PATCH V6 1/6] dt-bindings: usb: Add Cypress cypd4226 Type-C controller Jon Hunter
  2023-01-19 12:16 ` [PATCH V6 2/6] i2c: nvidia-gpu: Add ACPI property to align with device-tree Jon Hunter
@ 2023-01-19 12:16 ` Jon Hunter
  2023-01-20  9:33   ` Heikki Krogerus
  2023-01-19 12:16 ` [PATCH V6 4/6] i2c: nvidia-gpu: Remove ccgx,firmware-build property Jon Hunter
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 19+ messages in thread
From: Jon Hunter @ 2023-01-19 12:16 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman, Rob Herring,
	Krzysztof Kozlowski, Thierry Reding
  Cc: linux-usb, devicetree, linux-tegra, Wayne Chang, Jon Hunter

From: Wayne Chang <waynec@nvidia.com>

Add device-tree support for the Cypress CCG UCSI driver. The device-tree
binding for the Cypress CCG device uses the standard device-tree
'firmware-name' string property to indicate the firmware build that is
used. For ACPI a 16-bit property named 'ccgx,firmware-build' is used and
if this is not found fall back to the 'firmware-name' property.

Signed-off-by: Wayne Chang <waynec@nvidia.com>
Co-developed-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
V5 -> V6: fixed compilation
V4 -> V5: add support for 'firmware-name'
V1 -> V4: nothing has changed

 drivers/usb/typec/ucsi/ucsi_ccg.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/typec/ucsi/ucsi_ccg.c b/drivers/usb/typec/ucsi/ucsi_ccg.c
index 46441f1477f2..661a3988b39d 100644
--- a/drivers/usb/typec/ucsi/ucsi_ccg.c
+++ b/drivers/usb/typec/ucsi/ucsi_ccg.c
@@ -643,7 +643,7 @@ static int ccg_request_irq(struct ucsi_ccg *uc)
 {
 	unsigned long flags = IRQF_ONESHOT;
 
-	if (!has_acpi_companion(uc->dev))
+	if (!dev_fwnode(uc->dev))
 		flags |= IRQF_TRIGGER_HIGH;
 
 	return request_threaded_irq(uc->irq, NULL, ccg_irq_handler, flags, dev_name(uc->dev), uc);
@@ -1342,6 +1342,7 @@ static int ucsi_ccg_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
 	struct ucsi_ccg *uc;
+	const char *fw_name;
 	int status;
 
 	uc = devm_kzalloc(dev, sizeof(*uc), GFP_KERNEL);
@@ -1359,7 +1360,18 @@ static int ucsi_ccg_probe(struct i2c_client *client)
 	/* Only fail FW flashing when FW build information is not provided */
 	status = device_property_read_u16(dev, "ccgx,firmware-build",
 					  &uc->fw_build);
-	if (status)
+	if (status) {
+		status = device_property_read_string(dev, "firmware-name",
+						     &fw_name);
+		if (!status) {
+			if (!strcmp(fw_name, "nvidia,jetson-agx-xavier"))
+				uc->fw_build = CCG_FW_BUILD_NVIDIA_TEGRA;
+			else if (!strcmp(fw_name, "nvidia,gpu"))
+				uc->fw_build = CCG_FW_BUILD_NVIDIA;
+		}
+	}
+
+	if (!uc->fw_build)
 		dev_err(uc->dev, "failed to get FW build information\n");
 
 	/* reset ccg device and initialize ucsi */
@@ -1426,6 +1438,12 @@ static void ucsi_ccg_remove(struct i2c_client *client)
 	free_irq(uc->irq, uc);
 }
 
+static const struct of_device_id ucsi_ccg_of_match_table[] = {
+		{ .compatible = "cypress,cypd4226", },
+		{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, ucsi_ccg_of_match_table);
+
 static const struct i2c_device_id ucsi_ccg_device_id[] = {
 	{"ccgx-ucsi", 0},
 	{}
@@ -1480,6 +1498,7 @@ static struct i2c_driver ucsi_ccg_driver = {
 		.pm = &ucsi_ccg_pm,
 		.dev_groups = ucsi_ccg_groups,
 		.acpi_match_table = amd_i2c_ucsi_match,
+		.of_match_table = ucsi_ccg_of_match_table,
 	},
 	.probe_new = ucsi_ccg_probe,
 	.remove = ucsi_ccg_remove,
-- 
2.25.1


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

* [PATCH V6 4/6] i2c: nvidia-gpu: Remove ccgx,firmware-build property
  2023-01-19 12:16 [PATCH V6 0/6] Add device-tree support for Cypress CYPD4226 Jon Hunter
                   ` (2 preceding siblings ...)
  2023-01-19 12:16 ` [PATCH V6 3/6] usb: typec: ucsi_ccg: Add OF support Jon Hunter
@ 2023-01-19 12:16 ` Jon Hunter
  2023-01-20  9:37   ` Heikki Krogerus
  2023-01-19 12:16 ` [PATCH V6 5/6] usb: typec: ucsi_ccg: " Jon Hunter
  2023-01-19 12:16 ` [PATCH V6 6/6] arm64: tegra: Populate USB Type-C Controller for Jetson AGX Orin Jon Hunter
  5 siblings, 1 reply; 19+ messages in thread
From: Jon Hunter @ 2023-01-19 12:16 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman, Rob Herring,
	Krzysztof Kozlowski, Thierry Reding
  Cc: linux-usb, devicetree, linux-tegra, Wayne Chang, Jon Hunter

From: Wayne Chang <waynec@nvidia.com>

Now the Cypress CCG driver has been updated to support the
'firmware-name' property to align with device-tree, remove the
'ccgx,firmware-build' property as this is no longer needed.

Signed-off-by: Wayne Chang <waynec@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
V6: no changes
V5: Added this patch from V3

 drivers/i2c/busses/i2c-nvidia-gpu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-nvidia-gpu.c b/drivers/i2c/busses/i2c-nvidia-gpu.c
index 6d81ea530a83..a8b99e7f6262 100644
--- a/drivers/i2c/busses/i2c-nvidia-gpu.c
+++ b/drivers/i2c/busses/i2c-nvidia-gpu.c
@@ -259,8 +259,7 @@ static const struct pci_device_id gpu_i2c_ids[] = {
 MODULE_DEVICE_TABLE(pci, gpu_i2c_ids);
 
 static const struct property_entry ccgx_props[] = {
-	/* Use FW built for NVIDIA (nv) only */
-	PROPERTY_ENTRY_U16("ccgx,firmware-build", ('n' << 8) | 'v'),
+	/* Use FW built for NVIDIA GPU only */
 	PROPERTY_ENTRY_STRING("firmware-name", "nvidia,gpu"),
 	{ }
 };
-- 
2.25.1


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

* [PATCH V6 5/6] usb: typec: ucsi_ccg: Remove ccgx,firmware-build property
  2023-01-19 12:16 [PATCH V6 0/6] Add device-tree support for Cypress CYPD4226 Jon Hunter
                   ` (3 preceding siblings ...)
  2023-01-19 12:16 ` [PATCH V6 4/6] i2c: nvidia-gpu: Remove ccgx,firmware-build property Jon Hunter
@ 2023-01-19 12:16 ` Jon Hunter
  2023-01-20  9:34   ` Heikki Krogerus
  2023-01-19 12:16 ` [PATCH V6 6/6] arm64: tegra: Populate USB Type-C Controller for Jetson AGX Orin Jon Hunter
  5 siblings, 1 reply; 19+ messages in thread
From: Jon Hunter @ 2023-01-19 12:16 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman, Rob Herring,
	Krzysztof Kozlowski, Thierry Reding
  Cc: linux-usb, devicetree, linux-tegra, Wayne Chang, Jon Hunter

From: Wayne Chang <waynec@nvidia.com>

Remove the property 'ccgx,firmware-build' now we have migrated devices
to using the 'firmware-name' property.

Signed-off-by: Wayne Chang <waynec@nvidia.com>
Co-developed-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
V6: fixed compilation
V5: Added this patch from V3

 drivers/usb/typec/ucsi/ucsi_ccg.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/typec/ucsi/ucsi_ccg.c b/drivers/usb/typec/ucsi/ucsi_ccg.c
index 661a3988b39d..8f5ad2094f26 100644
--- a/drivers/usb/typec/ucsi/ucsi_ccg.c
+++ b/drivers/usb/typec/ucsi/ucsi_ccg.c
@@ -1358,17 +1358,13 @@ static int ucsi_ccg_probe(struct i2c_client *client)
 	INIT_WORK(&uc->pm_work, ccg_pm_workaround_work);
 
 	/* Only fail FW flashing when FW build information is not provided */
-	status = device_property_read_u16(dev, "ccgx,firmware-build",
-					  &uc->fw_build);
-	if (status) {
-		status = device_property_read_string(dev, "firmware-name",
-						     &fw_name);
-		if (!status) {
-			if (!strcmp(fw_name, "nvidia,jetson-agx-xavier"))
-				uc->fw_build = CCG_FW_BUILD_NVIDIA_TEGRA;
-			else if (!strcmp(fw_name, "nvidia,gpu"))
-				uc->fw_build = CCG_FW_BUILD_NVIDIA;
-		}
+	status = device_property_read_string(dev, "firmware-name",
+					     &fw_name);
+	if (!status) {
+		if (!strcmp(fw_name, "nvidia,jetson-agx-xavier"))
+			uc->fw_build = CCG_FW_BUILD_NVIDIA_TEGRA;
+		else if (!strcmp(fw_name, "nvidia,gpu"))
+			uc->fw_build = CCG_FW_BUILD_NVIDIA;
 	}
 
 	if (!uc->fw_build)
-- 
2.25.1


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

* [PATCH V6 6/6] arm64: tegra: Populate USB Type-C Controller for Jetson AGX Orin
  2023-01-19 12:16 [PATCH V6 0/6] Add device-tree support for Cypress CYPD4226 Jon Hunter
                   ` (4 preceding siblings ...)
  2023-01-19 12:16 ` [PATCH V6 5/6] usb: typec: ucsi_ccg: " Jon Hunter
@ 2023-01-19 12:16 ` Jon Hunter
  5 siblings, 0 replies; 19+ messages in thread
From: Jon Hunter @ 2023-01-19 12:16 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman, Rob Herring,
	Krzysztof Kozlowski, Thierry Reding
  Cc: linux-usb, devicetree, linux-tegra, Wayne Chang, Jon Hunter

Add the USB Type-C controller that is present on the Jetson AGX Orin
board. The ports for the Type-C controller are not populated yet, but
will be added later once the USB host and device support for Jetson AGX
Orin is enabled.

This is based upon a patch from Wayne Chang <waynec@nvidia.com>.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
V6: no changes
V5: no changes
V4: added in this version

 .../dts/nvidia/tegra234-p3737-0000+p3701-0000.dts  | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts b/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts
index 32c58aa00035..05819d8f8038 100644
--- a/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts
+++ b/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts
@@ -2115,6 +2115,20 @@ usb@3610000 {
 			phy-names = "usb2-0", "usb2-1", "usb2-2", "usb2-3",
 				"usb3-0", "usb3-1", "usb3-2";
 		};
+
+		i2c@c240000 {
+			status = "okay";
+			ucsi_ccg@8 {
+				compatible = "cypress,cypd4226";
+				reg = <0x08>;
+				interrupt-parent = <&gpio>;
+				interrupts = <TEGRA234_MAIN_GPIO(Y, 4) IRQ_TYPE_LEVEL_LOW>;
+				firmware-name = "nvidia,jetson-agx-xavier";
+				status = "okay";
+				#address-cells = <1>;
+				#size-cells = <0>;
+			};
+		};
 	};
 
 	chosen {
-- 
2.25.1


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

* Re: [PATCH V6 1/6] dt-bindings: usb: Add Cypress cypd4226 Type-C controller
  2023-01-19 12:16 ` [PATCH V6 1/6] dt-bindings: usb: Add Cypress cypd4226 Type-C controller Jon Hunter
@ 2023-01-20  8:32   ` Krzysztof Kozlowski
  2023-01-23 14:28     ` Jon Hunter
  0 siblings, 1 reply; 19+ messages in thread
From: Krzysztof Kozlowski @ 2023-01-20  8:32 UTC (permalink / raw)
  To: Jon Hunter, Heikki Krogerus, Greg Kroah-Hartman, Rob Herring,
	Krzysztof Kozlowski, Thierry Reding
  Cc: linux-usb, devicetree, linux-tegra, Wayne Chang

On 19/01/2023 13:16, Jon Hunter wrote:
> From: Wayne Chang <waynec@nvidia.com>
> 
> Add the device-tree binding documentation for Cypress cypd4226 dual
> Type-C controller.
> 
> Signed-off-by: Wayne Chang <waynec@nvidia.com>
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> ---
> V5 -> V6: no changes
> V4 -> V5: updated subject and updated binding to use 'firmware-name'.
> V3 -> V4: no changes
> V2 -> V3: fix additionalProperties warning on new schema
> V1 -> V2: based on the review comments. Fix some addressed issues on
> 
>  .../bindings/usb/cypress,cypd4226.yaml        | 86 +++++++++++++++++++
>  1 file changed, 86 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml
> 
> diff --git a/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml b/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml
> new file mode 100644
> index 000000000000..5d87c9f09913
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml
> @@ -0,0 +1,86 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/usb/cypress,cypd4226.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Cypress cypd4226 Type-C Controller
> +
> +maintainers:
> +  - Wayne Chang <waynec@nvidia.com>
> +
> +description:
> +  The Cypress cypd4226 is a dual Type-C controller that is controlled
> +  via an I2C interface.
> +
> +properties:
> +  compatible:
> +    const: cypress,cypd4226
> +
> +  '#address-cells':
> +    const: 1
> +
> +  '#size-cells':
> +    const: 0
> +
> +  reg:
> +    const: 0x08
> +
> +  interrupts:
> +    items:
> +      - description: cypd4226 host interrupt
> +
> +  firmware-name:
> +    enum:
> +      - nvidia,gpu
> +      - nvidia,jetson-agx-xavier
> +    description: |
> +      The name of the CCGx firmware built for product series.
> +      should be set one of following:
> +      - "nvidia,gpu" for the NVIDIA RTX product series
> +      - "nvidia,jetson-agx-xavier" for the NVIDIA Jetson product series
> +
> +patternProperties:
> +  '^connector@[0-1]+$':
> +    $ref: /schemas/connector/usb-connector.yaml#

On this level:
unevaluatedProperties: false

> +    properties:
> +      reg:
> +        maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/gpio/tegra194-gpio.h>
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +    i2c {
> +      #address-cells = <1>;
> +      #size-cells = <0>;
> +      #interrupt-cells = <2>;

Drop, does not look like relevant or used here.

> +
> +      ucsi-ccg@8 {

Node names should be generic.
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation

> +        compatible = "cypress,cypd4226";
> +        reg = <0x08>;
> +        interrupt-parent = <&gpio_aon>;
> +        interrupts = <TEGRA194_AON_GPIO(BB, 2) IRQ_TYPE_LEVEL_LOW>;
> +        firmware-name = "nvidia,jetson-agx-xavier";
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +        ccg_typec_con0: connector@0 {
> +          compatible = "usb-c-connector";
> +          reg = <0>;
> +          label = "USB-C";
> +          data-role = "dual";
> +          port {
> +            ucsi_ccg_p0: endpoint {
> +              remote-endpoint = <&usb_role_switch0>;
> +            };
> +          };
> +        };
> +      };
> +    };

Best regards,
Krzysztof


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

* Re: [PATCH V6 2/6] i2c: nvidia-gpu: Add ACPI property to align with device-tree
  2023-01-19 12:16 ` [PATCH V6 2/6] i2c: nvidia-gpu: Add ACPI property to align with device-tree Jon Hunter
@ 2023-01-20  9:18   ` Heikki Krogerus
  0 siblings, 0 replies; 19+ messages in thread
From: Heikki Krogerus @ 2023-01-20  9:18 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Thierry Reding, linux-usb, devicetree, linux-tegra, Wayne Chang

On Thu, Jan 19, 2023 at 12:16:35PM +0000, Jon Hunter wrote:
> From: Wayne Chang <waynec@nvidia.com>
> 
> Device-tree uses the 'firmware-name' string property to pass a name of
> the firmware build to the Cypress CCGx driver. Add a new ACPI string
> property to the NVIDIA GPU I2C driver to align with device-tree so that
> we can migrate to using a common property name for both ACPI and
> device-tree.
> 
> Signed-off-by: Wayne Chang <waynec@nvidia.com>
> Co-developed-by: Jon Hunter <jonathanh@nvidia.com>
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
> V6: no changes
> V5: Added this patch from V3
> 
>  drivers/i2c/busses/i2c-nvidia-gpu.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/i2c/busses/i2c-nvidia-gpu.c b/drivers/i2c/busses/i2c-nvidia-gpu.c
> index 12e330cd7635..6d81ea530a83 100644
> --- a/drivers/i2c/busses/i2c-nvidia-gpu.c
> +++ b/drivers/i2c/busses/i2c-nvidia-gpu.c
> @@ -261,6 +261,7 @@ MODULE_DEVICE_TABLE(pci, gpu_i2c_ids);
>  static const struct property_entry ccgx_props[] = {
>  	/* Use FW built for NVIDIA (nv) only */
>  	PROPERTY_ENTRY_U16("ccgx,firmware-build", ('n' << 8) | 'v'),
> +	PROPERTY_ENTRY_STRING("firmware-name", "nvidia,gpu"),
>  	{ }
>  };
>  
> -- 
> 2.25.1

-- 
heikki

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

* Re: [PATCH V6 3/6] usb: typec: ucsi_ccg: Add OF support
  2023-01-19 12:16 ` [PATCH V6 3/6] usb: typec: ucsi_ccg: Add OF support Jon Hunter
@ 2023-01-20  9:33   ` Heikki Krogerus
  2023-01-20 13:18     ` Jon Hunter
  0 siblings, 1 reply; 19+ messages in thread
From: Heikki Krogerus @ 2023-01-20  9:33 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Thierry Reding, linux-usb, devicetree, linux-tegra, Wayne Chang

On Thu, Jan 19, 2023 at 12:16:36PM +0000, Jon Hunter wrote:
> From: Wayne Chang <waynec@nvidia.com>
> 
> Add device-tree support for the Cypress CCG UCSI driver. The device-tree
> binding for the Cypress CCG device uses the standard device-tree
> 'firmware-name' string property to indicate the firmware build that is
> used. For ACPI a 16-bit property named 'ccgx,firmware-build' is used and
> if this is not found fall back to the 'firmware-name' property.
> 
> Signed-off-by: Wayne Chang <waynec@nvidia.com>
> Co-developed-by: Jon Hunter <jonathanh@nvidia.com>
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> ---
> V5 -> V6: fixed compilation
> V4 -> V5: add support for 'firmware-name'
> V1 -> V4: nothing has changed
> 
>  drivers/usb/typec/ucsi/ucsi_ccg.c | 23 +++++++++++++++++++++--
>  1 file changed, 21 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/ucsi/ucsi_ccg.c b/drivers/usb/typec/ucsi/ucsi_ccg.c
> index 46441f1477f2..661a3988b39d 100644
> --- a/drivers/usb/typec/ucsi/ucsi_ccg.c
> +++ b/drivers/usb/typec/ucsi/ucsi_ccg.c
> @@ -643,7 +643,7 @@ static int ccg_request_irq(struct ucsi_ccg *uc)
>  {
>  	unsigned long flags = IRQF_ONESHOT;
>  
> -	if (!has_acpi_companion(uc->dev))
> +	if (!dev_fwnode(uc->dev))
>  		flags |= IRQF_TRIGGER_HIGH;
>  
>  	return request_threaded_irq(uc->irq, NULL, ccg_irq_handler, flags, dev_name(uc->dev), uc);
> @@ -1342,6 +1342,7 @@ static int ucsi_ccg_probe(struct i2c_client *client)
>  {
>  	struct device *dev = &client->dev;
>  	struct ucsi_ccg *uc;
> +	const char *fw_name;
>  	int status;
>  
>  	uc = devm_kzalloc(dev, sizeof(*uc), GFP_KERNEL);
> @@ -1359,7 +1360,18 @@ static int ucsi_ccg_probe(struct i2c_client *client)
>  	/* Only fail FW flashing when FW build information is not provided */
>  	status = device_property_read_u16(dev, "ccgx,firmware-build",
>  					  &uc->fw_build);

You don't need this anymore. You already added the new property
"firmware-name" to drivers/i2c/busses/i2c-nvidia-gpu.c.

> -	if (status)
> +	if (status) {
> +		status = device_property_read_string(dev, "firmware-name",
> +						     &fw_name);
> +		if (!status) {
> +			if (!strcmp(fw_name, "nvidia,jetson-agx-xavier"))
> +				uc->fw_build = CCG_FW_BUILD_NVIDIA_TEGRA;
> +			else if (!strcmp(fw_name, "nvidia,gpu"))
> +				uc->fw_build = CCG_FW_BUILD_NVIDIA;
> +		}

So this will already work also with the build-in properties from
i2c-nvidia-gpu.c.

> +	}
> +
> +	if (!uc->fw_build)
>  		dev_err(uc->dev, "failed to get FW build information\n");
>  
>  	/* reset ccg device and initialize ucsi */
> @@ -1426,6 +1438,12 @@ static void ucsi_ccg_remove(struct i2c_client *client)
>  	free_irq(uc->irq, uc);
>  }
>  
> +static const struct of_device_id ucsi_ccg_of_match_table[] = {
> +		{ .compatible = "cypress,cypd4226", },
> +		{ /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, ucsi_ccg_of_match_table);
> +
>  static const struct i2c_device_id ucsi_ccg_device_id[] = {
>  	{"ccgx-ucsi", 0},
>  	{}
> @@ -1480,6 +1498,7 @@ static struct i2c_driver ucsi_ccg_driver = {
>  		.pm = &ucsi_ccg_pm,
>  		.dev_groups = ucsi_ccg_groups,
>  		.acpi_match_table = amd_i2c_ucsi_match,
> +		.of_match_table = ucsi_ccg_of_match_table,
>  	},
>  	.probe_new = ucsi_ccg_probe,
>  	.remove = ucsi_ccg_remove,
> -- 
> 2.25.1

-- 
heikki

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

* Re: [PATCH V6 5/6] usb: typec: ucsi_ccg: Remove ccgx,firmware-build property
  2023-01-19 12:16 ` [PATCH V6 5/6] usb: typec: ucsi_ccg: " Jon Hunter
@ 2023-01-20  9:34   ` Heikki Krogerus
  2023-01-20 13:20     ` Jon Hunter
  0 siblings, 1 reply; 19+ messages in thread
From: Heikki Krogerus @ 2023-01-20  9:34 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Thierry Reding, linux-usb, devicetree, linux-tegra, Wayne Chang

On Thu, Jan 19, 2023 at 12:16:38PM +0000, Jon Hunter wrote:
> From: Wayne Chang <waynec@nvidia.com>
> 
> Remove the property 'ccgx,firmware-build' now we have migrated devices
> to using the 'firmware-name' property.

Ah, so just do this in the patch 3/6.

> Signed-off-by: Wayne Chang <waynec@nvidia.com>
> Co-developed-by: Jon Hunter <jonathanh@nvidia.com>
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> ---
> V6: fixed compilation
> V5: Added this patch from V3
> 
>  drivers/usb/typec/ucsi/ucsi_ccg.c | 18 +++++++-----------
>  1 file changed, 7 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/usb/typec/ucsi/ucsi_ccg.c b/drivers/usb/typec/ucsi/ucsi_ccg.c
> index 661a3988b39d..8f5ad2094f26 100644
> --- a/drivers/usb/typec/ucsi/ucsi_ccg.c
> +++ b/drivers/usb/typec/ucsi/ucsi_ccg.c
> @@ -1358,17 +1358,13 @@ static int ucsi_ccg_probe(struct i2c_client *client)
>  	INIT_WORK(&uc->pm_work, ccg_pm_workaround_work);
>  
>  	/* Only fail FW flashing when FW build information is not provided */
> -	status = device_property_read_u16(dev, "ccgx,firmware-build",
> -					  &uc->fw_build);
> -	if (status) {
> -		status = device_property_read_string(dev, "firmware-name",
> -						     &fw_name);
> -		if (!status) {
> -			if (!strcmp(fw_name, "nvidia,jetson-agx-xavier"))
> -				uc->fw_build = CCG_FW_BUILD_NVIDIA_TEGRA;
> -			else if (!strcmp(fw_name, "nvidia,gpu"))
> -				uc->fw_build = CCG_FW_BUILD_NVIDIA;
> -		}
> +	status = device_property_read_string(dev, "firmware-name",
> +					     &fw_name);

One line.

> +	if (!status) {
> +		if (!strcmp(fw_name, "nvidia,jetson-agx-xavier"))
> +			uc->fw_build = CCG_FW_BUILD_NVIDIA_TEGRA;
> +		else if (!strcmp(fw_name, "nvidia,gpu"))
> +			uc->fw_build = CCG_FW_BUILD_NVIDIA;
>  	}
>  
>  	if (!uc->fw_build)
> -- 
> 2.25.1

thanks,

-- 
heikki

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

* Re: [PATCH V6 4/6] i2c: nvidia-gpu: Remove ccgx,firmware-build property
  2023-01-19 12:16 ` [PATCH V6 4/6] i2c: nvidia-gpu: Remove ccgx,firmware-build property Jon Hunter
@ 2023-01-20  9:37   ` Heikki Krogerus
  0 siblings, 0 replies; 19+ messages in thread
From: Heikki Krogerus @ 2023-01-20  9:37 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Thierry Reding, linux-usb, devicetree, linux-tegra, Wayne Chang

On Thu, Jan 19, 2023 at 12:16:37PM +0000, Jon Hunter wrote:
> From: Wayne Chang <waynec@nvidia.com>
> 
> Now the Cypress CCG driver has been updated to support the
> 'firmware-name' property to align with device-tree, remove the
> 'ccgx,firmware-build' property as this is no longer needed.
> 
> Signed-off-by: Wayne Chang <waynec@nvidia.com>
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> ---
> V6: no changes
> V5: Added this patch from V3
> 
>  drivers/i2c/busses/i2c-nvidia-gpu.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-nvidia-gpu.c b/drivers/i2c/busses/i2c-nvidia-gpu.c
> index 6d81ea530a83..a8b99e7f6262 100644
> --- a/drivers/i2c/busses/i2c-nvidia-gpu.c
> +++ b/drivers/i2c/busses/i2c-nvidia-gpu.c
> @@ -259,8 +259,7 @@ static const struct pci_device_id gpu_i2c_ids[] = {
>  MODULE_DEVICE_TABLE(pci, gpu_i2c_ids);
>  
>  static const struct property_entry ccgx_props[] = {
> -	/* Use FW built for NVIDIA (nv) only */
> -	PROPERTY_ENTRY_U16("ccgx,firmware-build", ('n' << 8) | 'v'),
> +	/* Use FW built for NVIDIA GPU only */
>  	PROPERTY_ENTRY_STRING("firmware-name", "nvidia,gpu"),
>  	{ }
>  };

This patch is fine, and it's in the right place, but you need to
squash 5/6 into 3/6.

thanks,

-- 
heikki

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

* Re: [PATCH V6 3/6] usb: typec: ucsi_ccg: Add OF support
  2023-01-20  9:33   ` Heikki Krogerus
@ 2023-01-20 13:18     ` Jon Hunter
  0 siblings, 0 replies; 19+ messages in thread
From: Jon Hunter @ 2023-01-20 13:18 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Thierry Reding, linux-usb, devicetree, linux-tegra, Wayne Chang



On 20/01/2023 09:33, Heikki Krogerus wrote:
> On Thu, Jan 19, 2023 at 12:16:36PM +0000, Jon Hunter wrote:
>> From: Wayne Chang <waynec@nvidia.com>
>>
>> Add device-tree support for the Cypress CCG UCSI driver. The device-tree
>> binding for the Cypress CCG device uses the standard device-tree
>> 'firmware-name' string property to indicate the firmware build that is
>> used. For ACPI a 16-bit property named 'ccgx,firmware-build' is used and
>> if this is not found fall back to the 'firmware-name' property.
>>
>> Signed-off-by: Wayne Chang <waynec@nvidia.com>
>> Co-developed-by: Jon Hunter <jonathanh@nvidia.com>
>> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
>> ---
>> V5 -> V6: fixed compilation
>> V4 -> V5: add support for 'firmware-name'
>> V1 -> V4: nothing has changed
>>
>>   drivers/usb/typec/ucsi/ucsi_ccg.c | 23 +++++++++++++++++++++--
>>   1 file changed, 21 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/typec/ucsi/ucsi_ccg.c b/drivers/usb/typec/ucsi/ucsi_ccg.c
>> index 46441f1477f2..661a3988b39d 100644
>> --- a/drivers/usb/typec/ucsi/ucsi_ccg.c
>> +++ b/drivers/usb/typec/ucsi/ucsi_ccg.c
>> @@ -643,7 +643,7 @@ static int ccg_request_irq(struct ucsi_ccg *uc)
>>   {
>>   	unsigned long flags = IRQF_ONESHOT;
>>   
>> -	if (!has_acpi_companion(uc->dev))
>> +	if (!dev_fwnode(uc->dev))
>>   		flags |= IRQF_TRIGGER_HIGH;
>>   
>>   	return request_threaded_irq(uc->irq, NULL, ccg_irq_handler, flags, dev_name(uc->dev), uc);
>> @@ -1342,6 +1342,7 @@ static int ucsi_ccg_probe(struct i2c_client *client)
>>   {
>>   	struct device *dev = &client->dev;
>>   	struct ucsi_ccg *uc;
>> +	const char *fw_name;
>>   	int status;
>>   
>>   	uc = devm_kzalloc(dev, sizeof(*uc), GFP_KERNEL);
>> @@ -1359,7 +1360,18 @@ static int ucsi_ccg_probe(struct i2c_client *client)
>>   	/* Only fail FW flashing when FW build information is not provided */
>>   	status = device_property_read_u16(dev, "ccgx,firmware-build",
>>   					  &uc->fw_build);
> 
> You don't need this anymore. You already added the new property
> "firmware-name" to drivers/i2c/busses/i2c-nvidia-gpu.c.


I was planning to get rid of this here, but I was not sure if AMD need 
this. I see now that Sanket has confirmed they don't use this and so 
will drop it from here.

Jon

-- 
nvpublic

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

* Re: [PATCH V6 5/6] usb: typec: ucsi_ccg: Remove ccgx,firmware-build property
  2023-01-20  9:34   ` Heikki Krogerus
@ 2023-01-20 13:20     ` Jon Hunter
  0 siblings, 0 replies; 19+ messages in thread
From: Jon Hunter @ 2023-01-20 13:20 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Thierry Reding, linux-usb, devicetree, linux-tegra, Wayne Chang



On 20/01/2023 09:34, Heikki Krogerus wrote:
> On Thu, Jan 19, 2023 at 12:16:38PM +0000, Jon Hunter wrote:
>> From: Wayne Chang <waynec@nvidia.com>
>>
>> Remove the property 'ccgx,firmware-build' now we have migrated devices
>> to using the 'firmware-name' property.
> 
> Ah, so just do this in the patch 3/6.

ACK. This was deliberate because I was unclear if AMD needed this and so 
if it turned out they needed this, we could just drop this patch. I see 
Sanket has confirmed now and so I will squash this as suggested.

Jon

-- 
nvpublic

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

* Re: [PATCH V6 1/6] dt-bindings: usb: Add Cypress cypd4226 Type-C controller
  2023-01-20  8:32   ` Krzysztof Kozlowski
@ 2023-01-23 14:28     ` Jon Hunter
  2023-01-23 15:04       ` Jon Hunter
  2023-01-23 15:54       ` Krzysztof Kozlowski
  0 siblings, 2 replies; 19+ messages in thread
From: Jon Hunter @ 2023-01-23 14:28 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Heikki Krogerus, Greg Kroah-Hartman,
	Rob Herring, Krzysztof Kozlowski, Thierry Reding
  Cc: linux-usb, devicetree, linux-tegra, Wayne Chang


On 20/01/2023 08:32, Krzysztof Kozlowski wrote:

...

>> +examples:
>> +  - |
>> +    #include <dt-bindings/gpio/tegra194-gpio.h>
>> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
>> +    i2c {
>> +      #address-cells = <1>;
>> +      #size-cells = <0>;
>> +      #interrupt-cells = <2>;
> 
> Drop, does not look like relevant or used here.


Without the above I get ...

Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dts:25.13-26: Warning (reg_format): /example-0/i2c/typec-controller@8:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)
Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: Warning (pci_device_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: Warning (simple_bus_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dts:22.13-43.11: Warning (i2c_bus_bridge): /example-0/i2c: incorrect #address-cells for I2C bus
Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dts:22.13-43.11: Warning (i2c_bus_bridge): /example-0/i2c: incorrect #size-cells for I2C bus
Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: Warning (i2c_bus_reg): Failed prerequisite 'i2c_bus_bridge'
Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: Warning (spi_bus_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dts:23.30-42.13: Warning (avoid_default_addr_size): /example-0/i2c/typec-controller@8: Relying on default #address-cells value
Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dts:23.30-42.13: Warning (avoid_default_addr_size): /example-0/i2c/typec-controller@8: Relying on default #size-cells value
Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: Warning (unique_unit_address_if_enabled): Failed prerequisite 'avoid_default_addr_size'
Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: typec-controller@8: interrupts: [[10], [8]] is too long

> 
>> +
>> +      ucsi-ccg@8 {
> 
> Node names should be generic.
> https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation


Thanks. I don't see anything there is would fit here, so would 'typec-controller' for the node name be OK?

Cheers
Jon

-- 
nvpublic

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

* Re: [PATCH V6 1/6] dt-bindings: usb: Add Cypress cypd4226 Type-C controller
  2023-01-23 14:28     ` Jon Hunter
@ 2023-01-23 15:04       ` Jon Hunter
  2023-01-23 15:54       ` Krzysztof Kozlowski
  1 sibling, 0 replies; 19+ messages in thread
From: Jon Hunter @ 2023-01-23 15:04 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Heikki Krogerus, Greg Kroah-Hartman,
	Rob Herring, Krzysztof Kozlowski, Thierry Reding
  Cc: linux-usb, devicetree, linux-tegra, Wayne Chang



On 23/01/2023 14:28, Jon Hunter wrote:

...

>>> +
>>> +      ucsi-ccg@8 {
>>
>> Node names should be generic.
>> https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
> 
> 
> Thanks. I don't see anything there is would fit here, so would 
> 'typec-controller' for the node name be OK?


Looks like the st,typec-stm32g0 and google,cros-ec-typec both use just 
'typec'. So we can use the same as this looks quite similar to the ST 
device.

Jon

-- 
nvpublic

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

* Re: [PATCH V6 1/6] dt-bindings: usb: Add Cypress cypd4226 Type-C controller
  2023-01-23 14:28     ` Jon Hunter
  2023-01-23 15:04       ` Jon Hunter
@ 2023-01-23 15:54       ` Krzysztof Kozlowski
  2023-01-23 22:16         ` Jon Hunter
  1 sibling, 1 reply; 19+ messages in thread
From: Krzysztof Kozlowski @ 2023-01-23 15:54 UTC (permalink / raw)
  To: Jon Hunter, Heikki Krogerus, Greg Kroah-Hartman, Rob Herring,
	Krzysztof Kozlowski, Thierry Reding
  Cc: linux-usb, devicetree, linux-tegra, Wayne Chang

On 23/01/2023 15:28, Jon Hunter wrote:
> 
> On 20/01/2023 08:32, Krzysztof Kozlowski wrote:
> 
> ...
> 
>>> +examples:
>>> +  - |
>>> +    #include <dt-bindings/gpio/tegra194-gpio.h>
>>> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
>>> +    i2c {
>>> +      #address-cells = <1>;
>>> +      #size-cells = <0>;
>>> +      #interrupt-cells = <2>;
>>
>> Drop, does not look like relevant or used here.
> 
> 
> Without the above I get ...

Didn't you drop too much? I meant only that one line above my comment,
so only interrupt-cells.

> 
> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dts:25.13-26: Warning (reg_format): /example-0/i2c/typec-controller@8:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)
> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: Warning (pci_device_reg): Failed prerequisite 'reg_format'
> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: Warning (simple_bus_reg): Failed prerequisite 'reg_format'
> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dts:22.13-43.11: Warning (i2c_bus_bridge): /example-0/i2c: incorrect #address-cells for I2C bus
> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dts:22.13-43.11: Warning (i2c_bus_bridge): /example-0/i2c: incorrect #size-cells for I2C bus
> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: Warning (i2c_bus_reg): Failed prerequisite 'i2c_bus_bridge'
> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: Warning (spi_bus_reg): Failed prerequisite 'reg_format'
> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dts:23.30-42.13: Warning (avoid_default_addr_size): /example-0/i2c/typec-controller@8: Relying on default #address-cells value
> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dts:23.30-42.13: Warning (avoid_default_addr_size): /example-0/i2c/typec-controller@8: Relying on default #size-cells value
> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: Warning (unique_unit_address_if_enabled): Failed prerequisite 'avoid_default_addr_size'
> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: typec-controller@8: interrupts: [[10], [8]] is too long
> 
>>
>>> +
>>> +      ucsi-ccg@8 {
>>
>> Node names should be generic.
>> https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
> 
> 
> Thanks. I don't see anything there is would fit here, so would 'typec-controller' for the node name be OK?

Yeah, pretty often we miss a generic example. Can be just "typec".


> 

Best regards,
Krzysztof


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

* Re: [PATCH V6 1/6] dt-bindings: usb: Add Cypress cypd4226 Type-C controller
  2023-01-23 15:54       ` Krzysztof Kozlowski
@ 2023-01-23 22:16         ` Jon Hunter
  2023-01-24  7:27           ` Krzysztof Kozlowski
  0 siblings, 1 reply; 19+ messages in thread
From: Jon Hunter @ 2023-01-23 22:16 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Heikki Krogerus, Greg Kroah-Hartman,
	Rob Herring, Krzysztof Kozlowski, Thierry Reding
  Cc: linux-usb, devicetree, linux-tegra, Wayne Chang


On 23/01/2023 15:54, Krzysztof Kozlowski wrote:

...

>>>> +examples:
>>>> +  - |
>>>> +    #include <dt-bindings/gpio/tegra194-gpio.h>
>>>> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
>>>> +    i2c {
>>>> +      #address-cells = <1>;
>>>> +      #size-cells = <0>;
>>>> +      #interrupt-cells = <2>;
>>>
>>> Drop, does not look like relevant or used here.
>>
>>
>> Without the above I get ...
> 
> Didn't you drop too much? I meant only that one line above my comment,
> so only interrupt-cells.

Yes, I was not sure if you meant just interrupt-cells or all of them.
However ...

>> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dts:25.13-26: Warning (reg_format): /example-0/i2c/typec-controller@8:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)
>> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: Warning (pci_device_reg): Failed prerequisite 'reg_format'
>> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
>> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: Warning (simple_bus_reg): Failed prerequisite 'reg_format'
>> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dts:22.13-43.11: Warning (i2c_bus_bridge): /example-0/i2c: incorrect #address-cells for I2C bus
>> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dts:22.13-43.11: Warning (i2c_bus_bridge): /example-0/i2c: incorrect #size-cells for I2C bus
>> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
>> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: Warning (i2c_bus_reg): Failed prerequisite 'i2c_bus_bridge'
>> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: Warning (spi_bus_reg): Failed prerequisite 'reg_format'
>> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dts:23.30-42.13: Warning (avoid_default_addr_size): /example-0/i2c/typec-controller@8: Relying on default #address-cells value
>> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dts:23.30-42.13: Warning (avoid_default_addr_size): /example-0/i2c/typec-controller@8: Relying on default #size-cells value
>> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: Warning (unique_unit_address_if_enabled): Failed prerequisite 'avoid_default_addr_size'
>> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: typec-controller@8: interrupts: [[10], [8]] is too long

Per the above if we remove interrupt-cells, then we get ...

Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: typec@8: interrupts: [[10], [8]] is too long
 From schema: /home/jonathanh/workdir/tegra/korg-linux-next.git/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml

So it seems that we need this as well.

Jon

-- 
nvpublic

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

* Re: [PATCH V6 1/6] dt-bindings: usb: Add Cypress cypd4226 Type-C controller
  2023-01-23 22:16         ` Jon Hunter
@ 2023-01-24  7:27           ` Krzysztof Kozlowski
  0 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2023-01-24  7:27 UTC (permalink / raw)
  To: Jon Hunter, Heikki Krogerus, Greg Kroah-Hartman, Rob Herring,
	Krzysztof Kozlowski, Thierry Reding
  Cc: linux-usb, devicetree, linux-tegra, Wayne Chang

On 23/01/2023 23:16, Jon Hunter wrote:
> Per the above if we remove interrupt-cells, then we get ...
> 
> Documentation/devicetree/bindings/usb/cypress,cypd4226.example.dtb: typec@8: interrupts: [[10], [8]] is too long
>  From schema: /home/jonathanh/workdir/tegra/korg-linux-next.git/Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml
> 
> So it seems that we need this as well.
>
Indeed.

Best regards,
Krzysztof


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

end of thread, other threads:[~2023-01-24  7:27 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-19 12:16 [PATCH V6 0/6] Add device-tree support for Cypress CYPD4226 Jon Hunter
2023-01-19 12:16 ` [PATCH V6 1/6] dt-bindings: usb: Add Cypress cypd4226 Type-C controller Jon Hunter
2023-01-20  8:32   ` Krzysztof Kozlowski
2023-01-23 14:28     ` Jon Hunter
2023-01-23 15:04       ` Jon Hunter
2023-01-23 15:54       ` Krzysztof Kozlowski
2023-01-23 22:16         ` Jon Hunter
2023-01-24  7:27           ` Krzysztof Kozlowski
2023-01-19 12:16 ` [PATCH V6 2/6] i2c: nvidia-gpu: Add ACPI property to align with device-tree Jon Hunter
2023-01-20  9:18   ` Heikki Krogerus
2023-01-19 12:16 ` [PATCH V6 3/6] usb: typec: ucsi_ccg: Add OF support Jon Hunter
2023-01-20  9:33   ` Heikki Krogerus
2023-01-20 13:18     ` Jon Hunter
2023-01-19 12:16 ` [PATCH V6 4/6] i2c: nvidia-gpu: Remove ccgx,firmware-build property Jon Hunter
2023-01-20  9:37   ` Heikki Krogerus
2023-01-19 12:16 ` [PATCH V6 5/6] usb: typec: ucsi_ccg: " Jon Hunter
2023-01-20  9:34   ` Heikki Krogerus
2023-01-20 13:20     ` Jon Hunter
2023-01-19 12:16 ` [PATCH V6 6/6] arm64: tegra: Populate USB Type-C Controller for Jetson AGX Orin Jon Hunter

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