diff options
| author | Sam Protsenko <[email protected]> | 2025-08-06 17:27:07 -0500 |
|---|---|---|
| committer | Minkyu Kang <[email protected]> | 2025-09-01 16:37:13 +0900 |
| commit | 75f75832d0a97a8c1e1167eb3a6d3dbd1d4eae54 (patch) | |
| tree | 3fd1c22a1266639dee4c8e0e539d66affbad451c | |
| parent | c542140d7cade7d2f14a7a0f260de9b196a97d00 (diff) | |
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 <[email protected]>
Signed-off-by: Minkyu Kang <[email protected]>
| -rw-r--r-- | board/samsung/e850-96/e850-96.c | 40 |
1 files changed, 30 insertions, 10 deletions
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 <init.h> #include <mapmem.h> #include <net.h> +#include <usb.h> #include <asm/io.h> #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; } |
