diff mbox series

[3/3] remoteproc: stm32: update error management in stm32_copro_start

Message ID 20201015150101.3.If11081706d310a6eb7ed2ba30291bdd20e74927b@changeid
State Accepted
Commit 9ed6f929a34b87c4bf06f01d84d8c58b0586b53a
Delegated to: Patrick Delaunay
Headers show
Series [1/3] reset: stm32: Add support of MCU HOLD BOOT | expand

Commit Message

Patrick DELAUNAY Oct. 15, 2020, 1:01 p.m. UTC
The coprocessor is running as soon as the hold boot is de-asserted.

So indicate this running state and save the resource table even
if the protective assert, to avoid autonomous reboot, is failed.

This error case should never occurs.


Cc: Fabien DESSENNE <fabien.dessenne@st.com>
Cc: Arnaud POULIQUEN <arnaud.pouliquen@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 drivers/remoteproc/stm32_copro.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Comments

Patrice CHOTARD Oct. 21, 2020, 11:43 a.m. UTC | #1
Hi Patrick

On 10/15/20 3:01 PM, Patrick Delaunay wrote:
> The coprocessor is running as soon as the hold boot is de-asserted.
>
> So indicate this running state and save the resource table even
> if the protective assert, to avoid autonomous reboot, is failed.
>
> This error case should never occurs.
>
>
> Cc: Fabien DESSENNE <fabien.dessenne@st.com>
> Cc: Arnaud POULIQUEN <arnaud.pouliquen@st.com>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
>
>  drivers/remoteproc/stm32_copro.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/remoteproc/stm32_copro.c b/drivers/remoteproc/stm32_copro.c
> index da678cb329..dc87cb794e 100644
> --- a/drivers/remoteproc/stm32_copro.c
> +++ b/drivers/remoteproc/stm32_copro.c
> @@ -139,19 +139,18 @@ static int stm32_copro_start(struct udevice *dev)
>  
>  	/*
>  	 * Once copro running, reset hold boot flag to avoid copro
> -	 * rebooting autonomously
> +	 * rebooting autonomously (error should never occur)
>  	 */
>  	ret = reset_assert(&priv->hold_boot);
>  	if (ret)
>  		dev_err(dev, "Unable to assert hold boot (ret=%d)\n", ret);
>  
> -	writel(ret ? TAMP_COPRO_STATE_OFF : TAMP_COPRO_STATE_CRUN,
> -	       TAMP_COPRO_STATE);
> -	if (!ret)
> -		/* Store rsc_address in bkp register */
> -		writel(priv->rsc_table_addr, TAMP_COPRO_RSC_TBL_ADDRESS);
> +	/* indicates that copro is running */
> +	writel(TAMP_COPRO_STATE_CRUN, TAMP_COPRO_STATE);
> +	/* Store rsc_address in bkp register */
> +	writel(priv->rsc_table_addr, TAMP_COPRO_RSC_TBL_ADDRESS);
>  
> -	return ret;
> +	return 0;
>  }
>  
>  /**

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

Thanks
Patrick DELAUNAY Nov. 25, 2020, 10:32 a.m. UTC | #2
Hi,

> From: Patrick DELAUNAY <patrick.delaunay@st.com>
> Sent: jeudi 15 octobre 2020 15:01
> 
> The coprocessor is running as soon as the hold boot is de-asserted.
> 
> So indicate this running state and save the resource table even if the protective
> assert, to avoid autonomous reboot, is failed.
> 
> This error case should never occurs.
> 
> 
> Cc: Fabien DESSENNE <fabien.dessenne@st.com>
> Cc: Arnaud POULIQUEN <arnaud.pouliquen@st.com>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
> 
>  drivers/remoteproc/stm32_copro.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 

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

Regards

Patrick
diff mbox series

Patch

diff --git a/drivers/remoteproc/stm32_copro.c b/drivers/remoteproc/stm32_copro.c
index da678cb329..dc87cb794e 100644
--- a/drivers/remoteproc/stm32_copro.c
+++ b/drivers/remoteproc/stm32_copro.c
@@ -139,19 +139,18 @@  static int stm32_copro_start(struct udevice *dev)
 
 	/*
 	 * Once copro running, reset hold boot flag to avoid copro
-	 * rebooting autonomously
+	 * rebooting autonomously (error should never occur)
 	 */
 	ret = reset_assert(&priv->hold_boot);
 	if (ret)
 		dev_err(dev, "Unable to assert hold boot (ret=%d)\n", ret);
 
-	writel(ret ? TAMP_COPRO_STATE_OFF : TAMP_COPRO_STATE_CRUN,
-	       TAMP_COPRO_STATE);
-	if (!ret)
-		/* Store rsc_address in bkp register */
-		writel(priv->rsc_table_addr, TAMP_COPRO_RSC_TBL_ADDRESS);
+	/* indicates that copro is running */
+	writel(TAMP_COPRO_STATE_CRUN, TAMP_COPRO_STATE);
+	/* Store rsc_address in bkp register */
+	writel(priv->rsc_table_addr, TAMP_COPRO_RSC_TBL_ADDRESS);
 
-	return ret;
+	return 0;
 }
 
 /**