[PATCH 07/12] ARM: versatile: make sure to run initcalls on versatile only

Sascha Hauer s.hauer at pengutronix.de
Tue May 2 02:14:14 PDT 2023


Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/boards/versatile/versatilepb.c | 13 +++++--------
 arch/arm/mach-versatile/core.c          |  9 ++++++---
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/arm/boards/versatile/versatilepb.c b/arch/arm/boards/versatile/versatilepb.c
index 8079ade9a5..3eae1e4f78 100644
--- a/arch/arm/boards/versatile/versatilepb.c
+++ b/arch/arm/boards/versatile/versatilepb.c
@@ -24,6 +24,10 @@ static int vpb_console_init(void)
 	char *hostname = "versatilepb-unknown";
 	char *model = "ARM Versatile PB";
 
+	if (!of_machine_is_compatible("arm,versatile-pb") &&
+	    !of_machine_is_compatible("arm,versatile-ab"))
+		return 0;
+
 	if (cpu_is_arm926()) {
 		hostname = "versatilepb-arm926";
 		model = "ARM Versatile PB (arm926)";
@@ -32,17 +36,10 @@ static int vpb_console_init(void)
 		model = "ARM Versatile PB (arm1176)";
 	}
 
+	armlinux_set_architecture(MACH_TYPE_VERSATILE_PB);
 	barebox_set_hostname(hostname);
 	barebox_set_model(model);
 
 	return 0;
 }
 console_initcall(vpb_console_init);
-
-static int vpb_devices_init(void)
-{
-	armlinux_set_architecture(MACH_TYPE_VERSATILE_PB);
-
-	return 0;
-}
-device_initcall(vpb_devices_init);
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 8dea053d48..74af8c0804 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -98,8 +98,6 @@ static int vpb_clocksource_init(void)
 	return init_clock(&vpb_cs);
 }
 
-core_initcall(vpb_clocksource_init);
-
 static void __noreturn versatile_reset_soc(struct restart_handler *rst)
 {
 	u32 val;
@@ -116,7 +114,12 @@ static void __noreturn versatile_reset_soc(struct restart_handler *rst)
 
 static int versatile_init(void)
 {
+	if (!of_machine_is_compatible("arm,versatile-pb") &&
+	    !of_machine_is_compatible("arm,versatile-ab"))
+		return 0;
+
+	vpb_clocksource_init();
 	restart_handler_register_fn("soc", versatile_reset_soc);
 	return 0;
 }
-coredevice_initcall(versatile_init);
+core_initcall(versatile_init);
-- 
2.39.2




More information about the barebox mailing list