[U-Boot] [PATCH] PPC: define post_word_{load/store} for all PPC boards.
Michael Zaidman
michael.zaidman at gmail.com
Tue Apr 20 21:44:32 CEST 2010
Defining the post_word_{load/store} routines in the ppc common code
eliminates the necessity to redefine them for each of the ppc CPUs or
boards.
Signed-off-by: Michael Zaidman <michael.zaidman at gmail.com>
---
arch/ppc/lib/Makefile | 1 +
arch/ppc/lib/commproc.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+), 0 deletions(-)
create mode 100644 arch/ppc/lib/commproc.c
diff --git a/arch/ppc/lib/Makefile b/arch/ppc/lib/Makefile
index 334e457..be9c6a3 100644
--- a/arch/ppc/lib/Makefile
+++ b/arch/ppc/lib/Makefile
@@ -38,6 +38,7 @@ COBJS-y += extable.o
COBJS-y += interrupts.o
COBJS-$(CONFIG_CMD_KGDB) += kgdb.o
COBJS-y += time.o
+COBJS-y += commproc.o
SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
diff --git a/arch/ppc/lib/commproc.c b/arch/ppc/lib/commproc.c
new file mode 100644
index 0000000..a0aaae6
--- /dev/null
+++ b/arch/ppc/lib/commproc.c
@@ -0,0 +1,54 @@
+/*
+ * (C) Copyright 2010
+ * Michael Zaidman, Kodak, michael.zaidman at kodak.com
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+
+#include <common.h>
+#include <asm/io.h>
+
+#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
+/* The CONFIG_SYS_POST_WORD_ADDR and/or CONFIG_SYS_POST_ALT_WORD_ADDR
+ * should be defined in the bord's configuration file as address of the
+ * RAM word available immediately after power on. For CPUs with IMMR it
+ * usually is configured as address of an unused register in IMMR area.
+ */
+#if defined(CONFIG_SYS_POST_WORD_ADDR)
+# define _POST_WORD_ADDR CONFIG_SYS_POST_WORD_ADDR
+#elif defined(CONFIG_SYS_POST_ALT_WORD_ADDR)
+# define _POST_WORD_ADDR (CONFIG_SYS_POST_ALT_WORD_ADDR)
+#endif
+
+static ulong __post_word_load (void)
+{
+ return in_be32((volatile void *)(_POST_WORD_ADDR));
+}
+ulong post_word_load (void)
+ __attribute__((weak, alias("__post_word_load")));
+
+static void __post_word_store (ulong value)
+{
+ out_be32((volatile void *)(_POST_WORD_ADDR), value);
+}
+void post_word_store (ulong value)
+ __attribute__((weak, alias("__post_word_store")));
+
+#endif /* CONFIG_POST || CONFIG_LOGBUFFER*/
--
1.6.3.3
More information about the U-Boot
mailing list