[U-Boot] [PATCH v2 5/7] mpc5121: add common post_word_load/store code

Anatolij Gustschin
2010-03-16T16:10:06Z

Add common post_word_load/post_word_store routines
for all mpc5121 boards. pdm360ng board support added
by subsequent patches needs these, as it adds a board
specific POST test.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
This patch is new in this series. This code was in board
support file in v1 patch series. Now it is common for
mpc512x boards.

cpu/mpc512x/Makefile | 1 +
cpu/mpc512x/commproc.c | 25 +++++++++++++++++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)
create mode 100644 cpu/mpc512x/commproc.c

diff --git a/cpu/mpc512x/Makefile b/cpu/mpc512x/Makefile
index 427db7a..d609cd6 100644
--- a/cpu/mpc512x/Makefile
+++ b/cpu/mpc512x/Makefile
@@ -29,6 +29,7 @@ LIB = $(obj)lib$(CPU).a
START = start.o
COBJS-y := cpu.o
COBJS-y += traps.o
+COBJS-y += commproc.o
COBJS-y += cpu_init.o
COBJS-y += fixed_sdram.o
COBJS-y += i2c.o
diff --git a/cpu/mpc512x/commproc.c b/cpu/mpc512x/commproc.c
new file mode 100644
index 0000000..180d323
--- /dev/null
+++ b/cpu/mpc512x/commproc.c
@@ -0,0 +1,25 @@
+#include <common.h>
+#include <asm/io.h>
+
+#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
+
+#if defined(CONFIG_SYS_POST_WORD_ADDR)
+# define _POST_ADDR (CONFIG_SYS_POST_WORD_ADDR)
+#else
+#error echo "No POST word address defined"
+#endif
+
+void post_word_store(ulong a)
+{
+ volatile void *save_addr = (volatile void *)(_POST_ADDR);
+
+ out_be32(save_addr, a);
+}
+
+ulong post_word_load(void)
+{
+ volatile void *save_addr = (volatile void *)(_POST_ADDR);
+
+ return in_be32(save_addr);
+}
+#endif /* CONFIG_POST || CONFIG_LOGBUFFER */
--
1.6.3.3