MLK-23361 usb: cdns3: gadget: reset endpoint before set DEVDS
On CDNS3 usb, the IOC interrupt for IN is triggered when data
move from memory to FIFO, but not for the transfer completion.
When running fastboot command "continue" to disconnect USB device.
The last message "OKAY" sent from device setups a callback to IOC
interrupt handler and disconnect with host in this callback.
However, the real transfer hasn't finished due to host doesn't send
IN at that time, it causes the error at host side.
This patch will reset all enabled endpoints in pull up before disable
the device mode. The reset checks the EP_STS.BUFFEREMPTY bit to ensure
data has sent to host.
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit
9be87bc89c1e75755b524703dc536c93bd3fbe5c)
(cherry picked from commit
076f49edefab2ef832b09ada855f968d44c15928)