Skip to content

Commit f55ab2f

Browse files
3V3RYONEmathieupoirier
authored andcommitted
remoteproc: k3: Refactor .start rproc ops into common driver
The k3_dsp_rproc_start() function sets the boot vector and releases the reset on the remote processor. Whereas, the k3_m4_rproc_start() function only needs to release the reset. Refactor the k3_m4_rproc_start() into ti_k3_common.c as k3_rproc_start() and align the DSP and M4 drivers to invoke this common function when releasing the reset on the remote processor. 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 3059abb commit f55ab2f

File tree

4 files changed

+19
-16
lines changed

4 files changed

+19
-16
lines changed

drivers/remoteproc/ti_k3_common.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,5 +267,20 @@ int k3_rproc_unprepare(struct rproc *rproc)
267267
}
268268
EXPORT_SYMBOL_GPL(k3_rproc_unprepare);
269269

270+
/*
271+
* Power up the remote processor.
272+
*
273+
* This function will be invoked only after the firmware for this rproc
274+
* was loaded, parsed successfully, and all of its resource requirements
275+
* were met. This callback is invoked only in remoteproc mode.
276+
*/
277+
int k3_rproc_start(struct rproc *rproc)
278+
{
279+
struct k3_rproc *kproc = rproc->priv;
280+
281+
return k3_rproc_release(kproc);
282+
}
283+
EXPORT_SYMBOL_GPL(k3_rproc_start);
284+
270285
MODULE_LICENSE("GPL");
271286
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
@@ -100,4 +100,5 @@ int k3_rproc_release(struct k3_rproc *kproc);
100100
int k3_rproc_request_mbox(struct rproc *rproc);
101101
int k3_rproc_prepare(struct rproc *rproc);
102102
int k3_rproc_unprepare(struct rproc *rproc);
103+
int k3_rproc_start(struct rproc *rproc);
103104
#endif /* REMOTEPROC_TI_K3_COMMON_H */

drivers/remoteproc/ti_k3_dsp_remoteproc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ static int k3_dsp_rproc_start(struct rproc *rproc)
5050
if (ret)
5151
return ret;
5252

53-
ret = k3_rproc_release(kproc);
53+
/* Call the K3 common start function after doing DSP specific stuff */
54+
ret = k3_rproc_start(rproc);
5455
if (ret)
5556
return ret;
5657

drivers/remoteproc/ti_k3_m4_remoteproc.c

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

247-
/*
248-
* Power up the M4 remote processor.
249-
*
250-
* This function will be invoked only after the firmware for this rproc
251-
* was loaded, parsed successfully, and all of its resource requirements
252-
* were met. This callback is invoked only in remoteproc mode.
253-
*/
254-
static int k3_m4_rproc_start(struct rproc *rproc)
255-
{
256-
struct k3_rproc *kproc = rproc->priv;
257-
258-
return k3_rproc_release(kproc);
259-
}
260-
261247
/*
262248
* Stop the M4 remote processor.
263249
*
@@ -298,7 +284,7 @@ static int k3_m4_rproc_detach(struct rproc *rproc)
298284
static const struct rproc_ops k3_m4_rproc_ops = {
299285
.prepare = k3_rproc_prepare,
300286
.unprepare = k3_rproc_unprepare,
301-
.start = k3_m4_rproc_start,
287+
.start = k3_rproc_start,
302288
.stop = k3_m4_rproc_stop,
303289
.attach = k3_m4_rproc_attach,
304290
.detach = k3_m4_rproc_detach,

0 commit comments

Comments
 (0)