Skip to contentSkip to conversation

uboot: zynqmp: Support loading a PMU config

PATCH New Brandon Maier 2 participants 2 messages Jun 26, 2020 – Jun 27, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 uboot: zynqmp: Support loading a PMU config

Before now, U-Boot SPL could only load the Platform Management Unit (PMU) by patching the board-specific pm_cfg_obj.c file into the generic PMU firmware, but that then requires generating a new PMU firmware for every board configuration. To fix that, Luca Ceresoli added support to U-Boot to load the pm_cfg_obj[1].

Like the PMU firmware, we need a way to pass the PMU cfg to U-Boot during build. U-Boot only accepts the binary format of the cfg, so we must convert the source file with the tool provided with U-Boot.

[1] https://lucaceresoli.net/zynqmp-uboot-spl-pmufw-cfg-load/

---
v2:
- Move convert command to a pre-build hook
- Remove redundant "PATH" variable

 boot/uboot/Config.in | 22 ++++++++++++++++++++++
 boot/uboot/uboot.mk  | 17 +++++++++++++++++
 2 files changed, 39 insertions(+)
boot/uboot/Config.in +22 -0
index 8cce9b1bae..5fa3b5942e 100644
@@ -458,6 +458,28 @@ config BR2_TARGET_UBOOT_ZYNQMP_PMUFW
 
 	  This feature requires U-Boot >= 2018.07.
 
+config BR2_TARGET_UBOOT_ZYNQMP_PM_CFG
+	string "PMU configuration location"
+	depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
+	help
+	  Location of a PMU configuration file.
+
+	  If not empty, Buildroot will convert the PMU configuration
+	  file into a loadable blob and pass it to U-Boot. The blob gets
+	  embedded into the U-Boot SPL and is used to configure the PMU
+	  during board initialization.
+
+	  Unlike the PMU firmware, the PMU configuration file is unique
+	  to each board configuration. A PMU configuration file can be
+	  generated by building your Xilinx SDK BSP. It can be found in
+	  the BSP source, for example at
+	  > ./psu_cortexa53_0/libsrc/xilpm_v2_4/src/pm_cfg_obj.c
+
+	  Leave this option empty if your PMU firmware has a hard-coded
+	  configuration object or you are loading it by any other means.
+
+	  This feature requires U-Boot >= v2019.10.
+
 config BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE
 	string "Custom psu_init_gpl file"
 	depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
boot/uboot/uboot.mk +17 -0
index 71689207e3..8a09969de1 100644
@@ -360,6 +360,22 @@ define UBOOT_ZYNQMP_KCONFIG_PMUFW
 	$(call KCONFIG_SET_OPT,CONFIG_PMUFW_INIT_FILE,"$(UBOOT_ZYNQMP_PMUFW_PATH)")
 endef
 
+UBOOT_ZYNQMP_PM_CFG = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PM_CFG))
+ifneq ($(UBOOT_ZYNQMP_PM_CFG),)
+UBOOT_ZYNQMP_PM_CFG_BIN = $(UBOOT_DIR)/pm_cfg_obj.bin
+define UBOOT_ZYNQMP_KCONFIG_PM_CFG
+	$(call KCONFIG_SET_OPT,CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE,"$(UBOOT_ZYNQMP_PM_CFG_BIN)", \
+		$(@D)/.config)
+endef
+
+define UBOOT_ZYNQMP_PM_CFG_CONVERT
+	$(UBOOT_DIR)/tools/zynqmp_pm_cfg_obj_convert.py \
+		"$(UBOOT_ZYNQMP_PM_CFG)" \
+		"$(UBOOT_ZYNQMP_PM_CFG_BIN)"
+endef
+UBOOT_PRE_BUILD_HOOKS += UBOOT_ZYNQMP_PM_CFG_CONVERT
+endif
+
 UBOOT_ZYNQMP_PSU_INIT = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE))
 UBOOT_ZYNQMP_PSU_INIT_PATH = $(shell readlink -f $(UBOOT_ZYNQMP_PSU_INIT))
 
@@ -422,6 +438,7 @@ endif
 
 define UBOOT_KCONFIG_FIXUP_CMDS
 	$(UBOOT_ZYNQMP_KCONFIG_PMUFW)
+	$(UBOOT_ZYNQMP_KCONFIG_PM_CFG)
 	$(UBOOT_ZYNQMP_KCONFIG_PSU_INIT)
 endef
 
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/1 uboot: zynqmp: Support loading a PMU config

Brancdon, All,

On 2020-06-26 10:59 -0500, Brandon Maier spake thusly:

Quoted 6 lines

