board: xilinx: Add capsule and FWU support

Guard configure_capsule_updates() so it is skipped when FWU
multi-bank update is enabled. Add set_dfu_alt_info() for FWU
multi-bank mode to generate DFU alt info dynamically from NOR
flash MTD partitions using fwu_gen_alt_info_from_mtd().

Signed-off-by: Padmarao Begari <padmarao.begari@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20260514102601.1759779-4-padmarao.begari@amd.com
This commit is contained in:
Padmarao Begari
2026-06-08 10:50:05 +02:00
committed by Michal Simek
parent f2390069d4
commit 371a6c1744
+41 -1
View File
@@ -10,6 +10,7 @@
#include <env.h>
#include <efi_loader.h>
#include <fdtdec.h>
#include <fwu.h>
#include <init.h>
#include <env_internal.h>
#include <log.h>
@@ -293,7 +294,8 @@ int board_late_init(void)
{
int ret;
if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT))
if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) &&
!IS_ENABLED(CONFIG_FWU_MULTI_BANK_UPDATE))
configure_capsule_updates();
if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
@@ -374,6 +376,8 @@ enum env_location env_get_location(enum env_operation op, int prio)
#define DFU_ALT_BUF_LEN SZ_1K
#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && \
!defined(CONFIG_FWU_MULTI_BANK_UPDATE)
static void mtd_found_part(u32 *base, u32 *size)
{
struct mtd_info *part, *mtd;
@@ -450,3 +454,39 @@ void configure_capsule_updates(void)
update_info.dfu_string = strdup(buf);
debug("Capsule DFU: %s\n", update_info.dfu_string);
}
#endif
#if defined(CONFIG_FWU_MULTI_BANK_UPDATE)
/* Generate dfu_alt_info from partitions */
void set_dfu_alt_info(char *interface, char *devstr)
{
int ret;
struct mtd_info *mtd;
/*
* It is called multiple times for every image
* per bank that's why enough to set it up once.
*/
if (env_get("dfu_alt_info"))
return;
ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN);
memset(buf, 0, DFU_ALT_BUF_LEN);
mtd_probe_devices();
mtd = get_mtd_device_nm("nor0");
if (IS_ERR_OR_NULL(mtd))
return;
ret = fwu_gen_alt_info_from_mtd(buf, DFU_ALT_BUF_LEN, mtd);
if (ret < 0) {
log_err("Error: Failed to generate dfu_alt_info. (%d)\n", ret);
return;
}
log_debug("Make dfu_alt_info: '%s'\n", buf);
env_set("dfu_alt_info", buf);
}
#endif