[PATCH 3.16 171/328] usb: gadget: net2280: fix pullup handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mian Yousaf Kaukab <yousaf.kaukab@xxxxxxxxx>

commit 11bece5e063ca567e631c6ea3b1611c10dbc3282 upstream.

Gadget must be informed about disconnection when pullup is removed.

Tested-by: Ricardo Ribalda Delgado <ricardo.ribalda@xxxxxxxxx>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@xxxxxxxxx>
Signed-off-by: Felipe Balbi <balbi@xxxxxx>
[bwh: Backported to 3.16: adjust filename, context]
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -139,6 +139,10 @@ static char *type_string (u8 bmAttribute
 #define valid_bit	cpu_to_le32 (1 << VALID_BIT)
 #define dma_done_ie	cpu_to_le32 (1 << DMA_DONE_INTERRUPT_ENABLE)
 
+static void stop_activity(struct net2280 *dev,
+					struct usb_gadget_driver *driver);
+static void ep0_start(struct net2280 *dev);
+
 /*-------------------------------------------------------------------------*/
 
 static int
@@ -1390,11 +1394,14 @@ static int net2280_pullup(struct usb_gad
 	spin_lock_irqsave (&dev->lock, flags);
 	tmp = readl (&dev->usb->usbctl);
 	dev->softconnect = (is_on != 0);
-	if (is_on)
-		tmp |= (1 << USB_DETECT_ENABLE);
-	else
-		tmp &= ~(1 << USB_DETECT_ENABLE);
-	writel (tmp, &dev->usb->usbctl);
+	if (is_on) {
+		ep0_start(dev);
+		writel(tmp | BIT(USB_DETECT_ENABLE), &dev->usb->usbctl);
+	} else {
+		writel(tmp & ~BIT(USB_DETECT_ENABLE), &dev->usb->usbctl);
+		stop_activity(dev, dev->driver);
+	}
+
 	spin_unlock_irqrestore (&dev->lock, flags);
 
 	return 0;




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux