From: Lukas Funke <lukas.fu...@weidmueller.com> In order to make CONFIG_IS_ENABLED() work with 'ZYNQMP_FIRMWARE' introduce an additional Kconfig 'SPL_ZYNQMP_FIRMWARE' which is selected if and only if ZYNQMP_FIRMWARE is enabled. Driver are adapted such that they build with and without the config being set.
Signed-off-by: Lukas Funke <lukas.fu...@weidmueller.com> --- arch/arm/mach-zynqmp/Kconfig | 2 +- arch/arm/mach-zynqmp/aes.c | 2 ++ arch/arm/mach-zynqmp/cpu.c | 4 ++-- board/xilinx/zynqmp/zynqmp.c | 4 ++-- drivers/firmware/Kconfig | 5 +++++ drivers/mmc/zynq_sdhci.c | 4 ++-- drivers/pinctrl/Kconfig | 2 +- 7 files changed, 15 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-zynqmp/Kconfig b/arch/arm/mach-zynqmp/Kconfig index 0d2238ace1e..304dce45439 100644 --- a/arch/arm/mach-zynqmp/Kconfig +++ b/arch/arm/mach-zynqmp/Kconfig @@ -36,7 +36,7 @@ config PMUFW_INIT_FILE config ZYNQMP_SPL_PM_CFG_OBJ_FILE string "PMU firmware configuration object to load at runtime by SPL" - depends on SPL + depends on SPL && ZYNQMP_FIRMWARE help Path to a binary PMU firmware configuration object to be linked into U-Boot SPL and loaded at runtime into the PMU firmware. diff --git a/arch/arm/mach-zynqmp/aes.c b/arch/arm/mach-zynqmp/aes.c index 8a2b7fdcbe9..100dde2f372 100644 --- a/arch/arm/mach-zynqmp/aes.c +++ b/arch/arm/mach-zynqmp/aes.c @@ -17,6 +17,7 @@ int zynqmp_aes_operation(struct zynqmp_aes *aes) { +#if CONFIG_IS_ENABLED(ZYNQMP_FIRMWARE) u32 ret_payload[PAYLOAD_ARG_CNT]; int ret; @@ -54,6 +55,7 @@ int zynqmp_aes_operation(struct zynqmp_aes *aes) ret, ret_payload[1]); return -EIO; } +#endif return 0; } diff --git a/arch/arm/mach-zynqmp/cpu.c b/arch/arm/mach-zynqmp/cpu.c index 6ae27894ecd..3515be257a5 100644 --- a/arch/arm/mach-zynqmp/cpu.c +++ b/arch/arm/mach-zynqmp/cpu.c @@ -188,7 +188,7 @@ int zynqmp_mmio_write(const u32 address, { if (IS_ENABLED(CONFIG_SPL_BUILD) || current_el() == 3) return zynqmp_mmio_rawwrite(address, mask, value); -#if defined(CONFIG_ZYNQMP_FIRMWARE) +#if CONFIG_IS_ENABLED(ZYNQMP_FIRMWARE) else return xilinx_pm_request(PM_MMIO_WRITE, address, mask, value, 0, NULL); @@ -207,7 +207,7 @@ int zynqmp_mmio_read(const u32 address, u32 *value) if (IS_ENABLED(CONFIG_SPL_BUILD) || current_el() == 3) { ret = zynqmp_mmio_rawread(address, value); } -#if defined(CONFIG_ZYNQMP_FIRMWARE) +#if CONFIG_IS_ENABLED(ZYNQMP_FIRMWARE) else { u32 ret_payload[PAYLOAD_ARG_CNT]; diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index f370fb7347a..95a134b972d 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -147,14 +147,14 @@ int board_init(void) int ret; #endif -#if defined(CONFIG_SPL_BUILD) +#if defined(CONFIG_SPL_BUILD) && CONFIG_IS_ENABLED(ZYNQMP_FIRMWARE) /* Check *at build time* if the filename is an non-empty string */ if (sizeof(CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE) > 1) zynqmp_pmufw_load_config_object(zynqmp_pm_cfg_obj, zynqmp_pm_cfg_obj_size); #endif -#if defined(CONFIG_ZYNQMP_FIRMWARE) +#if CONFIG_IS_ENABLED(ZYNQMP_FIRMWARE) struct udevice *dev; uclass_get_device_by_name(UCLASS_FIRMWARE, "power-management", &dev); diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index 8789b1ea141..ae785d55d54 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig @@ -30,6 +30,7 @@ config TI_SCI_PROTOCOL config ZYNQMP_FIRMWARE bool "ZynqMP Firmware interface" select FIRMWARE + select SPL_ZYNQMP_FIRMWARE if SPL help Firmware interface driver is used by different drivers to communicate with the firmware for @@ -37,6 +38,10 @@ config ZYNQMP_FIRMWARE Say yes to enable ZynqMP firmware interface driver. If in doubt, say N. +config SPL_ZYNQMP_FIRMWARE + bool "Enable ZynqMP Firmware interface in SPL" + depends on FIRMWARE && SPL + config ARM_SMCCC_FEATURES bool "Arm SMCCC features discovery" depends on ARM_PSCI_FW diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c index 935540d1719..3e4cae60c17 100644 --- a/drivers/mmc/zynq_sdhci.c +++ b/drivers/mmc/zynq_sdhci.c @@ -992,7 +992,7 @@ static const struct sdhci_ops arasan_ops = { }; #endif -#if defined(CONFIG_ARCH_ZYNQMP) && defined(CONFIG_ZYNQMP_FIRMWARE) +#if defined(CONFIG_ARCH_ZYNQMP) && CONFIG_IS_ENABLED(ZYNQMP_FIRMWARE) static int sdhci_zynqmp_set_dynamic_config(struct arasan_sdhci_priv *priv, struct udevice *dev) { @@ -1094,7 +1094,7 @@ static int arasan_sdhci_probe(struct udevice *dev) host = priv->host; -#if defined(CONFIG_ARCH_ZYNQMP) && defined(CONFIG_ZYNQMP_FIRMWARE) +#if defined(CONFIG_ARCH_ZYNQMP) && CONFIG_IS_ENABLED(ZYNQMP_FIRMWARE) if (device_is_compatible(dev, "xlnx,zynqmp-8.9a")) { ret = zynqmp_pm_is_function_supported(PM_IOCTL, IOCTL_SET_SD_CONFIG); diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index a1d53cfbdbe..d2ccfb724af 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig @@ -335,7 +335,7 @@ config PINCTRL_K210 config PINCTRL_ZYNQMP bool "Xilinx ZynqMP pin control driver" - depends on DM && PINCTRL_GENERIC && ARCH_ZYNQMP + depends on DM && PINCTRL_GENERIC && ARCH_ZYNQMP && ZYNQMP_FIRMWARE default y help Support pin multiplexing control on Xilinx ZynqMP. The driver uses -- 2.30.2