On Tuesday 07 September 2004 1:24 pm, Alan Stern wrote: > David and Alex: > > For a while now I've been seeing strange things with the net2280 driver. > When I rmmod the g_file_storage gadget, the connection isn't dropped. Not > even when I rmmod net2280. I actually have to unplug the cable before the > host realizes that the slave has vanished.
Did you apply the latest patch from Alex? Attached. This should (as I recall) affect _different_ disconnect behaviors -- but I've not had a chance to test it myself. > It hasn't always been this way. In the past, the host would realize the > connection had changed as soon as the gadget driver was unloaded. I > suspect the odd behavior began at the time the power & connection > management additions were made to the Gadget API. Hmm, could be. It probably needs to force off the softconnect flag or something. The API change was innocuous. The issue would have been implementing it on net2280 ... :) - Dave > > Alan Stern > >
--- gadget-2.6.original/drivers/usb/gadget/net2280.c 2004-08-16 04:31:21.000000000 -0700 +++ gadget-2.6.asanks/drivers/usb/gadget/net2280.c 2004-08-18 09:38:32.000000000 -0700 @@ -303,13 +303,16 @@ /* init to our chosen defaults, notably so that we NAK OUT * packets until the driver queues a read (+note erratum 0112) */ - writel ( (1 << SET_NAK_OUT_PACKETS_MODE) + tmp = (1 << SET_NAK_OUT_PACKETS_MODE) | (1 << SET_NAK_OUT_PACKETS) | (1 << CLEAR_EP_HIDE_STATUS_PHASE) - | (1 << CLEAR_INTERRUPT_MODE) - | (1 << CLEAR_ENDPOINT_TOGGLE) - | (1 << CLEAR_ENDPOINT_HALT) - , &ep->regs->ep_rsp); + | (1 << CLEAR_INTERRUPT_MODE); + + if (ep->num != 0) { + tmp |= (1 << CLEAR_ENDPOINT_TOGGLE) + | (1 << CLEAR_ENDPOINT_HALT); + } + writel (tmp, &ep->regs->ep_rsp); /* scrub most status bits, and flush any fifo state */ writel ( (1 << TIMEOUT) @@ -1919,8 +1922,6 @@ , &dev->usb->stdrsp); writel ( (1 << USB_ROOT_PORT_WAKEUP_ENABLE) | (1 << SELF_POWERED_USB_DEVICE) - /* erratum 0102 workaround */ - | ((dev->chiprev == 0100) ? 0 : 1) << SUSPEND_IMMEDIATELY | (1 << REMOTE_WAKEUP_SUPPORT) | (dev->softconnect << USB_DETECT_ENABLE) | (1 << SELF_POWERED_STATUS) @@ -2551,8 +2552,6 @@ if (stat & (1 << SUSPEND_REQUEST_INTERRUPT)) { if (dev->driver->suspend) dev->driver->suspend (&dev->gadget); - /* we use SUSPEND_IMMEDIATELY */ - stat &= ~(1 << SUSPEND_REQUEST_INTERRUPT); } else { if (dev->driver->resume) dev->driver->resume (&dev->gadget);