Skip to content

Commit 41d746b

Browse files
3V3RYONEmathieupoirier
authored andcommitted
remoteproc: k3-dsp: Don't override rproc ops in IPC-only mode
Currently, the driver overrides the rproc ops when booting in IPC-only mode. Remove these overrides and register the ops unconditionally. This requires to have IPC-only mode checks in the .prepare and .unprepare ops and returning early. The other rproc ops are invoked when booting either in IPC-only mode or in remoteproc mode but not both. This is done to align the rproc ops implementations of DSP driver with M4 driver and can be factored out at a later stage. Signed-off-by: Beleswar Padhi <[email protected]> Tested-by: Judith Mendez <[email protected]> Reviewed-by: Andrew Davis <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
1 parent 6fdad99 commit 41d746b

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

drivers/remoteproc/ti_k3_dsp_remoteproc.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ static int k3_dsp_rproc_prepare(struct rproc *rproc)
4040
struct device *dev = kproc->dev;
4141
int ret;
4242

43+
/* If the core is running already no need to deassert the module reset */
44+
if (rproc->state == RPROC_DETACHED)
45+
return 0;
46+
4347
ret = kproc->ti_sci->ops.dev_ops.get_device(kproc->ti_sci,
4448
kproc->ti_sci_id);
4549
if (ret)
@@ -64,6 +68,10 @@ static int k3_dsp_rproc_unprepare(struct rproc *rproc)
6468
struct device *dev = kproc->dev;
6569
int ret;
6670

71+
/* If the core is running already no need to deassert the module reset */
72+
if (rproc->state == RPROC_DETACHED)
73+
return 0;
74+
6775
ret = kproc->ti_sci->ops.dev_ops.put_device(kproc->ti_sci,
6876
kproc->ti_sci_id);
6977
if (ret)
@@ -232,10 +240,13 @@ static void *k3_dsp_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, bool
232240
}
233241

234242
static const struct rproc_ops k3_dsp_rproc_ops = {
235-
.start = k3_dsp_rproc_start,
236-
.stop = k3_dsp_rproc_stop,
237-
.kick = k3_rproc_kick,
238-
.da_to_va = k3_dsp_rproc_da_to_va,
243+
.start = k3_dsp_rproc_start,
244+
.stop = k3_dsp_rproc_stop,
245+
.attach = k3_dsp_rproc_attach,
246+
.detach = k3_dsp_rproc_detach,
247+
.kick = k3_rproc_kick,
248+
.da_to_va = k3_dsp_rproc_da_to_va,
249+
.get_loaded_rsc_table = k3_dsp_get_loaded_rsc_table,
239250
};
240251

241252
static int k3_dsp_rproc_of_get_memories(struct platform_device *pdev,
@@ -458,14 +469,6 @@ static int k3_dsp_rproc_probe(struct platform_device *pdev)
458469
if (p_state) {
459470
dev_info(dev, "configured DSP for IPC-only mode\n");
460471
rproc->state = RPROC_DETACHED;
461-
/* override rproc ops with only required IPC-only mode ops */
462-
rproc->ops->prepare = NULL;
463-
rproc->ops->unprepare = NULL;
464-
rproc->ops->start = NULL;
465-
rproc->ops->stop = NULL;
466-
rproc->ops->attach = k3_dsp_rproc_attach;
467-
rproc->ops->detach = k3_dsp_rproc_detach;
468-
rproc->ops->get_loaded_rsc_table = k3_dsp_get_loaded_rsc_table;
469472
} else {
470473
dev_info(dev, "configured DSP for remoteproc mode\n");
471474
/*

0 commit comments

Comments
 (0)