summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPadmarao Begari <[email protected]>2026-05-14 15:52:20 +0530
committerMichal Simek <[email protected]>2026-06-08 10:50:05 +0200
commit371a6c1744f3bae13a7abbcb06e448c75933c0dd (patch)
tree18b5e29c073b96079c9e4f8d12d88ef8b26afa23
parentf2390069d45b3490cfd87de6d6bac6e646796b6b (diff)
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 <[email protected]> Signed-off-by: Michal Simek <[email protected]> Link: https://lore.kernel.org/r/[email protected]
-rw-r--r--board/xilinx/versal/board.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c
index 9371c30ea27..8666f2ceff4 100644
--- a/board/xilinx/versal/board.c
+++ b/board/xilinx/versal/board.c
@@ -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