aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2020-12-11 13:36:18 +0100
committerPatrick Delaunay <patrick.delaunay@foss.st.com>2021-01-13 09:52:58 +0100
commit751f918bdb5af2d376146eb4b4c8f7bde65c58c8 (patch)
tree6da61de1e8facf73252c05a066a5a1713c24403a /arch
parente451fa2a05518860f640e61502568b5021fe9d0b (diff)
downloadu-boot-751f918bdb5af2d376146eb4b4c8f7bde65c58c8.zip
u-boot-751f918bdb5af2d376146eb4b4c8f7bde65c58c8.tar.gz
u-boot-751f918bdb5af2d376146eb4b4c8f7bde65c58c8.tar.bz2
arm: stm32mp: stm32prog: always flush DFU on start command for uart
Remove the test on data->dfu_seq, because dfu_seq=0 not only when the DFU is not started (mask with 0xffff). This flush is mandatory as the final treatment, common with USB, is done in DFU callback. This patch avoids issue if the received length is a multiple of the DFU packet. For example if size of bootfs partition is egual to 0x4000000, data->dfu_seq=0 at the end of the partition, the flush it not requested and the phase is not increased in the callback. U-Boot continue to request the bootfs in the next GetPhase command. Fixes: 468f0508b58b ("stm32mp: stm32prog: add serial link support") Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c
index e534b3f..68d841b 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c
@@ -397,14 +397,13 @@ static u8 stm32prog_start(struct stm32prog_data *data, u32 address)
if (!dfu_entity)
return -ENODEV;
- if (data->dfu_seq) {
- ret = dfu_flush(dfu_entity, NULL, 0, data->dfu_seq);
- data->dfu_seq = 0;
- if (ret) {
- stm32prog_err("DFU flush failed [%d]", ret);
- return ret;
- }
+ ret = dfu_flush(dfu_entity, NULL, 0, data->dfu_seq);
+ if (ret) {
+ stm32prog_err("DFU flush failed [%d]", ret);
+ return ret;
}
+ data->dfu_seq = 0;
+
printf("\n received length = 0x%x\n", data->cursor);
if (data->header.present) {
if (data->cursor !=