[U-Boot] [PATCH 13/16] powerpc: Move setup_board_extra() into a PPC file

Simon Glass sjg at chromium.org
Fri Mar 31 14:40:36 UTC 2017


We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 arch/powerpc/lib/Makefile |  1 +
 arch/powerpc/lib/setup.c  | 32 ++++++++++++++++++++++++++++++++
 common/board_f.c          | 25 -------------------------
 include/common.h          |  7 +++++++
 4 files changed, 40 insertions(+), 25 deletions(-)
 create mode 100644 arch/powerpc/lib/setup.c

diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 3c97476a83..4f68613a41 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -17,6 +17,7 @@ MINIMAL=y
 endif
 endif
 
+obj-$(CONFIG_SYS_EXTBDINFO) += setup.o
 ifdef MINIMAL
 obj-y += cache.o time.o
 obj-y += ticks.o
diff --git a/arch/powerpc/lib/setup.c b/arch/powerpc/lib/setup.c
new file mode 100644
index 0000000000..a4213359e2
--- /dev/null
+++ b/arch/powerpc/lib/setup.c
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2017 Google, Inc
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <common.h>
+#include <version.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int setup_board_extra(void)
+{
+	bd_t *bd = gd->bd;
+
+	strncpy((char *)bd->bi_s_version, "1.2", sizeof(bd->bi_s_version));
+	strncpy((char *)bd->bi_r_version, U_BOOT_VERSION,
+		sizeof(bd->bi_r_version));
+
+	bd->bi_procfreq = gd->cpu_clk;	/* Processor Speed, In Hz */
+	bd->bi_plb_busfreq = gd->bus_clk;
+#if defined(CONFIG_405GP) || defined(CONFIG_405EP) || \
+		defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
+		defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
+	bd->bi_pci_busfreq = get_PCI_freq();
+	bd->bi_opbfreq = get_OPB_freq();
+#elif defined(CONFIG_XILINX_405)
+	bd->bi_pci_busfreq = get_PCI_freq();
+#endif
+
+	return 0;
+}
diff --git a/common/board_f.c b/common/board_f.c
index 925861124c..c0fe6b08fb 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -11,7 +11,6 @@
  */
 
 #include <common.h>
-#include <version.h>
 #include <console.h>
 #include <environment.h>
 #include <dm.h>
@@ -615,30 +614,6 @@ static int setup_board_part2(void)
 }
 #endif
 
-#ifdef CONFIG_SYS_EXTBDINFO
-static int setup_board_extra(void)
-{
-	bd_t *bd = gd->bd;
-
-	strncpy((char *) bd->bi_s_version, "1.2", sizeof(bd->bi_s_version));
-	strncpy((char *) bd->bi_r_version, U_BOOT_VERSION,
-		sizeof(bd->bi_r_version));
-
-	bd->bi_procfreq = gd->cpu_clk;	/* Processor Speed, In Hz */
-	bd->bi_plb_busfreq = gd->bus_clk;
-#if defined(CONFIG_405GP) || defined(CONFIG_405EP) || \
-		defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
-		defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
-	bd->bi_pci_busfreq = get_PCI_freq();
-	bd->bi_opbfreq = get_OPB_freq();
-#elif defined(CONFIG_XILINX_405)
-	bd->bi_pci_busfreq = get_PCI_freq();
-#endif
-
-	return 0;
-}
-#endif
-
 #ifdef CONFIG_POST
 static int init_post(void)
 {
diff --git a/include/common.h b/include/common.h
index 1441581c40..93cc1abbe2 100644
--- a/include/common.h
+++ b/include/common.h
@@ -305,6 +305,13 @@ int print_cpuinfo(void);
 int update_flash_size(int flash_size);
 int arch_early_init_r(void);
 
+/*
+ * setup_board_extra() - Fill in extra details in the bd_t structure
+ *
+ * @return 0 if OK, -ve on error
+ */
+int setup_board_extra(void);
+
 /**
  * arch_fsp_init() - perform firmware support package init
  *
-- 
2.12.2.564.g063fe858b8-goog



More information about the U-Boot mailing list