Skip to contentSkip to conversation

phy: tegra: xusb: Add Tegra238 support

PATCH Applied Jon Hunter 4 participants 11 messages Oct 7 – Oct 9

Subsystems (4)
lore
Share & tools
lore

Jon Hunter

author maintainer
#0 lore raw

v3 cover phy: tegra: xusb: Add Tegra238 support

Add support for the Tegra238 device to the Tegra XUSB PHY driver and add the necessary device-tree binding documentation for this device.

This series also includes a trivial clean-up patch to use the dev_err_probe() function in the Tegra XUSB PHY driver instead of open coding this function.

---
Changes in v3:
- Fixed build issue reported by sashiko.
- Rebased on top of next-20261007 which now includes the dependent changes [0] and so applies cleanly.
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Dropped extra 'err' variable from patch that migrates to dev_err_probe
- Added Krzysztof's Reviewed-by for device-tree binding.
- Link to v1: https://patch.msgid.link/[email protected]

[0] https://lore.kernel.org/linux-tegra/[email protected]/

---
Jon Hunter (3):
dt-bindings: phy: tegra194: Add compatible for Tegra238
phy: tegra: xusb: Use dev_err_probe()
phy: tegra: Add support for Tegra238 XUSB pad controller

 .../bindings/phy/nvidia,tegra194-xusb-padctl.yaml  | 38 ++++++++++++++++++++++
 drivers/phy/tegra/Makefile                         |  1 +
 drivers/phy/tegra/xusb-tegra186.c                  | 29 +++++++++++++----
 drivers/phy/tegra/xusb.c                           | 14 ++++----
 drivers/phy/tegra/xusb.h                           |  3 ++
 5 files changed, 72 insertions(+), 13 deletions(-)

---
base-commit: b018686719706a781c45a874ed51374a2dc4b767
change-id: 20260918-tegra-phy-1611f1d54afa

Best regards,

Signature · 1 line
Jon Hunter <[email protected]>
author maintainer
#1 lore raw

PATCH v3 1/3 dt-bindings: phy: tegra194: Add compatible for Tegra238

The Tegra238 XUSB pad controller is similar to that found on the Tegra194 and Tegra234, but only has three USB2 ports and three USB3 ports.

Add the Tegra238 compatible string for the XUSB pad controller and constrain the binding so that a Tegra238 device tree can only have three USB2 and three USB3 ports.

---
 .../bindings/phy/nvidia,tegra194-xusb-padctl.yaml  | 38 ++++++++++++++++++++++
 1 file changed, 38 insertions(+)
Documentation/devicetree/bindings/phy/nvidia,tegra194-xusb-padctl.yaml +38 -0
index f6fe3c90b5b0..fbafe8eb150b 100644
@@ -45,6 +45,7 @@ properties:
     enum:
       - nvidia,tegra194-xusb-padctl
       - nvidia,tegra234-xusb-padctl
+      - nvidia,tegra238-xusb-padctl
       - nvidia,tegra264-xusb-padctl
 
   reg:
@@ -542,6 +543,43 @@ properties:
             description: connection to a USB Type C controller
             $ref: /schemas/graph.yaml#/properties/port
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: nvidia,tegra238-xusb-padctl
+    then:
+      properties:
+        pads:
+          properties:
+            usb2:
+              properties:
+                lanes:
+                  properties:
+                    usb2-3: false
+            usb3:
+              properties:
+                lanes:
+                  properties:
+                    usb3-3: false
+        ports:
+          properties:
+            usb2-3: false
+            usb3-0:
+              properties:
+                nvidia,usb2-companion:
+                  enum: [ 0, 1, 2 ]
+            usb3-1:
+              properties:
+                nvidia,usb2-companion:
+                  enum: [ 0, 1, 2 ]
+            usb3-2:
+              properties:
+                nvidia,usb2-companion:
+                  enum: [ 0, 1, 2 ]
+            usb3-3: false
+
 additionalProperties: false
 
 required:
Signature · 1 line
2.43.0
author maintainer
#2 lore raw

PATCH v3 2/3 phy: tegra: xusb: Use dev_err_probe()

In reply to Jon Hunter

Use the function dev_err_probe() instead of open coding the same logic.

---
 drivers/phy/tegra/xusb.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/phy/tegra/xusb.c +1 -7
