[PATCH 2/4] common/board_f: move CONFIG_MACH_TYPE logic to arch/arm/lib/bdinfo.c

Ovidiu Panait ovpanait at gmail.com
Sun Sep 11 18:10:49 CEST 2022


asm/mach_type.h header and CONFIG_MACH_TYPE macro are arm-specific, so move
related bdinfo logic to arch_setup_bdinfo() in arch/arm/lib/bdinfo.c.

Signed-off-by: Ovidiu Panait <ovpanait at gmail.com>
---

 arch/arm/lib/bdinfo.c | 12 ++++++++++++
 common/board_f.c      |  7 -------
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/arch/arm/lib/bdinfo.c b/arch/arm/lib/bdinfo.c
index b22ee07b85..826e09e72c 100644
--- a/arch/arm/lib/bdinfo.c
+++ b/arch/arm/lib/bdinfo.c
@@ -9,9 +9,21 @@
 #include <common.h>
 #include <init.h>
 #include <asm/global_data.h>
+#include <asm/mach-types.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
+int arch_setup_bdinfo(void)
+{
+#ifdef CONFIG_MACH_TYPE
+	struct bd_info *bd = gd->bd;
+
+	bd->bi_arch_number = CONFIG_MACH_TYPE; /* board id for Linux */
+#endif
+
+	return 0;
+}
+
 void arch_print_bdinfo(void)
 {
 	struct bd_info *bd = gd->bd;
diff --git a/common/board_f.c b/common/board_f.c
index f4238d4c90..3789708a30 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -45,9 +45,6 @@
 #include <video.h>
 #include <watchdog.h>
 #include <asm/cache.h>
-#ifdef CONFIG_MACH_TYPE
-#include <asm/mach-types.h>
-#endif
 #if defined(CONFIG_MP) && defined(CONFIG_PPC)
 #include <asm/mp.h>
 #endif
@@ -588,10 +585,6 @@ int setup_bdinfo(void)
 		bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE;  /* size  of SRAM */
 	}
 
-#ifdef CONFIG_MACH_TYPE
-	bd->bi_arch_number = CONFIG_MACH_TYPE; /* board id for Linux */
-#endif
-
 	return arch_setup_bdinfo();
 }
 
-- 
2.25.1



More information about the U-Boot mailing list