[U-Boot] [PATCH] usb: dwc2: fix aligned buffer usage

Stephen Warren swarren at wwwdotorg.org
Sun Mar 8 07:16:43 CET 2015


On 03/07/2015 11:09 PM, Stephen Warren wrote:
> The original aligned_buffer usage:
> a) Uselessly copied data into the aligned buffer even for IN
>    transactions.
> b) Needlessly split the memcpy() into separate calls per chunk, rather
>    than doing it all at once, as it did for the post-transfer copy for
>    IN transactions.
> c) Always programmed the HW to transfer to/from the start of the aligned
>    buffer, rather than the location of the start of the current chunk.
>    This worked fine for OUT transactions since the memcpy copied the data
>    to this location. However, for large IN transactions, it resulted in
>    each transfer over-writing the data for the first transfer.
> 
> This patch assumes that the USB maxpacket is at least 8, so that each
> chunk of the overall transfer is still aligned to the HW's 8-byte
> alignment requirement.

Hmm. Further investigation shows the maxpacket isn't restricted to nice
aligned values. For some reason I thought it was. I'll need to adjust
this patch. Time for sleep!


More information about the U-Boot mailing list