index d0d0b252a205..0635f0d82c96 100644
@@ -1257,13 +1257,7 @@ static int tegra_xusb_padctl_probe(struct platform_device *pdev)
 
 	err = tegra_xusb_setup_ports(padctl);
 	if (err) {
-		const char *level = KERN_ERR;
-
-		if (err == -EPROBE_DEFER)
-			level = KERN_DEBUG;
-
-		dev_printk(level, &pdev->dev,
-			   dev_fmt("failed to setup XUSB ports: %d\n"), err);
+		dev_err_probe(&pdev->dev, err, "failed to setup XUSB ports\n");
 		goto remove_pads;
 	}
 
Signature · 1 line
2.43.0
author maintainer
#3 lore raw

PATCH v3 3/3 phy: tegra: Add support for Tegra238 XUSB pad controller

In reply to Jon Hunter

Add support for the Tegra238 XUSB pad controller by populating the Tegra238 specific SoC data for the controller. The Tegra238 has three USB2 and USB3 ports, uses the same port ops as Tegra186 and has the same supplies as Tegra194. Due to the dependencies the Tegra238 device has on the Tegra186 port ops and Tegra194 supplies, drop the compile time guards around these structures.

---
 drivers/phy/tegra/Makefile        |  1 +
 drivers/phy/tegra/xusb-tegra186.c | 29 +++++++++++++++++++++++------
 drivers/phy/tegra/xusb.c          |  6 ++++++
 drivers/phy/tegra/xusb.h          |  3 +++
 4 files changed, 33 insertions(+), 6 deletions(-)
drivers/phy/tegra/Makefile +1 -0
index f5ed9582d80b..018a4cab2b40 100644
@@ -8,6 +8,7 @@ phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_210_SOC) += xusb-tegra210.o
 phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_186_SOC) += xusb-tegra186.o
 phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_194_SOC) += xusb-tegra186.o
 phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_234_SOC) += xusb-tegra186.o
+phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_238_SOC) += xusb-tegra186.o
 phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_264_SOC) += xusb-tegra186.o
 obj-$(CONFIG_PHY_TEGRA194_P2U) += phy-tegra194-p2u.o
 obj-$(CONFIG_PHY_TEGRA_MPHY) += phy-tegra-mphy.o
drivers/phy/tegra/xusb-tegra186.c +23 -6
index 322efdea0d80..aa8ab94fad4c 100644
@@ -1599,7 +1599,6 @@ static const struct tegra_xusb_padctl_ops tegra186_xusb_padctl_ops = {
 	.utmi_pad_power_down = tegra186_utmi_pad_power_down,
 };
 
