Skip to content

Commit 1ae680b

Browse files
MrVanmathieupoirier
authored andcommitted
remoteproc: imx_rproc: Add support for System Manager CPU API
When the System Manager configuration places the M7 core in the same Logical Machine(LM) as the A55 cores (M7 LM ID equals A55 LM ID), Linux can control M7 using the CPU protocol API. For more details, see the previous patch that adds LMM API support. Changes include: - Introduce imx_rproc_ops_sm_cpu for CPU API operations. - Reuse imx_rproc_sm_detect_mode to detect shared LM and set priv->ops to imx_rproc_ops_sm_cpu. - Implement imx_rproc_sm_cpu_{start,stop} to handle M7 start and stop. Signed-off-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> Link: https://lore.kernel.org/r/20260109-imx95-rproc-2026-1-8-v6-5-d2fefb36263d@nxp.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
1 parent d8ab94f commit 1ae680b

1 file changed

Lines changed: 33 additions & 2 deletions

File tree

drivers/remoteproc/imx_rproc.c

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ static void imx_rproc_free_mbox(void *data);
102102

103103
/* Forward declarations for platform operations */
104104
static const struct imx_rproc_plat_ops imx_rproc_ops_sm_lmm;
105+
static const struct imx_rproc_plat_ops imx_rproc_ops_sm_cpu;
105106

106107
struct imx_rproc {
107108
struct device *dev;
@@ -326,6 +327,21 @@ static int imx_rproc_scu_api_start(struct rproc *rproc)
326327
return imx_sc_pm_cpu_start(priv->ipc_handle, priv->rsrc_id, true, priv->entry);
327328
}
328329

330+
static int imx_rproc_sm_cpu_start(struct rproc *rproc)
331+
{
332+
struct imx_rproc *priv = rproc->priv;
333+
const struct imx_rproc_dcfg *dcfg = priv->dcfg;
334+
int ret;
335+
336+
ret = scmi_imx_cpu_reset_vector_set(dcfg->cpuid, 0, true, false, false);
337+
if (ret) {
338+
dev_err(priv->dev, "Failed to set reset vector cpuid(%u): %d\n", dcfg->cpuid, ret);
339+
return ret;
340+
}
341+
342+
return scmi_imx_cpu_start(dcfg->cpuid, true);
343+
}
344+
329345
static int imx_rproc_sm_lmm_start(struct rproc *rproc)
330346
{
331347
struct imx_rproc *priv = rproc->priv;
@@ -409,6 +425,14 @@ static int imx_rproc_scu_api_stop(struct rproc *rproc)
409425
return imx_sc_pm_cpu_start(priv->ipc_handle, priv->rsrc_id, false, priv->entry);
410426
}
411427

428+
static int imx_rproc_sm_cpu_stop(struct rproc *rproc)
429+
{
430+
struct imx_rproc *priv = rproc->priv;
431+
const struct imx_rproc_dcfg *dcfg = priv->dcfg;
432+
433+
return scmi_imx_cpu_start(dcfg->cpuid, false);
434+
}
435+
412436
static int imx_rproc_sm_lmm_stop(struct rproc *rproc)
413437
{
414438
struct imx_rproc *priv = rproc->priv;
@@ -1129,8 +1153,9 @@ static int imx_rproc_sm_detect_mode(struct rproc *rproc)
11291153
* If no, use Logical Machine API to manage M7.
11301154
*/
11311155
if (dcfg->lmid == info.lmid) {
1132-
dev_err(dev, "CPU Protocol OPS is not supported\n");
1133-
return -EOPNOTSUPP;
1156+
priv->ops = &imx_rproc_ops_sm_cpu;
1157+
dev_info(dev, "Using CPU Protocol OPS\n");
1158+
return 0;
11341159
}
11351160

11361161
priv->ops = &imx_rproc_ops_sm_lmm;
@@ -1321,6 +1346,12 @@ static const struct imx_rproc_plat_ops imx_rproc_ops_sm_lmm = {
13211346
.stop = imx_rproc_sm_lmm_stop,
13221347
};
13231348

1349+
static const struct imx_rproc_plat_ops imx_rproc_ops_sm_cpu = {
1350+
.detect_mode = imx_rproc_sm_detect_mode,
1351+
.start = imx_rproc_sm_cpu_start,
1352+
.stop = imx_rproc_sm_cpu_stop,
1353+
};
1354+
13241355
static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mn_mmio = {
13251356
.src_reg = IMX7D_SRC_SCR,
13261357
.src_mask = IMX7D_M4_RST_MASK,

0 commit comments

Comments
 (0)