summaryrefslogtreecommitdiff
path: root/board/xilinx/versal/board.c
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@amd.com>2024-10-25 13:56:08 +0200
committerMichal Simek <michal.simek@amd.com>2024-11-15 14:32:47 +0100
commit064c8978b44fe0e3297e4fbf7a1e53479274372c (patch)
tree94fb3c071618459651e6dc3b78681af9dd340967 /board/xilinx/versal/board.c
parentcf3aa7b52ccfbd38540464507fbe17925b9ed3ff (diff)
arm64: versal: Enable capsule update (SD)
Enable capsule update in SD boot mode. For getting it work there is a need to generate or setup dfu_alt_info and enable sysreset with DFU_MMC. Signed-off-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/cede513de764b99560dc3737457dbc8a5cc71d21.1729857366.git.michal.simek@amd.com
Diffstat (limited to 'board/xilinx/versal/board.c')
-rw-r--r--board/xilinx/versal/board.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c
index 27c1cfc6558..fd5c6ced795 100644
--- a/board/xilinx/versal/board.c
+++ b/board/xilinx/versal/board.c
@@ -12,12 +12,15 @@
#include <env_internal.h>
#include <log.h>
#include <malloc.h>
+#include <memalign.h>
+#include <mmc.h>
#include <time.h>
#include <asm/cache.h>
#include <asm/global_data.h>
#include <asm/io.h>
#include <asm/arch/hardware.h>
#include <asm/arch/sys_proto.h>
+#include <linux/sizes.h>
#include <dm/device.h>
#include <dm/uclass.h>
#include <versalpl.h>
@@ -338,3 +341,41 @@ enum env_location env_get_location(enum env_operation op, int prio)
}
}
#endif
+
+#if defined(CONFIG_SET_DFU_ALT_INFO)
+
+#define DFU_ALT_BUF_LEN SZ_1K
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+ int bootseq = 0, len = 0;
+ u32 bootmode = versal_get_bootmode();
+
+ ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN);
+
+ if (env_get("dfu_alt_info"))
+ return;
+
+ memset(buf, 0, sizeof(buf));
+
+ switch (bootmode) {
+ case EMMC_MODE:
+ case SD_MODE:
+ case SD1_LSHFT_MODE:
+ case SD_MODE1:
+ bootseq = mmc_get_env_dev();
+
+ len += snprintf(buf + len, DFU_ALT_BUF_LEN, "mmc %d=boot",
+ bootseq);
+
+ len += snprintf(buf + len, DFU_ALT_BUF_LEN, ".bin fat %d 1",
+ bootseq);
+ break;
+ default:
+ return;
+ }
+
+ env_set("dfu_alt_info", buf);
+ puts("DFU alt info setting: done\n");
+}
+#endif