arm64: versal: Support operations around multiboot register
authorMichal Simek <michal.simek@amd.com>
Thu, 5 Dec 2024 10:38:16 +0000 (11:38 +0100)
committerMichal Simek <michal.simek@amd.com>
Tue, 14 Jan 2025 07:23:47 +0000 (08:23 +0100)
Read multiboot register and show it's value by default.
Also extend logic in dfu_alt_info string generation to support capsule
update for different offsets.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/72ba2efd0fb7b66a86b409a1521fe288a4dd3453.1733395093.git.michal.simek@amd.com
board/xilinx/versal/board.c

index 964a779..d05220f 100644 (file)
@@ -36,9 +36,15 @@ static xilinx_desc versalpl = {
 };
 #endif
 
+static u32 versal_multi_boot(void)
+{
+       return readl(0xF1110004);
+}
+
 int board_init(void)
 {
        printf("EL Level:\tEL%d\n", current_el());
+       printf("Multiboot:\t%d\n", versal_multi_boot());
 
 #if defined(CONFIG_FPGA_VERSALPL)
        fpga_init();
@@ -375,6 +381,7 @@ static void mtd_found_part(u32 *base, u32 *size)
 void set_dfu_alt_info(char *interface, char *devstr)
 {
        int bootseq = 0, len = 0;
+       u32 multiboot = versal_multi_boot();
        u32 bootmode = versal_get_bootmode();
 
        ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN);
@@ -384,6 +391,8 @@ void set_dfu_alt_info(char *interface, char *devstr)
 
        memset(buf, 0, sizeof(buf));
 
+       multiboot = env_get_hex("multiboot", multiboot);
+
        switch (bootmode) {
        case EMMC_MODE:
        case SD_MODE:
@@ -394,6 +403,10 @@ void set_dfu_alt_info(char *interface, char *devstr)
                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);
                break;
@@ -401,7 +414,7 @@ void set_dfu_alt_info(char *interface, char *devstr)
        case QSPI_MODE_32BIT:
        case OSPI_MODE:
                {
-                       u32 base = 0;
+                       u32 base = multiboot * SZ_32K;
                        u32 size = 0x1500000;
                        u32 limit = size;