[PATCH v2 00/11] Remove unnecessary USBx dr_mode configuration.

For all TI platforms handled in this series, USBx dr_mode was configured as peripheral in '<board>-u-boot.dtsi'. This series removes these fragments, since USBx dual-role feature is already handled as peripheral only in 'dwc3_glue_bind_common()' function of 'dwc3-generic.c' driver:
static int dwc3_glue_bind_common(struct udevice *parent, ofnode node) { [...]
switch (dr_mode) { case USB_DR_MODE_PERIPHERAL: case USB_DR_MODE_OTG:
debug("%s: dr_mode: OTG or Peripheral\n", __func__); driver = "dwc3-generic-peripheral";
break;
[...] }
This follows a discussion about a similar topic for am3 boards: https://lore.kernel.org/u-boot/20230621-fix_usb_ether_init-v4-0-5f4977bb7678...
Signed-off-by: Julien Panis jpanis@baylibre.com --- Changes in v2: - Handle 'unknown' mode as 'otg' in dwc3 usb driver. - Link to v1: https://lore.kernel.org/r/20230706-handle-otg-as-periph-v1-0-bd85d15ffd50@ba...
--- Julien Panis (11): usb: dwc3: Handle unknown mode as otg arm: dts: dra7-evm-u-boot: Remove usb1 mode configuration arm: dts: dra71-evm-u-boot: Remove usb1 mode configuration arm: dts: dra72-evm-revc-u-boot: Remove usb1 mode configuration arm: dts: dra72-evm-u-boot: Remove usb1 mode configuration arm: dts: dra76-evm-u-boot: Remove usb1 mode configuration arm: dts: k3-am642-evm-u-boot: Remove usb0 mode configuration arm: dts: k3-am654-r5-base-board-u-boot: Remove usb mode configuration arm: dts: k3-j7200-common-proc-board-u-boot: Remove usb0 mode configuration arm: dts: k3-j721e-common-proc-board-u-boot: Remove usb0 mode configuration arm: dts: keystone-k2e-evm-u-boot: Remove usb1 mode configuration
arch/arm/dts/dra7-evm-u-boot.dtsi | 1 - arch/arm/dts/dra71-evm-u-boot.dtsi | 1 - arch/arm/dts/dra72-evm-revc-u-boot.dtsi | 1 - arch/arm/dts/dra72-evm-u-boot.dtsi | 1 - arch/arm/dts/dra76-evm-u-boot.dtsi | 1 - arch/arm/dts/k3-am642-evm-u-boot.dtsi | 1 - arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi | 5 ----- arch/arm/dts/k3-j7200-common-proc-board-u-boot.dtsi | 1 - arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi | 1 - arch/arm/dts/keystone-k2e-evm-u-boot.dtsi | 1 - drivers/usb/dwc3/dwc3-generic.c | 4 ++-- 11 files changed, 2 insertions(+), 16 deletions(-) --- base-commit: 19b77d3d23966a0d6dbb3c86187765f11100fb6f change-id: 20230706-handle-otg-as-periph-4546e874cd15
Best regards,

In case dr_mode attribute is not passed via DT, USB DRD controllers should default to OTG.
Signed-off-by: Julien Panis jpanis@baylibre.com --- drivers/usb/dwc3/dwc3-generic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c index 66da5a8d6f8c..857ae806e11d 100644 --- a/drivers/usb/dwc3/dwc3-generic.c +++ b/drivers/usb/dwc3/dwc3-generic.c @@ -182,8 +182,8 @@ static int dwc3_generic_of_to_plat(struct udevice *dev) node = dev_ofnode(dev->parent); plat->dr_mode = usb_get_dr_mode(node); if (plat->dr_mode == USB_DR_MODE_UNKNOWN) { - pr_err("Invalid usb mode setup\n"); - return -ENODEV; + pr_info("No USB mode specified. Using OTG.\n"); + plat->dr_mode = USB_DR_MODE_OTG; } }

