Skip to content

Commit 8715d4c

Browse files
3V3RYONEmathieupoirier
authored andcommitted
remoteproc: k3: Refactor .detach rproc ops into common driver
The .detach rproc ops implementations in TI K3 R5, DSP and M4 remoteproc drivers are NOPs. Refactor the implementations into ti_k3_common.c driver as k3_rproc_detach() and register this common function as .detach ops in R5, DSP and M4 drivers. 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 80e8a86 commit 8715d4c

File tree

5 files changed

+14
-33
lines changed

5 files changed

+14
-33
lines changed

drivers/remoteproc/ti_k3_common.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,5 +308,15 @@ EXPORT_SYMBOL_GPL(k3_rproc_stop);
308308
int k3_rproc_attach(struct rproc *rproc) { return 0; }
309309
EXPORT_SYMBOL_GPL(k3_rproc_attach);
310310

311+
/*
312+
* Detach from a running remote processor (IPC-only mode)
313+
*
314+
* The rproc detach callback is a NOP. The remote processor is not stopped and
315+
* will be left in booted state in IPC-only mode. This callback is invoked only
316+
* in IPC-only mode and exists for sanity sake
317+
*/
318+
int k3_rproc_detach(struct rproc *rproc) { return 0; }
319+
EXPORT_SYMBOL_GPL(k3_rproc_detach);
320+
311321
MODULE_LICENSE("GPL");
312322
MODULE_DESCRIPTION("TI K3 common Remoteproc code");

drivers/remoteproc/ti_k3_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,5 @@ int k3_rproc_unprepare(struct rproc *rproc);
103103
int k3_rproc_start(struct rproc *rproc);
104104
int k3_rproc_stop(struct rproc *rproc);
105105
int k3_rproc_attach(struct rproc *rproc);
106+
int k3_rproc_detach(struct rproc *rproc);
106107
#endif /* REMOTEPROC_TI_K3_COMMON_H */

drivers/remoteproc/ti_k3_dsp_remoteproc.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,6 @@ static int k3_dsp_rproc_start(struct rproc *rproc)
5858
return 0;
5959
}
6060

61-
/*
62-
* Detach from a running DSP remote processor (IPC-only mode)
63-
*
64-
* This rproc detach callback is a NOP. The DSP core is not stopped and will be
65-
* left to continue to run its booted firmware. This callback is invoked only in
66-
* IPC-only mode and exists for sanity sake.
67-
*/
68-
static int k3_dsp_rproc_detach(struct rproc *rproc) { return 0; }
69-
7061
/*
7162
* This function implements the .get_loaded_rsc_table() callback and is used
7263
* to provide the resource table for a booted DSP in IPC-only mode. The K3 DSP
@@ -162,7 +153,7 @@ static const struct rproc_ops k3_dsp_rproc_ops = {
162153
.start = k3_dsp_rproc_start,
163154
.stop = k3_rproc_stop,
164155
.attach = k3_rproc_attach,
165-
.detach = k3_dsp_rproc_detach,
156+
.detach = k3_rproc_detach,
166157
.kick = k3_rproc_kick,
167158
.da_to_va = k3_dsp_rproc_da_to_va,
168159
.get_loaded_rsc_table = k3_dsp_get_loaded_rsc_table,

drivers/remoteproc/ti_k3_m4_remoteproc.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -244,25 +244,13 @@ static void k3_m4_release_tsp(void *data)
244244
ti_sci_proc_release(tsp);
245245
}
246246

247-
/*
248-
* Detach from a running M4 remote processor (IPC-only mode)
249-
*
250-
* This rproc detach callback performs the opposite operation to attach
251-
* callback, the M4 core is not stopped and will be left to continue to
252-
* run its booted firmware. This callback is invoked only in IPC-only mode.
253-
*/
254-
static int k3_m4_rproc_detach(struct rproc *rproc)
255-
{
256-
return 0;
257-
}
258-
259247
static const struct rproc_ops k3_m4_rproc_ops = {
260248
.prepare = k3_rproc_prepare,
261249
.unprepare = k3_rproc_unprepare,
262250
.start = k3_rproc_start,
263251
.stop = k3_rproc_stop,
264252
.attach = k3_rproc_attach,
265-
.detach = k3_m4_rproc_detach,
253+
.detach = k3_rproc_detach,
266254
.kick = k3_rproc_kick,
267255
.da_to_va = k3_m4_rproc_da_to_va,
268256
.get_loaded_rsc_table = k3_m4_get_loaded_rsc_table,

drivers/remoteproc/ti_k3_r5_remoteproc.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -559,15 +559,6 @@ static int k3_r5_rproc_stop(struct rproc *rproc)
559559
return ret;
560560
}
561561

562-
/*
563-
* Detach from a running R5F remote processor (IPC-only mode)
564-
*
565-
* The R5F detach callback is a NOP. The R5F cores are not stopped and will be
566-
* left in booted state in IPC-only mode. This callback is invoked only in
567-
* IPC-only mode and exists for sanity sake.
568-
*/
569-
static int k3_r5_rproc_detach(struct rproc *rproc) { return 0; }
570-
571562
/*
572563
* This function implements the .get_loaded_rsc_table() callback and is used
573564
* to provide the resource table for the booted R5F in IPC-only mode. The K3 R5F
@@ -1049,7 +1040,7 @@ static int k3_r5_rproc_configure_mode(struct k3_rproc *kproc)
10491040
kproc->rproc->ops->start = NULL;
10501041
kproc->rproc->ops->stop = NULL;
10511042
kproc->rproc->ops->attach = k3_rproc_attach;
1052-
kproc->rproc->ops->detach = k3_r5_rproc_detach;
1043+
kproc->rproc->ops->detach = k3_rproc_detach;
10531044
kproc->rproc->ops->get_loaded_rsc_table =
10541045
k3_r5_get_loaded_rsc_table;
10551046
} else if (!c_state) {

0 commit comments

Comments
 (0)