[PATCH 18/23] usb: xhci-hcd: replace opencoded non-atomic 64-bit MMIO with lo_hi helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit 3c5317e9046 ("usb: xhci-hcd: Make use of lo_hi_readq/writeq()")
had made use of lo_hi_readq/writeq() to implement xhci_read/write_64(),
like Linux does, but this was removed in commit fddd1c7c51a8
("usb: host: remove xhci driver"). Reinstate it to make code clearer.

No functional change.

[Note: Linux doesn't use any readq/writeq, but does two 32-bit access
 always, even on 64-bit systems]

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 drivers/usb/host/xhci.h | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 1a3f7e7642bc..9ffbb103d562 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -18,6 +18,7 @@
 
 #include <asm/types.h>
 #include <io.h>
+#include <io-64-nonatomic-lo-hi.h>
 #include <linux/list.h>
 
 #define MAX_EP_CTX_NUM		31
@@ -1112,10 +1113,7 @@ static inline u64 xhci_readq(__le64 volatile *regs)
 #if BITS_PER_LONG == 64
 	return readq(regs);
 #else
-	__u32 *ptr = (__u32 *)regs;
-	u64 val_lo = readl(ptr);
-	u64 val_hi = readl(ptr + 1);
-	return val_lo + (val_hi << 32);
+	return lo_hi_readq(regs);
 #endif
 }
 
@@ -1124,12 +1122,7 @@ static inline void xhci_writeq(__le64 volatile *regs, const u64 val)
 #if BITS_PER_LONG == 64
 	writeq(val, regs);
 #else
-	__u32 *ptr = (__u32 *)regs;
-	u32 val_lo = lower_32_bits(val);
-	/* FIXME */
-	u32 val_hi = upper_32_bits(val);
-	writel(val_lo, ptr);
-	writel(val_hi, ptr + 1);
+	lo_hi_writeq(val, regs);
 #endif
 }
 
-- 
2.26.2


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux