usb: dw: Add sleep before FIFO flash

Adding sleep before TX FIFO flash fixes splitting networking packets
sent over USB endpoints making ECM broken since there is no flow
control other then frame sizes.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit is contained in:
Andrei Emeltchenko 2017-10-24 12:32:55 +03:00 committed by Anas Nashif
commit fe9dee0107

View file

@ -400,17 +400,19 @@ static int usb_dw_tx(u8_t ep, const u8_t *const data,
unsigned int key;
u32_t i;
key = irq_lock();
/* Check if FIFO space available */
avail_space = usb_dw_tx_fifo_avail(ep_idx);
if (avail_space != usb_dw_ctrl.in_ep_ctrl[ep_idx].fifo_size) {
SYS_LOG_DBG("USB IN EP%d fifo not empty: %d",
ep_idx, avail_space);
k_sleep(20);
usb_dw_flush_tx_fifo(ep_idx);
avail_space = usb_dw_tx_fifo_avail(ep_idx);
}
key = irq_lock();
avail_space *= 4;
if (!avail_space) {
SYS_LOG_ERR("USB IN EP%d no space available, DTXFSTS %x",