stm32mp: stm32prog: handle dfu error
authorPatrick Delaunay <patrick.delaunay@foss.st.com>
Tue, 18 May 2021 13:12:13 +0000 (15:12 +0200)
committerPatrice Chotard <patrice.chotard@foss.st.com>
Fri, 18 Jun 2021 08:09:41 +0000 (10:09 +0200)
Handle DFU stack error in STM32CubeProgrammer protocol.

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

index ab687c2..f7c93a1 100644 (file)
@@ -1783,3 +1783,17 @@ void dfu_initiated_callback(struct dfu_entity *dfu)
                log_debug("dfu offset = 0x%llx\n", dfu->offset);
        }
 }
+
+void dfu_error_callback(struct dfu_entity *dfu, const char *msg)
+{
+       struct stm32prog_data *data = stm32prog_data;
+
+       if (!stm32prog_data)
+               return;
+
+       if (!stm32prog_data->cur_part)
+               return;
+
+       if (dfu->alt == stm32prog_data->cur_part->alt_id)
+               stm32prog_err(msg);
+}