Commit b611e424 authored by Alan Stern's avatar Alan Stern Committed by Felipe Balbi

usb: gadget: net2280: use udc-core's reset notifier

This patch adds support for the new udc-core reset notifier to the
net2280 driver.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarPeter Chen <peter.chen@freescale.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 8480484d
...@@ -3308,17 +3308,42 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) ...@@ -3308,17 +3308,42 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
* only indicates a change in the reset state). * only indicates a change in the reset state).
*/ */
if (stat & tmp) { if (stat & tmp) {
bool reset = false;
bool disconnect = false;
/*
* Ignore disconnects and resets if the speed hasn't been set.
* VBUS can bounce and there's always an initial reset.
*/
writel(tmp, &dev->regs->irqstat1); writel(tmp, &dev->regs->irqstat1);
if ((((stat & BIT(ROOT_PORT_RESET_INTERRUPT)) && if (dev->gadget.speed != USB_SPEED_UNKNOWN) {
((readl(&dev->usb->usbstat) & mask) == 0)) || if ((stat & BIT(VBUS_INTERRUPT)) &&
((readl(&dev->usb->usbctl) & (readl(&dev->usb->usbctl) &
BIT(VBUS_PIN)) == 0)) && BIT(VBUS_PIN)) == 0) {
(dev->gadget.speed != USB_SPEED_UNKNOWN)) { disconnect = true;
ep_dbg(dev, "disconnect %s\n", ep_dbg(dev, "disconnect %s\n",
dev->driver->driver.name); dev->driver->driver.name);
stop_activity(dev, dev->driver); } else if ((stat & BIT(ROOT_PORT_RESET_INTERRUPT)) &&
ep0_start(dev); (readl(&dev->usb->usbstat) & mask)
return; == 0) {
reset = true;
ep_dbg(dev, "reset %s\n",
dev->driver->driver.name);
}
if (disconnect || reset) {
stop_activity(dev, dev->driver);
ep0_start(dev);
spin_unlock(&dev->lock);
if (reset)
usb_gadget_udc_reset
(&dev->gadget, dev->driver);
else
(dev->driver->disconnect)
(&dev->gadget);
spin_lock(&dev->lock);
return;
}
} }
stat &= ~tmp; stat &= ~tmp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment