From: Stefan Eichenberger <[email protected]>

On i.MX95 SoCs, peripherals like PCIe, the display pipeline (DPU, LVDS,
MIPI-DSI), the 10G ENET port and the Cortex-M7 core can be fused off.
U-Boot already fixes up the OS device tree accordingly in
ft_system_setup(), but its own control device tree keeps those nodes
enabled, so U-Boot might bind and probe drivers for hardware that are
not present on the SoC.

Enable CONFIG_OF_BOARD_FIXUP and implement board_fix_fdt() for Aquila,
Toradex SMARC iMX95 and Verdin iMX95 by calling
imx9_uboot_fixup_by_fuse(), mirroring the i.MX95 reference board
implementation.

Signed-off-by: Stefan Eichenberger <[email protected]>
---
 board/toradex/aquila-imx95/aquila-imx95.c | 8 ++++++++
 board/toradex/smarc-imx95/smarc-imx95.c   | 8 ++++++++
 board/toradex/verdin-imx95/verdin-imx95.c | 8 ++++++++
 configs/aquila-imx95_defconfig            | 1 +
 configs/toradex-smarc-imx95_defconfig     | 1 +
 configs/verdin-imx95_defconfig            | 1 +
 6 files changed, 27 insertions(+)

diff --git a/board/toradex/aquila-imx95/aquila-imx95.c 
b/board/toradex/aquila-imx95/aquila-imx95.c
index a5b26ef3dc3..a413f2fee62 100644
--- a/board/toradex/aquila-imx95/aquila-imx95.c
+++ b/board/toradex/aquila-imx95/aquila-imx95.c
@@ -42,3 +42,11 @@ int ft_board_setup(void *blob, struct bd_info *bd)
        return ft_common_board_setup(blob, bd);
 }
 #endif
+
+#if IS_ENABLED(CONFIG_OF_BOARD_FIXUP)
+int board_fix_fdt(void *fdt)
+{
+       /* Remove nodes based on fuses. */
+       return imx9_uboot_fixup_by_fuse(fdt);
+}
+#endif
diff --git a/board/toradex/smarc-imx95/smarc-imx95.c 
b/board/toradex/smarc-imx95/smarc-imx95.c
index d09ce8a52ab..d8132c1abb9 100644
--- a/board/toradex/smarc-imx95/smarc-imx95.c
+++ b/board/toradex/smarc-imx95/smarc-imx95.c
@@ -42,3 +42,11 @@ int ft_board_setup(void *blob, struct bd_info *bd)
        return ft_common_board_setup(blob, bd);
 }
 #endif
+
+#if IS_ENABLED(CONFIG_OF_BOARD_FIXUP)
+int board_fix_fdt(void *fdt)
+{
+       /* Remove nodes based on fuses. */
+       return imx9_uboot_fixup_by_fuse(fdt);
+}
+#endif
diff --git a/board/toradex/verdin-imx95/verdin-imx95.c 
b/board/toradex/verdin-imx95/verdin-imx95.c
index 7c0804c1d1c..e54ac309db4 100644
--- a/board/toradex/verdin-imx95/verdin-imx95.c
+++ b/board/toradex/verdin-imx95/verdin-imx95.c
@@ -78,3 +78,11 @@ int ft_board_setup(void *blob, struct bd_info *bd)
        return ft_common_board_setup(blob, bd);
 }
 #endif
+
+#if IS_ENABLED(CONFIG_OF_BOARD_FIXUP)
+int board_fix_fdt(void *fdt)
+{
+       /* Remove nodes based on fuses. */
+       return imx9_uboot_fixup_by_fuse(fdt);
+}
+#endif
diff --git a/configs/aquila-imx95_defconfig b/configs/aquila-imx95_defconfig
index bb3d475ef4d..8dc6780d98b 100644
--- a/configs/aquila-imx95_defconfig
+++ b/configs/aquila-imx95_defconfig
@@ -27,6 +27,7 @@ CONFIG_WATCHDOG_TIMEOUT_MSECS=30000
 CONFIG_SPL=y
 CONFIG_SPL_RECOVER_DATA_SECTION=y
 CONFIG_PCI=y
+CONFIG_OF_BOARD_FIXUP=y
 CONFIG_SYS_MEMTEST_START=0x90000000
 CONFIG_SYS_MEMTEST_END=0xA0000000
 CONFIG_REMAKE_ELF=y
diff --git a/configs/toradex-smarc-imx95_defconfig 
b/configs/toradex-smarc-imx95_defconfig
index 9abadb0ed1a..fcc006d1d2c 100644
--- a/configs/toradex-smarc-imx95_defconfig
+++ b/configs/toradex-smarc-imx95_defconfig
@@ -27,6 +27,7 @@ CONFIG_WATCHDOG_TIMEOUT_MSECS=30000
 CONFIG_SPL=y
 CONFIG_SPL_RECOVER_DATA_SECTION=y
 CONFIG_PCI=y
+CONFIG_OF_BOARD_FIXUP=y
 CONFIG_SYS_MEMTEST_START=0x90000000
 CONFIG_SYS_MEMTEST_END=0xA0000000
 CONFIG_REMAKE_ELF=y
diff --git a/configs/verdin-imx95_defconfig b/configs/verdin-imx95_defconfig
index daf41a8b830..47a800d5ba6 100644
--- a/configs/verdin-imx95_defconfig
+++ b/configs/verdin-imx95_defconfig
@@ -27,6 +27,7 @@ CONFIG_WATCHDOG_TIMEOUT_MSECS=30000
 CONFIG_SPL=y
 CONFIG_SPL_RECOVER_DATA_SECTION=y
 CONFIG_PCI=y
+CONFIG_OF_BOARD_FIXUP=y
 CONFIG_SYS_MEMTEST_START=0x90000000
 CONFIG_SYS_MEMTEST_END=0xA0000000
 CONFIG_REMAKE_ELF=y
-- 
2.55.0

Reply via email to