Skip to content

Commit 3b8127f

Browse files
3V3RYONEmathieupoirier
authored andcommitted
remoteproc: k3-m4: Introduce central function to release rproc from reset
Currently, the TI K3 M4 remoteproc driver assumes all of the M4 devices have local resets. Even though its true for all existing M4 devices, keep room for future devices which possibly may not have local resets and only have a module reset. Therefore introduce a central function, k3_m4_rproc_release() which handles both type of devices (with and without local resets), and use it throughout the driver to release the remote processor from reset. Also, for devices with local reset, Assert the module reset back in case the local reset deassert operation failed. This is done to align the reset release implementation with DSP remoteproc driver and can be factored out later. 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 334a841 commit 3b8127f

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

drivers/remoteproc/ti_k3_m4_remoteproc.c

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,30 @@
2121
#include "ti_sci_proc.h"
2222
#include "ti_k3_common.h"
2323

24+
/* Release the M4 remote processor from reset */
25+
static int k3_m4_rproc_release(struct k3_rproc *kproc)
26+
{
27+
struct device *dev = kproc->dev;
28+
int ret;
29+
30+
if (kproc->data->uses_lreset) {
31+
ret = reset_control_deassert(kproc->reset);
32+
if (ret) {
33+
dev_err(dev, "local-reset deassert failed, ret = %d\n", ret);
34+
if (kproc->ti_sci->ops.dev_ops.put_device(kproc->ti_sci,
35+
kproc->ti_sci_id))
36+
dev_warn(dev, "module-reset assert back failed\n");
37+
}
38+
} else {
39+
ret = kproc->ti_sci->ops.dev_ops.get_device(kproc->ti_sci,
40+
kproc->ti_sci_id);
41+
if (ret)
42+
dev_err(dev, "module-reset deassert failed, ret = %d\n", ret);
43+
}
44+
45+
return ret;
46+
}
47+
2448
static int k3_m4_rproc_ping_mbox(struct k3_rproc *kproc)
2549
{
2650
struct device *dev = kproc->dev;
@@ -347,20 +371,15 @@ static void k3_m4_release_tsp(void *data)
347371
static int k3_m4_rproc_start(struct rproc *rproc)
348372
{
349373
struct k3_rproc *kproc = rproc->priv;
350-
struct device *dev = kproc->dev;
351374
int ret;
352375

353376
ret = k3_m4_rproc_ping_mbox(kproc);
354377
if (ret)
355378
return ret;
356379

357-
ret = reset_control_deassert(kproc->reset);
358-
if (ret) {
359-
dev_err(dev, "local-reset deassert failed, ret = %d\n", ret);
360-
return ret;
361-
}
380+
ret = k3_m4_rproc_release(kproc);
362381

363-
return 0;
382+
return ret;
364383
}
365384

366385
/*

0 commit comments

Comments
 (0)