diff options
author | Michal Simek <michal.simek@amd.com> | 2022-12-02 14:06:15 +0100 |
---|---|---|
committer | Michal Simek <michal.simek@amd.com> | 2022-12-05 08:55:55 +0100 |
commit | b40d154ced47d43005f683f7e089b9c016c8ea3d (patch) | |
tree | f95685b1a4d86e61f5638e8b2d941fcfb61b86fc /board | |
parent | 7d13f72d74c7ed7e60d8e603a52de34061ff3dd0 (diff) | |
download | u-boot-b40d154ced47d43005f683f7e089b9c016c8ea3d.zip u-boot-b40d154ced47d43005f683f7e089b9c016c8ea3d.tar.gz u-boot-b40d154ced47d43005f683f7e089b9c016c8ea3d.tar.bz2 |
xilinx: zynqmp: Fix SPL_FS_LOAD_PAYLOAD_NAME usage
SPL_FS_LOAD_PAYLOAD_NAME depends on SPL to be enabled.
If SPL is not enabled code still expects SPL_FS_LOAD_PAYLOAD_NAME to be
present. That's why setup proper dependency in the code.
And by doing so also change the logic around dfu_alt_info string
composition to be simpler.
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/3989c390a4acae13a1b05c040e14fb3d68bced02.1669986373.git.michal.simek@amd.com
Diffstat (limited to 'board')
-rw-r--r-- | board/xilinx/zynqmp/zynqmp.c | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 5fe0873..579708d 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -611,8 +611,7 @@ enum env_location env_get_location(enum env_operation op, int prio) void set_dfu_alt_info(char *interface, char *devstr) { - int multiboot; - int bootseq = 0; + int multiboot, bootseq = 0, len = 0; ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN); @@ -634,29 +633,33 @@ void set_dfu_alt_info(char *interface, char *devstr) case SD1_LSHFT_MODE: case SD_MODE1: bootseq = mmc_get_env_dev(); - if (!multiboot) - snprintf(buf, DFU_ALT_BUF_LEN, - "mmc %d=boot.bin fat %d 1;" - "%s fat %d 1", - bootseq, bootseq, - CONFIG_SPL_FS_LOAD_PAYLOAD_NAME, bootseq); - else - snprintf(buf, DFU_ALT_BUF_LEN, - "mmc %d=boot%04d.bin fat %d 1;" - "%s fat %d 1", - bootseq, multiboot, bootseq, - CONFIG_SPL_FS_LOAD_PAYLOAD_NAME, bootseq); + + len += snprintf(buf + len, DFU_ALT_BUF_LEN, "mmc %d=boot", + bootseq); + + if (multiboot) + len += snprintf(buf + len, DFU_ALT_BUF_LEN, + "%04d", multiboot); + + len += snprintf(buf + len, DFU_ALT_BUF_LEN, ".bin fat %d 1", + bootseq); +#if defined(CONFIG_SPL_FS_LOAD_PAYLOAD_NAME) + len += snprintf(buf + len, DFU_ALT_BUF_LEN, ";%s fat %d 1", + CONFIG_SPL_FS_LOAD_PAYLOAD_NAME, bootseq); +#endif break; -#if defined(CONFIG_SYS_SPI_U_BOOT_OFFS) case QSPI_MODE_24BIT: case QSPI_MODE_32BIT: - snprintf(buf, DFU_ALT_BUF_LEN, - "sf 0:0=boot.bin raw %x 0x1500000;" - "%s raw 0x%x 0x500000", - multiboot * SZ_32K, CONFIG_SPL_FS_LOAD_PAYLOAD_NAME, - CONFIG_SYS_SPI_U_BOOT_OFFS); - break; + len += snprintf(buf + len, DFU_ALT_BUF_LEN, + "sf 0:0=boot.bin raw %x 0x1500000", + multiboot * SZ_32K); +#if defined(CONFIG_SPL_FS_LOAD_PAYLOAD_NAME) && defined(CONFIG_SYS_SPI_U_BOOT_OFFS) + len += snprintf(buf + len, DFU_ALT_BUF_LEN, + ";%s raw 0x%x 0x500000", + CONFIG_SPL_FS_LOAD_PAYLOAD_NAME, + CONFIG_SYS_SPI_U_BOOT_OFFS); #endif + break; default: return; } |