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 <b-pa...@ti.com> Tested-by: Judith Mendez <j...@ti.com> --- v11: Changelog: 1. Carried T/B tag. Link to v10: https://lore.kernel.org/all/20250417182001.3903905-25-b-pa...@ti.com/ v10: Changelog: 1. Don't remove dsp func override. Already done by [v10 20/33] patch. Link to v9: https://lore.kernel.org/all/20250317120622.1746415-18-b-pa...@ti.com/ drivers/remoteproc/ti_k3_common.c | 15 +++++++++++++++ drivers/remoteproc/ti_k3_common.h | 1 + drivers/remoteproc/ti_k3_dsp_remoteproc.c | 3 ++- drivers/remoteproc/ti_k3_m4_remoteproc.c | 16 +--------------- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/drivers/remoteproc/ti_k3_common.c b/drivers/remoteproc/ti_k3_common.c index b5f66be2e5cc8..5e0d1298d05b1 100644 --- a/drivers/remoteproc/ti_k3_common.c +++ b/drivers/remoteproc/ti_k3_common.c @@ -263,5 +263,20 @@ int k3_rproc_unprepare(struct rproc *rproc) } EXPORT_SYMBOL_GPL(k3_rproc_unprepare); +/* + * Power up the remote processor. + * + * This function will be invoked only after the firmware for this rproc + * was loaded, parsed successfully, and all of its resource requirements + * were met. This callback is invoked only in remoteproc mode. + */ +int k3_rproc_start(struct rproc *rproc) +{ + struct k3_rproc *kproc = rproc->priv; + + return k3_rproc_release(kproc); +} +EXPORT_SYMBOL_GPL(k3_rproc_start); + MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("TI K3 common Remoteproc code"); diff --git a/drivers/remoteproc/ti_k3_common.h b/drivers/remoteproc/ti_k3_common.h index c1b07187c124c..51a92a3064793 100644 --- a/drivers/remoteproc/ti_k3_common.h +++ b/drivers/remoteproc/ti_k3_common.h @@ -95,4 +95,5 @@ int k3_rproc_release(struct k3_rproc *kproc); int k3_rproc_request_mbox(struct rproc *rproc); int k3_rproc_prepare(struct rproc *rproc); int k3_rproc_unprepare(struct rproc *rproc); +int k3_rproc_start(struct rproc *rproc); #endif /* REMOTEPROC_TI_K3_COMMON_H */ diff --git a/drivers/remoteproc/ti_k3_dsp_remoteproc.c b/drivers/remoteproc/ti_k3_dsp_remoteproc.c index 5099d21ce066f..67d46c4a1ba61 100644 --- a/drivers/remoteproc/ti_k3_dsp_remoteproc.c +++ b/drivers/remoteproc/ti_k3_dsp_remoteproc.c @@ -50,7 +50,8 @@ static int k3_dsp_rproc_start(struct rproc *rproc) if (ret) return ret; - ret = k3_rproc_release(kproc); + /* Call the K3 common start function after doing DSP specific stuff */ + ret = k3_rproc_start(rproc); if (ret) return ret; diff --git a/drivers/remoteproc/ti_k3_m4_remoteproc.c b/drivers/remoteproc/ti_k3_m4_remoteproc.c index 7167d311e0876..69066cb917406 100644 --- a/drivers/remoteproc/ti_k3_m4_remoteproc.c +++ b/drivers/remoteproc/ti_k3_m4_remoteproc.c @@ -244,20 +244,6 @@ static void k3_m4_release_tsp(void *data) ti_sci_proc_release(tsp); } -/* - * Power up the M4 remote processor. - * - * This function will be invoked only after the firmware for this rproc - * was loaded, parsed successfully, and all of its resource requirements - * were met. This callback is invoked only in remoteproc mode. - */ -static int k3_m4_rproc_start(struct rproc *rproc) -{ - struct k3_rproc *kproc = rproc->priv; - - return k3_rproc_release(kproc); -} - /* * Stop the M4 remote processor. * @@ -298,7 +284,7 @@ static int k3_m4_rproc_detach(struct rproc *rproc) static const struct rproc_ops k3_m4_rproc_ops = { .prepare = k3_rproc_prepare, .unprepare = k3_rproc_unprepare, - .start = k3_m4_rproc_start, + .start = k3_rproc_start, .stop = k3_m4_rproc_stop, .attach = k3_m4_rproc_attach, .detach = k3_m4_rproc_detach, -- 2.34.1