]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
usb: xhci: Add missing endian conversions (cpu_to_leXX / leXX_to_cpu)
authorStefan Roese <sr@denx.de>
Tue, 21 Jul 2020 08:46:02 +0000 (10:46 +0200)
committerMarek Vasut <marex@denx.de>
Wed, 5 Aug 2020 07:30:46 +0000 (09:30 +0200)
While trying to use the U-Boot xHCI driver on the MIPS Octeon platform,
which is big endian, I noticed that the driver is missing a few endian
conversion calls. This patch adds these missing endian conversion
calls.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Marek Vasut <marex@denx.de>
drivers/usb/host/xhci-mem.c

index 108f4bd8cfd9033baee89ad419f4fba98a295d45..2c92c53808cde3d6b83f2c4677eb0805a13e059a 100644 (file)
@@ -110,7 +110,7 @@ static void xhci_scratchpad_free(struct xhci_ctrl *ctrl)
 
        ctrl->dcbaa->dev_context_ptrs[0] = 0;
 
-       free((void *)(uintptr_t)ctrl->scratchpad->sp_array[0]);
+       free((void *)(uintptr_t)le64_to_cpu(ctrl->scratchpad->sp_array[0]));
        free(ctrl->scratchpad->sp_array);
        free(ctrl->scratchpad);
        ctrl->scratchpad = NULL;
@@ -227,7 +227,8 @@ static void xhci_link_segments(struct xhci_segment *prev,
        prev->next = next;
        if (link_trbs) {
                val_64 = (uintptr_t)next->trbs;
-               prev->trbs[TRBS_PER_SEGMENT-1].link.segment_ptr = val_64;
+               prev->trbs[TRBS_PER_SEGMENT-1].link.segment_ptr =
+                       cpu_to_le64(val_64);
 
                /*
                 * Set the last TRB in the segment to
@@ -491,7 +492,7 @@ int xhci_alloc_virt_device(struct xhci_ctrl *ctrl, unsigned int slot_id)
        byte_64 = (uintptr_t)(virt_dev->out_ctx->bytes);
 
        /* Point to output device context in dcbaa. */
-       ctrl->dcbaa->dev_context_ptrs[slot_id] = byte_64;
+       ctrl->dcbaa->dev_context_ptrs[slot_id] = cpu_to_le64(byte_64);
 
        xhci_flush_cache((uintptr_t)&ctrl->dcbaa->dev_context_ptrs[slot_id],
                         sizeof(__le64));
@@ -773,7 +774,7 @@ void xhci_setup_addressable_virt_dev(struct xhci_ctrl *ctrl,
 
        debug("route string %x\n", route);
 #endif
-       slot_ctx->dev_info |= route;
+       slot_ctx->dev_info |= cpu_to_le32(route);
 
        switch (speed) {
        case USB_SPEED_SUPER: