usb: dwc2: Fix gadget DMA unmap direction
authorPhil Elwell <phil@raspberrypi.com>
Thu, 6 May 2021 07:54:03 +0000 (08:54 +0100)
committerPhil Elwell <phil@raspberrypi.com>
Thu, 6 May 2021 09:46:12 +0000 (10:46 +0100)
commitcbbca488b441e2aca198fe3c95deaa97e6087dd1
treee615e4ba25a554e82d04e0004c3d686272af08a6
parent9394937ee2b194cdc747aa7014c1f35a3ad3ee77
usb: dwc2: Fix gadget DMA unmap direction

The dwc2 gadget support maps and unmaps DMA buffers as necessary. When
mapping and unmapping it uses the direction of the endpoint to select
the direction of the DMA transfer, but this fails for Control OUT
transfers because the unmap occurs after the endpoint direction has
been reversed for the status phase.

A possible solution would be to unmap the buffer before the direction
is changed, but a safer, less invasive fix is to remember the buffer
direction independently of the endpoint direction.

See: https://github.com/raspberrypi/Raspberry-Pi-OS-64bit/issues/127

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
drivers/usb/dwc2/core.h
drivers/usb/dwc2/gadget.c