usb: dwc2: gadget: Fix GOUTNAK flow for Slave mode.
commit fecb3a171db425e5068b27231f8efe154bf72637 upstream. Because of dwc2_hsotg_ep_stop_xfr() function uses poll mode, first need to mask GINTSTS_GOUTNAKEFF interrupt. In Slave mode GINTSTS_GOUTNAKEFF interrupt will be aserted only after pop OUT NAK status packet from RxFIFO. In dwc2_hsotg_ep_sethalt() function before setting DCTL_SGOUTNAK need to unmask GOUTNAKEFF interrupt. Tested by USBCV CH9 and MSC tests set in Slave, BDMA and DDMA. All tests are passed. Fixes:a4f8277145
("usb: dwc2: gadget: Disable enabled HW endpoint in dwc2_hsotg_ep_disable") Fixes:6070636c49
("usb: dwc2: Fix Stalling a Non-Isochronous OUT EP") Cc: stable <stable@vger.kernel.org> Signed-off-by: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> Link: https://lore.kernel.org/r/e17fad802bbcaf879e1ed6745030993abb93baf8.1626152924.git.Minas.Harutyunyan@synopsys.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
7073acb51a
commit
f2c04f6b21
@@ -3900,9 +3900,27 @@ static void dwc2_hsotg_ep_stop_xfr(struct dwc2_hsotg *hsotg,
|
|||||||
__func__);
|
__func__);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
/* Mask GINTSTS_GOUTNAKEFF interrupt */
|
||||||
|
dwc2_hsotg_disable_gsint(hsotg, GINTSTS_GOUTNAKEFF);
|
||||||
|
|
||||||
if (!(dwc2_readl(hsotg, GINTSTS) & GINTSTS_GOUTNAKEFF))
|
if (!(dwc2_readl(hsotg, GINTSTS) & GINTSTS_GOUTNAKEFF))
|
||||||
dwc2_set_bit(hsotg, DCTL, DCTL_SGOUTNAK);
|
dwc2_set_bit(hsotg, DCTL, DCTL_SGOUTNAK);
|
||||||
|
|
||||||
|
if (!using_dma(hsotg)) {
|
||||||
|
/* Wait for GINTSTS_RXFLVL interrupt */
|
||||||
|
if (dwc2_hsotg_wait_bit_set(hsotg, GINTSTS,
|
||||||
|
GINTSTS_RXFLVL, 100)) {
|
||||||
|
dev_warn(hsotg->dev, "%s: timeout GINTSTS.RXFLVL\n",
|
||||||
|
__func__);
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* Pop GLOBAL OUT NAK status packet from RxFIFO
|
||||||
|
* to assert GOUTNAKEFF interrupt
|
||||||
|
*/
|
||||||
|
dwc2_readl(hsotg, GRXSTSP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Wait for global nak to take effect */
|
/* Wait for global nak to take effect */
|
||||||
if (dwc2_hsotg_wait_bit_set(hsotg, GINTSTS,
|
if (dwc2_hsotg_wait_bit_set(hsotg, GINTSTS,
|
||||||
GINTSTS_GOUTNAKEFF, 100))
|
GINTSTS_GOUTNAKEFF, 100))
|
||||||
@@ -4348,6 +4366,9 @@ static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value, bool now)
|
|||||||
epctl = dwc2_readl(hs, epreg);
|
epctl = dwc2_readl(hs, epreg);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
|
/* Unmask GOUTNAKEFF interrupt */
|
||||||
|
dwc2_hsotg_en_gsint(hs, GINTSTS_GOUTNAKEFF);
|
||||||
|
|
||||||
if (!(dwc2_readl(hs, GINTSTS) & GINTSTS_GOUTNAKEFF))
|
if (!(dwc2_readl(hs, GINTSTS) & GINTSTS_GOUTNAKEFF))
|
||||||
dwc2_set_bit(hs, DCTL, DCTL_SGOUTNAK);
|
dwc2_set_bit(hs, DCTL, DCTL_SGOUTNAK);
|
||||||
// STALL bit will be set in GOUTNAKEFF interrupt handler
|
// STALL bit will be set in GOUTNAKEFF interrupt handler
|
||||||
|
Reference in New Issue
Block a user