All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: peng.fan@oss.nxp.com
Cc: ohad@wizery.com, bjorn.andersson@linaro.org,
	o.rempel@pengutronix.de, robh+dt@kernel.org,
	devicetree@vger.kernel.org, shawnguo@kernel.org,
	s.hauer@pengutronix.de, kernel@pengutronix.de,
	festevam@gmail.com, linux-remoteproc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Peng Fan <peng.fan@nxp.com>
Subject: Re: [PATCH V3 5/8] remoteproc: imx_rproc: parse fsl,auto-boot
Date: Tue, 13 Apr 2021 11:31:13 -0600	[thread overview]
Message-ID: <20210413173113.GC750651@xps15> (raw)
In-Reply-To: <1617846898-13662-6-git-send-email-peng.fan@oss.nxp.com>

On Thu, Apr 08, 2021 at 09:54:55AM +0800, peng.fan@oss.nxp.com wrote:
> From: Peng Fan <peng.fan@nxp.com>
> 
> Parse fsl,auto-boot to indicate whether need remoteproc framework
> auto boot or not.
> 
> When remote processor is booted before Linux Kernel up, do not parse
> fsl,auto-boot. So add an entry to store the working mode of remote
> processor. Currently only IMX_RPROC_NORMAL, IMX_RPROC_EARLY_BOOT.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  drivers/remoteproc/imx_rproc.c | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> index ca17f520d904..c576e12d3817 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -83,6 +83,16 @@ struct imx_rproc_dcfg {
>  	size_t				att_size;
>  };
>  
> +enum imx_rproc_mode {
> +	/* Linux load/kick remote core */
> +	IMX_RPROC_NORMAL,
> +	/*
> +	 * remote core booted before kicking Linux, and remote core
> +	 * could be stopped & restarted by Linux
> +	 */
> +	IMX_RPROC_EARLY_BOOT,
> +};
> +

As far as I can see a new mode to track the state of the remote processor is not
needed.  rproc->state can do that for you.

