Skip to content
Commit 90570c6b authored by Declan Snyder's avatar Declan Snyder Committed by David Leach
Browse files

drivers: usb_dc_mcux: Fix write performance issues



The MCUX USB device driver currently suffers from
some performance related issues caused by the removal
of the intermediate buffer in commit 4e6f80d3.
This buffer was essential in the case when some USB
descriptors or data were in a slow access memory,
for example a flash memory accessed over flexspi.
USB DMA as AHB master would try to fetch the data,
but it would be too slow and USB peripheral
could not meet deadlines on the USB bus waiting for it,
and so it would send null packets instead causing errors.

This problem can be fixed by re-introducing an intermediate
buffer in RAM with the data copied from the slow memory by
the core before the USB transfer begins, so that USB DMA
is not responsible for fetching it from flexspi/flash.

Changes to MCUX USB Device Driver:
- Re-add intermediate buffer for USB writes in RAM
- Buffer is not needed for reads, add runtime check
  to avoid copy overhead
- Buffer is not needed for platforms with USB RAM,
  since the USB RAM itself acts as an intermediate buffer.
  Compile with buffer code only when USB RAM is not present on
  the platform, to avoid unecessary copy overhead.

Signed-off-by: default avatarDeclan Snyder <declan.snyder@nxp.com>
parent ff68cb22
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment