The shared LX2160A board file calls helpers that only exist when
their subsystem is enabled. Gate them on the matching CONFIG_*:
 - pci_init() under CONFIG_PCI.
 - fdt_fixup_mc_ddr() and fsl_rgmii_init() under CONFIG_FSL_MC_ENET.
 - qixis_*() and the QIXIS branch of checkboard() under
   CONFIG_FSL_QIXIS; cpu_name(buf) moves out so the non-QIXIS path
   still prints "Board: <name>".
 - EVENT_SPY_SIMPLE on init_func_vid moves inside the
   CONFIG_VOL_MONITOR_LTC3882_READ guard (was outside, dangling
   symbol when LTC3882 off).

 #if / #ifdef, not IS_ENABLED(), because the helpers are themselves
conditionally compiled.

While here, lx2160a_common.h: fix BOOT_TARGET_DEVICES_MMC
1 arg vs 2 args and gate the MMC target on CONFIG_CMD_MMC,
not CONFIG_MMC.

No functional change for NXP boards: LX2160ARDB, LX2160AQDS, or
LX2162AQDS, but mainly build clean up in order to support
other NXP lx2160a boards without those HW dependencies.

Signed-off-by: Vincent Jardin <[email protected]>

---

 arch/arm/cpu/armv8/fsl-layerscape/cpu.c |  6 +++++-
 board/nxp/lx2160a/lx2160a.c             | 18 +++++++++++++-----
 include/configs/lx2160a_common.h        |  4 ++--
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c 
b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
index cfbaa475701..5144a1e3c0e 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
@@ -1143,7 +1143,7 @@ int arch_early_init_r(void)
 #ifdef CONFIG_SYS_HAS_SERDES
        fsl_serdes_init();
 #endif
-#ifdef CONFIG_SYS_FSL_HAS_RGMII
+#if defined(CONFIG_SYS_FSL_HAS_RGMII) && defined(CONFIG_FSL_MC_ENET)
        /* some dpmacs in armv8a based freescale layerscape SOCs can be
         * configured via both serdes(sgmii, 10gbase-r, xlaui etc) bits and via
         * EC*_PMUX(rgmii) bits in RCW.
@@ -1158,6 +1158,10 @@ int arch_early_init_r(void)
         * function of SOC, the dpmac will be enabled as RGMII even if it was
         * also enabled before as SGMII. If ECx_PMUX is not configured for
         * RGMII, DPMAC will remain configured as SGMII from fsl_serdes_init().
+        *
+        * fsl_rgmii_init() itself is only built under CONFIG_FSL_MC_ENET
+        * (drivers/net/ldpaa_eth/); gate the call the same way so builds
+        * without MC-ENET still link.
         */
        fsl_rgmii_init();
 #endif
diff --git a/board/nxp/lx2160a/lx2160a.c b/board/nxp/lx2160a/lx2160a.c
index 341f82ce724..da943f161da 100644
--- a/board/nxp/lx2160a/lx2160a.c
+++ b/board/nxp/lx2160a/lx2160a.c
@@ -242,13 +242,17 @@ int init_func_vid(void)
 
        return 0;
 }
-#endif
 EVENT_SPY_SIMPLE(EVT_MISC_INIT_F, init_func_vid);
+#endif
 
 int checkboard(void)
 {
-       enum boot_src src = get_boot_src();
        char buf[64];
+
+       cpu_name(buf);
+
+#if IS_ENABLED(CONFIG_FSL_QIXIS)
+       enum boot_src src = get_boot_src();
        u8 sw;
 #if defined(CONFIG_TARGET_LX2160AQDS) || defined(CONFIG_TARGET_LX2162AQDS)
        int clock;
@@ -258,7 +262,6 @@ int checkboard(void)
                                           "100 separate SSCG"};
 #endif
 
-       cpu_name(buf);
 #if defined(CONFIG_TARGET_LX2160AQDS) || defined(CONFIG_TARGET_LX2162AQDS)
        printf("Board: %s-QDS, ", buf);
 #else
@@ -325,7 +328,10 @@ int checkboard(void)
        clock = sw >> 4;
        printf("Clock1 = %sMHz Clock2 = %sMHz\n", freq[clock], freq[clock]);
 #endif
-#endif
+#endif /* LX2160ARDB-inside-QIXIS switch */
+#else /* !CONFIG_FSL_QIXIS */
+       printf("Board: %s\n", buf);
+#endif /* CONFIG_FSL_QIXIS */
        return 0;
 }
 
@@ -554,7 +560,7 @@ int board_init(void)
        out_le32(irq_ccsr + IRQCR_OFFSET / 4, AQR107_IRQ_MASK);
 #endif
 
-#if !defined(CONFIG_SYS_EARLY_PCI_INIT)
+#if defined(CONFIG_PCI) && !defined(CONFIG_SYS_EARLY_PCI_INIT)
        pci_init();
 #endif
        return 0;
@@ -788,7 +794,9 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 
        ft_cpu_setup(blob, bd);
 
+#if IS_ENABLED(CONFIG_FSL_MC_ENET)
        fdt_fixup_mc_ddr(&mc_memory_base, &mc_memory_size);
+#endif
 
        if (mc_memory_base != 0)
                mc_memory_bank++;
diff --git a/include/configs/lx2160a_common.h b/include/configs/lx2160a_common.h
index 45b5cbdd85a..dc0d24dca0a 100644
--- a/include/configs/lx2160a_common.h
+++ b/include/configs/lx2160a_common.h
@@ -197,10 +197,10 @@
 #define BOOT_TARGET_DEVICES_USB(func)
 #endif
 
-#ifdef CONFIG_MMC
+#ifdef CONFIG_CMD_MMC
 #define BOOT_TARGET_DEVICES_MMC(func, instance) func(MMC, mmc, instance)
 #else
-#define BOOT_TARGET_DEVICES_MMC(func)
+#define BOOT_TARGET_DEVICES_MMC(func, instance)
 #endif
 
 #ifdef CONFIG_SCSI
-- 
2.43.0

base-commit: bfe90a308a94caa9d855440683521ff04122ae2a
branch: for-upstream/lx2160a-gate-feature-subsystems

Reply via email to