When working with non-coherent transfer buffers, we have to sync device and cpu for outgoing and incoming buffers. Fix the driver where non-coherent buffers are used in device context. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@xxxxxxxxx> --- Cc: barebox@xxxxxxxxxxxxxxxxxxx --- drivers/usb/host/xhci-hcd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/host/xhci-hcd.c b/drivers/usb/host/xhci-hcd.c index c3d623e91f51..fab884229732 100644 --- a/drivers/usb/host/xhci-hcd.c +++ b/drivers/usb/host/xhci-hcd.c @@ -1026,6 +1026,8 @@ static int xhci_submit_normal(struct usb_device *udev, unsigned long pipe, /* Normal TRB */ memset(&trb, 0, sizeof(union xhci_trb)); + dma_sync_single_for_device((unsigned long)buffer, length, + DMA_TO_DEVICE); trb.event_cmd.cmd_trb = cpu_to_le64((dma_addr_t)buffer); /* FIXME: TD remainder */ trb.event_cmd.status = TRB_LEN(length) | TRB_INTR_TARGET(0); @@ -1114,6 +1116,8 @@ static int xhci_submit_control(struct usb_device *udev, unsigned long pipe, /* Data TRB */ if (length > 0) { memset(&trb, 0, sizeof(union xhci_trb)); + dma_sync_single_for_device((unsigned long)buffer, length, + DMA_TO_DEVICE); trb.event_cmd.cmd_trb = cpu_to_le64((dma_addr_t)buffer); /* FIXME: TD remainder */ trb.event_cmd.status = TRB_LEN(length) | TRB_INTR_TARGET(0); @@ -1142,6 +1146,8 @@ static int xhci_submit_control(struct usb_device *udev, unsigned long pipe, length -= EVENT_TRB_LEN(trb.event_cmd.status); else if (ret < 0) return ret; + dma_sync_single_for_cpu((unsigned long)buffer, length, + DMA_FROM_DEVICE); } ret = xhci_wait_for_event(xhci, TRB_TRANSFER, &trb); -- 2.1.0 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox