[PATCH] arm64: zynqmp: Support converting pm_cfg_obj.c

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.maier@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:

Hi Brandon,
On 22/06/20 22:45, Brandon Maier wrote:
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.
In the workflows I have used so far U-Boot tools are extracted in a different step w.r.t. U-Boot cross-compilation, so I never felt the need for this feature. But I understand this feature can be handy.
The code looks OK too.
Reviewed-by: Luca Ceresoli luca@lucaceresoli.net

On 22. 06. 20 22:45, Brandon Maier wrote:
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.
Based on description I can't see the reason for it. pmu config object should be aligned with pmu not with u-boot itself.
Also using this script is just one way how to get pmufw config object. I personally don't use it but I can't see any issue to be in u-boot project if others want to use it.
Thanks, Michal
participants (3)
-
Brandon Maier
-
Luca Ceresoli
-
Michal Simek