-#if IS_ENABLED(CONFIG_ARCH_TEGRA_186_SOC)
 static const char * const tegra186_xusb_padctl_supply_names[] = {
 	"avdd-pll-erefeut",
 	"avdd-usb",
@@ -1665,11 +1664,7 @@ const struct tegra_xusb_padctl_soc tegra186_xusb_padctl_soc = {
 	.num_supplies = ARRAY_SIZE(tegra186_xusb_padctl_supply_names),
 };
 EXPORT_SYMBOL_GPL(tegra186_xusb_padctl_soc);
-#endif
 
-#if IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) || \
-	IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC) || \
-	IS_ENABLED(CONFIG_ARCH_TEGRA_264_SOC)
 static const char * const tegra194_xusb_padctl_supply_names[] = {
 	"avdd-usb",
 	"vclamp-usb",
@@ -1755,6 +1750,29 @@ const struct tegra_xusb_padctl_soc tegra234_xusb_padctl_soc = {
 };
 EXPORT_SYMBOL_GPL(tegra234_xusb_padctl_soc);
 
+const struct tegra_xusb_padctl_soc tegra238_xusb_padctl_soc = {
+	.num_pads = ARRAY_SIZE(tegra186_pads),
+	.pads = tegra186_pads,
+	.ports = {
+		.usb2 = {
+			.ops = &tegra186_usb2_port_ops,
+			.count = 3,
+		},
+		.usb3 = {
+			.ops = &tegra186_usb3_port_ops,
+			.count = 3,
+		},
+	},
+	.ops = &tegra186_xusb_padctl_ops,
+	.supply_names = tegra194_xusb_padctl_supply_names,
+	.num_supplies = ARRAY_SIZE(tegra194_xusb_padctl_supply_names),
+	.supports_gen2 = true,
+	.poll_trk_completed = true,
+	.trk_hw_mode = false,
+	.supports_lp_cfg_en = true,
+};
+EXPORT_SYMBOL_GPL(tegra238_xusb_padctl_soc);
+
 const struct tegra_xusb_padctl_soc tegra264_xusb_padctl_soc = {
 	.num_pads = ARRAY_SIZE(tegra194_pads),
 	.pads = tegra194_pads,
@@ -1778,7 +1796,6 @@ const struct tegra_xusb_padctl_soc tegra264_xusb_padctl_soc = {
 	.has_per_pad_term = true,
 };
 EXPORT_SYMBOL_GPL(tegra264_xusb_padctl_soc);
-#endif
 
 MODULE_AUTHOR("JC Kuo <[email protected]>");
 MODULE_DESCRIPTION("NVIDIA Tegra186 XUSB Pad Controller driver");
drivers/phy/tegra/xusb.c +6 -0
index 0635f0d82c96..89ce9ac87300 100644
@@ -78,6 +78,12 @@ static const struct of_device_id tegra_xusb_padctl_of_match[] = {
 		.data = &tegra234_xusb_padctl_soc,
 	},
 #endif
+#if defined(CONFIG_ARCH_TEGRA_238_SOC)
+	{
+		.compatible = "nvidia,tegra238-xusb-padctl",
+		.data = &tegra238_xusb_padctl_soc,
+	},
+#endif
 #if defined(CONFIG_ARCH_TEGRA_264_SOC)
 	{
 		.compatible = "nvidia,tegra264-xusb-padctl",
drivers/phy/tegra/xusb.h +3 -0
index d8d799d9e752..b9de4f3b5781 100644
@@ -514,6 +514,9 @@ extern const struct tegra_xusb_padctl_soc tegra194_xusb_padctl_soc;
 #if defined(CONFIG_ARCH_TEGRA_234_SOC)
 extern const struct tegra_xusb_padctl_soc tegra234_xusb_padctl_soc;
 #endif
+#if defined(CONFIG_ARCH_TEGRA_238_SOC)
+extern const struct tegra_xusb_padctl_soc tegra238_xusb_padctl_soc;
+#endif
 #if defined(CONFIG_ARCH_TEGRA_264_SOC)
 extern const struct tegra_xusb_padctl_soc tegra264_xusb_padctl_soc;
 #endif
Signature · 1 line
2.43.0
#4 lore raw

Re: [PATCH v3 3/3] phy: tegra: Add support for Tegra238 XUSB pad controller

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] phy: tegra: missing declarations for exported SoC structs in xusb.h --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] phy: tegra: missing declarations for exported SoC structs in xusb.h --

commit 8acf4872f17465f59f32558aefacb7be8e2c679f
Author: Jon Hunter <[email protected]>

phy: tegra: Add support for Tegra238 XUSB pad controller

This commit adds support for the Tegra238 XUSB pad controller. It populates the Tegra238 specific SoC data, reusing structures from Tegra186 and Tegra194, and drops the compile time guards around these shared structures in the source file.

Quoted 4 lines
drivers/phy/tegra/xusb-tegra186.c +0 -0
index 322efdea0d807..aa8ab94fad4cf 100644

[ ... ]

drivers/phy/tegra/xusb-tegra186.c const struct tegra_xusb_padctl_soc tegra186_xusb_padctl_soc = { · line 1668

Quoted 5 lines
drivers/phy/tegra/xusb-tegra186.c +0 -1
@@ -1665,11 +1664,7 @@ const struct tegra_xusb_padctl_soc tegra186_xusb_padctl_soc = {
 	.num_supplies = ARRAY_SIZE(tegra186_xusb_padctl_supply_names),
 };
 EXPORT_SYMBOL_GPL(tegra186_xusb_padctl_soc);
-#endif

[Severity: Low]
Since the guards are removed here, tegra186_xusb_padctl_soc is now defined and exported unconditionally. However, its extern declaration in drivers/phy/tegra/xusb.h remains conditionally guarded:

#if defined(CONFIG_ARCH_TEGRA_186_SOC)
extern const struct tegra_xusb_padctl_soc tegra186_xusb_padctl_soc; #endif

Does this cause missing declaration warnings (-Wmissing-declarations or -Wmissing-prototypes) during the build if the kernel is configured with CONFIG_ARCH_TEGRA_238_SOC=y but CONFIG_ARCH_TEGRA_186_SOC=n? Should the corresponding guards in xusb.h be removed as well?

drivers/phy/tegra/xusb-tegra186.c const struct tegra_xusb_padctl_soc tegra186_xusb_padctl_soc = { · line 1670

Quoted 7 lines
drivers/phy/tegra/xusb-tegra186.c +0 -3
-#if IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) || \
-	IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC) || \
-	IS_ENABLED(CONFIG_ARCH_TEGRA_264_SOC)
 static const char * const tegra194_xusb_padctl_supply_names[] = {
 	"avdd-usb",
 	"vclamp-usb",

[Severity: Low]
A similar mismatch occurs here for tegra194_xusb_padctl_soc. The definition is now unconditional, but the extern declaration in xusb.h is still guarded by #if defined(CONFIG_ARCH_TEGRA_194_SOC). Could this also trigger missing prototype warnings when building with certain configs disabled?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
#5 lore raw

Re: [PATCH v3 3/3] phy: tegra: Add support for Tegra238 XUSB pad controller

In reply to Jon Hunter
Quoted 20 lines · Jon Hunter

Add support for the Tegra238 XUSB pad controller by populating the Tegra238 specific SoC data for the controller. The Tegra238 has three USB2 and USB3 ports, uses the same port ops as Tegra186 and has the same supplies as Tegra194. Due to the dependencies the Tegra238 device has on the Tegra186 port ops and Tegra194 supplies, drop the compile time guards around these structures.

---
 drivers/phy/tegra/Makefile        |  1 +
 drivers/phy/tegra/xusb-tegra186.c | 29 +++++++++++++++++++++++------
 drivers/phy/tegra/xusb.c          |  6 ++++++
 drivers/phy/tegra/xusb.h          |  3 +++
 4 files changed, 33 insertions(+), 6 deletions(-)
drivers/phy/tegra/Makefile +0 -0
index f5ed9582d80b..018a4cab2b40 100644

drivers/phy/tegra/Makefile phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_210_SOC) += xusb-tegra210.o · line 12

Quoted 5 lines
drivers/phy/tegra/Makefile +1 -0
@@ -8,6 +8,7 @@ phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_210_SOC) += xusb-tegra210.o
 phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_186_SOC) += xusb-tegra186.o
 phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_194_SOC) += xusb-tegra186.o
 phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_234_SOC) += xusb-tegra186.o
+phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_238_SOC) += xusb-tegra186.o
 phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_264_SOC) += xusb-tegra186.o

This is just a mess. As a followup patch, could you please please switch to generic ARCH_TEGRA Kconfig option as done in this commit, 6b5e2f70a95c ("PCI: dwc: tegra194: Broaden architecture dependency")?

- Mani

Signature · 1 line
மணிவண்ணன் சதாசிவம்
author maintainer
#6 lore raw

Re: [PATCH v3 3/3] phy: tegra: Add support for Tegra238 XUSB pad controller

Quoted 16 lines · Manivannan Sadhasivam
Quoted 15 lines · Jon Hunter

Add support for the Tegra238 XUSB pad controller by populating the Tegra238 specific SoC data for the controller. The Tegra238 has three USB2 and USB3 ports, uses the same port ops as Tegra186 and has the same supplies as Tegra194. Due to the dependencies the Tegra238 device has on the Tegra186 port ops and Tegra194 supplies, drop the compile time guards around these structures.

---
  drivers/phy/tegra/Makefile        |  1 +
  drivers/phy/tegra/xusb-tegra186.c | 29 +++++++++++++++++++++++------
  drivers/phy/tegra/xusb.c          |  6 ++++++
  drivers/phy/tegra/xusb.h          |  3 +++
  4 files changed, 33 insertions(+), 6 deletions(-)
Quoted 14 lines

drivers/phy/tegra/Makefile phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_210_SOC) += xusb-tegra210.o · line 12

Quoted 10 lines
drivers/phy/tegra/Makefile +1 -0
index f5ed9582d80b..018a4cab2b40 100644
@@ -8,6 +8,7 @@ phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_210_SOC) += xusb-tegra210.o
  phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_186_SOC) += xusb-tegra186.o
  phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_194_SOC) += xusb-tegra186.o
  phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_234_SOC) += xusb-tegra186.o
+phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_238_SOC) += xusb-tegra186.o
  phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_264_SOC) += xusb-tegra186.o

This is just a mess. As a followup patch, could you please please switch to generic ARCH_TEGRA Kconfig option as done in this commit, 6b5e2f70a95c ("PCI: dwc: tegra194: Broaden architecture dependency")?

Yes that would be a good idea and yes I can do that as a follow-up.

Jon

Signature · 1 line
nvpublic
author maintainer
#7 lore raw

