]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm64: versal: Enable capsule update (SD)
authorMichal Simek <michal.simek@amd.com>
Fri, 25 Oct 2024 11:56:08 +0000 (13:56 +0200)
committerMichal Simek <michal.simek@amd.com>
Fri, 15 Nov 2024 13:32:47 +0000 (14:32 +0100)
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
board/xilinx/versal/board.c
configs/xilinx_versal_virt_defconfig

index 27c1cfc6558a6cd5a5e8969f50afeca518cf0372..fd5c6ced79563ed9567686bd3ff583d11571b4b1 100644 (file)
 #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
index 1a29c4aeff7795bcabbd9a06565187bfb883a990..3a4cd8f99f5ffeefb7409694476b1f13f850dd50 100644 (file)
@@ -4,6 +4,7 @@ CONFIG_POSITION_INDEPENDENT=y
 CONFIG_SYS_INIT_SP_BSS_OFFSET=1572864
 CONFIG_ARCH_VERSAL=y
 CONFIG_TEXT_BASE=0x8000000
+CONFIG_SYS_MALLOC_LEN=0x4000000
 CONFIG_SYS_MALLOC_F_LEN=0x100000
 CONFIG_NR_DRAM_BANKS=36
 CONFIG_SF_DEFAULT_SPEED=30000000
@@ -18,6 +19,10 @@ CONFIG_DEFINE_TCM_OCM_MMAP=y
 CONFIG_SYS_MEMTEST_START=0x00000000
 CONFIG_SYS_MEMTEST_END=0x00001000
 CONFIG_REMAKE_ELF=y
+CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_ON_DISK_EARLY=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
 CONFIG_EFI_HTTP_BOOT=y
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
@@ -76,6 +81,7 @@ CONFIG_TFTP_BLOCKSIZE=4096
 CONFIG_SIMPLE_PM_BUS=y
 CONFIG_CLK_VERSAL=y
 CONFIG_DFU_TIMEOUT=y
+CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_SYS_DFU_DATA_BUF_SIZE=0x1800000
 CONFIG_ARM_FFA_TRANSPORT=y
@@ -137,6 +143,8 @@ CONFIG_CADENCE_OSPI_VERSAL=y
 CONFIG_ZYNQ_SPI=y
 CONFIG_ZYNQMP_GQSPI=y
 CONFIG_SPI_STACKED_PARALLEL=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_PSCI=y
 CONFIG_TPM2_TIS_SPI=y
 CONFIG_USB=y
 CONFIG_DM_USB_GADGET=y