[05/11] remoteproc: stm32: Parse syscon that will manage M4 synchronisation
diff mbox series

Message ID 20200324220329.15523-6-mathieu.poirier@linaro.org
State New
Headers show
Series
  • remoteproc: stm32: Add support for synchronisation with MCU
Related show

Commit Message

Mathieu Poirier March 24, 2020, 10:03 p.m. UTC
Get from the DT the syncon to probe the state of the remote processor
and the location of the resource table.

Mainly based on the work published by Arnaud Pouliquen [1].

[1]. https://patchwork.kernel.org/project/linux-remoteproc/list/?series=239877

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

Comments

Loic PALLARDY March 27, 2020, 4:56 p.m. UTC | #1
> -----Original Message-----
> From: Mathieu Poirier <mathieu.poirier@linaro.org>
> Sent: mardi 24 mars 2020 23:03
> To: bjorn.andersson@linaro.org
> Cc: ohad@wizery.com; Loic PALLARDY <loic.pallardy@st.com>; s-
> anna@ti.com; peng.fan@nxp.com; Arnaud POULIQUEN
> <arnaud.pouliquen@st.com>; Fabien DESSENNE
> <fabien.dessenne@st.com>; linux-remoteproc@vger.kernel.org
> Subject: [PATCH 05/11] remoteproc: stm32: Parse syscon that will manage
> M4 synchronisation
> 
> Get from the DT the syncon to probe the state of the remote processor
> and the location of the resource table.
> 
> Mainly based on the work published by Arnaud Pouliquen [1].
> 
> [1]. https://patchwork.kernel.org/project/linux-
> remoteproc/list/?series=239877
> 
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Thanks Mathieu

Reviewed-by: Loic Pallardy <loic.pallardy@st.com>
> ---
>  drivers/remoteproc/stm32_rproc.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/drivers/remoteproc/stm32_rproc.c
> b/drivers/remoteproc/stm32_rproc.c
> index a3e278490bb4..7d5d4a7dbb04 100644
> --- a/drivers/remoteproc/stm32_rproc.c
> +++ b/drivers/remoteproc/stm32_rproc.c
> @@ -70,6 +70,8 @@ struct stm32_rproc {
>  	struct reset_control *rst;
>  	struct stm32_syscon hold_boot;
>  	struct stm32_syscon pdds;
> +	struct stm32_syscon m4_state;
> +	struct stm32_syscon rsctbl;
>  	int wdg_irq;
>  	u32 nb_rmems;
>  	struct stm32_rproc_mem *rmems;
> @@ -606,6 +608,30 @@ static int stm32_rproc_parse_dt(struct
> platform_device *pdev,
> 
>  	*auto_boot = of_property_read_bool(np, "st,auto-boot");
> 
> +	/*
> +	 * See if we can check the M4 status, i.e if it was started
> +	 * from the boot loader or not.
> +	 */
> +        err = stm32_rproc_get_syscon(np, "st,syscfg-m4-state",
> +                                     &ddata->m4_state);
> +        if (err) {
> +		/* remember this */
> +		ddata->m4_state.map = NULL;
> +                /* no coprocessor state syscon (optional) */
> +                dev_warn(dev, "m4 state not supported\n");
> +
> +		/* no need to go further */
> +		return 0;
> +        }
> +
> +	/* See if we can get the resource table */
> +        err = stm32_rproc_get_syscon(np, "st,syscfg-rsc-tbl",
> +                                     &ddata->rsctbl);
> +	if (err) {
> +		/* no rsc table syscon (optional) */
> +		dev_warn(dev, "rsc tbl syscon not supported\n");
> +	}
> +
>  	return 0;
>  }
> 
> --
> 2.20.1

Patch
diff mbox series

diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c
index a3e278490bb4..7d5d4a7dbb04 100644
--- a/drivers/remoteproc/stm32_rproc.c
+++ b/drivers/remoteproc/stm32_rproc.c
@@ -70,6 +70,8 @@  struct stm32_rproc {
 	struct reset_control *rst;
 	struct stm32_syscon hold_boot;
 	struct stm32_syscon pdds;
+	struct stm32_syscon m4_state;
+	struct stm32_syscon rsctbl;
 	int wdg_irq;
 	u32 nb_rmems;
 	struct stm32_rproc_mem *rmems;
@@ -606,6 +608,30 @@  static int stm32_rproc_parse_dt(struct platform_device *pdev,
 
 	*auto_boot = of_property_read_bool(np, "st,auto-boot");
 
+	/*
+	 * See if we can check the M4 status, i.e if it was started
+	 * from the boot loader or not.
+	 */
+        err = stm32_rproc_get_syscon(np, "st,syscfg-m4-state",
+                                     &ddata->m4_state);
+        if (err) {
+		/* remember this */
+		ddata->m4_state.map = NULL;
+                /* no coprocessor state syscon (optional) */
+                dev_warn(dev, "m4 state not supported\n");
+
+		/* no need to go further */
+		return 0;
+        }
+
+	/* See if we can get the resource table */
+        err = stm32_rproc_get_syscon(np, "st,syscfg-rsc-tbl",
+                                     &ddata->rsctbl);
+	if (err) {
+		/* no rsc table syscon (optional) */
+		dev_warn(dev, "rsc tbl syscon not supported\n");
+	}
+
 	return 0;
 }