[PATCH 05/15] usb: xhci: Add missing endian conversions (cpu_to_leXX / leXX_to_cpu)

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Feb 19 05:38:25 PST 2024


This imports U-Boot commit 543eb12ecd91df324554b8abc8d52e965bd4922b:

| Author:     Stefan Roese <sr at denx.de>
| AuthorDate: Tue Jul 21 10:46:02 2020 +0200
|
| usb: xhci: Add missing endian conversions (cpu_to_leXX / leXX_to_cpu)
|
| 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 at denx.de>

This introduces no functional change for existing platforms as the
barebox xHCI driver doesn't run on any big-endian CPUs.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/usb/host/xhci-mem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 1a66bc6a61a4..c49693bd9f1b 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -498,7 +498,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));
@@ -777,7 +777,7 @@ void xhci_setup_addressable_virt_dev(struct xhci_ctrl *ctrl,
 
 	dev_dbg(&udev->dev, "route string 0x%x\n", route);
 
-	slot_ctx->dev_info |= route;
+	slot_ctx->dev_info |= cpu_to_le32(route);
 
 	switch (speed) {
 	case USB_SPEED_SUPER:
-- 
2.39.2




More information about the barebox mailing list