diff options
author | 2025-05-13 11:15:10 +0530 | |
---|---|---|
committer | 2025-05-20 11:19:12 -0600 | |
commit | 5779f6f9a64ffc3e002a37ab1f78521d9a5c0100 (patch) | |
tree | 70b86ef0f3f73a9df22fa682783465495ed47133 | |
parent | remoteproc: k3: Refactor reserved_mem_init() functions into common driver (diff) | |
download | linux-rng-5779f6f9a64ffc3e002a37ab1f78521d9a5c0100.tar.xz linux-rng-5779f6f9a64ffc3e002a37ab1f78521d9a5c0100.zip |
remoteproc: k3: Refactor release_tsp() functions into common driver
The release_tsp() implementations in the TI K3 R5, DSP and M4 remoteproc
drivers release the TI-SCI processor control of a remote processor,
which is auto triggered upon device removal.
Refactor these functions into ti_k3_common.c driver as k3_release_tsp()
and use this common function throughout in R5, DSP and M4 drivers.
Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
Tested-by: Judith Mendez <jm@ti.com>
Reviewed-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20250513054510.3439842-37-b-padhi@ti.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
-rw-r--r-- | drivers/remoteproc/ti_k3_common.c | 8 | ||||
-rw-r--r-- | drivers/remoteproc/ti_k3_common.h | 1 | ||||
-rw-r--r-- | drivers/remoteproc/ti_k3_dsp_remoteproc.c | 9 | ||||
-rw-r--r-- | drivers/remoteproc/ti_k3_m4_remoteproc.c | 9 | ||||
-rw-r--r-- | drivers/remoteproc/ti_k3_r5_remoteproc.c | 9 |
5 files changed, 12 insertions, 24 deletions
diff --git a/drivers/remoteproc/ti_k3_common.c b/drivers/remoteproc/ti_k3_common.c index 92da2af2733d..d5dccc81d460 100644 --- a/drivers/remoteproc/ti_k3_common.c +++ b/drivers/remoteproc/ti_k3_common.c @@ -539,5 +539,13 @@ int k3_reserved_mem_init(struct k3_rproc *kproc) } EXPORT_SYMBOL_GPL(k3_reserved_mem_init); +void k3_release_tsp(void *data) +{ + struct ti_sci_proc *tsp = data; + + ti_sci_proc_release(tsp); +} +EXPORT_SYMBOL_GPL(k3_release_tsp); + 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 d304755990a9..aee3c28dbe51 100644 --- a/drivers/remoteproc/ti_k3_common.h +++ b/drivers/remoteproc/ti_k3_common.h @@ -114,4 +114,5 @@ int k3_rproc_of_get_memories(struct platform_device *pdev, struct k3_rproc *kproc); void k3_mem_release(void *data); int k3_reserved_mem_init(struct k3_rproc *kproc); +void k3_release_tsp(void *data); #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 45000b68260c..7a72933bd403 100644 --- a/drivers/remoteproc/ti_k3_dsp_remoteproc.c +++ b/drivers/remoteproc/ti_k3_dsp_remoteproc.c @@ -66,13 +66,6 @@ static const struct rproc_ops k3_dsp_rproc_ops = { .get_loaded_rsc_table = k3_get_loaded_rsc_table, }; -static void k3_dsp_release_tsp(void *data) -{ - struct ti_sci_proc *tsp = data; - - ti_sci_proc_release(tsp); -} - static int k3_dsp_rproc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -136,7 +129,7 @@ static int k3_dsp_rproc_probe(struct platform_device *pdev) dev_err_probe(dev, ret, "ti_sci_proc_request failed\n"); return ret; } - ret = devm_add_action_or_reset(dev, k3_dsp_release_tsp, kproc->tsp); + ret = devm_add_action_or_reset(dev, k3_release_tsp, kproc->tsp); if (ret) return ret; diff --git a/drivers/remoteproc/ti_k3_m4_remoteproc.c b/drivers/remoteproc/ti_k3_m4_remoteproc.c index 41bca6b64517..3a11fd24eb52 100644 --- a/drivers/remoteproc/ti_k3_m4_remoteproc.c +++ b/drivers/remoteproc/ti_k3_m4_remoteproc.c @@ -21,13 +21,6 @@ #include "ti_sci_proc.h" #include "ti_k3_common.h" -static void k3_m4_release_tsp(void *data) -{ - struct ti_sci_proc *tsp = data; - - ti_sci_proc_release(tsp); -} - static const struct rproc_ops k3_m4_rproc_ops = { .prepare = k3_rproc_prepare, .unprepare = k3_rproc_unprepare, @@ -93,7 +86,7 @@ static int k3_m4_rproc_probe(struct platform_device *pdev) ret = ti_sci_proc_request(kproc->tsp); if (ret < 0) return dev_err_probe(dev, ret, "ti_sci_proc_request failed\n"); - ret = devm_add_action_or_reset(dev, k3_m4_release_tsp, kproc->tsp); + ret = devm_add_action_or_reset(dev, k3_release_tsp, kproc->tsp); if (ret) return ret; diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c b/drivers/remoteproc/ti_k3_r5_remoteproc.c index 3cd8391212f7..e34c04c135fc 100644 --- a/drivers/remoteproc/ti_k3_r5_remoteproc.c +++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c @@ -1017,13 +1017,6 @@ static int k3_r5_core_of_get_sram_memories(struct platform_device *pdev, return 0; } -static void k3_r5_release_tsp(void *data) -{ - struct ti_sci_proc *tsp = data; - - ti_sci_proc_release(tsp); -} - static int k3_r5_cluster_rproc_init(struct platform_device *pdev) { struct k3_r5_cluster *cluster = platform_get_drvdata(pdev); @@ -1109,7 +1102,7 @@ static int k3_r5_cluster_rproc_init(struct platform_device *pdev) goto out; } - ret = devm_add_action_or_reset(cdev, k3_r5_release_tsp, kproc->tsp); + ret = devm_add_action_or_reset(cdev, k3_release_tsp, kproc->tsp); if (ret) goto out; } |