remoteproc: stm32: Parse syscon that will manage M4 synchronisation
authorMathieu Poirier <mathieu.poirier@linaro.org>
Tue, 14 Jul 2020 20:04:39 +0000 (14:04 -0600)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Sat, 18 Jul 2020 00:34:15 +0000 (17:34 -0700)
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

Acked-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Loic Pallardy <loic.pallardy@st.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20200714200445.1427257-6-mathieu.poirier@linaro.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
drivers/remoteproc/stm32_rproc.c

index 986f34a..961a53f 100644 (file)
@@ -71,6 +71,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;
@@ -607,6 +609,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;
 }