]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
drivers/usb/ehci: Use platform-specific accessors
authorAlexey Brodkin <Alexey.Brodkin@synopsys.com>
Mon, 5 Jun 2017 19:31:51 +0000 (22:31 +0300)
committerMarek Vasut <marex@denx.de>
Sat, 17 Jun 2017 15:59:03 +0000 (17:59 +0200)
Current implementation doesn't allow utilization of platform-specific
reads and writes.

But some arches or platforms may want to use their accessors that do
some extra work like adding barriers for data serialization etc.

Interesting enough OHCI accessors already do that so just aligning
EHCI to it now.

This is a resend of http://patchwork.ozlabs.org/patch/726714/
Back in the day this patch broke some PPC and Sandbox boards
as they we missing inclusion of "asm/io.h". Those missing items were
fixed with:
 1) http://patchwork.ozlabs.org/patch/751397/
 2) http://patchwork.ozlabs.org/patch/771099/

So now it should be safe to apply this patch.
FWIW TravisCI builds everything with all 3 patches in place,
see https://travis-ci.org/abrodkin/u-boot/builds/239563813

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
Acked-by: Marek Vasut <marex@denx.de>
drivers/usb/host/ehci.h

index 734d7f036278d2bd13e2250252c6b71f799c57e6..2ab830df5155a51c33828fe2a28e83eebba04ebc 100644 (file)
@@ -102,13 +102,11 @@ struct usb_linux_config_descriptor {
 } __attribute__ ((packed));
 
 #if defined CONFIG_EHCI_DESC_BIG_ENDIAN
 } __attribute__ ((packed));
 
 #if defined CONFIG_EHCI_DESC_BIG_ENDIAN
-#define ehci_readl(x)          cpu_to_be32((*((volatile u32 *)(x))))
-#define ehci_writel(a, b)      (*((volatile u32 *)(a)) = \
-                                       cpu_to_be32(((volatile u32)b)))
+#define ehci_readl(x)          cpu_to_be32(readl(x))
+#define ehci_writel(a, b)      writel(cpu_to_be32(b), a)
 #else
 #else
-#define ehci_readl(x)          cpu_to_le32((*((volatile u32 *)(x))))
-#define ehci_writel(a, b)      (*((volatile u32 *)(a)) = \
-                                       cpu_to_le32(((volatile u32)b)))
+#define ehci_readl(x)          cpu_to_le32(readl(x))
+#define ehci_writel(a, b)      writel(cpu_to_le32(b), a)
 #endif
 
 #if defined CONFIG_EHCI_MMIO_BIG_ENDIAN
 #endif
 
 #if defined CONFIG_EHCI_MMIO_BIG_ENDIAN