[PATCH 00/10] 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 --- Julien Panis (10): 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 - 10 files changed, 14 deletions(-) --- base-commit: 19b77d3d23966a0d6dbb3c86187765f11100fb6f change-id: 20230706-handle-otg-as-periph-4546e874cd15
Best regards,

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

Hi Julien,
On 06/07/2023 19:07, Julien Panis wrote:
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>;
snps,u2ss_inp3_quirk; status = "okay"; };dr_mode = "peripheral";
keystone-k2e.dtsi nor keystone-k2e-evm.dtsi has dr_mode set anywhere. In Linux, keystone-k2e-evm.dtsi has dr_mode as "peripheral". Can we please have the same in u-boot as well?
Then, from dwc3_generic_of_to_plat()
plat->dr_mode = usb_get_dr_mode(node); if (plat->dr_mode == USB_DR_MODE_UNKNOWN) { /* might be a leaf so check the parent for mode */ 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; } }
I suppose that should be changed to OTG by default instead of complaining that it's invalid.
FYI. From linux/devicetree/bindings/usb/usb-drd.yaml
dr_mode: description: Tells Dual-Role USB controllers that we want to work on a particular mode. In case this attribute isn't passed via DT, USB DRD controllers should *default to OTG*.

Hi Roger,
On 7/10/23 09:53, Roger Quadros wrote:
Hi Julien,
On 06/07/2023 19:07, Julien Panis wrote:
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>;
snps,u2ss_inp3_quirk; status = "okay"; };dr_mode = "peripheral";
keystone-k2e.dtsi nor keystone-k2e-evm.dtsi has dr_mode set anywhere. In Linux, keystone-k2e-evm.dtsi has dr_mode as "peripheral". Can we please have the same in u-boot as well?
I can do that, but... ...shouldn't uboot dts have been sync'ed with linux dts before ?
Then, from dwc3_generic_of_to_plat()
plat->dr_mode = usb_get_dr_mode(node); if (plat->dr_mode == USB_DR_MODE_UNKNOWN) { /* might be a leaf so check the parent for mode */ 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; } }
I suppose that should be changed to OTG by default instead of complaining that it's invalid.
FYI. From linux/devicetree/bindings/usb/usb-drd.yaml
dr_mode: description: Tells Dual-Role USB controllers that we want to work on a particular mode. In case this attribute isn't passed via DT, USB DRD controllers should *default to OTG*.
I agree with you, I'll change that.
Julien

On 10/07/2023 11:57, Julien Panis wrote:
Hi Roger,
On 7/10/23 09:53, Roger Quadros wrote:
Hi Julien,
On 06/07/2023 19:07, Julien Panis wrote:
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"; };
keystone-k2e.dtsi nor keystone-k2e-evm.dtsi has dr_mode set anywhere. In Linux, keystone-k2e-evm.dtsi has dr_mode as "peripheral". Can we please have the same in u-boot as well?
I can do that, but... ...shouldn't uboot dts have been sync'ed with linux dts before ?
This has to be manually done. Maybe this platform got left out? Someone with access to K2E-EVM needs to do the sync and test if it works.
Then, from dwc3_generic_of_to_plat()
plat->dr_mode = usb_get_dr_mode(node); if (plat->dr_mode == USB_DR_MODE_UNKNOWN) { /* might be a leaf so check the parent for mode */ 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; } }
I suppose that should be changed to OTG by default instead of complaining that it's invalid.
FYI. From linux/devicetree/bindings/usb/usb-drd.yaml
dr_mode: description: Tells Dual-Role USB controllers that we want to work on a particular mode. In case this attribute isn't passed via DT, USB DRD controllers should *default to OTG*.
I agree with you, I'll change that.
Julien

On 7/10/23 11:58, Roger Quadros wrote:
On 10/07/2023 11:57, Julien Panis wrote:
Hi Roger,
On 7/10/23 09:53, Roger Quadros wrote:
Hi Julien,
On 06/07/2023 19:07, Julien Panis wrote:
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"; };
keystone-k2e.dtsi nor keystone-k2e-evm.dtsi has dr_mode set anywhere. In Linux, keystone-k2e-evm.dtsi has dr_mode as "peripheral". Can we please have the same in u-boot as well?
I can do that, but... ...shouldn't uboot dts have been sync'ed with linux dts before ?
This has to be manually done. Maybe this platform got left out? Someone with access to K2E-EVM needs to do the sync and test if it works.
The sync is not done either for 'keystone.dtsi' and 'keystone-k2e.dtsi'. I can't do the full sync. But I'm going to handle usb nodes, at least.

On 7/10/23 11:58, Roger Quadros wrote:
On 10/07/2023 11:57, Julien Panis wrote:
Hi Roger,
On 7/10/23 09:53, Roger Quadros wrote:
Hi Julien,
On 06/07/2023 19:07, Julien Panis wrote:
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"; };
keystone-k2e.dtsi nor keystone-k2e-evm.dtsi has dr_mode set anywhere. In Linux, keystone-k2e-evm.dtsi has dr_mode as "peripheral". Can we please have the same in u-boot as well?
I can do that, but... ...shouldn't uboot dts have been sync'ed with linux dts before ?
This has to be manually done. Maybe this platform got left out? Someone with access to K2E-EVM needs to do the sync and test if it works.
The sync is not done for many (all ?) keystone-k2 platforms actually. In next version, I will modify the driver so that 'unknown' usb mode can be handled as 'otg', but sync will be another part of the job for someone who can get access to all K2 boards and test it (I started it for usb nodes only and realized that the risk of forgetting/breaking something was too big).

On Mon, Jul 10, 2023 at 10:57:19AM +0200, Julien Panis wrote:
Hi Roger,
On 7/10/23 09:53, Roger Quadros wrote:
Hi Julien,
On 06/07/2023 19:07, Julien Panis wrote:
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>;
snps,u2ss_inp3_quirk; status = "okay"; };dr_mode = "peripheral";
keystone-k2e.dtsi nor keystone-k2e-evm.dtsi has dr_mode set anywhere. In Linux, keystone-k2e-evm.dtsi has dr_mode as "peripheral". Can we please have the same in u-boot as well?
I can do that, but... ...shouldn't uboot dts have been sync'ed with linux dts before ?
*cough* Keystone 2 is unmaintained in U-Boot currently and Nishanth owes me a patch taking over the machines.
participants (3)
-
Julien Panis
-
Roger Quadros
-
Tom Rini