mbox series

[U-Boot,RFC,0/2] arm64: zynqmp: pass a PMUFW config object

Message ID 20190228222825.1273-1-luca@lucaceresoli.net
Headers show
Series arm64: zynqmp: pass a PMUFW config object | expand

Message

Luca Ceresoli Feb. 28, 2019, 10:28 p.m. UTC
Hi,

a long-standing issue in the ZynqMP users community is the management
on the PMU firmware configuration object.

The Platform Management Unit (PMU) needs a configuration object (cfg
obj) to know how to operate the SoC. When using the "Xilinx workflow",
the Xilinx FSBL (First Stage Bootloader) has te SPL role. FSBL has a
built-in cfg obj and passes it to the PMUFW at runtime before jumping
to U-Boot proper.

This is just not implemented in the U-Boot code. The best workaround
for U-Boot SPL users is to patch [0] the PMUFW itself to have the cfg
obj built-in and self-load it. This approach has some drawbacks: among
others, it forces to use a different PMUFW binary for each hardware
and hardware configuation. It also makes it impossible to change the
configuration after boot.

This patchset is a first attempt at filling the gap by allowing U-Boot
to load the cfg obj firmware at runtime. It adds a Kconfig string
option to point to the cfg obj in the form of a C file as produced by
Xilinx tools (usually called pm_cfg_obj.c). If the option is
non-empty, code is enabled to compile that file in U-Boot proper and
to send the configuration to PMUFW early after SPL.

This mechanism relies on the underlying EL3 (ARM Trusted Firmware) to
implement the SET_CONFIGURATION SMC call. I just sent a trivial pull
request [1] to ATF to add this call. With this in place, the path of
the cfg obj is U-Boot -> ATF -> PMUFW.

This is a rather simple approach that works in many cases, but not
all, as pointed out by Michal Simek. Some boards (reportedly zcu100
and ultra96 according to Michal) need the cfg obj loaded in SPL,
before applying psu_init. Such boards cannot boot with my patches.

Michal also suggested that the cfg obj loading code should be
available both in SPL (configured at build time) and in U-Boot proper
(loading an object from a file) in order to support different FPGA
configuration and partial reconfiguration at runtime. Even with these
limitations Michal suggested to send this work as an RFC to start the
discussion.

These patches are tested on the ZCU106 and UltraZed EV boards.

[0] https://github.com/topic-embedded-products/meta-topic/blob/master/recipes-bsp/pmu-firmware/pmu-firmware/0001-Load-XPm_ConfigObject-at-boot.patch

[1] https://github.com/ARM-software/arm-trusted-firmware/pull/1850

Luca

Luca Ceresoli (2):
  arm64: zynqmp: add minimal include files to build a pm_cfg_obj.c
  arm64: zynqmp: install a PMU firmware config object at runtime

 arch/arm/mach-zynqmp/include/mach/sys_proto.h |   1 +
 board/xilinx/zynqmp/Kconfig                   |  27 ++
 board/xilinx/zynqmp/Makefile                  |   4 +
 board/xilinx/zynqmp/pm_defs.h                 | 254 ++++++++++++++++++
 board/xilinx/zynqmp/pmu_global.h              |   0
 board/xilinx/zynqmp/xil_types.h               |   1 +
 board/xilinx/zynqmp/zynqmp.c                  |  23 ++
 7 files changed, 310 insertions(+)
 create mode 100644 board/xilinx/zynqmp/pm_defs.h
 create mode 100644 board/xilinx/zynqmp/pmu_global.h
 create mode 100644 board/xilinx/zynqmp/xil_types.h