[PATCH 1/2] dt-bindings: usb/ti,am62-usb.yaml: Add ti,lane-reverse property

Richard Genoud posted 2 patches 5 months ago
[PATCH 1/2] dt-bindings: usb/ti,am62-usb.yaml: Add ti,lane-reverse property
Posted by Richard Genoud 5 months ago
On some designs, the D+ and D- lines are swapped (on purpose or not).
The PHY can handle that with the LANE_REVERSE bit.

Signed-off-by: Richard Genoud <richard.genoud@bootlin.com>
---
 Documentation/devicetree/bindings/usb/ti,am62-usb.yaml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml b/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml
index f6e6d084d1c5..ba894d610af0 100644
--- a/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml
+++ b/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml
@@ -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
Posted by Krzysztof Kozlowski 5 months ago
On Mon, Sep 08, 2025 at 06:20:51PM +0200, Richard Genoud wrote:
> On some designs, the D+ and D- lines are swapped (on purpose or not).
> The PHY can handle that with the LANE_REVERSE bit.
> 
> Signed-off-by: Richard Genoud <richard.genoud@bootlin.com>
> ---
>  Documentation/devicetree/bindings/usb/ti,am62-usb.yaml | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml b/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml
> index f6e6d084d1c5..ba894d610af0 100644
> --- a/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml
> +++ b/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml
> @@ -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
Posted by Richard GENOUD 5 months ago
Le 09/09/2025 à 09:32, Krzysztof Kozlowski a écrit :
> On Mon, Sep 08, 2025 at 06:20:51PM +0200, Richard Genoud wrote:
>> On some designs, the D+ and D- lines are swapped (on purpose or not).
>> The PHY can handle that with the LANE_REVERSE bit.
>>
>> Signed-off-by: Richard Genoud <richard.genoud@bootlin.com>
>> ---
>>   Documentation/devicetree/bindings/usb/ti,am62-usb.yaml | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml b/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml
>> index f6e6d084d1c5..ba894d610af0 100644
>> --- a/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml
>> +++ b/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml
>> @@ -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?
Hum, indeed. data-lanes could definitely be used here.

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

> 
> Best regards,
> Krzysztof
> 

Re: [PATCH 1/2] dt-bindings: usb/ti,am62-usb.yaml: Add ti,lane-reverse property
Posted by Krzysztof Kozlowski 4 months, 3 weeks ago
On 09/09/2025 11:11, Richard GENOUD wrote:
>>> diff --git a/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml b/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml
>>> index f6e6d084d1c5..ba894d610af0 100644
>>> --- a/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml
>>> +++ b/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml
>>> @@ -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?
> Hum, indeed. data-lanes could definitely be used here.
> 
>>
>> 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 

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
Posted by Richard GENOUD 4 months, 3 weeks ago
Hi Krzysztof,
Le 14/09/2025 à 16:55, Krzysztof Kozlowski a écrit :
> On 09/09/2025 11:11, Richard GENOUD wrote:
>>>> diff --git a/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml b/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml
>>>> index f6e6d084d1c5..ba894d610af0 100644
>>>> --- a/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml
>>>> +++ b/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml
>>>> @@ -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?
>> Hum, indeed. data-lanes could definitely be used here.
>>
>>>
>>> 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
> 
> 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 ]

> 
> 
> Best regards,
> Krzysztof


-- 
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
Posted by Krzysztof Kozlowski 4 months, 3 weeks ago
On 19/09/2025 00:41, Richard GENOUD wrote:
> Hi Krzysztof,
> Le 14/09/2025 à 16:55, Krzysztof Kozlowski a écrit :
>> On 09/09/2025 11:11, Richard GENOUD wrote:
>>>>> diff --git a/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml b/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml
>>>>> index f6e6d084d1c5..ba894d610af0 100644
>>>>> --- a/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml
>>>>> +++ b/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml
>>>>> @@ -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?
>>> Hum, indeed. data-lanes could definitely be used here.
>>>
>>>>
>>>> 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
>>
>> 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?

> Let me show the example with the dts k3-am62-main.dtsi:

That's DTS, not exactly hardware.

> 	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;
> 		};
> 	};

And where is your proper OF graph?

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

So I don't get what is not matching hardware...



Best regards,
Krzysztof