All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] remoteproc: imx: add start up delay
@ 2022-06-09 12:34 ` Peng Fan (OSS)
  0 siblings, 0 replies; 10+ messages in thread
From: Peng Fan (OSS) @ 2022-06-09 12:34 UTC (permalink / raw)
  To: bjorn.andersson, mathieu.poirier, shawnguo, s.hauer, kernel,
	festevam, linux-imx, linux-remoteproc, linux-arm-kernel,
	linux-kernel, robh+dt, krzysztof.kozlowski+dt
  Cc: devicetree, Peng Fan

From: Peng Fan <peng.fan@nxp.com>

There is case that after remoteproc start remote processor[M4], the M4
runs slow and before M4 finish its own rpmsg framework initialization,
linux sends out vring kick message, then M4 firmware drops the kick
message. Some NXP released Cortex-M[x] images has such limitation that
it requires linux sends out vring kick message after M4 firmware finish
its rpmsg framework initialization.

The best case is to use a method to let M4 notify Linux that M4 has
finished initialization, but we could not patch released firmware,
then update driver to detect notification. 

So add delay before linux send out vring kick message. It is not good to
use a fixed time delay in driver, so I choose to get that from device
tree.

Peng Fan (2):
  dt-bindings: remoteproc: imx_rproc: add fsl,startup-delay-ms
  remoteproc: imx_rproc: delay after kick remote processor

 .../devicetree/bindings/remoteproc/fsl,imx-rproc.yaml    | 4 ++++
 drivers/remoteproc/imx_rproc.c                           | 9 +++++++++
 2 files changed, 13 insertions(+)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 0/2] remoteproc: imx: add start up delay
@ 2022-06-09 12:34 ` Peng Fan (OSS)
  0 siblings, 0 replies; 10+ messages in thread
From: Peng Fan (OSS) @ 2022-06-09 12:34 UTC (permalink / raw)
  To: bjorn.andersson, mathieu.poirier, shawnguo, s.hauer, kernel,
	festevam, linux-imx, linux-remoteproc, linux-arm-kernel,
	linux-kernel, robh+dt, krzysztof.kozlowski+dt
  Cc: devicetree, Peng Fan

From: Peng Fan <peng.fan@nxp.com>

There is case that after remoteproc start remote processor[M4], the M4
runs slow and before M4 finish its own rpmsg framework initialization,
linux sends out vring kick message, then M4 firmware drops the kick
message. Some NXP released Cortex-M[x] images has such limitation that
it requires linux sends out vring kick message after M4 firmware finish
its rpmsg framework initialization.

The best case is to use a method to let M4 notify Linux that M4 has
finished initialization, but we could not patch released firmware,
then update driver to detect notification. 

So add delay before linux send out vring kick message. It is not good to
use a fixed time delay in driver, so I choose to get that from device
tree.

Peng Fan (2):
  dt-bindings: remoteproc: imx_rproc: add fsl,startup-delay-ms
  remoteproc: imx_rproc: delay after kick remote processor

 .../devicetree/bindings/remoteproc/fsl,imx-rproc.yaml    | 4 ++++
 drivers/remoteproc/imx_rproc.c                           | 9 +++++++++
 2 files changed, 13 insertions(+)

-- 
2.25.1


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] dt-bindings: remoteproc: imx_rproc: add fsl,startup-delay-ms
  2022-06-09 12:34 ` Peng Fan (OSS)
@ 2022-06-09 12:34   ` Peng Fan (OSS)
  -1 siblings, 0 replies; 10+ messages in thread
From: Peng Fan (OSS) @ 2022-06-09 12:34 UTC (permalink / raw)
  To: bjorn.andersson, mathieu.poirier, shawnguo, s.hauer, kernel,
	festevam, linux-imx, linux-remoteproc, linux-arm-kernel,
	linux-kernel, robh+dt, krzysztof.kozlowski+dt
  Cc: devicetree, Peng Fan

From: Peng Fan <peng.fan@nxp.com>

add fsl,startup-delay-ms property indicating delay some time after just
kicks remote processor.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 .../devicetree/bindings/remoteproc/fsl,imx-rproc.yaml         | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
index 64e783234e38..56f3ed18c28c 100644
--- a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
+++ b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
@@ -76,6 +76,10 @@ properties:
       This property is to specify the resource id of the remote processor in SoC
       which supports SCFW
 
+  fsl,startup-delay-ms:
+    $ref: "/schemas/types.yaml#/definitions/uint32"
+    description: Startup time that remote processor ready for communication
+
 required:
   - compatible
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 1/2] dt-bindings: remoteproc: imx_rproc: add fsl,startup-delay-ms
@ 2022-06-09 12:34   ` Peng Fan (OSS)
  0 siblings, 0 replies; 10+ messages in thread
From: Peng Fan (OSS) @ 2022-06-09 12:34 UTC (permalink / raw)
  To: bjorn.andersson, mathieu.poirier, shawnguo, s.hauer, kernel,
	festevam, linux-imx, linux-remoteproc, linux-arm-kernel,
	linux-kernel, robh+dt, krzysztof.kozlowski+dt
  Cc: devicetree, Peng Fan

From: Peng Fan <peng.fan@nxp.com>

add fsl,startup-delay-ms property indicating delay some time after just
kicks remote processor.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 .../devicetree/bindings/remoteproc/fsl,imx-rproc.yaml         | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
index 64e783234e38..56f3ed18c28c 100644
--- a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
+++ b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
@@ -76,6 +76,10 @@ properties:
       This property is to specify the resource id of the remote processor in SoC
       which supports SCFW
 
+  fsl,startup-delay-ms:
+    $ref: "/schemas/types.yaml#/definitions/uint32"
+    description: Startup time that remote processor ready for communication
+
 required:
   - compatible
 
-- 
2.25.1


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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] remoteproc: imx_rproc: delay after kick remote processor
  2022-06-09 12:34 ` Peng Fan (OSS)
@ 2022-06-09 12:35   ` Peng Fan (OSS)
  -1 siblings, 0 replies; 10+ messages in thread
From: Peng Fan (OSS) @ 2022-06-09 12:35 UTC (permalink / raw)
  To: bjorn.andersson, mathieu.poirier, shawnguo, s.hauer, kernel,
	festevam, linux-imx, linux-remoteproc, linux-arm-kernel,
	linux-kernel, robh+dt, krzysztof.kozlowski+dt
  Cc: devicetree, Peng Fan

From: Peng Fan <peng.fan@nxp.com>

There is case that after remoteproc start remote processor[M4], the M4
runs slow and before M4 finish its own rpmsg framework initialization,
linux sends out vring kick message, then M4 firmware drops the kick
message. Some NXP released Cortex-M[x] images has such limitation that
it requires linux sends out vring kick message after M4 firmware finish
its rpmsg framework initialization.

So add delay before linux send out vring kick message.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/remoteproc/imx_rproc.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 8fe139624ecc..ad0fec128504 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -6,6 +6,7 @@
 #include <dt-bindings/firmware/imx/rsrc.h>
 #include <linux/arm-smccc.h>
 #include <linux/clk.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/firmware/imx/sci.h>
 #include <linux/interrupt.h>
@@ -109,6 +110,7 @@ struct imx_rproc {
 	u32				core_index;
 	struct device                   **pd_dev;
 	struct device_link              **pd_dev_link;
+	u32				startup_delay;
 };
 
 static const struct imx_rproc_att imx_rproc_att_imx93[] = {
@@ -381,6 +383,9 @@ static int imx_rproc_start(struct rproc *rproc)
 	if (ret)
 		dev_err(dev, "Failed to enable remote core!\n");
 
+	if (priv->startup_delay)
+		msleep_interruptible(priv->startup_delay);
+
 	return ret;
 }
 
@@ -1020,6 +1025,10 @@ static int imx_rproc_probe(struct platform_device *pdev)
 	if (rproc->state != RPROC_DETACHED)
 		rproc->auto_boot = of_property_read_bool(np, "fsl,auto-boot");
 
+	ret = of_property_read_u32(np, "fsl,startup-delay-ms", &priv->startup_delay);
+	if (ret)
+		priv->startup_delay = 0;
+
 	ret = rproc_add(rproc);
 	if (ret) {
 		dev_err(dev, "rproc_add failed\n");
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] remoteproc: imx_rproc: delay after kick remote processor
@ 2022-06-09 12:35   ` Peng Fan (OSS)
  0 siblings, 0 replies; 10+ messages in thread
From: Peng Fan (OSS) @ 2022-06-09 12:35 UTC (permalink / raw)
  To: bjorn.andersson, mathieu.poirier, shawnguo, s.hauer, kernel,
	festevam, linux-imx, linux-remoteproc, linux-arm-kernel,
	linux-kernel, robh+dt, krzysztof.kozlowski+dt
  Cc: devicetree, Peng Fan

From: Peng Fan <peng.fan@nxp.com>

There is case that after remoteproc start remote processor[M4], the M4
runs slow and before M4 finish its own rpmsg framework initialization,
linux sends out vring kick message, then M4 firmware drops the kick
message. Some NXP released Cortex-M[x] images has such limitation that
it requires linux sends out vring kick message after M4 firmware finish
its rpmsg framework initialization.

So add delay before linux send out vring kick message.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/remoteproc/imx_rproc.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 8fe139624ecc..ad0fec128504 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -6,6 +6,7 @@
 #include <dt-bindings/firmware/imx/rsrc.h>
 #include <linux/arm-smccc.h>
 #include <linux/clk.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/firmware/imx/sci.h>
 #include <linux/interrupt.h>
