[PATCH 1/1] usb: gadget: ether: Disable USB pullup in eth probe

Zixun LI admin at hifiphile.com
Thu Aug 22 11:11:06 CEST 2024


Hi,

On Thu, Aug 22, 2024 at 1:26 AM Marek Vasut <marex at denx.de> wrote:
>
> Would it be possible to fix up the g_dnl ?

g_dnl's interface is pretty different from usb_ether, I can't find a
way to access
usb_gadget struct in g_dnl_register().

Meanwhile it can be fixed in udc core, by doing gadget_driver bind
after udc start,
in addition to keeping the controller in disconnected state.

diff --git a/drivers/usb/gadget/udc/udc-core.c
b/drivers/usb/gadget/udc/udc-core.c
index 6bb419ae2a..b917a79892 100644
--- a/drivers/usb/gadget/udc/udc-core.c
+++ b/drivers/usb/gadget/udc/udc-core.c
@@ -300,15 +300,17 @@ static int udc_bind_to_driver(struct usb_udc
*udc, struct usb_gadget_driver *dri

     usb_gadget_udc_set_speed(udc, driver->speed);

-    ret = driver->bind(udc->gadget);
-    if (ret)
-        goto err1;
     ret = usb_gadget_udc_start(udc);
     if (ret) {
-        driver->unbind(udc->gadget);
         goto err1;
     }
-    usb_gadget_connect(udc->gadget);
+
+    /* Keep pullup disabled until interrupt is available */
+    usb_gadget_disconnect(udc->gadget);
+
+    ret = driver->bind(udc->gadget);
+    if (ret)
+        goto err1;

     return 0;
 err1:


More information about the U-Boot mailing list