This series completes the work to enable VBE on a suitable board. Most of it is rockchip-specific patches to support the VPL phase, i.e. the one which decides which boot patch to take (A, B or recovery).
A good chunk of this series is adding an image for VBE, by creating a new Binman image. Future work in Binman may make this more automated / easier, but for now it is written out in full. The work is undertaken piecemeal so it is easier to review the steps. VBE allows similar boards to share firmware images, with perhaps just TPL (around 75K) being different for each board. Using a common image for VPL, SPL and U-Boot saves a lot of space in the image and makes builds easier. Of course, each board still needs a separate devicetree. Here is the layout of the image: Name Image-pos Size Entry-type Offset Uncomp-size ---------------------------------------------------------------------------------------------- image 0 1b960cf section 0 alternates-fdt 8000 31000 alternates-fdt 8000 mkimage 8000 31000 mkimage 0 u-boot-tpl 8048 12a11 u-boot-tpl 48 vpl 208000 16200 fit 208000 image-vpl 209400 a5a3 section 1400 section 209400 a5a3 section 0 u-boot-vpl-nodtb 10348 u-boot-vpl-nodtb 0 u-boot-vpl-bss-pad 20 u-boot-vpl-bss-pad 10348 @fdt-SEQ 0 0 section 0 vbe-a 800000 39b200 section 800000 spl-a 800000 100000 fit 0 spl 801400 10c97 section 1400 section 801400 10c97 section 0 u-boot-spl-nodtb 1a908 u-boot-spl-nodtb 0 u-boot-spl-bss-pad 1b0 u-boot-spl-bss-pad 1a908 @fdt-SEQ 0 0 section 0 u-boot-a 900000 29b200 fit 100000 spl 902400 10c97 section 2400 section 902400 10c97 section 0 u-boot-spl-nodtb 1a908 u-boot-spl-nodtb 0 u-boot-spl-bss-pad 1b0 u-boot-spl-bss-pad 1a908 u-boot 913200 e4250 section 13200 u-boot-nodtb 913200 e4250 u-boot-nodtb 0 @atf-SEQ 0 0 section 0 atf-bl31 0 0 atf-bl31 0 @tee-SEQ 0 0 section 0 tee-os 0 0 tee-os 0 @fdt-SEQ 0 0 section 0 vbe-b 1000000 39b200 section 1000000 spl-b 1000000 100000 fit 0 spl 1001400 10c97 section 1400 section 1001400 10c97 section 0 u-boot-spl-nodtb 1a908 u-boot-spl-nodtb 0 u-boot-spl-bss-pad 1b0 u-boot-spl-bss-pad 1a908 @fdt-SEQ 0 0 section 0 u-boot-b 1100000 29b200 fit 100000 spl 1102400 10c97 section 2400 section 1102400 10c97 section 0 u-boot-spl-nodtb 1a908 u-boot-spl-nodtb 0 u-boot-spl-bss-pad 1b0 u-boot-spl-bss-pad 1a908 u-boot 1113200 e4250 section 13200 u-boot-nodtb 1113200 e4250 u-boot-nodtb 0 @atf-SEQ 0 0 section 0 atf-bl31 0 0 atf-bl31 0 @tee-SEQ 0 0 section 0 tee-os 0 0 tee-os 0 @fdt-SEQ 0 0 section 0 vbe-recovery 1800000 39b200 section 1800000 spl-recovery 1800000 100000 fit 0 spl 1801400 10c97 section 1400 section 1801400 10c97 section 0 u-boot-spl-nodtb 1a908 u-boot-spl-nodtb 0 u-boot-spl-bss-pad 1b0 u-boot-spl-bss-pad 1a908 @fdt-SEQ 0 0 section 0 u-boot-recovery 1900000 29b200 fit 100000 spl 1902400 10c97 section 2400 section 1902400 10c97 section 0 u-boot-spl-nodtb 1a908 u-boot-spl-nodtb 0 u-boot-spl-bss-pad 1b0 u-boot-spl-bss-pad 1a908 u-boot 1913200 e4250 section 13200 u-boot-nodtb 1913200 e4250 u-boot-nodtb 0 @atf-SEQ 0 0 section 0 atf-bl31 0 0 atf-bl31 0 @tee-SEQ 0 0 section 0 tee-os 0 0 tee-os 0 @fdt-SEQ 0 0 section 0 fdtmap 1b9b200 2ecf fdtmap 1b9b200 This series still includes the bloblist reverts, at the end, just so that the board doesn't have on boot, but I have a series locally which should improve things, so I will send that when complete. This is (mostly) the final VBE series, but there are a few loose ends to tidy up: - cache is disabled in SPL, which slows the boot a little - pinctrl init needs to be tidied up to avoid warnings - bloblist logic as above - bloblist-relocation is partly in board-specific code, partly generic Other things may become apparently after more usage / testing. Changes in v5: - Drop stray #endif - Drop removal of stray #ifdef - Mention VBE in the first paragraph of the commit message - Wrap the entire simple-bin node and add the properties to vpl - Expand commit message to mention VBE - Move SUPPORT_VPL next to other SUPPORT_xxx options - Put TPL_DM_MMC in alpha order - Move VPL_ROCKCHIP_COMMON_BOARD up a bit - Move VPL_LDSCRIPT up a bit - Drop config SPL_STACK_R_ADDR - Use if() instead of ? in spl_boot_device() - Drop mention of SPL_RAW_IMAGE_SUPPORT since it is already the default - Drop mention of SPL_SEPARATE_BSS since VPL doesn't need it - Drop duplicate __image_copy_start and __image_copy_end - Drop unwanted comment in script - Reword first paragraph to mention bloblist instead of other stacks - Add value for CONFIG_SPL_STACK_R_ADDR - Add to VPL file also - Use 'SDRAM' instead of 'IRAM' in comment - Drop mention of rk3399 since 64-boards always have TF-A after SPL - Drop condition on VPL Changes in v4: - Use FIT_ARCH instead of ARCH - Use FIT_ARCH instead of ARCH - Use FIT_ARCH instead of ARCH - Use fit_template instead of common_part - Put the fdtmap at the end of the image - Update the comment at the end of the '#ifndef CONFIG_VPL' block - Add a value for SPL_STACK_R_ADDR - Drop SPL_PAD_TO value since the default is fine - Drop ROCKCHIP_IODOMAIN since it is the default - Add SPL_LIBCOMMON_SUPPORT and SPL_LIBGENERIC_SUPPORT Changes in v3: - Add blank lines before the node - Add a comment about the offsets - Move template to the vpl file - Unindent bootph tags - Add the BLOBLIST_RELOC condition as well Changes in v2: - Move VPL things into a separate file - Move VPL things into a separate file - Move VPL things into a separate file - Mention RK3399 with respect to the memory limit - Move VPL things into a separate file - Only enable MMC when VPM is in use. - Rewrite help for VPL_ROCKCHIP_COMMON_BOARD - Skip spl-boot-order.c for VPL (rather than modifying it) - Reword commit to mention comments from Jonas - Rename to rk3399-generic-ddr3 - Update devicetree to match firefly-rk3399 - Use the firefly devicetree as the default for this board - Move this patch to the end of the series - Drop 0x8000 offset for SPI - Add new patch with a bootmeth driver for abrec - Split out the fixes for skip-at-start into a new patch - Move this logic into board-specific code - Move the actual relocation code to a previous board-specific patch Simon Glass (25): spl: Adjust xPL symbols spl: Allow VBE to handle xPL size vbe: Show the margin when using SPL_RELOC rockchip: Allow RAM init to happen in SPL on rk3399 rockchip: dts: Add an fdtmap rockchip: dts: Specify the phase in the image rockchip: Provide a bootstd configuration rockchip: Add SPL into the main FIT rockchip: Add a template for SPL rockchip: Add a VPL image rockchip: Add TPL alternatives rockchip: Update rk3399 bootph-tags for VPL rockchip: Provide a VPL phase on rk3399 rockchip: Add symbols for spl_reloc rockchip: rk3399: Adjust TPL stack to allow for bloblist rockchip: Allow SPL to set up SDRAM rockchip: Add a generic-ddr3 rk3399 board rockchip: Add documentation for VBE gitlab: Add an VBE board to the sjg lab rockchip: Set the skip-at-start property correctly vbe: Add a bootmeth driver for abrec rockchip: Update binman image for new skip-at-start setup bloblist: Temporary hacks to get VBE going rockchip: Relocate bloblist at the end of the SPL phase bloblist: Allow using a different bloblist address .gitlab-ci.yml | 20 +- arch/arm/dts/rk3399-u-boot.dtsi | 9 + arch/arm/dts/rockchip-u-boot.dtsi | 17 ++ arch/arm/dts/rockchip-vpl-u-boot.dtsi | 224 +++++++++++++++++++++++ arch/arm/include/asm/spl.h | 1 + arch/arm/lib/xferlist.c | 12 +- arch/arm/mach-rockchip/Kconfig | 23 ++- arch/arm/mach-rockchip/Makefile | 11 +- arch/arm/mach-rockchip/rk3399/Kconfig | 11 +- arch/arm/mach-rockchip/spl.c | 17 ++ arch/arm/mach-rockchip/tpl.c | 13 +- arch/arm/mach-rockchip/u-boot-tpl-v8.lds | 10 + arch/arm/mach-rockchip/u-boot-vpl-v8.lds | 107 +++++++++++ arch/arm/mach-rockchip/vpl.c | 53 ++++++ board/rockchip/evb_rk3399/MAINTAINERS | 6 + boot/vbe_abrec.c | 99 ++++++++++ cmd/vbe.c | 8 +- common/Kconfig | 20 ++ common/bloblist.c | 127 +++++-------- common/spl/Kconfig | 3 +- common/spl/spl.c | 2 + common/spl/spl_reloc.c | 14 +- configs/rk3399-generic-ddr3_defconfig | 125 +++++++++++++ doc/board/rockchip/rockchip.rst | 13 ++ drivers/ram/rockchip/sdram_rk3399.c | 6 +- include/bloblist.h | 16 +- include/vbe.h | 3 + 27 files changed, 849 insertions(+), 121 deletions(-) create mode 100644 arch/arm/dts/rockchip-vpl-u-boot.dtsi create mode 100644 arch/arm/mach-rockchip/u-boot-vpl-v8.lds create mode 100644 arch/arm/mach-rockchip/vpl.c create mode 100644 configs/rk3399-generic-ddr3_defconfig -- 2.43.0 base-commit: bab54f5942c428be698216224fd10b91d974d4da branch: vbi5