]> git.baikalelectronics.ru Git - kernel.git/commit
usb: dwc2: handle DMA buffer unmapping sanely
authorPaul Zimmerman <Paul.Zimmerman@synopsys.com>
Tue, 16 Sep 2014 20:47:27 +0000 (13:47 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Sep 2014 23:17:58 +0000 (16:17 -0700)
commit6e440aa98a4a56863258a843bac8ec63c6449924
treee25163adc05c801147a573462dde9ee51ebaa0fb
parent0a6103fba1e11087f172e4b514fe7b95be40e362
usb: dwc2: handle DMA buffer unmapping sanely

The driver's handling of DMA buffers for non-aligned transfers
was kind of nuts. For IN transfers, it left the URB DMA buffer
mapped until the transfer completed, then synced it, copied the
data from the bounce buffer, then synced it again.

Instead of that, just call usb_hcd_unmap_urb_for_dma() to unmap
the buffer before starting the transfer. Then no syncing is
required when doing the copy. This should also allow handling of
other types of mappings besides just dma_map_single() ones.

Also reduce the size of the bounce buffer allocation for Isoc
endpoints to 3K, since that's the largest possible transfer size.

Tested on Raspberry Pi and Altera SOCFPGA.

Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc2/hcd.c
drivers/usb/dwc2/hcd.h
drivers/usb/dwc2/hcd_intr.c
drivers/usb/dwc2/hcd_queue.c