diff options
author | Peter Chen <peter.chen@freescale.com> | 2014-11-06 14:27:59 +0800 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-11-10 17:19:36 -0600 |
commit | 90834d3ecb952f8f0ab8a5687e58c472935a4e70 (patch) | |
tree | 4ec5335448ce80bfdded8991f4f54b5e662b93ca /drivers/usb/gadget/udc/pxa25x_udc.c | |
parent | afbe47758a5931aa1ddd71da53189092f564b230 (diff) | |
download | op-kernel-dev-90834d3ecb952f8f0ab8a5687e58c472935a4e70.zip op-kernel-dev-90834d3ecb952f8f0ab8a5687e58c472935a4e70.tar.gz |
usb: gadget: pxa25x_udc: use udc-core's reset notifier
Replace usb_gadget_driver's disconnect with udc-core's reset notifier at
bus reset handler.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/udc/pxa25x_udc.c')
-rw-r--r-- | drivers/usb/gadget/udc/pxa25x_udc.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c index 2944092..8664b99 100644 --- a/drivers/usb/gadget/udc/pxa25x_udc.c +++ b/drivers/usb/gadget/udc/pxa25x_udc.c @@ -1284,6 +1284,33 @@ bind_fail: } static void +reset_gadget(struct pxa25x_udc *dev, struct usb_gadget_driver *driver) +{ + int i; + + /* don't disconnect drivers more than once */ + if (dev->gadget.speed == USB_SPEED_UNKNOWN) + driver = NULL; + dev->gadget.speed = USB_SPEED_UNKNOWN; + + /* prevent new request submissions, kill any outstanding requests */ + for (i = 0; i < PXA_UDC_NUM_ENDPOINTS; i++) { + struct pxa25x_ep *ep = &dev->ep[i]; + + ep->stopped = 1; + nuke(ep, -ESHUTDOWN); + } + del_timer_sync(&dev->timer); + + /* report reset; the driver is already quiesced */ + if (driver) + usb_gadget_udc_reset(&dev->gadget, driver); + + /* re-init driver-visible data structures */ + udc_reinit(dev); +} + +static void stop_activity(struct pxa25x_udc *dev, struct usb_gadget_driver *driver) { int i; @@ -1721,7 +1748,7 @@ pxa25x_udc_irq(int irq, void *_dev) /* reset driver and endpoints, * in case that's not yet done */ - stop_activity (dev, dev->driver); + reset_gadget(dev, dev->driver); } else { DBG(DBG_VERBOSE, "USB reset end\n"); |