Hi, On Wed, Aug 15, 2012 at 11:09:51AM -0400, Alan Stern wrote: > > FYI, dwc3 would look like this: > > > > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c > > index e09a7c4..723a530 100644 > > --- a/drivers/usb/dwc3/gadget.c > > +++ b/drivers/usb/dwc3/gadget.c > > @@ -1846,6 +1846,15 @@ static void dwc3_disconnect_gadget(struct dwc3 *dwc) > > } > > } > > > > +static void dwc3_reset_gadget(struct dwc3 *dwc) > > +{ > > + if (dwc->gadget_driver && dwc->gadget_driver->reset) { > > + spin_unlock(&dwc->lock); > > + dwc->gadget_driver->reset(&dwc->gadget); > > + spin_lock(&dwc->lock); > > + } > > +} > > Should we try to maintain backward compatibility by invoking the > disconnect callback during a reset if the gadget driver doesn't have a > reset callback? To tell the truth, I don't know to what extent most > gadget drivers need to know the difference between reset and > disconnect. good point :-) Will do that now. > > @@ -2021,8 +2030,7 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc) > > dwc3_gadget_usb3_phy_suspend(dwc, false); > > } > > > > - if (dwc->gadget.speed != USB_SPEED_UNKNOWN) > > - dwc3_disconnect_gadget(dwc); > > + dwc3_reset_gadget(dwc); > > > > reg = dwc3_readl(dwc->regs, DWC3_DCTL); > > reg &= ~DWC3_DCTL_TSTCTRL_MASK; > > I'll check to see about making a similar change to net2280. dummy-hcd > should be fairly easy. thanks a lot. I'll do that for musb ;-) > > When doing that, I thought we could also drop the "don't call disconnect > > if we get a reset when gadget never enumerated" thing. What do you say ? > > Is there such a rule? I wasn't aware of it. Yes, it seems like a very Unfortunately, yes. Or at least there used to be. I can't remember the details now, sorry. > minor sort of optimization; we could easily get rid of it. that sounds like a plan :-) Tomorrow I can send a series of patches starting off the split, then people can just send in more patches for other controllers as we go. cheers -- balbi
Attachment:
signature.asc
Description: Digital signature