Skip to content

Commit b80151c

Browse files
3V3RYONEmathieupoirier
authored andcommitted
remoteproc: k3-dsp: Assert local reset during .prepare callback
The ti_k3_dsp_remoteproc.c driver asserts the local reset in probe and releases the module reset in .prepare callback. This is done to ensure the core does not execute bogus code when module reset is deasserted. Put both of these operations together in .prepare callback, which is more suitable as it ensures local reset is asserted for subsequent core start operations from sysfs. This is done to align the .prepare callback of DSP with the M4 driver which 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 41d746b commit b80151c

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

drivers/remoteproc/ti_k3_dsp_remoteproc.c

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ static int k3_dsp_rproc_prepare(struct rproc *rproc)
4444
if (rproc->state == RPROC_DETACHED)
4545
return 0;
4646

47+
/*
48+
* Ensure the local reset is asserted so the core doesn't
49+
* execute bogus code when the module reset is released.
50+
*/
51+
if (kproc->data->uses_lreset) {
52+
ret = k3_rproc_reset(kproc);
53+
if (ret)
54+
return ret;
55+
56+
ret = reset_control_status(kproc->reset);
57+
if (ret <= 0) {
58+
dev_err(dev, "local reset still not asserted\n");
59+
return ret;
60+
}
61+
}
62+
4763
ret = kproc->ti_sci->ops.dev_ops.get_device(kproc->ti_sci,
4864
kproc->ti_sci_id);
4965
if (ret)
@@ -471,20 +487,6 @@ static int k3_dsp_rproc_probe(struct platform_device *pdev)
471487
rproc->state = RPROC_DETACHED;
472488
} else {
473489
dev_info(dev, "configured DSP for remoteproc mode\n");
474-
/*
475-
* ensure the DSP local reset is asserted to ensure the DSP
476-
* doesn't execute bogus code in .prepare() when the module
477-
* reset is released.
478-
*/
479-
if (data->uses_lreset) {
480-
ret = reset_control_status(kproc->reset);
481-
if (ret < 0) {
482-
return dev_err_probe(dev, ret, "failed to get reset status\n");
483-
} else if (ret == 0) {
484-
dev_warn(dev, "local reset is deasserted for device\n");
485-
k3_rproc_reset(kproc);
486-
}
487-
}
488490
}
489491

490492
ret = devm_rproc_add(dev, rproc);

0 commit comments

Comments
 (0)