Hi Yiping,
Thanks for sharing the information.
Actually, I have already tested STREAM_DISABLE and found that the problem still occurs even with Stream Mode disabled.
Here is code changes I have applied to the FSL UDC core driver (Linux 3.2) to disable Steam Mode.
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index 01de16e..1a3e3d3 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -295,6 +295,7 @@ static int dr_controller_setup(struct fsl_udc *udc)
tmp = fsl_readl(&dr_regs->usbmode);
tmp &= ~USB_MODE_CTRL_MODE_MASK; /* clear mode bits */
tmp |= USB_MODE_CTRL_MODE_DEVICE;
+ tmp |= USB_MODE_STREAM_DISABLE;
/* Disable Setup Lockout */
tmp |= USB_MODE_SETUP_LOCK_OFF;
if (udc->pdata->es)
@@ -363,6 +364,7 @@ static void dr_controller_run(struct fsl_udc *udc)
/* Set the controller as device mode */
temp = fsl_readl(&dr_regs->usbmode);
temp |= USB_MODE_CTRL_MODE_DEVICE;
+ temp |= USB_MODE_STREAM_DISABLE;
fsl_writel(temp, &dr_regs->usbmode);
/* Set controller to Run */
Apparently, this problem seems to happen due to USB-A001. I think so because if I remove the 2ms delay between 1448 Bytes transfers, the problem disappears for more than 15 hours.
Having the delay between transfers, the problem appears after 10 minutes to 5 hours of testing (I would say, it happens randomly).
I really appreciate if you can shed some light on this urgent issue as this problem is quiet ciritical to our product.
USB-A001: Last read of the current dTD done after USB interrupt
Description: Devices: MPC8349E, MPC8347E, MPC8343E
After executing a dTD, the device controller executes a final read of the dTD terminate bit. This
is done in order to verify if another dTD has been added to the linked list by software right at
the last moment.
It was found that the last read of the current dTD is being performed after the interrupt was
issued. This causes a potential race condition between this final dTD read and the interrupt
handling routine servicing the interrupt on complete which may result in the software freeing
the data structure memory location, prior to the last dTD read being completed. This issue is
only applied to a USB device controller.
Best regards,
Chan