aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHector Martin <marcan@marcan.st>2023-10-29 15:37:44 +0900
committerMarek Vasut <marex@denx.de>2023-12-01 14:06:04 +0100
commita14843fdac24bf18bd58152b959ca0425adaa1e4 (patch)
tree4220f61f166f8095a9df0d766d5d56f2d6428a7c
parent2fd7037122a920ae22377b06aa5b32651cc71f13 (diff)
downloadu-boot-a14843fdac24bf18bd58152b959ca0425adaa1e4.zip
u-boot-a14843fdac24bf18bd58152b959ca0425adaa1e4.tar.gz
u-boot-a14843fdac24bf18bd58152b959ca0425adaa1e4.tar.bz2
usb: xhci: Fix DMA address calculation in queue_trb
We need to get the DMA address before incrementing the pointer, as that might move us onto another segment. Signed-off-by: Hector Martin <marcan@marcan.st> Reviewed-by: Marek Vasut <marex@denx.de>
-rw-r--r--drivers/usb/host/xhci-ring.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index ae0ab57..b60661f 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -202,6 +202,7 @@ static dma_addr_t queue_trb(struct xhci_ctrl *ctrl, struct xhci_ring *ring,
bool more_trbs_coming, unsigned int *trb_fields)
{
struct xhci_generic_trb *trb;
+ dma_addr_t addr;
int i;
trb = &ring->enqueue->generic;
@@ -211,9 +212,11 @@ static dma_addr_t queue_trb(struct xhci_ctrl *ctrl, struct xhci_ring *ring,
xhci_flush_cache((uintptr_t)trb, sizeof(struct xhci_generic_trb));
+ addr = xhci_trb_virt_to_dma(ring->enq_seg, (union xhci_trb *)trb);
+
inc_enq(ctrl, ring, more_trbs_coming);
- return xhci_trb_virt_to_dma(ring->enq_seg, (union xhci_trb *)trb);
+ return addr;
}
/**