usb: xhci: Implement DMA mapping
authorMark Kettenis <kettenis@openbsd.org>
Sat, 21 Jan 2023 19:27:55 +0000 (20:27 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 27 Jan 2023 19:47:58 +0000 (14:47 -0500)
commitba1efb3d2494e8ceb0ff405642f44a955f8d8e1b
tree9785b311bfffb082a65d4ec99248e940a7a77ada
parent862b4a0f32ae395dac147542c3336ae8a0c47d69
usb: xhci: Implement DMA mapping

An XHCI controller that sits behind an IOMMU needs to map and unmap
its memory buffers to do DMA.  Implement this by inroducing new
xhci_dma_map() and xhci_dma_unmap() helper functions.  The
xhci_dma_map() function replaces the existing xhci_virt_to_bus()
function in the sense that it returns the bus address in the case
of simple address translation in the absence of an IOMMU.  The
xhci_bus_to_virt() function is eliminated by storing the CPU
address of the allocated scratchpad memory in struct xhci_ctrl.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Marek Vasut <marex@denx.de>
drivers/usb/host/xhci-mem.c
drivers/usb/host/xhci-ring.c
drivers/usb/host/xhci.c
include/usb/xhci.h