]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
stm32mp: stm32prog: change default flashlayout location to CONFIG_SYS_LOAD_ADDR
authorPatrick Delaunay <patrick.delaunay@foss.st.com>
Tue, 6 Sep 2022 16:53:18 +0000 (18:53 +0200)
committerPatrice Chotard <patrice.chotard@foss.st.com>
Fri, 23 Sep 2022 11:58:20 +0000 (13:58 +0200)
Change the defaut flashlayout location, hardcoded at STM32_DDR_BASE,
to CONFIG_SYS_LOAD_ADDR to avoid issue on board with reserved memory
at STM32_DDR_BASE.

This patch changes the command behavior for STM32MP13 and STM32MP15
platform, as CONFIG_SYS_LOAD_ADDR(0xc2000000) != STM32_DDR_BASE
but without impact for serial boot with STM32CubeProgrammer.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c

index f59414e716f6131cc051be1da3d4488731256a14..cb9e20da136b656fe06e10ccd606a80064cb5a51 100644 (file)
@@ -61,7 +61,7 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc,
 
        dev = (int)dectoul(argv[2], NULL);
 
-       addr = STM32_DDR_BASE;
+       addr = CONFIG_SYS_LOAD_ADDR;
        size = 0;
        if (argc > 3) {
                addr = hextoul(argv[3], NULL);
index 7067605d49b6a1e8930d889faa3a38e3ecccee94..082f7887c4608cf84bf3eaafddd0b9efd529b409 100644 (file)
@@ -1388,7 +1388,7 @@ static int dfu_init_entities(struct stm32prog_data *data)
                char buf[ALT_BUF_LEN];
 
                sprintf(buf, "@FlashLayout/0x%02x/1*256Ke ram %x 40000",
-                       PHASE_FLASHLAYOUT, STM32_DDR_BASE);
+                       PHASE_FLASHLAYOUT, CONFIG_SYS_LOAD_ADDR);
                ret = dfu_alt_add(dfu, "ram", NULL, buf);
                log_debug("dfu_alt_add(ram, NULL,%s) result %d\n", buf, ret);
        }
@@ -1699,15 +1699,15 @@ static void stm32prog_end_phase(struct stm32prog_data *data, u64 offset)
 {
        if (data->phase == PHASE_FLASHLAYOUT) {
 #if defined(CONFIG_LEGACY_IMAGE_FORMAT)
-               if (genimg_get_format((void *)STM32_DDR_BASE) == IMAGE_FORMAT_LEGACY) {
-                       data->script = STM32_DDR_BASE;
+               if (genimg_get_format((void *)CONFIG_SYS_LOAD_ADDR) == IMAGE_FORMAT_LEGACY) {
+                       data->script = CONFIG_SYS_LOAD_ADDR;
                        data->phase = PHASE_END;
                        log_notice("U-Boot script received\n");
                        return;
                }
 #endif
                log_notice("\nFlashLayout received, size = %lld\n", offset);
-               if (parse_flash_layout(data, STM32_DDR_BASE, offset))
+               if (parse_flash_layout(data, CONFIG_SYS_LOAD_ADDR, offset))
                        stm32prog_err("Layout: invalid FlashLayout");
                return;
        }
index 1a69bc38979db9eafb1fc15dadfde2a951244360..e71956831b6cab46d31fcfdbc81eef304de265fe 100644 (file)
@@ -462,7 +462,7 @@ static void get_phase_command(struct stm32prog_data *data)
                length = strlen(err_msg);
        }
        if (phase == PHASE_FLASHLAYOUT)
-               destination = STM32_DDR_BASE;
+               destination = CONFIG_SYS_LOAD_ADDR;
 
        stm32prog_serial_putc(length + 5);           /* Total length */
        stm32prog_serial_putc(phase & 0xFF);         /* partition ID */
index a8b57c4d8f05c92521aeffc012a61bb1436a6e15..bcb4d373f692ebb6e3e2d4853ba8e8d90e025875 100644 (file)
@@ -90,7 +90,7 @@ static int stm32prog_cmd_read(u64 offset, void *buf, long *len)
        }
        phase = stm32prog_data->phase;
        if (phase == PHASE_FLASHLAYOUT)
-               destination = STM32_DDR_BASE;
+               destination = CONFIG_SYS_LOAD_ADDR;
        dfu_offset = stm32prog_data->offset;
 
        /* mandatory header, size = PHASE_MIN_SIZE */