All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm: stm32mp: stm32prog: always flush DFU on start command for uart
@ 2020-12-11 12:36 Patrick Delaunay
  2021-01-06 14:24 ` Patrice CHOTARD
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Patrick Delaunay @ 2020-12-11 12:36 UTC (permalink / raw)
  To: u-boot

From: Patrick Delaunay <patrick.delaunay@st.com>

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>
---

 .../mach-stm32mp/cmd_stm32prog/stm32prog_serial.c   | 13 ++++++-------
 1 file 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 8aad4be467..8fba92b2b5 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 !=
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] arm: stm32mp: stm32prog: always flush DFU on start command for uart
  2020-12-11 12:36 [PATCH] arm: stm32mp: stm32prog: always flush DFU on start command for uart Patrick Delaunay
@ 2021-01-06 14:24 ` Patrice CHOTARD
  2021-01-06 14:37 ` Patrice CHOTARD
  2021-01-13 10:14 ` Patrick DELAUNAY
  2 siblings, 0 replies; 4+ messages in thread
From: Patrice CHOTARD @ 2021-01-06 14:24 UTC (permalink / raw)
  To: u-boot

Hi Patrick??

On 12/11/20 1:36 PM, Patrick Delaunay wrote:
> From: Patrick Delaunay <patrick.delaunay@st.com>
>
> 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>
> ---
>
>  .../mach-stm32mp/cmd_stm32prog/stm32prog_serial.c   | 13 ++++++-------
>  1 file 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 8aad4be467..8fba92b2b5 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 !=

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks

Patrice

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] arm: stm32mp: stm32prog: always flush DFU on start command for uart
  2020-12-11 12:36 [PATCH] arm: stm32mp: stm32prog: always flush DFU on start command for uart Patrick Delaunay
  2021-01-06 14:24 ` Patrice CHOTARD
@ 2021-01-06 14:37 ` Patrice CHOTARD
  2021-01-13 10:14 ` Patrick DELAUNAY
  2 siblings, 0 replies; 4+ messages in thread
From: Patrice CHOTARD @ 2021-01-06 14:37 UTC (permalink / raw)
  To: u-boot

Hi Patrick

On 12/11/20 1:36 PM, Patrick Delaunay wrote:
> From: Patrick Delaunay <patrick.delaunay@st.com>
>
> 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>
> ---
>
>  .../mach-stm32mp/cmd_stm32prog/stm32prog_serial.c   | 13 ++++++-------
>  1 file 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 8aad4be467..8fba92b2b5 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 !=

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks

Patrice

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] arm: stm32mp: stm32prog: always flush DFU on start command for uart
  2020-12-11 12:36 [PATCH] arm: stm32mp: stm32prog: always flush DFU on start command for uart Patrick Delaunay
  2021-01-06 14:24 ` Patrice CHOTARD
  2021-01-06 14:37 ` Patrice CHOTARD
@ 2021-01-13 10:14 ` Patrick DELAUNAY
  2 siblings, 0 replies; 4+ messages in thread
From: Patrick DELAUNAY @ 2021-01-13 10:14 UTC (permalink / raw)
  To: u-boot

Hi,

On 12/11/20 1:36 PM, Patrick Delaunay wrote:
> From: Patrick Delaunay <patrick.delaunay@st.com>
>
> 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>
> ---
>
>   .../mach-stm32mp/cmd_stm32prog/stm32prog_serial.c   | 13 ++++++-------
>   1 file changed, 6 insertions(+), 7 deletions(-)
>

Applied to u-boot-stm/master, thanks!

Regards

Patrick

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-01-13 10:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-11 12:36 [PATCH] arm: stm32mp: stm32prog: always flush DFU on start command for uart Patrick Delaunay
2021-01-06 14:24 ` Patrice CHOTARD
2021-01-06 14:37 ` Patrice CHOTARD
2021-01-13 10:14 ` Patrick DELAUNAY

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.