From: Sam Protsenko Date: Fri, 20 Jun 2025 18:50:10 +0000 (-0500) Subject: board: samsung: e850-96: Load LDFW in board_late_init() X-Git-Tag: v2025.07-rc5~4 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c08cecf2d7632d2c7be9a9d260f74bb585d7a3e3;p=pandora-u-boot.git board: samsung: e850-96: Load LDFW in board_late_init() As stated in 5e847f7729b3 ("efi_loader: call efi_init_early() earlier"): efi_init_early() creates an event hook for block device probing. It has to be called before any block device is probed. Indeed, efi_bl_init() registers EVT_DM_POST_PROBE event, which calls efi_disk_probe() whenever any block device is probed. And to make that hook work, the initialization of all block devices was put after efi_init_early() in initcall_run_r(): INITCALL(efi_init_early); INITCALL(initr_nand); INITCALL(initr_onenand); INITCALL(initr_mmc); Because LDFW firmware is being read from MMC, attempt to load LDFW in board_init() causes MMC driver to be probed. And because board_init() is executed before efi_init_early(), the hook mentioned above won't work for MMC devices anymore. So EFI disk objects won't be created, which in turn makes the EFI subsystem non-functional, showing next symptoms: - 'efidebug dh' output is empty - attempt to add boot devices in 'eficonfig' shows this message: "No block device found!" - 'bootefi selftest $fdtcontroladdr' shows this warning: "Cannot persist EFI variables without system partition" - booting GRUB with 'bootefi' runs minimal GRUB shell which doesn't see any block devices as well, probably because EFI vars weren't passed Load LDFW in board_late_init() instead, as it's called after efi_init_early(). This fixes the described problem and makes it possible to run EFI apps like GRUB correctly, add entries in 'eficonfig', and makes 'efivar --list' command in Linux rootfs actually show EFI variables. The only user of LDFW at the moment is the TRNG driver, and it's probed later, only when it's going to be used (e.g. on "rng" command). So it's fine to load LDFW in board_late_init(). Now the corresponding call order will look like this: efi_init_early() initr_mmc() mmc_probe() EVT_DM_POST_PROBE -> efi_disk_probe() board_late_init() load_ldfw() -> fs_read(), blk_dread() exynos_trng_probe() Fixes: ccfd8de541a8 ("board: samsung: e850-96: Report LDFW loading failures") Fixes: f04e58cc9788 ("board: samsung: e850-96: Load LDFW firmware on board init") Signed-off-by: Sam Protsenko --- diff --git a/board/samsung/e850-96/e850-96.c b/board/samsung/e850-96/e850-96.c index 0bef68d2fb2..3bbd95201b5 100644 --- a/board/samsung/e850-96/e850-96.c +++ b/board/samsung/e850-96/e850-96.c @@ -18,9 +18,18 @@ int dram_init_banksize(void) } int board_init(void) +{ + return 0; +} + +int board_late_init(void) { int err; + /* + * Do this in board_late_init() to make sure MMC is not probed before + * efi_init_early(). + */ err = load_ldfw(); if (err) printf("ERROR: LDFW loading failed (%d)\n", err); diff --git a/configs/e850-96_defconfig b/configs/e850-96_defconfig index 5facd418260..e4c6aa28e0b 100644 --- a/configs/e850-96_defconfig +++ b/configs/e850-96_defconfig @@ -19,6 +19,7 @@ CONFIG_ANDROID_BOOT_IMAGE=y CONFIG_BOOTSTD_FULL=y CONFIG_DEFAULT_FDT_FILE="exynos850-e850-96.dtb" # CONFIG_DISPLAY_CPUINFO is not set +CONFIG_BOARD_LATE_INIT=y CONFIG_CMD_BOOTEFI_SELFTEST=y CONFIG_CMD_ABOOTIMG=y CONFIG_CMD_NVEDIT_EFI=y