MIPS: add readl/write_be accessors
authorFlorian Fainelli <ffainelli@freebox.fr>
Wed, 16 Dec 2009 10:29:06 +0000 (11:29 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Sat, 27 Feb 2010 11:53:12 +0000 (12:53 +0100)
MIPS currently lacks the readl_be and writel_be accessors
which are required by BCM63xx for OHCI and EHCI support.
Let's define them globally for MIPS. This also fixes the
compilation of the bcm63xx defconfig against USB.

Signed-off-by: Florian Fainelli <ffainelli@freebox.fr>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: linux-mips@linux-mips.org
Cc: Maxime Bizon <mbizon@freebox.fr>
Patchwork: http://patchwork.linux-mips.org/patch/793/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/include/asm/io.h

index 436878e4e0639e26761561641f6ccf30223a88d6..c98bf514ec7de9efe6596721cfa472d878da3f16 100644 (file)
@@ -447,6 +447,24 @@ __BUILDIO(q, u64)
 #define readl_relaxed                  readl
 #define readq_relaxed                  readq
 
+#define readb_be(addr)                                                 \
+       __raw_readb((__force unsigned *)(addr))
+#define readw_be(addr)                                                 \
+       be16_to_cpu(__raw_readw((__force unsigned *)(addr)))
+#define readl_be(addr)                                                 \
+       be32_to_cpu(__raw_readl((__force unsigned *)(addr)))
+#define readq_be(addr)                                                 \
+       be64_to_cpu(__raw_readq((__force unsigned *)(addr)))
+
+#define writeb_be(val, addr)                                           \
+       __raw_writeb((val), (__force unsigned *)(addr))
+#define writew_be(val, addr)                                           \
+       __raw_writew(cpu_to_be16((val)), (__force unsigned *)(addr))
+#define writel_be(val, addr)                                           \
+       __raw_writel(cpu_to_be32((val)), (__force unsigned *)(addr))
+#define writeq_be(val, addr)                                           \
+       __raw_writeq(cpu_to_be64((val)), (__force unsigned *)(addr))
+
 /*
  * Some code tests for these symbols
  */