Skip to contentSkip to conversation

toradex: Switch from ARCH_MISC_INIT to MISC_INIT_R in some cases

PATCH In review Tom Rini 3 participants 5 messages Jul 4, 2025 – Jul 11, 2025

Subsystems (5)
lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/2 toradex: Switch from ARCH_MISC_INIT to MISC_INIT_R in some cases

The hook arch_misc_init was not intended to be used for per-board hooks. This can be done with misc_init_r instead, which is what follows immediately after arch_misc_init. Switch a few platforms.

---
Cc: Francesco Dolcini <[email protected]>

---
 board/toradex/apalis-tk1/apalis-tk1.c   | 2 +-
 board/toradex/apalis_t30/apalis_t30.c   | 2 +-
 board/toradex/colibri_t20/colibri_t20.c | 2 +-
 board/toradex/colibri_t30/colibri_t30.c | 2 +-
 configs/apalis-tk1_defconfig            | 2 +-
 configs/apalis_t30_defconfig            | 2 +-
 configs/colibri_t20_defconfig           | 2 +-
 configs/colibri_t30_defconfig           | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)
board/toradex/apalis-tk1/apalis-tk1.c +1 -1
index 4557ed1f1f2f..168840764a1d 100644
@@ -36,7 +36,7 @@
 #define VCC_USBO1	TEGRA_GPIO(T, 5)
 #define VCC_USBO1_V1_0	TEGRA_GPIO(N, 4)
 