Before now, U-Boot SPL could only load the Platform Management Unit (PMU) by patching the board-specific pm_cfg_obj.c file into the generic PMU firmware, but that then requires generating a new PMU firmware for every board configuration. To fix that, Luca Ceresoli added support to U-Boot to load the pm_cfg_obj[1].

Quoted 7 lines

Like the PMU firmware, we need a way to pass the PMU cfg to U-Boot during build. U-Boot only accepts the binary format of the cfg, so we must convert the source file with the tool provided with U-Boot.

[1] https://lucaceresoli.net/zynqmp-uboot-spl-pmufw-cfg-load/

Applied to master, thanks (but see below).

Quoted 23 lines

---
v2:
- Move convert command to a pre-build hook
- Remove redundant "PATH" variable

 boot/uboot/Config.in | 22 ++++++++++++++++++++++
 boot/uboot/uboot.mk  | 17 +++++++++++++++++
 2 files changed, 39 insertions(+)
boot/uboot/Config.in +6 -0
index 8cce9b1bae..5fa3b5942e 100644
@@ -458,6 +458,28 @@ config BR2_TARGET_UBOOT_ZYNQMP_PMUFW
 
 	  This feature requires U-Boot >= 2018.07.
 
+config BR2_TARGET_UBOOT_ZYNQMP_PM_CFG
+	string "PMU configuration location"
+	depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
+	help
+	  Location of a PMU configuration file.
+

boot/uboot/Config.in config BR2_TARGET_UBOOT_ZYNQMP_PMUFW · line 476

Quoted 10 lines
boot/uboot/Config.in +10 -0
+	  If not empty, Buildroot will convert the PMU configuration
+	  file into a loadable blob and pass it to U-Boot. The blob gets
+	  embedded into the U-Boot SPL and is used to configure the PMU
+	  during board initialization.
+
+	  Unlike the PMU firmware, the PMU configuration file is unique
+	  to each board configuration. A PMU configuration file can be
+	  generated by building your Xilinx SDK BSP. It can be found in
+	  the BSP source, for example at
+	  > ./psu_cortexa53_0/libsrc/xilpm_v2_4/src/pm_cfg_obj.c

I replaced the leading '>' with just a space ' ', this still indents nicely...

Regards,
Yann E. MORIN.

Quoted 50 lines
boot/uboot/Config.in +5 -0
+	  Leave this option empty if your PMU firmware has a hard-coded
+	  configuration object or you are loading it by any other means.
+
+	  This feature requires U-Boot >= v2019.10.
+
 config BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE
 	string "Custom psu_init_gpl file"
 	depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
boot/uboot/uboot.mk +17 -0
index 71689207e3..8a09969de1 100644
@@ -360,6 +360,22 @@ define UBOOT_ZYNQMP_KCONFIG_PMUFW
 	$(call KCONFIG_SET_OPT,CONFIG_PMUFW_INIT_FILE,"$(UBOOT_ZYNQMP_PMUFW_PATH)")
 endef
 
+UBOOT_ZYNQMP_PM_CFG = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PM_CFG))
+ifneq ($(UBOOT_ZYNQMP_PM_CFG),)
+UBOOT_ZYNQMP_PM_CFG_BIN = $(UBOOT_DIR)/pm_cfg_obj.bin
+define UBOOT_ZYNQMP_KCONFIG_PM_CFG
+	$(call KCONFIG_SET_OPT,CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE,"$(UBOOT_ZYNQMP_PM_CFG_BIN)", \
+		$(@D)/.config)
+endef
+
+define UBOOT_ZYNQMP_PM_CFG_CONVERT
+	$(UBOOT_DIR)/tools/zynqmp_pm_cfg_obj_convert.py \
+		"$(UBOOT_ZYNQMP_PM_CFG)" \
+		"$(UBOOT_ZYNQMP_PM_CFG_BIN)"
+endef
+UBOOT_PRE_BUILD_HOOKS += UBOOT_ZYNQMP_PM_CFG_CONVERT
+endif
+
 UBOOT_ZYNQMP_PSU_INIT = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE))
 UBOOT_ZYNQMP_PSU_INIT_PATH = $(shell readlink -f $(UBOOT_ZYNQMP_PSU_INIT))
 
@@ -422,6 +438,7 @@ endif
 
 define UBOOT_KCONFIG_FIXUP_CMDS
 	$(UBOOT_ZYNQMP_KCONFIG_PMUFW)
+	$(UBOOT_ZYNQMP_KCONFIG_PM_CFG)
 	$(UBOOT_ZYNQMP_KCONFIG_PSU_INIT)
 endef
 
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'