diff mbox series

usb: dwc2: Fix EP TxFIFO number setting

Message ID bb3efede4d049e1671029df165860d87e268e527.1548944758.git.hminas@synopsys.com (mailing list archive)
State Mainlined
Commit 97311c8f8b6e26d5ba6508f0df430ad80fc59327
Headers show
Series usb: dwc2: Fix EP TxFIFO number setting | expand

Commit Message

Minas Harutyunyan Jan. 31, 2019, 2:28 p.m. UTC
In case when some EP IN is frequently reused, i.e. enabled/disabled by
function driver. It is required to clear TxFIFO number field in DIEPCTL
register before setting new number. Otherwise there is probability to
have same TxFIFO number for different EP's because of OR operator.

Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
---
 drivers/usb/dwc2/gadget.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 68ad75a7460d..1e5ee3c7be39 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -4005,6 +4005,7 @@  static int dwc2_hsotg_ep_enable(struct usb_ep *ep,
 			ret = -ENOMEM;
 			goto error1;
 		}
+		epctrl &= ~(DXEPCTL_TXFNUM_LIMIT << DXEPCTL_TXFNUM_SHIFT);
 		hsotg->fifo_map |= 1 << fifo_index;
 		epctrl |= DXEPCTL_TXFNUM(fifo_index);
 		hs_ep->fifo_index = fifo_index;