To use CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE, a developer must pull down the
U-Boot source and run ./tools/zynqmp_pm_cfg_obj_convert.py to convert
their pm_cfg_obj.c into U-Boot's PMU loader format, then feed that file
back to U-Boot during build.

Instead, by doing the conversion in U-Boot during the build, we can
simplify the developer's build system. And it ensures that if
zynqmp_pm_cfg_obj_convert.py is updated, the pm_cfg_obj will stay in
sync with U-Boot.

Add a config to set the file format, but leave the default as binary
type for backwards compatibility.

Signed-off-by: Brandon Maier <brandon.ma...@rockwellcollins.com>
---

 arch/arm/mach-zynqmp/Kconfig     | 20 ++++++++++++++++++++
 board/xilinx/zynqmp/Makefile     | 10 +++++++++-
 board/xilinx/zynqmp/pm_cfg_obj.S |  2 +-
 3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-zynqmp/Kconfig b/arch/arm/mach-zynqmp/Kconfig
index d82a737a69..d9116870ee 100644
--- a/arch/arm/mach-zynqmp/Kconfig
+++ b/arch/arm/mach-zynqmp/Kconfig
@@ -65,6 +65,26 @@ config PMUFW_INIT_FILE
          Include external PMUFW (Platform Management Unit FirmWare) to
          a Xilinx bootable image (boot.bin).
 
+choice
+       prompt "PMU firmware configuration format"
+       default ZYNQMP_SPL_PM_CFG_BIN
+       help
+         Format of the file given to ZYNQMP_SPL_PM_CFG_OBJ_FILE.
+
+config ZYNQMP_SPL_PM_CFG_BIN
+       bool "pm_cfg_obj.bin"
+       help
+         The pm_cfg_obj.c after being preprocessed to a binary blob.
+
+config ZYNQMP_SPL_PM_CFG_SRC
+       bool "pm_cfg_obj.c"
+       help
+         The source file output from the Xilinx tools. This file is
+         generated when building the Xilinx SDK BSP. For example at
+         ./psu_cortexa53_0/libsrc/xilpm_v2_4/src/pm_cfg_obj.c
+
+endchoice
+
 config ZYNQMP_SPL_PM_CFG_OBJ_FILE
        string "PMU firmware configuration object to load at runtime by SPL"
        depends on SPL
diff --git a/board/xilinx/zynqmp/Makefile b/board/xilinx/zynqmp/Makefile
index 398c6aaa45..05067c43be 100644
--- a/board/xilinx/zynqmp/Makefile
+++ b/board/xilinx/zynqmp/Makefile
@@ -40,8 +40,16 @@ endif
 
 ifdef CONFIG_SPL_BUILD
 ifneq ($(CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE),"")
+ZYNQMP_SPL_CFG_OBJ_FILE = $(shell cd $(srctree); readlink -f 
$(CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE)) FORCE
+ifdef CONFIG_ZYNQMP_SPL_PM_CFG_BIN
+board/xilinx/zynqmp/pm_cfg_obj.bin: $(ZYNQMP_SPL_CFG_OBJ_FILE)
+       cp $< $@
+else
+board/xilinx/zynqmp/pm_cfg_obj.bin: $(ZYNQMP_SPL_CFG_OBJ_FILE)
+       $(srctree)/tools/zynqmp_pm_cfg_obj_convert.py $< $@
+endif
 obj-$(CONFIG_SPL_BUILD) += pm_cfg_obj.o
-$(obj)/pm_cfg_obj.o: $(shell cd $(srctree); readlink -f 
$(CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE)) FORCE
+$(obj)/pm_cfg_obj.o: board/xilinx/zynqmp/pm_cfg_obj.bin
 endif
 endif
 
diff --git a/board/xilinx/zynqmp/pm_cfg_obj.S b/board/xilinx/zynqmp/pm_cfg_obj.S
index c4ca77e396..77e39017f8 100644
--- a/board/xilinx/zynqmp/pm_cfg_obj.S
+++ b/board/xilinx/zynqmp/pm_cfg_obj.S
@@ -9,7 +9,7 @@
 
 zynqmp_pm_cfg_obj:
 .align 4
-.incbin CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE
+.incbin "board/xilinx/zynqmp/pm_cfg_obj.bin"
 
 zynqmp_pm_cfg_obj_end:
 
-- 
2.25.1

Reply via email to