The USB DRD bindingsa at [1] are clear, if not specified the dr_mode property defaults to otg, and this is how Linux behaves.
A cleanup is ongoing on the Linux Device Trees to remove dr_mode when set to "otg", so take this in account and do not fail anymore when dr_mode isn't specified in the glue or dwc3 node. [1] https://www.kernel.org/doc/Documentation/devicetree/bindings/usb/usb-drd.yaml Signed-off-by: Neil Armstrong <neil.armstr...@linaro.org> --- drivers/usb/dwc3/dwc3-generic.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c index 2ab41cbae45..d62d687ece3 100644 --- a/drivers/usb/dwc3/dwc3-generic.c +++ b/drivers/usb/dwc3/dwc3-generic.c @@ -183,10 +183,10 @@ static int dwc3_generic_of_to_plat(struct udevice *dev) /* 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; - } + + /* If none of the nodes have dr_mode, bindings says default is OTG */ + if (!plat->dr_mode) + plat->dr_mode = USB_DR_MODE_OTG; } return 0; @@ -527,6 +527,10 @@ static int dwc3_glue_bind_common(struct udevice *parent, ofnode node) if (!dr_mode) dr_mode = usb_get_dr_mode(node); + /* If none of the nodes have dr_mode, bindings says default is OTG */ + if (!dr_mode) + dr_mode = USB_DR_MODE_OTG; + if (CONFIG_IS_ENABLED(DM_USB_GADGET) && (dr_mode == USB_DR_MODE_PERIPHERAL || dr_mode == USB_DR_MODE_OTG)) { debug("%s: dr_mode: OTG or Peripheral\n", __func__); --- base-commit: d5cab0d6adc26ec1bbd45c2fed101184d04454ae change-id: 20241016-topic-usb-dwc3-dr-mode-otg-88ec307e0970 Best regards, -- Neil Armstrong <neil.armstr...@linaro.org>