@@ -109,6 +110,7 @@ struct imx_rproc {
 	u32				core_index;
 	struct device                   **pd_dev;
 	struct device_link              **pd_dev_link;
+	u32				startup_delay;
 };
 
 static const struct imx_rproc_att imx_rproc_att_imx93[] = {
@@ -381,6 +383,9 @@ static int imx_rproc_start(struct rproc *rproc)
 	if (ret)
 		dev_err(dev, "Failed to enable remote core!\n");
 
+	if (priv->startup_delay)
+		msleep_interruptible(priv->startup_delay);
+
 	return ret;
 }
 
@@ -1020,6 +1025,10 @@ static int imx_rproc_probe(struct platform_device *pdev)
 	if (rproc->state != RPROC_DETACHED)
 		rproc->auto_boot = of_property_read_bool(np, "fsl,auto-boot");
 
+	ret = of_property_read_u32(np, "fsl,startup-delay-ms", &priv->startup_delay);
+	if (ret)
+		priv->startup_delay = 0;
+
 	ret = rproc_add(rproc);
 	if (ret) {
 		dev_err(dev, "rproc_add failed\n");
-- 
2.25.1


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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] dt-bindings: remoteproc: imx_rproc: add fsl,startup-delay-ms
  2022-06-09 12:34   ` Peng Fan (OSS)
@ 2022-06-09 15:23     ` Rob Herring
  -1 siblings, 0 replies; 10+ messages in thread
From: Rob Herring @ 2022-06-09 15:23 UTC (permalink / raw)
  To: Peng Fan (OSS)
  Cc: bjorn.andersson, mathieu.poirier, shawnguo, s.hauer, kernel,
	festevam, linux-imx, linux-remoteproc, linux-arm-kernel,
	linux-kernel, krzysztof.kozlowski+dt, devicetree, Peng Fan

On Thu, Jun 09, 2022 at 08:34:59PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
> 
> add fsl,startup-delay-ms property indicating delay some time after just
> kicks remote processor.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  .../devicetree/bindings/remoteproc/fsl,imx-rproc.yaml         | 4 ++++
>  1 file changed, 4 insertions(+)

What's the base? Doesn't apply to v5.19-rc1 for me.

> 
> diff --git a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
> index 64e783234e38..56f3ed18c28c 100644
> --- a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
> +++ b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
> @@ -76,6 +76,10 @@ properties:
>        This property is to specify the resource id of the remote processor in SoC
>        which supports SCFW
>  
> +  fsl,startup-delay-ms:
> +    $ref: "/schemas/types.yaml#/definitions/uint32"

Standard unit types don't need a type. 'make dt_binding_check' should 
have told you this.

> +    description: Startup time that remote processor ready for communication
> +
>  required:
>    - compatible
>  
> -- 
> 2.25.1
> 
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] dt-bindings: remoteproc: imx_rproc: add fsl,startup-delay-ms
@ 2022-06-09 15:23     ` Rob Herring
  0 siblings, 0 replies; 10+ messages in thread
From: Rob Herring @ 2022-06-09 15:23 UTC (permalink / raw)
  To: Peng Fan (OSS)
  Cc: bjorn.andersson, mathieu.poirier, shawnguo, s.hauer, kernel,
	festevam, linux-imx, linux-remoteproc, linux-arm-kernel,
	linux-kernel, krzysztof.kozlowski+dt, devicetree, Peng Fan

On Thu, Jun 09, 2022 at 08:34:59PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
> 
> add fsl,startup-delay-ms property indicating delay some time after just
> kicks remote processor.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  .../devicetree/bindings/remoteproc/fsl,imx-rproc.yaml         | 4 ++++
>  1 file changed, 4 insertions(+)

What's the base? Doesn't apply to v5.19-rc1 for me.

> 
> diff --git a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
> index 64e783234e38..56f3ed18c28c 100644
> --- a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
> +++ b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
> @@ -76,6 +76,10 @@ properties:
>        This property is to specify the resource id of the remote processor in SoC
>        which supports SCFW
>  
> +  fsl,startup-delay-ms:
> +    $ref: "/schemas/types.yaml#/definitions/uint32"

Standard unit types don't need a type. 'make dt_binding_check' should 
have told you this.

> +    description: Startup time that remote processor ready for communication
> +
>  required:
>    - compatible
>  
> -- 
> 2.25.1
> 
> 

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH 1/2] dt-bindings: remoteproc: imx_rproc: add fsl,startup-delay-ms
  2022-06-09 15:23     ` Rob Herring