Re: [PATCH v3 3/3] phy: tegra: Add support for Tegra238 XUSB pad controller

Quoted 33 lines · Jon Hunter
Quoted 16 lines · Manivannan Sadhasivam
Quoted 15 lines · Jon Hunter

Add support for the Tegra238 XUSB pad controller by populating the Tegra238 specific SoC data for the controller. The Tegra238 has three USB2 and USB3 ports, uses the same port ops as Tegra186 and has the same supplies as Tegra194. Due to the dependencies the Tegra238 device has on the Tegra186 port ops and Tegra194 supplies, drop the compile time guards around these structures.

---
  drivers/phy/tegra/Makefile        |  1 + drivers/phy/tegra/xusb-tegra186.c | 29 +++++++++++++++++++++++------ drivers/phy/tegra/xusb.c          |  6 ++++++ drivers/phy/tegra/xusb.h          |  3 +++

  4 files changed, 33 insertions(+), 6 deletions(-)
Quoted 14 lines
Quoted 10 lines
drivers/phy/tegra/Makefile +0 -0
index f5ed9582d80b..018a4cab2b40 100644
@@ -8,6 +8,7 @@ phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_210_SOC) += xusb-tegra210.o

  phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_186_SOC) += xusb-tegra186.o phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_194_SOC) += xusb-tegra186.o phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_234_SOC) += xusb-tegra186.o +phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_238_SOC) += xusb-tegra186.o phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_264_SOC) += xusb-tegra186.o

This is just a mess. As a followup patch, could you please please switch to generic ARCH_TEGRA Kconfig option as done in this commit, 6b5e2f70a95c ("PCI: dwc: tegra194: Broaden architecture dependency")?

Quoted 1 line

Yes that would be a good idea and yes I can do that as a follow-up.

I did see the latest sashiko warning:

"Does this cause missing declaration warnings (-Wmissing-declarations or -Wmissing-prototypes)".

I am not seeing any warnings but I can also address that in the follow-up.

Jon

Signature · 1 line
nvpublic
maintainer
#8 lore raw

Re: [PATCH v3 3/3] phy: tegra: Add support for Tegra238 XUSB pad controller

Quoted 11 lines · Jon Hunter
Quoted 9 lines · Jon Hunter
Quoted 6 lines · Manivannan Sadhasivam

On Wed, Oct 07, 2026 at 03:44:43PM +0100, Jon Hunter wrote:

This is just a mess. As a followup patch, could you please please switch to generic ARCH_TEGRA Kconfig option as done in this commit, 6b5e2f70a95c ("PCI: dwc: tegra194: Broaden architecture dependency")?

Quoted 8 lines
Quoted 1 line

Yes that would be a good idea and yes I can do that as a follow-up.

I did see the latest sashiko warning:

"Does this cause missing declaration warnings (-Wmissing-declarations or -Wmissing-prototypes)".

I am not seeing any warnings but I can also address that in the follow-up.

Thanks, would appreciate if you folks can get this sorted. I have picked this one though...

Signature · 1 line
~Vinod
reviewer Reviewed-by on the v3 series
#9 lore raw
In reply to Jon Hunter
Quoted 8 lines · Jon Hunter

Add support for the Tegra238 device to the Tegra XUSB PHY driver and add the necessary device-tree binding documentation for this device.

This series also includes a trivial clean-up patch to use the dev_err_probe() function in the Tegra XUSB PHY driver instead of open coding this function.

- Mani

Signature · 1 line
மணிவண்ணன் சதாசிவம்
maintainer Applied
#10 lore raw
In reply to Jon Hunter
Quoted 8 lines · Jon Hunter

Add support for the Tegra238 device to the Tegra XUSB PHY driver and add the necessary device-tree binding documentation for this device.

This series also includes a trivial clean-up patch to use the dev_err_probe() function in the Tegra XUSB PHY driver instead of open coding this function.

[...]

Applied, thanks!

[1/3] dt-bindings: phy: tegra194: Add compatible for Tegra238

      commit: d940f4f05123ecdc3d1226df76ce652c1b4d845c
[2/3] phy: tegra: xusb: Use dev_err_probe()
      commit: c0c4091bbaa3c6dc05ecf8a639cec25eca933bfe
[3/3] phy: tegra: Add support for Tegra238 XUSB pad controller
      commit: 8f56fdf3d8cb9f1dbdc93bf9ac816698aa6f70b7

Best regards,

Signature · 1 line
~Vinod