Skip to content

Commit 80e8a86

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

File tree

5 files changed

+16
-37
lines changed

5 files changed

+16
-37
lines changed

drivers/remoteproc/ti_k3_common.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,5 +296,17 @@ int k3_rproc_stop(struct rproc *rproc)
296296
}
297297
EXPORT_SYMBOL_GPL(k3_rproc_stop);
298298

299+
/*
300+
* Attach to a running remote processor (IPC-only mode)
301+
*
302+
* The rproc attach callback is a NOP. The remote processor is already booted,
303+
* and all required resources have been acquired during probe routine, so there
304+
* is no need to issue any TI-SCI commands to boot the remote cores in IPC-only
305+
* mode. This callback is invoked only in IPC-only mode and exists because
306+
* rproc_validate() checks for its existence.
307+
*/
308+
int k3_rproc_attach(struct rproc *rproc) { return 0; }
309+
EXPORT_SYMBOL_GPL(k3_rproc_attach);
310+
299311
MODULE_LICENSE("GPL");
300312
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
@@ -102,4 +102,5 @@ int k3_rproc_prepare(struct rproc *rproc);
102102
int k3_rproc_unprepare(struct rproc *rproc);
103103
int k3_rproc_start(struct rproc *rproc);
104104
int k3_rproc_stop(struct rproc *rproc);
105+
int k3_rproc_attach(struct rproc *rproc);
105106
#endif /* REMOTEPROC_TI_K3_COMMON_H */

drivers/remoteproc/ti_k3_dsp_remoteproc.c

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

61-
/*
62-
* Attach to a running DSP remote processor (IPC-only mode)
63-
*
64-
* This rproc attach callback is a NOP. The remote processor is already booted,
65-
* and all required resources have been acquired during probe routine, so there
66-
* is no need to issue any TI-SCI commands to boot the DSP core. This callback
67-
* is invoked only in IPC-only mode and exists because rproc_validate() checks
68-
* for its existence.
69-
*/
70-
static int k3_dsp_rproc_attach(struct rproc *rproc) { return 0; }
71-
7261
/*
7362
* Detach from a running DSP remote processor (IPC-only mode)
7463
*
@@ -172,7 +161,7 @@ static void *k3_dsp_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, bool
172161
static const struct rproc_ops k3_dsp_rproc_ops = {
173162
.start = k3_dsp_rproc_start,
174163
.stop = k3_rproc_stop,
175-
.attach = k3_dsp_rproc_attach,
164+
.attach = k3_rproc_attach,
176165
.detach = k3_dsp_rproc_detach,
177166
.kick = k3_rproc_kick,
178167
.da_to_va = k3_dsp_rproc_da_to_va,

drivers/remoteproc/ti_k3_m4_remoteproc.c

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

247-
/*
248-
* Attach to a running M4 remote processor (IPC-only mode)
249-
*
250-
* The remote processor is already booted, so there is no need to issue any
251-
* TI-SCI commands to boot the M4 core. This callback is used only in IPC-only
252-
* mode.
253-
*/
254-
static int k3_m4_rproc_attach(struct rproc *rproc)
255-
{
256-
return 0;
257-
}
258-
259247
/*
260248
* Detach from a running M4 remote processor (IPC-only mode)
261249
*
@@ -273,7 +261,7 @@ static const struct rproc_ops k3_m4_rproc_ops = {
273261
.unprepare = k3_rproc_unprepare,
274262
.start = k3_rproc_start,
275263
.stop = k3_rproc_stop,
276-
.attach = k3_m4_rproc_attach,
264+
.attach = k3_rproc_attach,
277265
.detach = k3_m4_rproc_detach,
278266
.kick = k3_rproc_kick,
279267
.da_to_va = k3_m4_rproc_da_to_va,

drivers/remoteproc/ti_k3_r5_remoteproc.c

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

562-
/*
563-
* Attach to a running R5F remote processor (IPC-only mode)
564-
*
565-
* The R5F attach callback is a NOP. The remote processor is already booted, and
566-
* all required resources have been acquired during probe routine, so there is
567-
* no need to issue any TI-SCI commands to boot the R5F cores in IPC-only mode.
568-
* This callback is invoked only in IPC-only mode and exists because
569-
* rproc_validate() checks for its existence.
570-
*/
571-
static int k3_r5_rproc_attach(struct rproc *rproc) { return 0; }
572-
573562
/*
574563
* Detach from a running R5F remote processor (IPC-only mode)
575564
*
@@ -1059,7 +1048,7 @@ static int k3_r5_rproc_configure_mode(struct k3_rproc *kproc)
10591048
kproc->rproc->ops->unprepare = NULL;
10601049
kproc->rproc->ops->start = NULL;
10611050
kproc->rproc->ops->stop = NULL;
1062-
kproc->rproc->ops->attach = k3_r5_rproc_attach;
1051+
kproc->rproc->ops->attach = k3_rproc_attach;
10631052
kproc->rproc->ops->detach = k3_r5_rproc_detach;
10641053
kproc->rproc->ops->get_loaded_rsc_table =
10651054
k3_r5_get_loaded_rsc_table;

0 commit comments

Comments
 (0)