* [PATCH 0/2] ti,am62-usb: introduce ti,lane-reverse property @ 2025-09-08 16:20 Richard Genoud 2025-09-08 16:20 ` [PATCH 1/2] dt-bindings: usb/ti,am62-usb.yaml: Add " Richard Genoud 2025-09-08 16:20 ` [PATCH 2/2] usb: dwc3-am62: support " Richard Genoud 0 siblings, 2 replies; 8+ messages in thread From: Richard Genoud @ 2025-09-08 16:20 UTC (permalink / raw) To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Thinh Nguyen Cc: Aswath Govindraju, linux-usb, devicetree, linux-kernel, Thomas Petazzoni, Richard Genoud 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(+) ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] dt-bindings: usb/ti,am62-usb.yaml: Add ti,lane-reverse property 2025-09-08 16:20 [PATCH 0/2] ti,am62-usb: introduce ti,lane-reverse property Richard Genoud @ 2025-09-08 16:20 ` Richard Genoud 2025-09-09 7:32 ` Krzysztof Kozlowski 2025-09-08 16:20 ` [PATCH 2/2] usb: dwc3-am62: support " Richard Genoud 1 sibling, 1 reply; 8+ messages in thread From: Richard Genoud @ 2025-09-08 16:20 UTC (permalink / raw) To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Thinh Nguyen Cc: Aswath Govindraju, linux-usb, devicetree, linux-kernel, Thomas Petazzoni, Richard Genoud 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 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] dt-bindings: usb/ti,am62-usb.yaml: Add ti,lane-reverse property 2025-09-08 16:20 ` [PATCH 1/2] dt-bindings: usb/ti,am62-usb.yaml: Add " Richard Genoud @ 2025-09-09 7:32 ` Krzysztof Kozlowski 2025-09-09 9:11 ` Richard GENOUD 0 siblings, 1 reply; 8+ messages in thread From: Krzysztof Kozlowski @ 2025-09-09 7:32 UTC (permalink / raw) To: Richard Genoud Cc: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Thinh Nguyen, Aswath Govindraju, linux-usb, devicetree, linux-kernel, Thomas Petazzoni 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] dt-bindings: usb/ti,am62-usb.yaml: Add ti,lane-reverse property 2025-09-09 7:32 ` Krzysztof Kozlowski @ 2025-09-09 9:11 ` Richard GENOUD 2025-09-14 14:55 ` Krzysztof Kozlowski 0 siblings, 1 reply; 8+ messages in thread From: Richard GENOUD @ 2025-09-09 9:11 UTC (permalink / raw) To: Krzysztof Kozlowski Cc: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Thinh Nguyen, Aswath Govindraju, linux-usb, devicetree, linux-kernel, Thomas Petazzoni 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 > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] dt-bindings: usb/ti,am62-usb.yaml: Add ti,lane-reverse property 2025-09-09 9:11 ` Richard GENOUD @ 2025-09-14 14:55 ` Krzysztof Kozlowski 2025-09-18 15:41 ` Richard GENOUD 0 siblings, 1 reply; 8+ messages in thread From: Krzysztof Kozlowski @ 2025-09-14 14:55 UTC (permalink / raw) To: Richard GENOUD Cc: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Thinh Nguyen, Aswath Govindraju, linux-usb, devicetree, linux-kernel, Thomas Petazzoni 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] dt-bindings: usb/ti,am62-usb.yaml: Add ti,lane-reverse property 2025-09-14 14:55 ` Krzysztof Kozlowski @ 2025-09-18 15:41 ` Richard GENOUD 2025-09-19 4:31 ` Krzysztof Kozlowski 0 siblings, 1 reply; 8+ messages in thread From: Richard GENOUD @ 2025-09-18 15:41 UTC (permalink / raw) To: Krzysztof Kozlowski Cc: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Thinh Nguyen, Aswath Govindraju, linux-usb, devicetree, linux-kernel, Thomas Petazzoni 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] dt-bindings: usb/ti,am62-usb.yaml: Add ti,lane-reverse property 2025-09-18 15:41 ` Richard GENOUD @ 2025-09-19 4:31 ` Krzysztof Kozlowski 0 siblings, 0 replies; 8+ messages in thread From: Krzysztof Kozlowski @ 2025-09-19 4:31 UTC (permalink / raw) To: Richard GENOUD Cc: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Thinh Nguyen, Aswath Govindraju, linux-usb, devicetree, linux-kernel, Thomas Petazzoni 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] usb: dwc3-am62: support ti,lane-reverse property 2025-09-08 16:20 [PATCH 0/2] ti,am62-usb: introduce ti,lane-reverse property Richard Genoud 2025-09-08 16:20 ` [PATCH 1/2] dt-bindings: usb/ti,am62-usb.yaml: Add " Richard Genoud @ 2025-09-08 16:20 ` Richard Genoud 1 sibling, 0 replies; 8+ messages in thread From: Richard Genoud @ 2025-09-08 16:20 UTC (permalink / raw) To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Thinh Nguyen Cc: Aswath Govindraju, linux-usb, devicetree, linux-kernel, Thomas Petazzoni, Richard Genoud Support 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. Signed-off-by: Richard Genoud <richard.genoud@bootlin.com> --- drivers/usb/dwc3/dwc3-am62.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c index 9db8f3ca493d..9437d2246ee9 100644 --- a/drivers/usb/dwc3/dwc3-am62.c +++ b/drivers/usb/dwc3/dwc3-am62.c @@ -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) ^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-09-19 4:31 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-09-08 16:20 [PATCH 0/2] ti,am62-usb: introduce ti,lane-reverse property Richard Genoud 2025-09-08 16:20 ` [PATCH 1/2] dt-bindings: usb/ti,am62-usb.yaml: Add " Richard Genoud 2025-09-09 7:32 ` Krzysztof Kozlowski 2025-09-09 9:11 ` Richard GENOUD 2025-09-14 14:55 ` Krzysztof Kozlowski 2025-09-18 15:41 ` Richard GENOUD 2025-09-19 4:31 ` Krzysztof Kozlowski 2025-09-08 16:20 ` [PATCH 2/2] usb: dwc3-am62: support " Richard Genoud
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox