diff mbox series

[v4,7/9] remoteproc: Refactor function rproc_trigger_auto_boot()

Message ID 20200601175139.22097-8-mathieu.poirier@linaro.org (mailing list archive)
State Superseded
Headers show
Series remoteproc: Add support for attaching with rproc | expand

Commit Message

Mathieu Poirier June 1, 2020, 5:51 p.m. UTC
Refactor function rproc_trigger_auto_boot() to properly deal
with scenarios where the remoteproc core needs to attach with a
remote processor that has already been booted by an external
entity.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 drivers/remoteproc/remoteproc_core.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Bjorn Andersson June 22, 2020, 7:25 a.m. UTC | #1
On Mon 01 Jun 10:51 PDT 2020, Mathieu Poirier wrote:

> Refactor function rproc_trigger_auto_boot() to properly deal
> with scenarios where the remoteproc core needs to attach with a
> remote processor that has already been booted by an external
> entity.
> 
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

> ---
>  drivers/remoteproc/remoteproc_core.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
> index 48ddc29814be..d32ac8f0c872 100644
> --- a/drivers/remoteproc/remoteproc_core.c
> +++ b/drivers/remoteproc/remoteproc_core.c
> @@ -1586,6 +1586,15 @@ static int rproc_trigger_auto_boot(struct rproc *rproc)
>  {
>  	int ret;
>  
> +	/*
> +	 * Since the remote processor is in a detached state, it has already
> +	 * been booted by another entity.  As such there is no point in waiting
> +	 * for a firmware image to be loaded, we can simply initiate the process
> +	 * of attaching to it immediately.
> +	 */
> +	if (rproc->state == RPROC_DETACHED)
> +		return rproc_boot(rproc);
> +
>  	/*
>  	 * We're initiating an asynchronous firmware loading, so we can
>  	 * be built-in kernel code, without hanging the boot process.
> -- 
> 2.20.1
>
diff mbox series

Patch

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 48ddc29814be..d32ac8f0c872 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -1586,6 +1586,15 @@  static int rproc_trigger_auto_boot(struct rproc *rproc)
 {
 	int ret;
 
+	/*
+	 * Since the remote processor is in a detached state, it has already
+	 * been booted by another entity.  As such there is no point in waiting
+	 * for a firmware image to be loaded, we can simply initiate the process
+	 * of attaching to it immediately.
+	 */
+	if (rproc->state == RPROC_DETACHED)
+		return rproc_boot(rproc);
+
 	/*
 	 * We're initiating an asynchronous firmware loading, so we can
 	 * be built-in kernel code, without hanging the boot process.