Skip to content

Commit bbd0f64

Browse files
3V3RYONEmathieupoirier
authored andcommitted
remoteproc: k3: Refactor .stop rproc ops into common driver
The .stop rproc ops implementations in TI K3 DSP and M4 remoteproc drivers put the remote processor into reset. Refactor the implementations into ti_k3_common.c driver as k3_rproc_stop() and register this common function as .stop ops in 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 f55ab2f commit bbd0f64

File tree

4 files changed

+17
-30
lines changed

4 files changed

+17
-30
lines changed

drivers/remoteproc/ti_k3_common.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,5 +282,19 @@ int k3_rproc_start(struct rproc *rproc)
282282
}
283283
EXPORT_SYMBOL_GPL(k3_rproc_start);
284284

285+
/*
286+
* Stop the remote processor.
287+
*
288+
* This function puts the remote processor into reset, and finishes processing
289+
* of any pending messages. This callback is invoked only in remoteproc mode.
290+
*/
291+
int k3_rproc_stop(struct rproc *rproc)
292+
{
293+
struct k3_rproc *kproc = rproc->priv;
294+
295+
return k3_rproc_reset(kproc);
296+
}
297+
EXPORT_SYMBOL_GPL(k3_rproc_stop);
298+
285299
MODULE_LICENSE("GPL");
286300
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
@@ -101,4 +101,5 @@ int k3_rproc_request_mbox(struct rproc *rproc);
101101
int k3_rproc_prepare(struct rproc *rproc);
102102
int k3_rproc_unprepare(struct rproc *rproc);
103103
int k3_rproc_start(struct rproc *rproc);
104+
int k3_rproc_stop(struct rproc *rproc);
104105
#endif /* REMOTEPROC_TI_K3_COMMON_H */

drivers/remoteproc/ti_k3_dsp_remoteproc.c

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

61-
/*
62-
* Stop the DSP remote processor.
63-
*
64-
* This function puts the DSP processor into reset, and finishes processing
65-
* of any pending messages. This callback is invoked only in remoteproc mode.
66-
*/
67-
static int k3_dsp_rproc_stop(struct rproc *rproc)
68-
{
69-
struct k3_rproc *kproc = rproc->priv;
70-
71-
k3_rproc_reset(kproc);
72-
73-
return 0;
74-
}
75-
7661
/*
7762
* Attach to a running DSP remote processor (IPC-only mode)
7863
*
@@ -186,7 +171,7 @@ static void *k3_dsp_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, bool
186171

187172
static const struct rproc_ops k3_dsp_rproc_ops = {
188173
.start = k3_dsp_rproc_start,
189-
.stop = k3_dsp_rproc_stop,
174+
.stop = k3_rproc_stop,
190175
.attach = k3_dsp_rproc_attach,
191176
.detach = k3_dsp_rproc_detach,
192177
.kick = k3_rproc_kick,

drivers/remoteproc/ti_k3_m4_remoteproc.c

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

247-
/*
248-
* Stop the M4 remote processor.
249-
*
250-
* This function puts the M4 processor into reset, and finishes processing
251-
* of any pending messages. This callback is invoked only in remoteproc mode.
252-
*/
253-
static int k3_m4_rproc_stop(struct rproc *rproc)
254-
{
255-
struct k3_rproc *kproc = rproc->priv;
256-
257-
return k3_rproc_reset(kproc);
258-
}
259-
260247
/*
261248
* Attach to a running M4 remote processor (IPC-only mode)
262249
*
@@ -285,7 +272,7 @@ static const struct rproc_ops k3_m4_rproc_ops = {
285272
.prepare = k3_rproc_prepare,
286273
.unprepare = k3_rproc_unprepare,
287274
.start = k3_rproc_start,
288-
.stop = k3_m4_rproc_stop,
275+
.stop = k3_rproc_stop,
289276
.attach = k3_m4_rproc_attach,
290277
.detach = k3_m4_rproc_detach,
291278
.kick = k3_rproc_kick,

0 commit comments

Comments
 (0)