ti,am62-usb: introduce ti,lane-reverse property
Subsystems (3)
cover ti,am62-usb: introduce ti,lane-reverse property
This mini series introduces and uses the ti,lane-reverse property.
dwc3-am62 USB PHY supports swapping D+ and D- lines which is quite useful when a mistake as been made in the design, or even if the lines were swapped on purpose, to facilitate routing for example.
The first patch adds the binding and the second one uses it.
This has been tested on a am625 Soc
Richard Genoud (2):
dt-bindings: usb/ti,am62-usb.yaml: Add ti,lane-reverse property
usb: dwc3-am62: support ti,lane-reverse property
Documentation/devicetree/bindings/usb/ti,am62-usb.yaml | 5 +++++ drivers/usb/dwc3/dwc3-am62.c | 5 +++++ 2 files changed, 10 insertions(+)
PATCH 1/2 dt-bindings: usb/ti,am62-usb.yaml: Add ti,lane-reverse property
On some designs, the D+ and D- lines are swapped (on purpose or not). The PHY can handle that with the LANE_REVERSE bit.
--- Documentation/devicetree/bindings/usb/ti,am62-usb.yaml | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/usb/ti,am62-usb.yaml +5 -0
@@ -36,6 +36,11 @@ properties: items: - const: ref + ti,lane-reverse: + description: + Should be present if D+ and D- lanes have to be swapped. + type: boolean + ti,vbus-divider: description: Should be present if USB VBUS line is connected to the
Re: [PATCH 1/2] dt-bindings: usb/ti,am62-usb.yaml: Add ti,lane-reverse property
Quoted 13 lines · Richard Genoud
On some designs, the D+ and D- lines are swapped (on purpose or not). The PHY can handle that with the
LANE_REVERSEbit.Signed-off-by Richard Genoud <[email protected]>--- Documentation/devicetree/bindings/usb/ti,am62-usb.yaml | 5 +++++ 1 file changed, 5 insertions(+)Documentation/devicetree/bindings/usb/ti,am62-usb.yaml +0
-0
Documentation/devicetree/bindings/usb/ti,am62-usb.yaml properties: · line 42
Quoted 7 lines
Documentation/devicetree/bindings/usb/ti,am62-usb.yaml +4
-0@@ -36,6 +36,11 @@ properties: items: - const: ref + ti,lane-reverse: + description: + Should be present if D+ and D- lanes have to be swapped. + type: boolean
What is not working with existing data-lanes property?
Plus, lanes are swapped per port, not for entire device, no?
Best regards,
Krzysztof
Re: [PATCH 1/2] dt-bindings: usb/ti,am62-usb.yaml: Add ti,lane-reverse property
Le 09/09/2025 à 09:32, Krzysztof Kozlowski a écrit :
Quoted 17 lines · Richard Genoud
Quoted 16 lines
On some designs, the D+ and D- lines are swapped (on purpose or not). The PHY can handle that with the
LANE_REVERSEbit.Signed-off-by Richard Genoud <[email protected]>--- Documentation/devicetree/bindings/usb/ti,am62-usb.yaml | 5 +++++ 1 file changed, 5 insertions(+)Documentation/devicetree/bindings/usb/ti,am62-usb.yaml +0
-0@@ -36,6 +36,11 @@ properties: items: - const: ref
Quoted 6 lines
Documentation/devicetree/bindings/usb/ti,am62-usb.yaml properties: · line 42
Quoted 4 lines
Documentation/devicetree/bindings/usb/ti,am62-usb.yaml +4
-0+ ti,lane-reverse: + description: + Should be present if D+ and D- lanes have to be swapped. + type: booleanWhat is not working with existing data-lanes property?
Hum, indeed. data-lanes could definitely be used here.
Quoted 2 lines
Plus, lanes are swapped per port, not for entire device, no?
I'm not sure to get what you mean here.
The use case I'm trying to address is:
pin AD10(USB1_DM) of the AM625 is routed to USB_DP pin of an USB connector.
And pin AE9(USB1_DP) of the AM625 is routed to USB_DM pin of an USB connector.
And using LANE_REVERSE bit of MMR_USB2SS_CFG_PHY_CONFIG swaps the DM/DP lines of the corresponding USB instance.
Regards,
Richard
Quoted 4 lines
Best regards,
Krzysztof
Re: [PATCH 1/2] dt-bindings: usb/ti,am62-usb.yaml: Add ti,lane-reverse property
Quoted 14 lines · Richard GENOUD
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/usb/ti,am62-usb.yaml +0
-0@@ -36,6 +36,11 @@ properties: items: - const: refQuoted 6 lines
Documentation/devicetree/bindings/usb/ti,am62-usb.yaml properties: · line 42
Quoted 4 lines
Documentation/devicetree/bindings/usb/ti,am62-usb.yaml +4
-0+ ti,lane-reverse: + description: + Should be present if D+ and D- lanes have to be swapped. + type: booleanWhat is not working with existing data-lanes property?
Quoted 8 lines
Hum, indeed. data-lanes could definitely be used here.
Quoted 2 lines
Plus, lanes are swapped per port, not for entire device, no?
I'm not sure to get what you mean here.
The use case I'm trying to address is:
pinAD10(USB1_DM)of the AM625 is routed toUSB_DPpin of an USB connector. And pinAE9(USB1_DP)of the AM625 is routed toUSB_DMpin of an USB
I understand what you are trying to achieve and my comment was exactly about it. You want to change properties of specific connection, high speed in that case, right? So this belongs to specific port. Just do the homework and run git grep data-lanes.
Best regards,
Krzysztof
Re: [PATCH 1/2] dt-bindings: usb/ti,am62-usb.yaml: Add ti,lane-reverse property
Hi Krzysztof,
Le 14/09/2025 à 16:55, Krzysztof Kozlowski a écrit :
Quoted 24 lines · Richard GENOUD
Quoted 14 lines
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/usb/ti,am62-usb.yaml +0
-0@@ -36,6 +36,11 @@ properties: items: - const: refQuoted 6 lines
Documentation/devicetree/bindings/usb/ti,am62-usb.yaml properties: · line 42
Quoted 4 lines
Documentation/devicetree/bindings/usb/ti,am62-usb.yaml +4
-0+ ti,lane-reverse: + description: + Should be present if D+ and D- lanes have to be swapped. + type: booleanWhat is not working with existing data-lanes property?
Quoted 8 lines
Hum, indeed. data-lanes could definitely be used here.
Quoted 2 lines
Plus, lanes are swapped per port, not for entire device, no?
I'm not sure to get what you mean here.
The use case I'm trying to address is:
pinAD10(USB1_DM)of the AM625 is routed toUSB_DPpin of an USB connector. And pinAE9(USB1_DP)of the AM625 is routed toUSB_DMpin of an USB
Quoted 4 lines
I understand what you are trying to achieve and my comment was exactly about it. You want to change properties of specific connection, high speed in that case, right? So this belongs to specific port. Just do the homework and run
git grep data-lanes.
I'm ok with data-lanes, I'm not arguing on that part.
I'm being confused by using it on the port, it doesn't seem to fit the hardware. Let me show the example with the dts k3-am62-main.dtsi:
usbss0: dwc3-usb@f900000 {
compatible = "ti,am62-usb";
reg = <0x00 0x0f900000 0x00 0x800>,
<0x00 0x0f908000 0x00 0x400>;
clocks = <&k3_clks 161 3>;
clock-names = "ref";
ti,syscon-phy-pll-refclk = <&usb0_phy_ctrl 0x0>;
#address-cells = <2>;
#size-cells = <2>;
power-domains = <&k3_pds 178 TI_SCI_PD_EXCLUSIVE>;
ranges;
status = "disabled";
usb0: usb@31000000 {
compatible = "snps,dwc3";
reg = <0x00 0x31000000 0x00 0x50000>;
interrupts = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "host", "peripheral";
maximum-speed = "high-speed";
dr_mode = "otg";
snps,usb2-gadget-lpm-disable;
snps,usb2-lpm-disable;
};
};The bit used to swap data lanes is in MMR_USB2SS_CFG_PHY_CONFIG Register at address 0x0F900008, so it should be in usbss0 node to match the hardware right?
(I've checked on all ti,am62-usb devices, they have only one port)
Thanks for your inputs,
Regards,
Richard
[ Source: https://www.ti.com/lit/pdf/spruiv7 p12003 ]
Quoted 4 lines
Best regards,
Krzysztof
Signature · 3 lines
Richard Genoud, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH 1/2] dt-bindings: usb/ti,am62-usb.yaml: Add ti,lane-reverse property
Quoted 26 lines · Richard GENOUD
Hi Krzysztof,
Le 14/09/2025 à 16:55, Krzysztof Kozlowski a écrit :Quoted 24 lines · Richard GENOUD
Quoted 22 lines
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/usb/ti,am62-usb.yaml +0
-0@@ -36,6 +36,11 @@ properties: items: - const: refQuoted 6 lines
Documentation/devicetree/bindings/usb/ti,am62-usb.yaml properties: · line 42
Quoted 4 lines
Documentation/devicetree/bindings/usb/ti,am62-usb.yaml +4
-0+ ti,lane-reverse: + description: + Should be present if D+ and D- lanes have to be swapped. + type: booleanWhat is not working with existing data-lanes property?
Hum, indeed. data-lanes could definitely be used here.
Quoted 2 lines
Plus, lanes are swapped per port, not for entire device, no?
I'm not sure to get what you mean here.
The use case I'm trying to address is:
pinAD10(USB1_DM)of the AM625 is routed toUSB_DPpin of an USB connector. And pinAE9(USB1_DP)of the AM625 is routed toUSB_DMpin of an USB
Quoted 8 lines
Quoted 4 lines
I understand what you are trying to achieve and my comment was exactly about it. You want to change properties of specific connection, high speed in that case, right? So this belongs to specific port. Just do the homework and run
git grep data-lanes.I'm ok with data-lanes, I'm not arguing on that part.
I'm being confused by using it on the port, it doesn't seem to fit the hardware.
Why? You do have ports in your hardware, right? Physical connections/wires?
Quoted 1 line
Let me show the example with the dts
k3-am62-main.dtsi:
That's DTS, not exactly hardware.
Quoted 17 lines
usbss0: dwc3-usb@f900000 {
compatible = "ti,am62-usb";
reg = <0x00 0x0f900000 0x00 0x800>,
<0x00 0x0f908000 0x00 0x400>;
clocks = <&k3_clks 161 3>;
clock-names = "ref";
ti,syscon-phy-pll-refclk = <&usb0_phy_ctrl 0x0>;
#address-cells = <2>;
#size-cells = <2>;
power-domains = <&k3_pds 178 TI_SCI_PD_EXCLUSIVE>;
ranges;
status = "disabled";
usb0: usb@31000000 {
compatible = "snps,dwc3";
reg = <0x00 0x31000000 0x00 0x50000>;
interrupts = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>,Quoted 8 lines
<GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "host", "peripheral"; maximum-speed = "high-speed"; dr_mode = "otg"; snps,usb2-gadget-lpm-disable; snps,usb2-lpm-disable; }; };
And where is your proper OF graph?
Quoted 5 lines
The bit used to swap data lanes is in
MMR_USB2SS_CFG_PHY_CONFIGRegister at address0x0F900008, so it should be in usbss0 node to match the hardware right?(I've checked on all ti,am62-usb devices, they have only one port)
So I don't get what is not matching hardware...
Best regards,
Krzysztof
PATCH 2/2 usb: dwc3-am62: support ti,lane-reverse property
In reply to Richard GenoudSupport the ti,lane-reverse property by setting the USBSS_PHY_LANE_REVERSE bit.
This way, D+ line become D- and vice and versa.
Tested on am625 SoC.
--- drivers/usb/dwc3/dwc3-am62.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/dwc3/dwc3-am62.c +5 -0
@@ -119,6 +119,7 @@ struct dwc3_am62 {struct regmap *syscon;unsigned int offset;unsigned int vbus_divider; +unsigned int lane_reverse;u32 wakeup_stat;void __iomem *phy_regs; };
@@ -203,6 +204,9 @@ static int dwc3_ti_init(struct dwc3_am62 *am62)if (am62->vbus_divider) reg |=1 <<USBSS_PHY_VBUS_SEL_SHIFT ; +if (am62->lane_reverse) + reg |=USBSS_PHY_LANE_REVERSE ; +dwc3_ti_writel (am62,USBSS_PHY_CONFIG , reg);clk_prepare_enable (am62->usb2_refclk);
@@ -264,6 +268,7 @@ static int dwc3_ti_probe(struct platform_device *pdev) } am62->vbus_divider =device_property_read_bool (dev,"ti,vbus-divider" ); + am62->lane_reverse =device_property_read_bool (dev,"ti,lane-reverse" ); ret =dwc3_ti_init (am62);if (ret)