aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc2
diff options
context:
space:
mode:
authorMian Yousaf Kaukab <yousaf.kaukab@intel.com>2015-01-09 07:39:10 -0500
committerFelipe Balbi <balbi@ti.com>2015-01-12 16:34:58 -0500
commit6d713c1531638df8d459d248a89948318cbeec4c (patch)
treefe91baffb639fc77b6059397e5f9602b0da9ae0a /drivers/usb/dwc2
parent1b7a66b4d3399da5e0b13cf90fb4bd33b7197ff2 (diff)
usb: dwc2: gadget: report disconnection after reset
If usb bus is reset without a physical disconnection, all endpoints will remain open. Call s3c_hsotg_disconnect() from reset handler to report a disconnect to gadget framework. hsotg->connected is checked in s3c_hsotg_disconnect() before processing disconnect. In some cases, USBRst is seen before EnumDone and after it as well. So move setting of hsotg->connected to set-address to avoid reporting extra disconnection in this case. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc2')
-rw-r--r--drivers/usb/dwc2/gadget.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index df9080d20606..882a1a8953f5 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -1103,6 +1103,7 @@ static void s3c_hsotg_process_control(struct dwc2_hsotg *hsotg,
1103 if ((ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD) { 1103 if ((ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD) {
1104 switch (ctrl->bRequest) { 1104 switch (ctrl->bRequest) {
1105 case USB_REQ_SET_ADDRESS: 1105 case USB_REQ_SET_ADDRESS:
1106 hsotg->connected = 1;
1106 dcfg = readl(hsotg->regs + DCFG); 1107 dcfg = readl(hsotg->regs + DCFG);
1107 dcfg &= ~DCFG_DEVADDR_MASK; 1108 dcfg &= ~DCFG_DEVADDR_MASK;
1108 dcfg |= (le16_to_cpu(ctrl->wValue) << 1109 dcfg |= (le16_to_cpu(ctrl->wValue) <<
@@ -2305,7 +2306,6 @@ irq_retry:
2305 writel(GINTSTS_ENUMDONE, hsotg->regs + GINTSTS); 2306 writel(GINTSTS_ENUMDONE, hsotg->regs + GINTSTS);
2306 2307
2307 s3c_hsotg_irq_enumdone(hsotg); 2308 s3c_hsotg_irq_enumdone(hsotg);
2308 hsotg->connected = 1;
2309 } 2309 }
2310 2310
2311 if (gintsts & (GINTSTS_OEPINT | GINTSTS_IEPINT)) { 2311 if (gintsts & (GINTSTS_OEPINT | GINTSTS_IEPINT)) {
@@ -2343,6 +2343,9 @@ irq_retry:
2343 2343
2344 writel(GINTSTS_USBRST, hsotg->regs + GINTSTS); 2344 writel(GINTSTS_USBRST, hsotg->regs + GINTSTS);
2345 2345
2346 /* Report disconnection if it is not already done. */
2347 s3c_hsotg_disconnect(hsotg);
2348
2346 if (usb_status & GOTGCTL_BSESVLD) { 2349 if (usb_status & GOTGCTL_BSESVLD) {
2347 if (time_after(jiffies, hsotg->last_rst + 2350 if (time_after(jiffies, hsotg->last_rst +
2348 msecs_to_jiffies(200))) { 2351 msecs_to_jiffies(200))) {