From: Sam Protsenko Date: Wed, 6 Aug 2025 22:27:07 +0000 (-0500) Subject: board: samsung: e850-96: Add bootdev var to choose boot device X-Git-Tag: v2025.10-rc4~5^2~7 X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75f75832d0a97a8c1e1167eb3a6d3dbd1d4eae54;p=pandora-u-boot.git board: samsung: e850-96: Add bootdev var to choose boot device Provide a way for the user to select which storage to load the LDFW firmware from, by setting the corresponding environment variables: - bootdev: block device interface name - bootdevnum: block device number - bootdevpart: partition number This might be useful when the OS is flashed and booted from a different storage device than eMMC (e.g. USB flash drive). In this case it should be sufficient to just set: => setenv bootdev usb => env save assuming that the USB drive layout follows the same partitioning scheme as defined in $partitions. Signed-off-by: Sam Protsenko Signed-off-by: Minkyu Kang --- diff --git a/board/samsung/e850-96/e850-96.c b/board/samsung/e850-96/e850-96.c index b5f6ba23432..3df241edde2 100644 --- a/board/samsung/e850-96/e850-96.c +++ b/board/samsung/e850-96/e850-96.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "fw.h" #include "pmic.h" @@ -136,21 +137,40 @@ static void setup_ethaddr(void) eth_env_set_enetaddr("ethaddr", mac_addr); } -int board_late_init(void) +/* + * Call this in board_late_init() to avoid probing block devices before + * efi_init_early(). + */ +void load_firmware(void) { + const char *ifname; + ulong dev, part; int err; - setup_serial(); - setup_ethaddr(); - - /* - * Do this in board_late_init() to make sure MMC is not probed before - * efi_init_early(). - */ - err = load_ldfw(EMMC_IFNAME, EMMC_DEV_NUM, EMMC_ESP_PART, - LDFW_NWD_ADDR); + ifname = env_get("bootdev"); + if (!ifname) + ifname = EMMC_IFNAME; + dev = env_get_ulong("bootdevnum", 10, EMMC_DEV_NUM); + part = env_get_ulong("bootdevpart", 10, EMMC_ESP_PART); + + if (!strcmp(ifname, "usb")) { + printf("Starting USB (bootdev=usb)...\n"); + err = usb_init(); + if (err) + return; + } + + printf("Loading LDFW firmware (from %s %ld)...\n", ifname, dev); + err = load_ldfw(ifname, dev, part, LDFW_NWD_ADDR); if (err) printf("ERROR: LDFW loading failed (%d)\n", err); +} + +int board_late_init(void) +{ + setup_serial(); + setup_ethaddr(); + load_firmware(); return 0; }