@ 2022-06-10  2:10       ` Peng Fan
  -1 siblings, 0 replies; 10+ messages in thread
From: Peng Fan @ 2022-06-10  2:10 UTC (permalink / raw)
  To: Rob Herring, Peng Fan (OSS)
  Cc: bjorn.andersson, mathieu.poirier, shawnguo, s.hauer, kernel,
	festevam, dl-linux-imx, linux-remoteproc, linux-arm-kernel,
	linux-kernel, krzysztof.kozlowski+dt, devicetree

> Subject: Re: [PATCH 1/2] dt-bindings: remoteproc: imx_rproc: add
> fsl,startup-delay-ms
> 
> On Thu, Jun 09, 2022 at 08:34:59PM +0800, Peng Fan (OSS) wrote:
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > add fsl,startup-delay-ms property indicating delay some time after
> > just kicks remote processor.
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> >  .../devicetree/bindings/remoteproc/fsl,imx-rproc.yaml         | 4 ++++
> >  1 file changed, 4 insertions(+)
> 
> What's the base? Doesn't apply to v5.19-rc1 for me.

Sorry, I missed to mention that this patchset is based on the patchset
which support i.MX8QM/QXP:

https://patchwork.kernel.org/project/linux-remoteproc/cover/
20220517064937.4033441-1-peng.fan@oss.nxp.com/

> 
> >
> > diff --git
> > a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
> > b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
> > index 64e783234e38..56f3ed18c28c 100644
> > --- a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
> > +++ b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
> > @@ -76,6 +76,10 @@ properties:
> >        This property is to specify the resource id of the remote processor in
> SoC
> >        which supports SCFW
> >
> > +  fsl,startup-delay-ms:
> > +    $ref: "/schemas/types.yaml#/definitions/uint32"
> 
> Standard unit types don't need a type. 'make dt_binding_check' should have
> told you this.
> 
> > +    description: Startup time that remote processor ready for
> > + communication
> > +
> >  required:
> >    - compatible
> >
> > --
> > 2.25.1
> >
> >

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH 1/2] dt-bindings: remoteproc: imx_rproc: add fsl,startup-delay-ms
@ 2022-06-10  2:10       ` Peng Fan
  0 siblings, 0 replies; 10+ messages in thread
From: Peng Fan @ 2022-06-10  2:10 UTC (permalink / raw)
  To: Rob Herring, Peng Fan (OSS)
  Cc: bjorn.andersson, mathieu.poirier, shawnguo, s.hauer, kernel,
	festevam, dl-linux-imx, linux-remoteproc, linux-arm-kernel,
	linux-kernel, krzysztof.kozlowski+dt, devicetree

> Subject: Re: [PATCH 1/2] dt-bindings: remoteproc: imx_rproc: add
> fsl,startup-delay-ms
> 
> On Thu, Jun 09, 2022 at 08:34:59PM +0800, Peng Fan (OSS) wrote:
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > add fsl,startup-delay-ms property indicating delay some time after
> > just kicks remote processor.
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> >  .../devicetree/bindings/remoteproc/fsl,imx-rproc.yaml         | 4 ++++
> >  1 file changed, 4 insertions(+)
> 
> What's the base? Doesn't apply to v5.19-rc1 for me.

Sorry, I missed to mention that this patchset is based on the patchset
which support i.MX8QM/QXP:

https://patchwork.kernel.org/project/linux-remoteproc/cover/
20220517064937.4033441-1-peng.fan@oss.nxp.com/

> 
> >
> > diff --git
> > a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
> > b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
> > index 64e783234e38..56f3ed18c28c 100644
> > --- a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
> > +++ b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
> > @@ -76,6 +76,10 @@ properties:
> >        This property is to specify the resource id of the remote processor in
> SoC
> >        which supports SCFW
> >
> > +  fsl,startup-delay-ms:
> > +    $ref: "/schemas/types.yaml#/definitions/uint32"
> 
> Standard unit types don't need a type. 'make dt_binding_check' should have
> told you this.
> 
> > +    description: Startup time that remote processor ready for
> > + communication
> > +
> >  required:
> >    - compatible
> >
> > --
> > 2.25.1
> >
> >

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-06-10  2:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-09 12:34 [PATCH 0/2] remoteproc: imx: add start up delay Peng Fan (OSS)
2022-06-09 12:34 ` Peng Fan (OSS)
2022-06-09 12:34 ` [PATCH 1/2] dt-bindings: remoteproc: imx_rproc: add fsl,startup-delay-ms Peng Fan (OSS)
2022-06-09 12:34   ` Peng Fan (OSS)
2022-06-09 15:23   ` Rob Herring
2022-06-09 15:23     ` Rob Herring
2022-06-10  2:10     ` Peng Fan
2022-06-10  2:10       ` Peng Fan
2022-06-09 12:35 ` [PATCH 2/2] remoteproc: imx_rproc: delay after kick remote processor Peng Fan (OSS)
2022-06-09 12:35   ` Peng Fan (OSS)

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.