]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
stm32mp: stm32prog: use defines for virtual partition size
authorPatrick Delaunay <patrick.delaunay@foss.st.com>
Mon, 5 Jul 2021 07:39:01 +0000 (09:39 +0200)
committerPatrick Delaunay <patrick.delaunay@foss.st.com>
Fri, 16 Jul 2021 07:28:46 +0000 (09:28 +0200)
Use the existing defines PMIC_SIZE and OTP_SIZE and a new define
CMD_SIZE for virtual partition size.

This patch corrects the size for OTP partition in alternate name
(1024 instead of 512) and avoids other alignment issues.

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/stm32prog.c
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c

index f7c93a1298d541c29c6883a37283ad486bd5fddf..96ebc6d97837ef0977469513f8af3b08c3f8d791 100644 (file)
@@ -1199,13 +1199,13 @@ static int dfu_init_entities(struct stm32prog_data *data)
        }
 
        if (!ret)
-               ret = stm32prog_alt_add_virt(dfu, "virtual", PHASE_CMD, 512);
+               ret = stm32prog_alt_add_virt(dfu, "virtual", PHASE_CMD, CMD_SIZE);
 
        if (!ret)
-               ret = stm32prog_alt_add_virt(dfu, "OTP", PHASE_OTP, 512);
+               ret = stm32prog_alt_add_virt(dfu, "OTP", PHASE_OTP, OTP_SIZE);
 
        if (!ret && CONFIG_IS_ENABLED(DM_PMIC))
-               ret = stm32prog_alt_add_virt(dfu, "PMIC", PHASE_PMIC, 8);
+               ret = stm32prog_alt_add_virt(dfu, "PMIC", PHASE_PMIC, PMIC_SIZE);
 
        if (ret)
                stm32prog_err("dfu init failed: %d", ret);
index efb51a3022b4d5e5c7353087298f415e82389bf9..9d58cf0e2dac4ee8485472213cff1a781582c604 100644 (file)
@@ -19,6 +19,7 @@
 
 #define DEFAULT_ADDRESS                0xFFFFFFFF
 
+#define CMD_SIZE               512
 #define OTP_SIZE               1024
 #define PMIC_SIZE              8
 
index d4a3f7ea16f18e65849392a7920b63ce3e5075b1..e8acc302f9eaadd6ab7065086bf9e795d2735261 100644 (file)
@@ -178,7 +178,7 @@ int stm32prog_get_medium_size_virt(struct dfu_entity *dfu, u64 *size)
 
        switch (dfu->data.virt.dev_num) {
        case PHASE_CMD:
-               *size = 512;
+               *size = CMD_SIZE;
                break;
        case PHASE_OTP:
                *size = OTP_SIZE;