From: Vardan Mikayelyan Date: Thu, 26 May 2016 01:07:02 +0000 (-0700) Subject: UPSTREAM: usb: dwc2: gadget: Fix transfer stop programming for out endpoint X-Git-Tag: firefly_0821_release~847 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=626df6922b6bc5f2a73959796bb2ebdf46ee6b3c;p=firefly-linux-kernel-4.4.55.git UPSTREAM: usb: dwc2: gadget: Fix transfer stop programming for out endpoint According DWC-OTG databook, "GOUTNakEff" is read only and can be cleared only by "DCTL.CGOUTNak", but here we do not need to clear it because DWC-OTG programming guide says that before disabling any OUT endpoint, the application must enable Global OUT NAK mode, so if this mode is enabled we can continue without this step. Change-Id: If85da6787d585582712ca5d116db52caa70e72fc Tested-by: John Keeping Signed-off-by: Vardan Mikayelyan Signed-off-by: John Youn Signed-off-by: Felipe Balbi Signed-off-by: Huang, Tao (cherry picked from commit 6b58cb07a850f9b6d348feb2455b2c264a515f4a) --- diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 71681727c66d..54d242b6d2aa 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2866,10 +2866,8 @@ static void dwc2_hsotg_ep_stop_xfr(struct dwc2_hsotg *hsotg, dev_warn(hsotg->dev, "%s: timeout DIEPINT.NAKEFF\n", __func__); } else { - /* Clear any pending nak effect interrupt */ - dwc2_writel(GINTSTS_GOUTNAKEFF, hsotg->regs + GINTSTS); - - __orr32(hsotg->regs + DCTL, DCTL_SGOUTNAK); + if (!(dwc2_readl(hsotg->regs + GINTSTS) & GINTSTS_GOUTNAKEFF)) + __orr32(hsotg->regs + DCTL, DCTL_SGOUTNAK); /* Wait for global nak to take effect */ if (dwc2_hsotg_wait_bit_set(hsotg, GINTSTS,