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

Marek Vasut marex at denx.de
Thu Aug 22 17:19:40 CEST 2024


On 8/22/24 11:11 AM, Zixun LI wrote:
> Hi,

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().

Can you change the g_dnl_register() prototype and pass he structure in ? 
I suspect it should be available in the commands which register g_dnl ?

> 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);

This is no good, this is a workaround, let's not do this.

> +    ret = driver->bind(udc->gadget);
> +    if (ret)
> +        goto err1;
> 
>       return 0;
>   err1:

[...]


More information about the U-Boot mailing list