>  struct imx_rproc {
>  	struct device			*dev;
>  	struct regmap			*regmap;
> @@ -96,6 +106,7 @@ struct imx_rproc {
>  	struct work_struct		rproc_work;
>  	struct workqueue_struct		*workqueue;
>  	void __iomem			*rsc_table;
> +	enum imx_rproc_mode		mode;
>  };
>  
>  static const struct imx_rproc_att imx_rproc_att_imx8mq[] = {
> @@ -565,14 +576,18 @@ static int imx_rproc_detect_mode(struct imx_rproc *priv)
>  	int ret;
>  	u32 val;
>  
> +	priv->mode = IMX_RPROC_NORMAL;
> +
>  	ret = regmap_read(priv->regmap, dcfg->src_reg, &val);
>  	if (ret) {
>  		dev_err(dev, "Failed to read src\n");
>  		return ret;
>  	}
>  
> -	if (!(val & dcfg->src_stop))
> +	if (!(val & dcfg->src_stop)) {
> +		priv->mode = IMX_RPROC_EARLY_BOOT;
>  		priv->rproc->state = RPROC_DETACHED;
> +	}
>  
>  	return 0;
>  }
> @@ -654,6 +669,9 @@ static int imx_rproc_probe(struct platform_device *pdev)
>  
>  	INIT_WORK(&priv->rproc_work, imx_rproc_vq_work);
>  
> +	if (priv->mode == IMX_RPROC_NORMAL)
> +		rproc->auto_boot = of_property_read_bool(np, "fsl,auto-boot");
> +

        if (rproc->state == RPROC_DETACHED)

>  	ret = rproc_add(rproc);
>  	if (ret) {
>  		dev_err(dev, "rproc_add failed\n");
> -- 
> 2.30.0
> 

WARNING: multiple messages have this Message-ID (diff)
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: peng.fan@oss.nxp.com
Cc: ohad@wizery.com, bjorn.andersson@linaro.org,
	o.rempel@pengutronix.de, robh+dt@kernel.org,
	devicetree@vger.kernel.org, shawnguo@kernel.org,
	s.hauer@pengutronix.de, kernel@pengutronix.de,
	festevam@gmail.com, linux-remoteproc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Peng Fan <peng.fan@nxp.com>
Subject: Re: [PATCH V3 5/8] remoteproc: imx_rproc: parse fsl,auto-boot
Date: Tue, 13 Apr 2021 11:31:13 -0600	[thread overview]
Message-ID: <20210413173113.GC750651@xps15> (raw)
In-Reply-To: <1617846898-13662-6-git-send-email-peng.fan@oss.nxp.com>

On Thu, Apr 08, 2021 at 09:54:55AM +0800, peng.fan@oss.nxp.com wrote:
> From: Peng Fan <peng.fan@nxp.com>
> 
> Parse fsl,auto-boot to indicate whether need remoteproc framework
> auto boot or not.
> 
> When remote processor is booted before Linux Kernel up, do not parse
> fsl,auto-boot. So add an entry to store the working mode of remote
> processor. Currently only IMX_RPROC_NORMAL, IMX_RPROC_EARLY_BOOT.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  drivers/remoteproc/imx_rproc.c | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> index ca17f520d904..c576e12d3817 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -83,6 +83,16 @@ struct imx_rproc_dcfg {
>  	size_t				att_size;
>  };
>  
> +enum imx_rproc_mode {
> +	/* Linux load/kick remote core */
> +	IMX_RPROC_NORMAL,
> +	/*
> +	 * remote core booted before kicking Linux, and remote core
> +	 * could be stopped & restarted by Linux
> +	 */
> +	IMX_RPROC_EARLY_BOOT,
> +};
> +

As far as I can see a new mode to track the state of the remote processor is not
needed.  rproc->state can do that for you.

>  struct imx_rproc {
>  	struct device			*dev;
>  	struct regmap			*regmap;
> @@ -96,6 +106,7 @@ struct imx_rproc {
>  	struct work_struct		rproc_work;
>  	struct workqueue_struct		*workqueue;
>  	void __iomem			*rsc_table;
> +	enum imx_rproc_mode		mode;
>  };
>  
>  static const struct imx_rproc_att imx_rproc_att_imx8mq[] = {
> @@ -565,14 +576,18 @@ static int imx_rproc_detect_mode(struct imx_rproc *priv)
>  	int ret;
>  	u32 val;
>  
> +	priv->mode = IMX_RPROC_NORMAL;
> +
>  	ret = regmap_read(priv->regmap, dcfg->src_reg, &val);
>  	if (ret) {
>  		dev_err(dev, "Failed to read src\n");
>  		return ret;
>  	}
>  
> -	if (!(val & dcfg->src_stop))
> +	if (!(val & dcfg->src_stop)) {
> +		priv->mode = IMX_RPROC_EARLY_BOOT;
>  		priv->rproc->state = RPROC_DETACHED;
> +	}
>  
>  	return 0;
>  }
> @@ -654,6 +669,9 @@ static int imx_rproc_probe(struct platform_device *pdev)
>  
>  	INIT_WORK(&priv->rproc_work, imx_rproc_vq_work);
>  
> +	if (priv->mode == IMX_RPROC_NORMAL)
> +		rproc->auto_boot = of_property_read_bool(np, "fsl,auto-boot");
> +

        if (rproc->state == RPROC_DETACHED)

>  	ret = rproc_add(rproc);
>  	if (ret) {
>  		dev_err(dev, "rproc_add failed\n");
> -- 
> 2.30.0
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-04-13 17:32 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-08  1:54 [PATCH V3 0/8] remoteproc: imx_rproc: support i.MX7ULP/8MN/8MP peng.fan
2021-04-08  1:54 ` peng.fan
2021-04-08  1:54 ` [PATCH V3 1/8] dt-bindings: remoteproc: imx_rproc: add fsl,auto-boot property peng.fan
2021-04-08  1:54   ` [PATCH V3 1/8] dt-bindings: remoteproc: imx_rproc: add fsl, auto-boot property peng.fan
2021-04-08  1:54 ` [PATCH V3 2/8] dt-bindings: remoteproc: imx_rproc: add i.MX7ULP support peng.fan
2021-04-08  1:54   ` peng.fan
2021-04-13 16:55   ` Mathieu Poirier
2021-04-13 16:55     ` Mathieu Poirier
2021-04-08  1:54 ` [PATCH V3 3/8] dt-bindings: remoteproc: imx_rproc: support i.MX8MN/P peng.fan
2021-04-08  1:54   ` peng.fan
2021-04-08  1:54 ` [PATCH V3 4/8] remoteproc: imx_rproc: make clk optional peng.fan
2021-04-08  1:54   ` peng.fan
2021-04-13 17:28   ` Mathieu Poirier
2021-04-13 17:28     ` Mathieu Poirier
2021-04-08  1:54 ` [PATCH V3 5/8] remoteproc: imx_rproc: parse fsl,auto-boot peng.fan
2021-04-08  1:54   ` peng.fan
2021-04-13 17:31   ` Mathieu Poirier [this message]
2021-04-13 17:31     ` Mathieu Poirier
2021-04-08  1:54 ` [PATCH V3 6/8] remoteproc: imx_rproc: initial support for mutilple start/stop method peng.fan
2021-04-08  1:54   ` peng.fan
2021-04-13 17:45   ` Mathieu Poirier
2021-04-13 17:45     ` Mathieu Poirier
2021-04-08  1:54 ` [PATCH V3 7/8] remoteproc: imx_rproc: support i.MX7ULP peng.fan
2021-04-08  1:54   ` peng.fan
2021-04-13 17:49   ` Mathieu Poirier
2021-04-13 17:49     ` Mathieu Poirier
2021-04-08  1:54 ` [PATCH V3 8/8] remoteproc: imx_rproc: support i.MX8MN/P peng.fan
2021-04-08  1:54   ` peng.fan
2021-04-13 17:52   ` Mathieu Poirier
2021-04-13 17:52     ` Mathieu Poirier
2021-04-15 13:47     ` Peng Fan (OSS)
2021-04-15 13:47       ` Peng Fan (OSS)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210413173113.GC750651@xps15 \
    --to=mathieu.poirier@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=ohad@wizery.com \
    --cc=peng.fan@nxp.com \
    --cc=peng.fan@oss.nxp.com \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.