[U-Boot] [PATCH] usb: ci_udc: fix interaction with CONFIG_USB_ETH_CDC

Stephen Warren swarren at wwwdotorg.org
Wed Jun 25 18:06:33 CEST 2014


On 06/25/2014 07:51 AM, Marek Vasut wrote:
> On Monday, June 23, 2014 at 08:02:48 PM, Stephen Warren wrote:
> 
> +CC Jorg, rest of email is intact. Jorg, does this patch fix your issue?

Jorg's issue was timeouts during transfers, whereas this patch addresses
cleanup issues once the device isn't being used any more. I can't
imagine how this patch could influence the issue Jorg is seeing.

>> From: Stephen Warren <swarren at nvidia.com>
>>
>> ci_udc.c's usb_gadget_unregister_driver() doesn't call driver->unbind()
>> unlike other USB gadget drivers. Fix it to do this.
>>
>> Without this, when ether.c's CDC Ethernet device is torn down,
>> eth_unbind() is never called, so dev->gadget is never set to NULL.
>> For some reason, usb_eth_halt() is called both at the end of the first
>> use of the Ethernet device, and prior to any subsequent use. Since
>> dev->gadget is never cleared, all calls to usb_eth_halt() attempt to
>> stop, disconnect, and clean up the device, resulting in double cleanup,
>> which hangs U-Boot on my Tegra device at least.
>>
>> ci_udc allocates its own singleton EP0 request object, and cleans it up
>> during usb_gadget_unregister_driver(). This appears necessary when using
>> the USB gadget framework in U-Boot, since that does not allocate/free
>> the EP0 request. However, the CDC Ethernet driver *does* allocate and
>> free its own EP0 requests. Consequently, we must protect
>> ci_ep_free_request() against double-freeing the request.



More information about the U-Boot mailing list