[PATCH v5 10/13] xhci: translate virtual addresses into the bus's address space

Nicolas Saenz Julienne nsaenzjulienne at suse.de
Thu Dec 24 13:23:10 CET 2020


On Wed, 2020-12-23 at 19:55 +0100, Nicolas Saenz Julienne wrote:
> So far we've been content with passing physical addresses when
> configuring memory addresses into XHCI controllers, but not all
> platforms have buses with transparent mappings. Specifically the
> Raspberry Pi 4 might introduce an offset to memory accesses incoming
> from its PCIe port.
> 
> Introduce xhci_virt_to_bus() and xhci_bus_to_virt() to cater with these
> limitations, and make sure we don't break non DM users.
> 
> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne at suse.de>
> Reviewed-by: Simon Glass <sjg at chromium.org>
> Reviewed-by: Stefan Roese <sr at denx.de>
---

Upon testing this on more RPi4 variants I realized that I'm missing this:

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index eba2b89a88..6b31ad4398 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -726,7 +726,7 @@ again:
                return -ETIMEDOUT;
        }
 
-       if ((uintptr_t)(le64_to_cpu(event->trans_event.buffer))
+       if ((uintptr_t)(le64_to_cpu(xhci_bus_to_virt(ctrl, event->trans_event.buffer)))
                        != (uintptr_t)last_transfer_trb_addr) {
                available_length -=
                        (int)EVENT_TRB_LEN(le32_to_cpu(event->trans_event.transfer_len));

Will update the patch on v6.

Regards,
Nicolas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201224/ab6e50eb/attachment.sig>


More information about the U-Boot mailing list