USB1 dual-role feature is already handled as peripheral only in dwc3-generic driver.
Signed-off-by: Julien Panis jpanis@baylibre.com --- arch/arm/dts/dra7-evm-u-boot.dtsi | 1 - 1 file changed, 1 deletion(-)
diff --git a/arch/arm/dts/dra7-evm-u-boot.dtsi b/arch/arm/dts/dra7-evm-u-boot.dtsi index 87b2451a8e8b..f6fd21f2c660 100644 --- a/arch/arm/dts/dra7-evm-u-boot.dtsi +++ b/arch/arm/dts/dra7-evm-u-boot.dtsi @@ -39,7 +39,6 @@
&usb1 { bootph-pre-ram; - dr_mode = "peripheral"; };
&usb2_phy1 {

USB1 dual-role feature is already handled as peripheral only in dwc3-generic driver.
Signed-off-by: Julien Panis jpanis@baylibre.com --- arch/arm/dts/dra71-evm-u-boot.dtsi | 1 - 1 file changed, 1 deletion(-)
diff --git a/arch/arm/dts/dra71-evm-u-boot.dtsi b/arch/arm/dts/dra71-evm-u-boot.dtsi index 8e7dc719bf85..48a194c941d7 100644 --- a/arch/arm/dts/dra71-evm-u-boot.dtsi +++ b/arch/arm/dts/dra71-evm-u-boot.dtsi @@ -51,7 +51,6 @@
&usb1 { bootph-pre-ram; - dr_mode = "peripheral"; };
&usb2_phy1 {

USB1 dual-role feature is already handled as peripheral only in dwc3-generic driver.
Signed-off-by: Julien Panis jpanis@baylibre.com --- arch/arm/dts/dra72-evm-revc-u-boot.dtsi | 1 - 1 file changed, 1 deletion(-)
diff --git a/arch/arm/dts/dra72-evm-revc-u-boot.dtsi b/arch/arm/dts/dra72-evm-revc-u-boot.dtsi index 8e7dc719bf85..48a194c941d7 100644 --- a/arch/arm/dts/dra72-evm-revc-u-boot.dtsi +++ b/arch/arm/dts/dra72-evm-revc-u-boot.dtsi @@ -51,7 +51,6 @@
&usb1 { bootph-pre-ram; - dr_mode = "peripheral"; };
&usb2_phy1 {

USB1 dual-role feature is already handled as peripheral only in dwc3-generic driver.
Signed-off-by: Julien Panis jpanis@baylibre.com --- arch/arm/dts/dra72-evm-u-boot.dtsi | 1 - 1 file changed, 1 deletion(-)
diff --git a/arch/arm/dts/dra72-evm-u-boot.dtsi b/arch/arm/dts/dra72-evm-u-boot.dtsi index 91a3b6b742a0..18350ed08909 100644 --- a/arch/arm/dts/dra72-evm-u-boot.dtsi +++ b/arch/arm/dts/dra72-evm-u-boot.dtsi @@ -11,7 +11,6 @@
&usb1 { bootph-pre-ram; - dr_mode = "peripheral"; };
&usb2_phy1 {

USB1 dual-role feature is already handled as peripheral only in dwc3-generic driver.
Signed-off-by: Julien Panis jpanis@baylibre.com --- arch/arm/dts/dra76-evm-u-boot.dtsi | 1 - 1 file changed, 1 deletion(-)
diff --git a/arch/arm/dts/dra76-evm-u-boot.dtsi b/arch/arm/dts/dra76-evm-u-boot.dtsi index 1216d93bdcd6..47a92e214d27 100644 --- a/arch/arm/dts/dra76-evm-u-boot.dtsi +++ b/arch/arm/dts/dra76-evm-u-boot.dtsi @@ -31,7 +31,6 @@
&usb1 { bootph-pre-ram; - dr_mode = "peripheral"; };
&usb2_phy1 {

USB0 dual-role feature is already handled as peripheral only in dwc3-generic driver.
Signed-off-by: Julien Panis jpanis@baylibre.com --- arch/arm/dts/k3-am642-evm-u-boot.dtsi | 1 - 1 file changed, 1 deletion(-)
diff --git a/arch/arm/dts/k3-am642-evm-u-boot.dtsi b/arch/arm/dts/k3-am642-evm-u-boot.dtsi index 64857b09099d..f3f0d07df49f 100644 --- a/arch/arm/dts/k3-am642-evm-u-boot.dtsi +++ b/arch/arm/dts/k3-am642-evm-u-boot.dtsi @@ -56,7 +56,6 @@ };
&usb0 { - dr_mode="peripheral"; bootph-pre-ram; };

USB0 and USB1 dual-role feature is already handled as peripheral only in dwc3-generic driver.
Signed-off-by: Julien Panis jpanis@baylibre.com --- arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi | 5 ----- 1 file changed, 5 deletions(-)
diff --git a/arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi b/arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi index 4516ab1437e7..3ccd42985fd8 100644 --- a/arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi +++ b/arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi @@ -169,10 +169,6 @@ bootph-pre-ram; };
-&usb1 { - dr_mode = "peripheral"; -}; - &fss { bootph-pre-ram; }; @@ -198,7 +194,6 @@ &usb0 { pinctrl-names = "default"; pinctrl-0 = <&usb0_pins_default>; - dr_mode = "peripheral"; bootph-pre-ram; };

USB0 dual-role feature is already handled as peripheral only in dwc3-generic driver.
Signed-off-by: Julien Panis jpanis@baylibre.com --- arch/arm/dts/k3-j7200-common-proc-board-u-boot.dtsi | 1 - 1 file changed, 1 deletion(-)
diff --git a/arch/arm/dts/k3-j7200-common-proc-board-u-boot.dtsi b/arch/arm/dts/k3-j7200-common-proc-board-u-boot.dtsi index f57c2306ba1a..dbe22fc3a459 100644 --- a/arch/arm/dts/k3-j7200-common-proc-board-u-boot.dtsi +++ b/arch/arm/dts/k3-j7200-common-proc-board-u-boot.dtsi @@ -157,7 +157,6 @@ };
&usb0 { - dr_mode = "peripheral"; bootph-pre-ram; };

USB0 dual-role feature is already handled as peripheral only in dwc3-generic driver.
Signed-off-by: Julien Panis jpanis@baylibre.com --- arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi | 1 - 1 file changed, 1 deletion(-)
diff --git a/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi b/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi index 867ec2bb1aff..d14f3346caf7 100644 --- a/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi +++ b/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi @@ -143,7 +143,6 @@ };
&usb0 { - dr_mode = "peripheral"; bootph-pre-ram; };

USB1 dual-role feature is already handled as peripheral only in dwc3-generic driver.
Signed-off-by: Julien Panis jpanis@baylibre.com --- arch/arm/dts/keystone-k2e-evm-u-boot.dtsi | 1 - 1 file changed, 1 deletion(-)
diff --git a/arch/arm/dts/keystone-k2e-evm-u-boot.dtsi b/arch/arm/dts/keystone-k2e-evm-u-boot.dtsi index 970d452f0804..a75f78377c28 100644 --- a/arch/arm/dts/keystone-k2e-evm-u-boot.dtsi +++ b/arch/arm/dts/keystone-k2e-evm-u-boot.dtsi @@ -39,7 +39,6 @@ &usb1 { dwc3@25010000 { phys = <&usb1_phy>; - dr_mode = "peripheral"; snps,u2ss_inp3_quirk; status = "okay"; };

On 10/07/2023 16:54, Julien Panis wrote:
For all TI platforms handled in this series, USBx dr_mode was configured as peripheral in '<board>-u-boot.dtsi'. This series removes these fragments, since USBx dual-role feature is already handled as peripheral only in 'dwc3_glue_bind_common()' function of 'dwc3-generic.c' driver:
static int dwc3_glue_bind_common(struct udevice *parent, ofnode node) { [...]
switch (dr_mode) { case USB_DR_MODE_PERIPHERAL: case USB_DR_MODE_OTG:
debug("%s: dr_mode: OTG or Peripheral\n", __func__); driver = "dwc3-generic-peripheral"; break;
[...] }
This follows a discussion about a similar topic for am3 boards: https://lore.kernel.org/u-boot/20230621-fix_usb_ether_init-v4-0-5f4977bb7678...
Signed-off-by: Julien Panis jpanis@baylibre.com
Changes in v2:
- Handle 'unknown' mode as 'otg' in dwc3 usb driver.
- Link to v1: https://lore.kernel.org/r/20230706-handle-otg-as-periph-v1-0-bd85d15ffd50@ba...
Julien Panis (11): usb: dwc3: Handle unknown mode as otg arm: dts: dra7-evm-u-boot: Remove usb1 mode configuration arm: dts: dra71-evm-u-boot: Remove usb1 mode configuration arm: dts: dra72-evm-revc-u-boot: Remove usb1 mode configuration arm: dts: dra72-evm-u-boot: Remove usb1 mode configuration arm: dts: dra76-evm-u-boot: Remove usb1 mode configuration arm: dts: k3-am642-evm-u-boot: Remove usb0 mode configuration arm: dts: k3-am654-r5-base-board-u-boot: Remove usb mode configuration arm: dts: k3-j7200-common-proc-board-u-boot: Remove usb0 mode configuration arm: dts: k3-j721e-common-proc-board-u-boot: Remove usb0 mode configuration arm: dts: keystone-k2e-evm-u-boot: Remove usb1 mode configuration
arch/arm/dts/dra7-evm-u-boot.dtsi | 1 - arch/arm/dts/dra71-evm-u-boot.dtsi | 1 - arch/arm/dts/dra72-evm-revc-u-boot.dtsi | 1 - arch/arm/dts/dra72-evm-u-boot.dtsi | 1 - arch/arm/dts/dra76-evm-u-boot.dtsi | 1 - arch/arm/dts/k3-am642-evm-u-boot.dtsi | 1 - arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi | 5 ----- arch/arm/dts/k3-j7200-common-proc-board-u-boot.dtsi | 1 - arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi | 1 - arch/arm/dts/keystone-k2e-evm-u-boot.dtsi | 1 - drivers/usb/dwc3/dwc3-generic.c | 4 ++-- 11 files changed, 2 insertions(+), 16 deletions(-)
base-commit: 19b77d3d23966a0d6dbb3c86187765f11100fb6f change-id: 20230706-handle-otg-as-periph-4546e874cd15
Best regards,
For this series:
Acked-by: Roger Quadros rogerq@kernel.org
participants (2)
-
Julien Panis
-
Roger Quadros