diff mbox series

[05/10] stm32mp: stm32prog: handle the next phase after USB re-enumeration

Message ID 20210518151206.5.Ic81eb7eb5bd44c0d9022eb4b7aed823a934eecda@changeid
State Accepted
Commit be4182bf23a73b29eb07496057f346e07534259c
Delegated to: Patrice Chotard
Headers show
Series stm32mp: stm32prog: several features and fixes | expand

Commit Message

Patrick DELAUNAY May 18, 2021, 1:12 p.m. UTC
Handle the second USB enumeration only when the flashlayout is received
and when phase is PHASE_FLASHLAYOUT. This patch removes the call of
stm32prog_next_phase as it is already done in stm32prog_dfu_init().

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Patrice CHOTARD May 28, 2021, 12:53 p.m. UTC | #1
Hi Patrick

On 5/18/21 3:12 PM, Patrick Delaunay wrote:
> Handle the second USB enumeration only when the flashlayout is received
> and when phase is PHASE_FLASHLAYOUT. This patch removes the call of
> stm32prog_next_phase as it is already done in stm32prog_dfu_init().
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
> 
>  arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c
> index bc44d9fc8f..d4a3f7ea16 100644
> --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c
> +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c
> @@ -207,13 +207,10 @@ bool stm32prog_usb_loop(struct stm32prog_data *data, int dev)
>  
>  	if (stm32prog_data->phase == PHASE_FLASHLAYOUT) {
>  		ret = run_usb_dnl_gadget(dev, "usb_dnl_dfu");
> -		if (ret || stm32prog_data->phase == PHASE_DO_RESET)
> +		if (ret || stm32prog_data->phase != PHASE_FLASHLAYOUT)
>  			return ret;
>  		/* prepare the second enumeration with the FlashLayout */
> -		if (stm32prog_data->phase == PHASE_FLASHLAYOUT)
> -			stm32prog_dfu_init(data);
> -		/* found next selected partition */
> -		stm32prog_next_phase(data);
> +		stm32prog_dfu_init(data);
>  	}
>  
>  	ret = run_usb_dnl_gadget(dev, "usb_dnl_dfu");
> 
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice
Patrice CHOTARD June 18, 2021, 7:57 a.m. UTC | #2
On 5/28/21 2:53 PM, Patrice CHOTARD wrote:
> Hi Patrick
> 
> On 5/18/21 3:12 PM, Patrick Delaunay wrote:
>> Handle the second USB enumeration only when the flashlayout is received
>> and when phase is PHASE_FLASHLAYOUT. This patch removes the call of
>> stm32prog_next_phase as it is already done in stm32prog_dfu_init().
>>
>> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
>> ---
>>
>>  arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c | 7 ++-----
>>  1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c
>> index bc44d9fc8f..d4a3f7ea16 100644
>> --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c
>> +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c
>> @@ -207,13 +207,10 @@ bool stm32prog_usb_loop(struct stm32prog_data *data, int dev)
>>  
>>  	if (stm32prog_data->phase == PHASE_FLASHLAYOUT) {
>>  		ret = run_usb_dnl_gadget(dev, "usb_dnl_dfu");
>> -		if (ret || stm32prog_data->phase == PHASE_DO_RESET)
>> +		if (ret || stm32prog_data->phase != PHASE_FLASHLAYOUT)
>>  			return ret;
>>  		/* prepare the second enumeration with the FlashLayout */
>> -		if (stm32prog_data->phase == PHASE_FLASHLAYOUT)
>> -			stm32prog_dfu_init(data);
>> -		/* found next selected partition */
>> -		stm32prog_next_phase(data);
>> +		stm32prog_dfu_init(data);
>>  	}
>>  
>>  	ret = run_usb_dnl_gadget(dev, "usb_dnl_dfu");
>>
> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
> 
> Thanks
> Patrice
> _______________________________________________
> Uboot-stm32 mailing list
> Uboot-stm32@st-md-mailman.stormreply.com
> https://st-md-mailman.stormreply.com/mailman/listinfo/uboot-stm32
> 
Applied on u-boot-stm32/next

Thanks
diff mbox series

Patch

diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c
index bc44d9fc8f..d4a3f7ea16 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c
@@ -207,13 +207,10 @@  bool stm32prog_usb_loop(struct stm32prog_data *data, int dev)
 
 	if (stm32prog_data->phase == PHASE_FLASHLAYOUT) {
 		ret = run_usb_dnl_gadget(dev, "usb_dnl_dfu");
-		if (ret || stm32prog_data->phase == PHASE_DO_RESET)
+		if (ret || stm32prog_data->phase != PHASE_FLASHLAYOUT)
 			return ret;
 		/* prepare the second enumeration with the FlashLayout */
-		if (stm32prog_data->phase == PHASE_FLASHLAYOUT)
-			stm32prog_dfu_init(data);
-		/* found next selected partition */
-		stm32prog_next_phase(data);
+		stm32prog_dfu_init(data);
 	}
 
 	ret = run_usb_dnl_gadget(dev, "usb_dnl_dfu");