[PATCH] usb: gadget: dwc2: Move dr_mode check from of_to_plat() to bind()
Marek Vasut
marek.vasut at mailbox.org
Thu Jan 29 01:27:45 CET 2026
On 1/28/26 11:50 PM, Jonas Karlman wrote:
> +static int dwc2_udc_otg_bind(struct udevice *dev)
> +{
> + enum usb_dr_mode dr_mode = usb_get_dr_mode(dev_ofnode(dev));
> +
> + if (dr_mode != USB_DR_MODE_PERIPHERAL && dr_mode != USB_DR_MODE_OTG) {
> + dev_dbg(dev, "Invalid mode\n");
Please print the mode while at it.
> + return -ENODEV;
> + }
> +
> + return 0;
> +}
> +
> static int dwc2_gadget_handle_interrupts(struct udevice *dev)
> {
> return dwc2_udc_handle_interrupt();
> @@ -1186,6 +1192,7 @@ U_BOOT_DRIVER(dwc2_udc_otg) = {
> .of_match = dwc2_udc_otg_ids,
> .ops = &dwc2_gadget_ops,
> .of_to_plat = dwc2_udc_otg_of_to_plat,
> + .bind = dwc2_udc_otg_bind,
> .probe = dwc2_udc_otg_probe,
> .remove = dwc2_udc_otg_remove,
> .plat_auto = sizeof(struct dwc2_plat_otg_data),
The rest looks good, thanks !
More information about the U-Boot
mailing list