[PATCH 24/27] ARM: pxa: move over to MULTIARCH

Sascha Hauer <[email protected]>
Newsgroups org.infradead.lists.barebox
Message-ID <[email protected]>
PXA was one of the architectures left in the "ARM system type" choice,
so a build could contain it or another architecture, never both.

Nothing about the SoC support requires that anymore, but its initcalls
did: the restart handler and the poweroff handler were registered
unconditionally and go straight at PXA registers, which on a multiarch
build would run on whatever else is in the image. Guard both with
of_machine_is_compatible() and move the architecture out of the choice.

For that to work the board has to identify as a PXA3xx. The SoC device
tree include says so, but a board that overrides the root compatible has
to keep it in its list.

While at it, drop the separate device_initcall() for
pxa_detect_reset_source(): pxa3xx_init() already calls it, so the reset
source was detected twice.

Assisted-by: Claude Opus 5
Signed-off-by: Sascha Hauer <[email protected]>
---
 arch/arm/Kconfig           | 16 ++++++++--------
 arch/arm/mach-pxa/common.c |  4 ++++
 arch/arm/mach-pxa/pxa3xx.c |  6 ++++--
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 106f3d559e..6a4825fe33 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -118,14 +118,6 @@ config ARCH_MXS
 	select COMMON_CLK
 	select HAS_DEBUG_LL
 
-config ARCH_PXA
-	bool "Intel/Marvell PXA based"
-	depends on 32BIT
-	select GPIOLIB
-	select HAS_DEBUG_LL
-	select OFTREE
-	select OFDEVICE
-
 config ARCH_SOCFPGA
 	bool "Altera SOCFPGA"
 	select HAS_DEBUG_LL
@@ -188,6 +180,14 @@ config ARCH_K3
 	select COMMON_CLK_OF_PROVIDER
 	select PM_GENERIC_DOMAINS
 
+config ARCH_PXA
+	bool "Intel/Marvell PXA based"
+	depends on 32BIT
+	select GPIOLIB
+	select HAS_DEBUG_LL
+	select OFTREE
+	select OFDEVICE
+
 config ARCH_SUNXI
 	bool "Allwinner (sunxi) SoCs"
 	depends on ARCH_MULTIARCH
diff --git a/arch/arm/mach-pxa/common.c b/arch/arm/mach-pxa/common.c
index 1da1b58054..fea570c5fa 100644
--- a/arch/arm/mach-pxa/common.c
+++ b/arch/arm/mach-pxa/common.c
@@ -13,6 +13,7 @@
  */
 
 #include <common.h>
+#include <of.h>
 #include <init.h>
 #include <restart.h>
 #include <mach/pxa/pxa-regs.h>
@@ -42,6 +43,9 @@ static void __noreturn pxa_restart_soc(struct restart_handler *rst,
 
 static int restart_register_feature(void)
 {
+	if (!of_machine_is_compatible("marvell,pxa3xx"))
+		return 0;
+
 	restart_handler_register_fn("soc-wdt", pxa_restart_soc);
 
 	return 0;
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index ea84efc8b0..6edc55481e 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -13,6 +13,7 @@
  */
 
 #include <common.h>
+#include <of.h>
 #include <init.h>
 #include <poweroff.h>
 #include <reset_source.h>
@@ -47,8 +48,6 @@ void pxa_clear_reset_source(void)
 	ARSR = ARSR_GPR | ARSR_LPMR | ARSR_WDT | ARSR_HWR;
 }
 
-device_initcall(pxa_detect_reset_source);
-
 static void __noreturn pxa3xx_poweroff(struct poweroff_handler *handler,
 				       unsigned long flags)
 {
@@ -62,6 +61,9 @@ static void __noreturn pxa3xx_poweroff(struct poweroff_handler *handler,
 
 static int pxa3xx_init(void)
 {
+	if (!of_machine_is_compatible("marvell,pxa3xx"))
+		return 0;
+
 	poweroff_handler_register_fn(pxa3xx_poweroff);
 
 	pxa_detect_reset_source();

-- 
2.47.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.