Commit 11bece5e authored by Mian Yousaf Kaukab's avatar Mian Yousaf Kaukab Committed by Felipe Balbi

usb: gadget: net2280: fix pullup handling

Gadget must be informed about disconnection when pullup is removed.
Tested-by: default avatarRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: default avatarMian Yousaf Kaukab <yousaf.kaukab@intel.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 971fe656
...@@ -124,6 +124,9 @@ static char *type_string(u8 bmAttributes) ...@@ -124,6 +124,9 @@ static char *type_string(u8 bmAttributes)
#define dma_done_ie cpu_to_le32(BIT(DMA_DONE_INTERRUPT_ENABLE)) #define dma_done_ie cpu_to_le32(BIT(DMA_DONE_INTERRUPT_ENABLE))
static void ep_clear_seqnum(struct net2280_ep *ep); static void ep_clear_seqnum(struct net2280_ep *ep);
static void stop_activity(struct net2280 *dev,
struct usb_gadget_driver *driver);
static void ep0_start(struct net2280 *dev);
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static inline void enable_pciirqenb(struct net2280_ep *ep) static inline void enable_pciirqenb(struct net2280_ep *ep)
...@@ -1495,11 +1498,14 @@ static int net2280_pullup(struct usb_gadget *_gadget, int is_on) ...@@ -1495,11 +1498,14 @@ static int net2280_pullup(struct usb_gadget *_gadget, int is_on)
spin_lock_irqsave(&dev->lock, flags); spin_lock_irqsave(&dev->lock, flags);
tmp = readl(&dev->usb->usbctl); tmp = readl(&dev->usb->usbctl);
dev->softconnect = (is_on != 0); dev->softconnect = (is_on != 0);
if (is_on) if (is_on) {
tmp |= BIT(USB_DETECT_ENABLE); ep0_start(dev);
else writel(tmp | BIT(USB_DETECT_ENABLE), &dev->usb->usbctl);
tmp &= ~BIT(USB_DETECT_ENABLE); } else {
writel(tmp, &dev->usb->usbctl); writel(tmp & ~BIT(USB_DETECT_ENABLE), &dev->usb->usbctl);
stop_activity(dev, dev->driver);
}
spin_unlock_irqrestore(&dev->lock, flags); spin_unlock_irqrestore(&dev->lock, flags);
return 0; return 0;
......
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