
28 May
2021
28 May
'21
11:32 a.m.
Hi,
On 3/10/21 12:15 PM, Sughosh Ganu wrote:
On Wed, 10 Mar 2021 at 14:57, Patrick Delaunay <patrick.delaunay@foss.st.com mailto:patrick.delaunay@foss.st.com> wrote:
Fix the result of DFU_OP_WRITE operation in mtd_block_op function when mtd_lock is not supported (-EOPNOTSUPP) to avoid DFU stack error on the DFU manifestation of the MTD device, when dfu_flush_medium_mtd is called. Without this patch, dfu-util failed on dfuERROR state at the end of the write operation on the alternate even if MTD write opeartion is correctly performed. $> dfu-util -a 3 -D test.bin .... DFU mode device DFU version 0110 Device returned transfer size 4096 Copying data from PC to DFU device .... Download [=========================] 100% 225469 bytes Download done. state(10) = dfuERROR, status(14) = Something went wrong, but the device does not know what it was Done! Fixes: 65f3fc18fc1e ("dfu_mtd: Add provision to unlock mtd device") Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com <mailto:patrick.delaunay@foss.st.com>> ---
Acked-by: Sughosh Ganu <sughosh.ganu@linaro.org mailto:sughosh.ganu@linaro.org>
drivers/dfu/dfu_mtd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/dfu/dfu_mtd.c b/drivers/dfu/dfu_mtd.c index ca67585a7e..ec40b8f6bb 100644 --- a/drivers/dfu/dfu_mtd.c +++ b/drivers/dfu/dfu_mtd.c @@ -150,7 +150,9 @@ static int mtd_block_op(enum dfu_op op, struct dfu_entity *dfu, /* Write done, lock again */ debug("Locking the mtd device\n"); ret = mtd_lock(mtd, lock_ofs, lock_len); - if (ret && ret != -EOPNOTSUPP) + if (ret == -EOPNOTSUPP) + ret = 0; + else if (ret) printf("MTD device lock failed\n"); } return ret; -- 2.17.1
Applied to u-boot-stm/master, thanks!
See request in
Re: [PATCH v4 12/14] dfu_mtd: Ignore non-implemented lock device failure
http://patchwork.ozlabs.org/project/uboot/patch/162140319389.47256.629728945...
http://u-boot.10912.n7.nabble.com/PATCH-v4-00-14-arm64-synquacer-Add-SynQuac...
Patrick