mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
remoteproc: imx_rproc: Make detach operation platform-specific
Refactor the detach logic to support platform-specific implementations via the dcfg->ops->detach callback. Allow finer control over detach behavior depending on the remote processor management method, and make it easier to add detach support for new SoCs. The previous hardcoded SCU API detach logic is now moved into a dedicated imx_rproc_scu_api_detach() function, and registered via the plat ops structure. The generic imx_rproc_detach() now delegates to the platform-specific handler if available. Also, the dcfg->method check with IMX_RPROC_SCU_API is removed. No functional changes. Reviewed-by: Frank Li <Frank.Li@nxp.com> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Peng Fan <peng.fan@nxp.com> Link: https://lore.kernel.org/r/20251024-imx_rproc_c4-v4-2-af83ed3fdbba@nxp.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
This commit is contained in:
committed by
Mathieu Poirier
parent
ddbec021a3
commit
016a3d4bcf
@@ -575,13 +575,9 @@ static int imx_rproc_attach(struct rproc *rproc)
|
||||
return imx_rproc_xtr_mbox_init(rproc, true);
|
||||
}
|
||||
|
||||
static int imx_rproc_detach(struct rproc *rproc)
|
||||
static int imx_rproc_scu_api_detach(struct rproc *rproc)
|
||||
{
|
||||
struct imx_rproc *priv = rproc->priv;
|
||||
const struct imx_rproc_dcfg *dcfg = priv->dcfg;
|
||||
|
||||
if (dcfg->method != IMX_RPROC_SCU_API)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (imx_sc_rm_is_resource_owned(priv->ipc_handle, priv->rsrc_id))
|
||||
return -EOPNOTSUPP;
|
||||
@@ -591,6 +587,17 @@ static int imx_rproc_detach(struct rproc *rproc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int imx_rproc_detach(struct rproc *rproc)
|
||||
{
|
||||
struct imx_rproc *priv = rproc->priv;
|
||||
const struct imx_rproc_dcfg *dcfg = priv->dcfg;
|
||||
|
||||
if (!dcfg->ops || !dcfg->ops->detach)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return dcfg->ops->detach(rproc);
|
||||
}
|
||||
|
||||
static struct resource_table *imx_rproc_get_loaded_rsc_table(struct rproc *rproc, size_t *table_sz)
|
||||
{
|
||||
struct imx_rproc *priv = rproc->priv;
|
||||
@@ -1162,6 +1169,7 @@ static const struct imx_rproc_plat_ops imx_rproc_ops_mmio = {
|
||||
static const struct imx_rproc_plat_ops imx_rproc_ops_scu_api = {
|
||||
.start = imx_rproc_scu_api_start,
|
||||
.stop = imx_rproc_scu_api_stop,
|
||||
.detach = imx_rproc_scu_api_detach,
|
||||
.detect_mode = imx_rproc_scu_api_detect_mode,
|
||||
};
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ enum imx_rproc_method {
|
||||
struct imx_rproc_plat_ops {
|
||||
int (*start)(struct rproc *rproc);
|
||||
int (*stop)(struct rproc *rproc);
|
||||
int (*detach)(struct rproc *rproc);
|
||||
int (*detect_mode)(struct rproc *rproc);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user