On Thu, Nov 21, 2019 at 09:40:05AM +0100, Ahmad Fatoum wrote:
> Both the STM32 and i.MX7 remote proc drivers populate the .stop member
> in the struct rproc, but it's not used anywhere.

The .stop member in struct rproc is introduced in this patch.

> The firmware API is not
> really fitting to 'unload' firmware. Add instead a device parameter to
> stop a remote processor, e.g. remoteproc0.stop=1. This is similar to the
> probe command used with MMCs.
> 
> Signed-off-by: Ahmad Fatoum <ah...@a3f.at>
> ---
>  drivers/remoteproc/remoteproc_core.c | 30 +++++++++++++++++++++++-----
>  include/linux/remoteproc.h           |  2 ++
>  2 files changed, 27 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/remoteproc/remoteproc_core.c 
> b/drivers/remoteproc/remoteproc_core.c
> index 8a28c1bafc1b..e031640bc7a0 100644
> --- a/drivers/remoteproc/remoteproc_core.c
> +++ b/drivers/remoteproc/remoteproc_core.c
> @@ -101,6 +101,8 @@ static int rproc_firmware_finish(struct firmware_handler 
> *fh)
>       fw.size = rproc->fw_buf_ofs;
>  
>       ret = rproc_start(rproc, &fw);
> +     if (ret == 0)
> +             rproc->stop = PARAM_TRISTATE_FALSE;

Can we use positive logic here? "Status Stopped is false" is harder to
read than just "running" or "started".

  
>       kfree(rproc->fw_buf);
>  
> @@ -120,6 +122,19 @@ static int rproc_register_dev(struct rproc *rproc, const 
> char *alias)
>       return register_device(&rproc->dev);
>  }
>  
> +static int rproc_set_stop(struct param_d *param, void *priv)
> +{
> +     struct rproc *rproc = priv;
> +     int (*stop)(struct rproc *);
> +
> +     stop = rproc->ops->stop;
> +
> +     if (!stop)
> +             return -ENOSYS;
> +
> +     return stop(rproc);
> +}

I would assume that when I can stop the remote processor with this
parameter I should be able to start it here as well, no?

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to