Skip to content

Commit ca8921f

Browse files
3V3RYONEmathieupoirier
authored andcommitted
remoteproc: k3-m4: Introduce central function to put rproc into 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_reset() which handles both type of devices (with and without local resets), and use it throughout the driver to put the remote processor into reset. This is done to align the reset 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 754d13d commit ca8921f

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

drivers/remoteproc/ti_k3_m4_remoteproc.c

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

24+
/* Put the M4 remote processor into reset */
25+
static int k3_m4_rproc_reset(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_assert(kproc->reset);
32+
if (ret)
33+
dev_err(dev, "local-reset assert failed, ret = %d\n", ret);
34+
} else {
35+
ret = kproc->ti_sci->ops.dev_ops.put_device(kproc->ti_sci,
36+
kproc->ti_sci_id);
37+
if (ret)
38+
dev_err(dev, "module-reset assert failed, ret = %d\n", ret);
39+
}
40+
41+
return ret;
42+
}
43+
2444
static int k3_m4_rproc_ping_mbox(struct k3_rproc *kproc)
2545
{
2646
struct device *dev = kproc->dev;
@@ -65,11 +85,9 @@ static int k3_m4_rproc_prepare(struct rproc *rproc)
6585
* Ensure the local reset is asserted so the core doesn't
6686
* execute bogus code when the module reset is released.
6787
*/
68-
ret = reset_control_assert(kproc->reset);
69-
if (ret) {
70-
dev_err(dev, "could not assert local reset\n");
88+
ret = k3_m4_rproc_reset(kproc);
89+
if (ret)
7190
return ret;
72-
}
7391

7492
ret = reset_control_status(kproc->reset);
7593
if (ret <= 0) {
@@ -374,16 +392,8 @@ static int k3_m4_rproc_start(struct rproc *rproc)
374392
static int k3_m4_rproc_stop(struct rproc *rproc)
375393
{
376394
struct k3_rproc *kproc = rproc->priv;
377-
struct device *dev = kproc->dev;
378-
int ret;
379395

380-
ret = reset_control_assert(kproc->reset);
381-
if (ret) {
382-
dev_err(dev, "local-reset assert failed, ret = %d\n", ret);
383-
return ret;
384-
}
385-
386-
return 0;
396+
return k3_m4_rproc_reset(kproc);
387397
}
388398

389399
/*

0 commit comments

Comments
 (0)