-int arch_misc_init(void)
+int misc_init_r(void)
 {
 	if (readl(NV_PA_BASE_SRAM + NVBOOTINFOTABLE_BOOTTYPE) ==
 	    NVBOOTTYPE_RECOVERY) {
board/toradex/apalis_t30/apalis_t30.c +1 -1
index 02e8f8eb1fed..2c785da41eaa 100644
@@ -35,7 +35,7 @@ DECLARE_GLOBAL_DATA_PTR;
 static int pci_reset_status;
 #endif /* CONFIG_APALIS_T30_PCIE_EVALBOARD_INIT */
 
-int arch_misc_init(void)
+int misc_init_r(void)
 {
 	if (readl(NV_PA_BASE_SRAM + NVBOOTINFOTABLE_BOOTTYPE) ==
 	    NVBOOTTYPE_RECOVERY)
board/toradex/colibri_t20/colibri_t20.c +1 -1
index d432fd2b843d..05c3377a60bc 100644
@@ -29,7 +29,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define PMU_SUPPLYENE_SYSINEN	(1<<5)
 #define PMU_SUPPLYENE_EXITSLREQ	(1<<1)
 
-int arch_misc_init(void)
+int misc_init_r(void)
 {
 	/* Disable PMIC sleep mode on low supply voltage */
 	struct udevice *dev;
board/toradex/colibri_t30/colibri_t30.c +1 -1
index 342673ac506c..1b091ea1694e 100644
@@ -18,7 +18,7 @@
 #include "pinmux-config-colibri_t30.h"
 #include "../common/tdx-common.h"
 
-int arch_misc_init(void)
+int misc_init_r(void)
 {
 	if (readl(NV_PA_BASE_SRAM + NVBOOTINFOTABLE_BOOTTYPE) ==
 	    NVBOOTTYPE_RECOVERY)
configs/apalis-tk1_defconfig +1 -1
index de30fa1b961c..846c7bde2343 100644
@@ -27,7 +27,7 @@ CONFIG_CONSOLE_MUX=y
 CONFIG_SYS_STDIO_DEREGISTER=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_ARCH_MISC_INIT=y
+CONFIG_MISC_INIT_R=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
configs/apalis_t30_defconfig +1 -1
index e9c9cfe940e4..57e1eb733a87 100644
@@ -22,7 +22,7 @@ CONFIG_CONSOLE_MUX=y
 CONFIG_SYS_STDIO_DEREGISTER=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_ARCH_MISC_INIT=y
+CONFIG_MISC_INIT_R=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
configs/colibri_t20_defconfig +1 -1
index c8a17cd40a2f..02e33ba5e3cb 100644
@@ -20,7 +20,7 @@ CONFIG_SYS_PBSIZE=1055
 CONFIG_SYS_STDIO_DEREGISTER=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_ARCH_MISC_INIT=y
+CONFIG_MISC_INIT_R=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
configs/colibri_t30_defconfig +1 -1
index 8d7a6bf7060c..63b695c1e54b 100644
@@ -21,7 +21,7 @@ CONFIG_CONSOLE_MUX=y
 CONFIG_SYS_STDIO_DEREGISTER=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_ARCH_MISC_INIT=y
+CONFIG_MISC_INIT_R=y
 CONFIG_SPL_FOOTPRINT_LIMIT=y
 CONFIG_SPL_MAX_FOOTPRINT=0x8000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 2/2 global: Make ARCH_MISC_INIT a selected symbol

This symbol is not something that the user should be enabling or disabling but rather the developer for a particular board should select it when required.

This is mostly size neutral, however a few places do have changes. In the case of i.MX6ULL systems, it is always the case that arch_misc_init() could call setup_serial_number() and do useful work, but was not enabled widely, but now is. In the case of i.MX23/28 systems, we should be able to call mx28_fixup_vt() again here, so do so. Finally, some platforms were calling arch_misc_init() and then not doing anything and this results in removing the option.

---
Cc: Stefano Babic <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>

---
 arch/arm/Kconfig                          | 7 ++++---
 arch/arm/cpu/armv7/ls102xa/Kconfig        | 1 +
 arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 1 +
 arch/arm/mach-imx/imx9/Kconfig            | 2 ++
 arch/arm/mach-imx/mx6/Kconfig             | 1 +
 arch/arm/mach-omap2/am33xx/Kconfig        | 6 ++++++
 arch/mips/mach-octeon/Kconfig             | 1 +
 board/toradex/verdin-imx8mm/spl.c         | 2 ++
 common/Kconfig                            | 3 ++-
 9 files changed, 20 insertions(+), 4 deletions(-)
arch/arm/Kconfig +4 -3
index be0819a9c9d6..a10d1bb32b63 100644
@@ -905,6 +905,7 @@ config ARCH_IMX8
 
 config ARCH_IMX8M
 	bool "NXP i.MX8M platform"
+	select ARCH_MISC_INIT if FSL_CAAM
 	select ARM64
 	select GPIO_EXTRA_HEADER
 	select MACH_IMX
@@ -954,6 +955,7 @@ config ARCH_IMXRT
 
 config ARCH_MX23
 	bool "NXP i.MX23 family"
+	select ARCH_MISC_INIT
 	select CPU_ARM926EJS
 	select GPIO_EXTRA_HEADER
 	select MACH_IMX
@@ -961,6 +963,7 @@ config ARCH_MX23
 
 config ARCH_MX28
 	bool "NXP i.MX28 family"
+	select ARCH_MISC_INIT
 	select CPU_ARM926EJS
 	select GPIO_EXTRA_HEADER
 	select MACH_IMX
@@ -1102,6 +1105,7 @@ config ARCH_QEMU
 
 config ARCH_RENESAS
 	bool "Renesas ARM SoCs"
+	select ARCH_MISC_INIT if DISPLAY_CPUINFO && !(RZA1 || RZN1)
 	select DM
 	select DM_SERIAL
 	select GPIO_EXTRA_HEADER
@@ -1111,7 +1115,6 @@ config ARCH_RENESAS
 	imply FAT_WRITE
 	imply OF_UPSTREAM
 	imply SYS_THUMB_BUILD
-	imply ARCH_MISC_INIT if DISPLAY_CPUINFO
 
 config ARCH_SNAPDRAGON
 	bool "Qualcomm Snapdragon SoCs"
@@ -1540,7 +1543,6 @@ config TARGET_LX2160AQDS
 config TARGET_LX2162AQDS
 	bool "Support lx2162aqds"
 	select ARCH_LX2162A
-	select ARCH_MISC_INIT
 	select ARM64
 	select ARMV8_MULTIENTRY
 	select ARCH_SUPPORT_TFABOOT
@@ -1953,7 +1955,6 @@ config TARGET_SL28
 config TARGET_TEN64
 	bool "Support ten64"
 	select ARCH_LS1088A
-	select ARCH_MISC_INIT
 	select ARM64
 	select ARMV8_MULTIENTRY
 	select ARCH_SUPPORT_TFABOOT
arch/arm/cpu/armv7/ls102xa/Kconfig +1 -0
index 46ace7e5fd68..5c8839583aa6 100644
@@ -1,5 +1,6 @@
 config ARCH_LS1021A
 	bool
+	select ARCH_MISC_INIT if FSL_CAAM
 	select FSL_DEVICE_DISABLE
 	select FSL_IFC if !QSPI_BOOT && !SD_BOOT_QSPI
 	select LS102XA_STREAM_ID
arch/arm/cpu/armv8/fsl-layerscape/Kconfig +1 -0
index 080fe3fc327d..787c7a7c1da6 100644
@@ -328,6 +328,7 @@ config ARCH_LX2160A
 
 config FSL_LSCH2
 	bool
+	select ARCH_MISC_INIT if FSL_CAAM
 	select SKIP_LOWLEVEL_INIT
 	select SYS_FSL_CCSR_GUR_BE
 	select SYS_FSL_CCSR_SCFG_BE
arch/arm/mach-imx/imx9/Kconfig +2 -0
index 280d255c0864..6af45938edb3 100644
@@ -22,10 +22,12 @@ config IMX93
 config IMX91
 	bool
 	select IMX9
+	select ARCH_MISC_INIT
 	select ARMV8_SPL_EXCEPTION_VECTORS
 
 config IMX95
 	bool
+	select ARCH_MISC_INIT
 	select ARMV8_SPL_EXCEPTION_VECTORS
 	select IMX9
 	select DM_MAILBOX
arch/arm/mach-imx/mx6/Kconfig +1 -0
index 2f873ed6ddf1..3f5e91da204f 100644
@@ -63,6 +63,7 @@ config MX6UL
 
 config MX6ULL
 	bool "i.MX 6ULL SoC support"
+	select ARCH_MISC_INIT
 	select ROM_UNIFIED_SECTIONS
 	select SYSCOUNTER_TIMER
 	select SYS_L2CACHE_OFF
arch/arm/mach-omap2/am33xx/Kconfig +6 -0
index 46abf070f9d5..dff4f1cf202f 100644
@@ -9,6 +9,7 @@ choice
 
 config TARGET_AM335X_EVM
 	bool "Support am335x_evm"
+	select ARCH_MISC_INIT
 	select BOARD_LATE_INIT
 	select DM
 	select DM_GPIO
@@ -70,6 +71,7 @@ config TARGET_AM335X_SHC
 
 config TARGET_AM335X_GUARDIAN
 	bool "Support am335x based guardian board from bosch"
+	select ARCH_MISC_INIT
 	select BOARD_LATE_INIT
 	select DM
 	select DM_SERIAL
@@ -116,6 +118,7 @@ config TARGET_ETAMIN
 
 config TARGET_PCM051
 	bool "Support pcm051"
+	select ARCH_MISC_INIT
 	select DM
 	select DM_GPIO
 	select DM_SERIAL
@@ -123,6 +126,7 @@ config TARGET_PCM051
 
 config TARGET_PHYCORE_AM335X_R2
 	bool "Support phyCORE AM335X R2"
+	select ARCH_MISC_INIT
 	select DM
 	select DM_GPIO
 	select DM_SERIAL
@@ -130,6 +134,7 @@ config TARGET_PHYCORE_AM335X_R2
 
 config TARGET_PXM2
 	bool "Support pxm2"
+	select ARCH_MISC_INIT
 	select BOARD_LATE_INIT
 	select DM
 	select DM_GPIO
@@ -148,6 +153,7 @@ config TARGET_RASTABAN
 
 config TARGET_RUT
 	bool "Support rut"
+	select ARCH_MISC_INIT
 	select BOARD_LATE_INIT
 	select DM
 	select DM_GPIO
arch/mips/mach-octeon/Kconfig +1 -0
index 5d2186bba551..6105cdcf96ea 100644
@@ -42,6 +42,7 @@ config TARGET_OCTEON_EBB7304
 
 config TARGET_OCTEON_NIC23
 	bool "Marvell Octeon NIC23"
+	select ARCH_MISC_INIT
 	select OCTEON_CN73XX
 	help
 	 Choose this for the Octeon NIC23 board
board/toradex/verdin-imx8mm/spl.c +2 -0
index 1020078afea2..3c2d0ba1dd46 100644
@@ -53,7 +53,9 @@ void spl_dram_init(void)
 
 void spl_board_init(void)
 {
+#if IS_ENABLED(CONFIG_ARCH_MISC_INIT)
 	arch_misc_init();
+#endif
 }
 
 #ifdef CONFIG_SPL_LOAD_FIT
common/Kconfig +2 -1
index 17539079f90f..a2f653f7e722 100644
@@ -704,8 +704,9 @@ config ARCH_EARLY_INIT_R
 	  enabled. This can be used to set up architecture-specific devices.
 
 config ARCH_MISC_INIT
-	bool "Call arch-specific init after relocation, when console is ready"
+	bool
 	help
+	  Call arch-specific init after relocation, when console is ready.
 	  With this option U-Boot will call arch_misc_init() after
 	  relocation to allow miscellaneous arch-dependent initialisation
 	  to be performed. This function should be defined by the board
Signature · 1 line
2.43.0
Acked-by on v1 2/2
#2 lore raw

RE: [PATCH 2/2] global: Make ARCH_MISC_INIT a selected symbol

Quoted 14 lines

Subject: [PATCH 2/2] global: Make ARCH_MISC_INIT a selected symbol

This symbol is not something that the user should be enabling or disabling but rather the developer for a particular board should select it when required.

This is mostly size neutral, however a few places do have changes. In the case of i.MX6ULL systems, it is always the case that arch_misc_init() could call setup_serial_number() and do useful work, but was not enabled widely, but now is. In the case of i.MX23/28 systems, we should be able to call mx28_fixup_vt() again here, so do so. Finally, some platforms were calling arch_misc_init() and then not doing anything and this results in removing the option.

Quoted 1 line
author
#4 lore raw
In reply to Tom Rini
Quoted 5 lines · Tom Rini

The hook arch_misc_init was not intended to be used for per-board hooks. This can be done with misc_init_r instead, which is what follows immediately after arch_misc_init. Switch a few platforms.

Applied to u-boot/master, thanks!

[1/2] toradex: Switch from ARCH_MISC_INIT to MISC_INIT_R in some cases

      commit: 0d50d5fc52f0fe54f5d80bb9543f92f362c8b80a
[2/2] global: Make ARCH_MISC_INIT a selected symbol
      commit: d0ed9636902bc5c0d7ea5f73926441241acb6051
Signature · 1 line
Tom