From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Nelson Date: Mon, 23 Jun 2014 12:03:22 -0700 Subject: [U-Boot] [PATCH] usb: ci_udc: fix interaction with CONFIG_USB_ETH_CDC In-Reply-To: <1403546568-30830-1-git-send-email-swarren@wwwdotorg.org> References: <1403546568-30830-1-git-send-email-swarren@wwwdotorg.org> Message-ID: <53A879FA.9080309@boundarydevices.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Thanks Stephen, On 06/23/2014 11:02 AM, Stephen Warren wrote: > From: Stephen Warren > > 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. > Tested-by: Eric Nelson Tested on Nitrogen6x (i.MX6). On this platform, without the patch, I could execute ping exactly once. With the patch, repeated pings work great! Regards, Eric