* [PATCH v1 0/2] usb: tegra: separate schema and adjust OTG logic
@ 2026-10-04 16:52 Svyatoslav Ryhel
2026-10-04 16:52 ` [PATCH v1 1/2] dt-bindings: usb: Move Tegra-specific Chipidea USB properties into a dedicated schema Svyatoslav Ryhel
2026-10-04 16:52 ` [PATCH v1 2/2] usb: phy: tegra: Disable internal USB sensing if extcon is used Svyatoslav Ryhel
0 siblings, 2 replies; 6+ messages in thread
From: Svyatoslav Ryhel @ 2026-10-04 16:52 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Thierry Reding, Jonathan Hunter, Svyatoslav Ryhel,
Mikko Perttunen, Jordan Viknar
Cc: linux-usb, devicetree, linux-tegra, linux-kernel
Separate Tegra specific USB controller props into a dedicated schema.
Adjust USB OTG mode behavior with extcon use.
Jordan Viknar (1):
usb: phy: tegra: Disable internal USB sensing if extcon is used
Svyatoslav Ryhel (1):
dt-bindings: usb: Move Tegra-specific Chipidea USB properties into a
dedicated schema
.../bindings/usb/chipidea,usb2-tegra.yaml | 88 +++++++++++++++++++
.../devicetree/bindings/usb/ci-hdrc-usb2.yaml | 22 -----
drivers/usb/phy/phy-tegra-usb.c | 55 ++++++++++++
include/linux/usb/tegra_usb_phy.h | 1 +
4 files changed, 144 insertions(+), 22 deletions(-)
create mode 100644 Documentation/devicetree/bindings/usb/chipidea,usb2-tegra.yaml
--
2.53.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v1 1/2] dt-bindings: usb: Move Tegra-specific Chipidea USB properties into a dedicated schema
2026-10-04 16:52 [PATCH v1 0/2] usb: tegra: separate schema and adjust OTG logic Svyatoslav Ryhel
@ 2026-10-04 16:52 ` Svyatoslav Ryhel
2026-10-26 22:29 ` Rob Herring
2026-10-04 16:52 ` [PATCH v1 2/2] usb: phy: tegra: Disable internal USB sensing if extcon is used Svyatoslav Ryhel
1 sibling, 1 reply; 6+ messages in thread
From: Svyatoslav Ryhel @ 2026-10-04 16:52 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Thierry Reding, Jonathan Hunter, Svyatoslav Ryhel,
Mikko Perttunen, Jordan Viknar
Cc: linux-usb, devicetree, linux-tegra, linux-kernel
Move all Tegra-specific Chipidea devices and their properties into a
dedicated schema file, by analogy with i.MX.
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
.../bindings/usb/chipidea,usb2-tegra.yaml | 88 +++++++++++++++++++
.../devicetree/bindings/usb/ci-hdrc-usb2.yaml | 22 -----
2 files changed, 88 insertions(+), 22 deletions(-)
create mode 100644 Documentation/devicetree/bindings/usb/chipidea,usb2-tegra.yaml
diff --git a/Documentation/devicetree/bindings/usb/chipidea,usb2-tegra.yaml b/Documentation/devicetree/bindings/usb/chipidea,usb2-tegra.yaml
new file mode 100644
index 0000000000000..78046f8a63ad5
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/chipidea,usb2-tegra.yaml
@@ -0,0 +1,88 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/chipidea,usb2-tegra.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Tegra USB2 ChipIdea USB controller
+
+maintainers:
+ - Svyatoslav Ryhel <clamor95@gmail.com>
+
+properties:
+ compatible:
+ oneOf:
+ - enum:
+ - nvidia,tegra20-ehci
+ - nvidia,tegra20-udc
+ - nvidia,tegra30-ehci
+ - nvidia,tegra30-udc
+ - nvidia,tegra114-udc
+ - nvidia,tegra124-udc
+ - items:
+ - enum:
+ - nvidia,tegra114-ehci
+ - nvidia,tegra124-ehci
+ - nvidia,tegra210-ehci
+ - const: nvidia,tegra30-ehci
+
+ operating-points-v2:
+ description: A phandle to the OPP table containing the performance states.
+ $ref: /schemas/types.yaml#/definitions/phandle
+
+ nvidia,phy:
+ description: phandle of usb phy that connects to the port. Use "phys" instead.
+ $ref: /schemas/types.yaml#/definitions/phandle
+ deprecated: true
+
+ nvidia,needs-double-reset:
+ description: Indicates double reset or not.
+ type: boolean
+ deprecated: true
+
+required:
+ - compatible
+ - reg
+ - interrupts
+ - clocks
+ - resets
+
+allOf:
+ - $ref: chipidea,usb2-common.yaml#
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/tegra30-car.h>
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+ usb@7d000000 {
+ compatible = "nvidia,tegra30-udc";
+ reg = <0x7d000000 0x4000>;
+ interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
+ phy_type = "utmi";
+ clocks = <&tegra_car TEGRA30_CLK_USBD>;
+ resets = <&tegra_car 22>;
+ reset-names = "usb";
+ phys = <&phy1>;
+ power-domains = <&pd_core>;
+ operating-points-v2 = <&usbd_dvfs_opp_table>;
+
+ dr_mode = "otg";
+
+ hnp-disable;
+ srp-disable;
+ adp-disable;
+
+ usb-role-switch;
+ extcon = <&charger>, <&extcon>; /* vbus, id */
+ vbus-supply = <&usb_otg_vbus>;
+
+ port {
+ usb_in: endpoint {
+ remote-endpoint = <&connector_out>;
+ };
+ };
+ };
+...
diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml
index 620b564914d43..b73bea61dcac0 100644
--- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml
+++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml
@@ -17,20 +17,8 @@ properties:
- chipidea,usb2
- lsi,zevio-usb
- nuvoton,npcm750-udc
- - nvidia,tegra20-ehci
- - nvidia,tegra20-udc
- - nvidia,tegra30-ehci
- - nvidia,tegra30-udc
- - nvidia,tegra114-udc
- - nvidia,tegra124-udc
- nxp,s32g2-usb
- qcom,ci-hdrc
- - items:
- - enum:
- - nvidia,tegra114-ehci
- - nvidia,tegra124-ehci
- - nvidia,tegra210-ehci
- - const: nvidia,tegra30-ehci
- items:
- const: xlnx,zynq-usb-2.20a
- const: chipidea,usb2
@@ -66,16 +54,6 @@ properties:
- description: register offset
- description: phy index
- nvidia,phy:
- description: phandle of usb phy that connects to the port. Use "phys" instead.
- $ref: /schemas/types.yaml#/definitions/phandle
- deprecated: true
-
- nvidia,needs-double-reset:
- description: Indicates double reset or not.
- type: boolean
- deprecated: true
-
ulpi:
type: object
additionalProperties: false
--
2.53.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v1 2/2] usb: phy: tegra: Disable internal USB sensing if extcon is used
2026-10-04 16:52 [PATCH v1 0/2] usb: tegra: separate schema and adjust OTG logic Svyatoslav Ryhel
2026-10-04 16:52 ` [PATCH v1 1/2] dt-bindings: usb: Move Tegra-specific Chipidea USB properties into a dedicated schema Svyatoslav Ryhel
@ 2026-10-04 16:52 ` Svyatoslav Ryhel
1 sibling, 0 replies; 6+ messages in thread
From: Svyatoslav Ryhel @ 2026-10-04 16:52 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Thierry Reding, Jonathan Hunter, Svyatoslav Ryhel,
Mikko Perttunen, Jordan Viknar
Cc: linux-usb, devicetree, linux-tegra, linux-kernel
From: Jordan Viknar <jordanviknar@gmail.com>
The Tegra USB PHY features four VBUS sensors: A_VBUS_VLD, A_SESS_VLD,
B_SESS_VLD, and B_SESS_END. This allows the SoC to detect mode switches
and natively work with OTG. On some devices, instead of relying on Tegra's
own mechanism, some type of extcon detection chip may be used, which
conflicts with the native Tegra implementation.
Add extcon parsing from the linked USB controller. If such a property
exists, switch VBUS sensors to software mode and set their values to SET.
This indicates that the VBUS sensors are not required by the USB
controller, which uses extcon for detection instead.
This fixes all devices that have OTG mode set with extcon for Tegra20
(LG Optimus 2X P990), Tegra30 (LG Optimus 4X P880 and Vu P895),
Tegra114 (Nvidia Tegra Note 7), and Tegra124 (Xiaomi Mi Pad). All listed
devices were tested.
Assisted-by: Claude Sonnet 5
Signed-off-by: Jordan Viknar <jordanviknar@gmail.com>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
drivers/usb/phy/phy-tegra-usb.c | 55 +++++++++++++++++++++++++++++++
include/linux/usb/tegra_usb_phy.h | 1 +
2 files changed, 56 insertions(+)
diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c
index 00443a7beaeb0..d3faeb6619454 100644
--- a/drivers/usb/phy/phy-tegra-usb.c
+++ b/drivers/usb/phy/phy-tegra-usb.c
@@ -16,6 +16,7 @@
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/resource.h>
@@ -68,9 +69,18 @@
#define UHSIC_PHY_ENABLE BIT(19)
#define USB_PHY_VBUS_SENSORS 0x404
+#define B_SESS_VLD_SW_EN BIT(11)
+#define B_SESS_VLD_SW_VALUE BIT(12)
#define B_SESS_VLD_WAKEUP_EN BIT(14)
+#define A_SESS_VLD_SW_EN BIT(19)
+#define A_SESS_VLD_SW_VALUE BIT(20)
#define A_SESS_VLD_WAKEUP_EN BIT(22)
+#define A_VBUS_VLD_SW_EN BIT(27)
+#define A_VBUS_VLD_SW_VALUE BIT(28)
#define A_VBUS_VLD_WAKEUP_EN BIT(30)
+#define VBUS_SENSORS_SW_OVERRIDE (B_SESS_VLD_SW_EN | B_SESS_VLD_SW_VALUE | \
+ A_SESS_VLD_SW_EN | A_SESS_VLD_SW_VALUE | \
+ A_VBUS_VLD_SW_EN | A_VBUS_VLD_SW_VALUE)
#define USB_PHY_VBUS_WAKEUP_ID 0x408
#define ID_INT_EN BIT(0)
@@ -621,6 +631,10 @@ static int utmi_phy_power_on(struct tegra_usb_phy *phy)
val = readl_relaxed(base + USB_PHY_VBUS_SENSORS);
val &= ~(A_VBUS_VLD_WAKEUP_EN | A_SESS_VLD_WAKEUP_EN);
val &= ~(B_SESS_VLD_WAKEUP_EN);
+
+ if (phy->has_extcon)
+ val |= VBUS_SENSORS_SW_OVERRIDE;
+
writel_relaxed(val, base + USB_PHY_VBUS_SENSORS);
val = readl_relaxed(base + UTMIP_BAT_CHRG_CFG0);
@@ -727,6 +741,12 @@ static int utmi_phy_power_off(struct tegra_usb_phy *phy)
val, !(val & VBUS_WAKEUP_STS),
5000, 100000);
+ if (phy->has_extcon) {
+ val = readl_relaxed(base + USB_PHY_VBUS_SENSORS);
+ val &= ~VBUS_SENSORS_SW_OVERRIDE;
+ writel_relaxed(val, base + USB_PHY_VBUS_SENSORS);
+ }
+
utmi_phy_clk_disable(phy);
/* PHY won't resume if reset is asserted */
@@ -1456,6 +1476,34 @@ static int tegra_usb_phy_parse_pmc(struct device *dev,
return 0;
}
+static int tegra_usb_phy_parse_controller(struct device *dev,
+ struct tegra_usb_phy *phy)
+{
+ struct device_node *usb_node;
+ char *node_path;
+ u64 addr;
+ int ret;
+
+ ret = of_property_read_reg(dev->of_node, 0, &addr, NULL);
+ if (ret) {
+ dev_err(dev, "Failed to read reg entry 0: %d\n", ret);
+ return ret;
+ }
+
+ node_path = devm_kasprintf(dev, GFP_KERNEL, "/usb@%08llx", addr);
+ if (!node_path)
+ return -ENOMEM;
+
+ usb_node = of_find_node_by_path(node_path);
+ if (!usb_node)
+ return -ENODEV;
+
+ phy->has_extcon = of_property_present(usb_node, "extcon");
+ of_node_put(usb_node);
+
+ return 0;
+}
+
static const struct tegra_phy_soc_config tegra20_soc_config = {
.utmi_pll_config_in_car_module = false,
.has_hostpc = false,
@@ -1552,6 +1600,13 @@ static int tegra_usb_phy_probe(struct platform_device *pdev)
return err;
}
+ if (tegra_phy->mode == USB_DR_MODE_OTG) {
+ err = tegra_usb_phy_parse_controller(&pdev->dev, tegra_phy);
+ if (err)
+ return dev_err_probe(&pdev->dev, err,
+ "Failed to get controller\n");
+ }
+
tegra_phy->phy_type = of_usb_get_phy_mode(np);
switch (tegra_phy->phy_type) {
case USBPHY_INTERFACE_MODE_UTMI:
diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_usb_phy.h
index 6343f88df5de8..4bb20e39003ab 100644
--- a/include/linux/usb/tegra_usb_phy.h
+++ b/include/linux/usb/tegra_usb_phy.h
@@ -87,6 +87,7 @@ struct tegra_usb_phy {
bool wakeup_enabled;
bool pad_wakeup;
bool powered_on;
+ bool has_extcon;
};
#endif /* __TEGRA_USB_PHY_H */
--
2.53.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 1/2] dt-bindings: usb: Move Tegra-specific Chipidea USB properties into a dedicated schema
2026-10-04 16:52 ` [PATCH v1 1/2] dt-bindings: usb: Move Tegra-specific Chipidea USB properties into a dedicated schema Svyatoslav Ryhel
@ 2026-10-26 22:29 ` Rob Herring
2026-10-27 8:51 ` Svyatoslav Ryhel
0 siblings, 1 reply; 6+ messages in thread
From: Rob Herring @ 2026-10-26 22:29 UTC (permalink / raw)
To: Svyatoslav Ryhel
Cc: Greg Kroah-Hartman, Krzysztof Kozlowski, Conor Dooley,
Thierry Reding, Jonathan Hunter, Mikko Perttunen, Jordan Viknar,
linux-usb, devicetree, linux-tegra, linux-kernel
On Sun, Oct 04, 2026 at 07:52:03PM +0300, Svyatoslav Ryhel wrote:
> Move all Tegra-specific Chipidea devices and their properties into a
> dedicated schema file, by analogy with i.MX.
I don't really see the point given it is only 2 deprecated properties.
Maybe those can be removed? Depends if they are deprecated and still
used or deprecated and removed from .dts files years ago.
Rob
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 1/2] dt-bindings: usb: Move Tegra-specific Chipidea USB properties into a dedicated schema
2026-10-26 22:29 ` Rob Herring
@ 2026-10-27 8:51 ` Svyatoslav Ryhel
2026-10-27 11:50 ` Rob Herring
0 siblings, 1 reply; 6+ messages in thread
From: Svyatoslav Ryhel @ 2026-10-27 8:51 UTC (permalink / raw)
To: Rob Herring
Cc: Greg Kroah-Hartman, Krzysztof Kozlowski, Conor Dooley,
Thierry Reding, Jonathan Hunter, Mikko Perttunen, Jordan Viknar,
linux-usb, devicetree, linux-tegra, linux-kernel
вт, 27 жовт. 2026 р. о 00:29 Rob Herring <robh@kernel.org> пише:
>
> On Sun, Oct 04, 2026 at 07:52:03PM +0300, Svyatoslav Ryhel wrote:
> > Move all Tegra-specific Chipidea devices and their properties into a
> > dedicated schema file, by analogy with i.MX.
>
> I don't really see the point given it is only 2 deprecated properties.
> Maybe those can be removed? Depends if they are deprecated and still
> used or deprecated and removed from .dts files years ago.
>
The ci-hdrc-usb2.yaml schema contains properties that are not
applicable to Tegra, and conversely, Tegra-specific properties are not
applicable to qcom, nxp, nuvoton, etc.
The 'nvidia,needs-double-reset' property is required for Tegra20 and
Tegra30, and it is still actively in use, as you can see here [1]. Its
marked deprecated state appears to be incorrect, as it should simply
be restricted to Tegra20 and Tegra30.
The 'nvidia,phy' property is still used across all ARMv7 Tegra
generations + Tegra210, as the Chipidea driver has not yet been
converted to use the generic property. Therefore, while it is marked
as deprecated, it remains in active use.
The example I added is from Tegra30, which in the real devicetree uses
both properties, so I've included them here as well. With your
permission, I can remove the Tegra-specific parts from
ci-hdrc-usb2.yaml and tailor the proposed schema to better fit the
current state.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/arch/arm/boot/dts/nvidia/tegra30.dtsi?h=next-20261026#n1146
> Rob
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 1/2] dt-bindings: usb: Move Tegra-specific Chipidea USB properties into a dedicated schema
2026-10-27 8:51 ` Svyatoslav Ryhel
@ 2026-10-27 11:50 ` Rob Herring
0 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2026-10-27 11:50 UTC (permalink / raw)
To: Svyatoslav Ryhel
Cc: Greg Kroah-Hartman, Krzysztof Kozlowski, Conor Dooley,
Thierry Reding, Jonathan Hunter, Mikko Perttunen, Jordan Viknar,
linux-usb, devicetree, linux-tegra, linux-kernel
On Tue, Oct 27, 2026 at 10:51:52AM +0200, Svyatoslav Ryhel wrote:
> вт, 27 жовт. 2026 р. о 00:29 Rob Herring <robh@kernel.org> пише:
> >
> > On Sun, Oct 04, 2026 at 07:52:03PM +0300, Svyatoslav Ryhel wrote:
> > > Move all Tegra-specific Chipidea devices and their properties into a
> > > dedicated schema file, by analogy with i.MX.
> >
> > I don't really see the point given it is only 2 deprecated properties.
> > Maybe those can be removed? Depends if they are deprecated and still
> > used or deprecated and removed from .dts files years ago.
> >
>
> The ci-hdrc-usb2.yaml schema contains properties that are not
> applicable to Tegra, and conversely, Tegra-specific properties are not
> applicable to qcom, nxp, nuvoton, etc.
>
> The 'nvidia,needs-double-reset' property is required for Tegra20 and
> Tegra30, and it is still actively in use, as you can see here [1]. Its
> marked deprecated state appears to be incorrect, as it should simply
> be restricted to Tegra20 and Tegra30.
>
> The 'nvidia,phy' property is still used across all ARMv7 Tegra
> generations + Tegra210, as the Chipidea driver has not yet been
> converted to use the generic property. Therefore, while it is marked
> as deprecated, it remains in active use.
>
> The example I added is from Tegra30, which in the real devicetree uses
> both properties, so I've included them here as well. With your
> permission, I can remove the Tegra-specific parts from
> ci-hdrc-usb2.yaml and tailor the proposed schema to better fit the
> current state.
Okay, please add these details to the commit msg.
Rob
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-10-27 11:50 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-04 16:52 [PATCH v1 0/2] usb: tegra: separate schema and adjust OTG logic Svyatoslav Ryhel
2026-10-04 16:52 ` [PATCH v1 1/2] dt-bindings: usb: Move Tegra-specific Chipidea USB properties into a dedicated schema Svyatoslav Ryhel
2026-10-26 22:29 ` Rob Herring
2026-10-27 8:51 ` Svyatoslav Ryhel
2026-10-27 11:50 ` Rob Herring
2026-10-04 16:52 ` [PATCH v1 2/2] usb: phy: tegra: Disable internal USB sensing if extcon is used Svyatoslav Ryhel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®