[U-Boot][PATCH] asm-ppc/io.h - added 64bits I/O accessors for ppc32.

Michael Zaidman michael.zaidman at gmail.com
Fri Apr 16 17:50:43 CEST 2010


Suggested-by: Joakim Tjernlund <joakim.tjernlund at transmode.se>
Signed-off-by: Michael Zaidman <michael.zaidman at gmail.com>
---
 include/asm-ppc/io.h |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index 4ddad26..0d5e125 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -231,6 +231,31 @@ extern inline unsigned in_be32(const volatile
unsigned __iomem *addr)
 	return ret;
 }

+/* 64 bits I/O read accessor for ppc32 */
+extern inline void in_be64(volatile unsigned __iomem *addr, volatile
unsigned __iomem *ret)
+{
+/* FIXME: Add other CPUs without FPU here... */
+#if defined(CONFIG_MPC832x)
+	__asm__ __volatile__(
+			"sync\n"
+			"lwz%U0%X0 0,%0\n"
+			"stw%U1%X1 0,%1\n"
+			"lwz%U0%X0 0,4+%0\n"
+			"stw%U1%X1 0,4+%1\n"
+			"isync"
+			:"=m" (*ret)
+			:"m"  (*addr), "r" (addr), "r" (ret));
+#else
+	__asm__ __volatile__(
+			"sync\n"
+			"lfd%U0%X0  1,%0\n"
+			"stfd%U1%X1 1,%1\n"
+			"isync"
+			:"=m" (*ret)
+			:"m"  (*addr), "r" (addr), "r" (ret));
+#endif
+}
+
 extern inline void out_le32(volatile unsigned __iomem *addr, int val)
 {
 	__asm__ __volatile__("sync; stwbrx %1,0,%2" : "=m" (*addr) :
@@ -242,6 +267,30 @@ extern inline void out_be32(volatile unsigned
__iomem *addr, int val)
 	__asm__ __volatile__("sync; stw%U0%X0 %1,%0" : "=m" (*addr) : "r" (val));
 }

+/* 64 bits I/O write accessor for ppc32 */
+extern inline void out_be64(volatile unsigned __iomem *addr, volatile
unsigned __iomem *val)
+{
+/* FIXME: Add other CPUs without FPU here... */
+#if defined(CONFIG_MPC832x)
+	__asm__ __volatile__(
+			"sync\n"
+			"lwz%U0%X0 0,%0\n"
+			"stw%U1%X1 0,%1\n"
+			"lwz%U0%X0 0,4+%0\n"
+			"stw%U1%X1 0,4+%1\n"
+			"isync"
+			:"=m" (*addr)
+			:"m"  (*val), "r" (addr), "r" (val));
+#else
+	__asm__ __volatile__(
+			"sync\n"
+			"lfd%U1%X1  1,%1\n"
+			"stfd%U0%X0 1,%0"
+			:"=m" (*addr)
+			:"m"  (*val), "r" (addr), "r" (val));
+#endif
+}
+
 /* Clear and set bits in one shot. These macros can be used to clear and
  * set multiple bits in a register using a single call. These macros can
  * also be used to set a multiple-bit bit pattern using a mask, by
-- 
1.6.3.3

>
> but 83xx is still missing (at least) the post_word_{load,store} functions:
[snip]
> Michael, can you resubmit something more comprehensive, something that
> builds for 83xx with CONFIG_POST turned on?
>
Sure.

-michael


More information about the U-Boot mailing list