mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/5] remoteproc: imx_rproc: misc clean up
@ 2025-09-18 11:51 Peng Fan
  2025-09-18 11:51 ` [PATCH 1/5] remoteproc: imx_rproc: Simplify clock enable logic using dcfg flags Peng Fan
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Peng Fan @ 2025-09-18 11:51 UTC (permalink / raw)
  To: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Frank Li, Daniel Baluta
  Cc: linux-remoteproc, imx, linux-arm-kernel, linux-kernel, Peng Fan

This is the 3rd series to cleanup the driver. This patchset is based
on the 2nd patchset [1] for the clean-up

Patch 1: simplify clock enable logic
Patch 2: Add a platform detach ops which will be easier to support new
         platforms
Patch 3: Enable runtime for all
Patch 4: Drop method assignment
Patch 5: Add an MAINTAINER entry for i.MX remoteproc drivers with
         Daniel and me as maintainer

This is the last patchset to do the clean up for imx_rproc.c.
After imx_dsp_rproc.c moved to use platform ops with swith-case removed,
the method entry from dcfg could be removed in the end.

Tested on
i.MX8MP-EVK, i.MX8MM-EVK, i.MX93-11x11-EVK, i.MX8QXP-MEK, and i.MX8ULP-EVK.

Thanks to Daniel and Frank for the internal reviewing.

[1] https://lore.kernel.org/linux-remoteproc/CAEnQRZD=1hxMmR98qfpoH_RFFrSrYMQ6ithFkjyqVgtqWKB_+Q@mail.gmail.com/T/#mc08d4cbf10e913d9e680ed93f5467603be37228a

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
Peng Fan (5):
      remoteproc: imx_rproc: Simplify clock enable logic using dcfg flags
      remoteproc: imx_rproc: Make detach operation platform-specific
      remoteproc: imx_rproc: Enable PM runtime support unconditionally
      remoteproc: imx_rproc: Remove the assignement to method
      MAINTAINERS: Add an entry for i.MX remoteproc driver

 MAINTAINERS                    |  8 ++++
 drivers/remoteproc/imx_rproc.c | 85 +++++++++++++++++-------------------------
 drivers/remoteproc/imx_rproc.h |  2 +
 3 files changed, 44 insertions(+), 51 deletions(-)
---
base-commit: 872c1e97ca571f8e1afff2659006a2948b9fb483
change-id: 20250916-imx_rproc_c2-2b9ad7882f4d

Best regards,
-- 
Peng Fan <peng.fan@nxp.com>


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/5] remoteproc: imx_rproc: Simplify clock enable logic using dcfg flags
  2025-09-18 11:51 [PATCH 0/5] remoteproc: imx_rproc: misc clean up Peng Fan
@ 2025-09-18 11:51 ` Peng Fan
  2025-09-18 12:32   ` Daniel Baluta
  2025-09-18 16:38   ` Frank Li
  2025-09-18 11:51 ` [PATCH 2/5] remoteproc: imx_rproc: Make detach operation platform-specific Peng Fan
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 16+ messages in thread
From: Peng Fan @ 2025-09-18 11:51 UTC (permalink / raw)
  To: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Frank Li, Daniel Baluta
  Cc: linux-remoteproc, imx, linux-arm-kernel, linux-kernel, Peng Fan

Simplify the clock enable logic by removing the dedicated
imx_rproc_clk_enable() function and integrate the clock handling directly
into the probe function to simplify the code.

Add a new IMX_RPROC_NEED_CLKS flag in dcfg to indicate whether clock
management is required for a given SoC. Update probe logic to conditionally
enable clocks based on the new flag.

Set the flag for applicable SoCs (e.g., i.MX7D, i.MX8MQ, i.MX93, etc.).

No functional changes.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/remoteproc/imx_rproc.c | 37 ++++++++++++-------------------------
 drivers/remoteproc/imx_rproc.h |  1 +
 2 files changed, 13 insertions(+), 25 deletions(-)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 694fbbb2f34061de22a3a815f8a6114159585f9e..71617b20f9d0ae698e7f655aae22e8895434f32c 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -1002,28 +1002,6 @@ static int imx_rproc_detect_mode(struct imx_rproc *priv)
 	return dcfg->ops->detect_mode(priv->rproc);
 }
 
-static int imx_rproc_clk_enable(struct imx_rproc *priv)
-{
-	const struct imx_rproc_dcfg *dcfg = priv->dcfg;
-	struct device *dev = priv->dev;
-
-	/* Remote core is not under control of Linux or it is managed by SCU API */
-	if (dcfg->method == IMX_RPROC_NONE || dcfg->method == IMX_RPROC_SCU_API)
-		return 0;
-
-	/*
-	 * clk for M4 block including memory. Should be
-	 * enabled before .start for FW transfer.
-	 */
-	priv->clk = devm_clk_get_enabled(dev, NULL);
-	if (IS_ERR(priv->clk)) {
-		dev_err(dev, "Failed to enable clock\n");
-		return PTR_ERR(priv->clk);
-	}
-
-	return 0;
-}
-
 static int imx_rproc_sys_off_handler(struct sys_off_data *data)
 {
 	struct rproc *rproc = data->cb_data;
@@ -1108,9 +1086,12 @@ static int imx_rproc_probe(struct platform_device *pdev)
 	if (ret)
 		return dev_err_probe(dev, ret, "failed on detect mode\n");
 
-	ret = imx_rproc_clk_enable(priv);
-	if (ret)
-		return dev_err_probe(dev, ret, "failed to enable clks\n");
+	/* Remote core is under control of Linux or clock is not managed by firmware */
+	if (dcfg->flags & IMX_RPROC_NEED_CLKS) {
+		priv->clk = devm_clk_get_enabled(dev, NULL);
+		if (IS_ERR(priv->clk))
+			return dev_err_probe(dev, PTR_ERR(priv->clk), "Failed to enable clock\n");
+	}
 
 	if (rproc->state != RPROC_DETACHED)
 		rproc->auto_boot = of_property_read_bool(np, "fsl,auto-boot");
@@ -1185,6 +1166,7 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mn_mmio = {
 	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mn),
 	.method		= IMX_RPROC_MMIO,
 	.ops		= &imx_rproc_ops_mmio,
+	.flags		= IMX_RPROC_NEED_CLKS,
 };
 
 static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mn = {
@@ -1192,6 +1174,7 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mn = {
 	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mn),
 	.method		= IMX_RPROC_SMC,
 	.ops		= &imx_rproc_ops_arm_smc,
+	.flags		= IMX_RPROC_NEED_CLKS,
 };
 
 static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mq = {
@@ -1203,6 +1186,7 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mq = {
 	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mq),
 	.method		= IMX_RPROC_MMIO,
 	.ops		= &imx_rproc_ops_mmio,
+	.flags		= IMX_RPROC_NEED_CLKS,
 };
 
 static const struct imx_rproc_dcfg imx_rproc_cfg_imx8qm = {
@@ -1241,6 +1225,7 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx7d = {
 	.att_size	= ARRAY_SIZE(imx_rproc_att_imx7d),
 	.method		= IMX_RPROC_MMIO,
 	.ops		= &imx_rproc_ops_mmio,
+	.flags		= IMX_RPROC_NEED_CLKS,
 };
 
 static const struct imx_rproc_dcfg imx_rproc_cfg_imx6sx = {
@@ -1252,6 +1237,7 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx6sx = {
 	.att_size	= ARRAY_SIZE(imx_rproc_att_imx6sx),
 	.method		= IMX_RPROC_MMIO,
 	.ops		= &imx_rproc_ops_mmio,
+	.flags		= IMX_RPROC_NEED_CLKS,
 };
 
 static const struct imx_rproc_dcfg imx_rproc_cfg_imx93 = {
@@ -1259,6 +1245,7 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx93 = {
 	.att_size	= ARRAY_SIZE(imx_rproc_att_imx93),
 	.method		= IMX_RPROC_SMC,
 	.ops		= &imx_rproc_ops_arm_smc,
+	.flags		= IMX_RPROC_NEED_CLKS,
 };
 
 static const struct of_device_id imx_rproc_of_match[] = {
diff --git a/drivers/remoteproc/imx_rproc.h b/drivers/remoteproc/imx_rproc.h
index 3a9adaaf048b396102feeb45488cd2ff125a807a..a9cba623560c85ea37e47401c392c06dada500aa 100644
--- a/drivers/remoteproc/imx_rproc.h
+++ b/drivers/remoteproc/imx_rproc.h
@@ -30,6 +30,7 @@ enum imx_rproc_method {
 
 /* dcfg flags */
 #define IMX_RPROC_NEED_SYSTEM_OFF	BIT(0)
+#define IMX_RPROC_NEED_CLKS		BIT(1)
 
 struct imx_rproc_plat_ops {
 	int (*start)(struct rproc *rproc);

-- 
2.37.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 2/5] remoteproc: imx_rproc: Make detach operation platform-specific
  2025-09-18 11:51 [PATCH 0/5] remoteproc: imx_rproc: misc clean up Peng Fan
  2025-09-18 11:51 ` [PATCH 1/5] remoteproc: imx_rproc: Simplify clock enable logic using dcfg flags Peng Fan
@ 2025-09-18 11:51 ` Peng Fan
  2025-09-18 12:36   ` Daniel Baluta
  2025-09-18 16:39   ` Frank Li
  2025-09-18 11:51 ` [PATCH 3/5] remoteproc: imx_rproc: Enable PM runtime support unconditionally Peng Fan
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 16+ messages in thread
From: Peng Fan @ 2025-09-18 11:51 UTC (permalink / raw)
  To: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Frank Li, Daniel Baluta
  Cc: linux-remoteproc, imx, linux-arm-kernel, linux-kernel, Peng Fan

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.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/remoteproc/imx_rproc.c | 18 +++++++++++++-----
 drivers/remoteproc/imx_rproc.h |  1 +
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 71617b20f9d0ae698e7f655aae22e8895434f32c..74c958d44611b66e024180d69d71daac5a2f9e76 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -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;
@@ -1152,6 +1159,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,
 };
 
diff --git a/drivers/remoteproc/imx_rproc.h b/drivers/remoteproc/imx_rproc.h
index a9cba623560c85ea37e47401c392c06dada500aa..aeed08bdfb5619c7afd7201589f417cfd6745818 100644
--- a/drivers/remoteproc/imx_rproc.h
+++ b/drivers/remoteproc/imx_rproc.h
@@ -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);
 };
 

-- 
2.37.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 3/5] remoteproc: imx_rproc: Enable PM runtime support unconditionally
  2025-09-18 11:51 [PATCH 0/5] remoteproc: imx_rproc: misc clean up Peng Fan
  2025-09-18 11:51 ` [PATCH 1/5] remoteproc: imx_rproc: Simplify clock enable logic using dcfg flags Peng Fan
  2025-09-18 11:51 ` [PATCH 2/5] remoteproc: imx_rproc: Make detach operation platform-specific Peng Fan
@ 2025-09-18 11:51 ` Peng Fan
  2025-09-18 12:37   ` Daniel Baluta
  2025-09-18 16:40   ` Frank Li
  2025-09-18 11:51 ` [PATCH 4/5] remoteproc: imx_rproc: Remove the assignement to method Peng Fan
  2025-09-18 11:51 ` [PATCH 5/5] MAINTAINERS: Add an entry for i.MX remoteproc driver Peng Fan
  4 siblings, 2 replies; 16+ messages in thread
From: Peng Fan @ 2025-09-18 11:51 UTC (permalink / raw)
  To: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Frank Li, Daniel Baluta
  Cc: linux-remoteproc, imx, linux-arm-kernel, linux-kernel, Peng Fan

PM runtime support is safe and applicable across all i.MX platforms, not
just those using the SCU API. Remove the conditional check and enable PM
runtime unconditionally to simplify the code and ensure consistent power
management behavior.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/remoteproc/imx_rproc.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 74c958d44611b66e024180d69d71daac5a2f9e76..69b57cb4b251d9fb65a23e139a1960bf29c175ed 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -1123,19 +1123,17 @@ static int imx_rproc_probe(struct platform_device *pdev)
 			return dev_err_probe(dev, ret, "register restart handler failure\n");
 	}
 
-	if (dcfg->method == IMX_RPROC_SCU_API) {
-		ret = devm_pm_runtime_enable(dev);
-		if (ret)
-			return dev_err_probe(dev, ret, "Failed to enable runtime PM\n");
+	ret = devm_pm_runtime_enable(dev);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to enable runtime PM\n");
 
-		ret = pm_runtime_resume_and_get(dev);
-		if (ret)
-			return dev_err_probe(dev, ret, "pm_runtime get failed\n");
+	ret = pm_runtime_resume_and_get(dev);
+	if (ret)
+		return dev_err_probe(dev, ret, "pm_runtime get failed\n");
 
-		ret = devm_add_action_or_reset(dev, imx_rproc_pm_runtime_put, dev);
-		if (ret)
-			return dev_err_probe(dev, ret, "Failed to add devm disable pm action\n");
-	}
+	ret = devm_add_action_or_reset(dev, imx_rproc_pm_runtime_put, dev);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to add devm disable pm action\n");
 
 	ret = devm_rproc_add(dev, rproc);
 	if (ret)

-- 
2.37.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 4/5] remoteproc: imx_rproc: Remove the assignement to method
  2025-09-18 11:51 [PATCH 0/5] remoteproc: imx_rproc: misc clean up Peng Fan
                   ` (2 preceding siblings ...)
  2025-09-18 11:51 ` [PATCH 3/5] remoteproc: imx_rproc: Enable PM runtime support unconditionally Peng Fan
@ 2025-09-18 11:51 ` Peng Fan
  2025-09-19 11:26   ` Daniel Baluta
  2025-09-19 14:52   ` Frank Li
  2025-09-18 11:51 ` [PATCH 5/5] MAINTAINERS: Add an entry for i.MX remoteproc driver Peng Fan
  4 siblings, 2 replies; 16+ messages in thread
From: Peng Fan @ 2025-09-18 11:51 UTC (permalink / raw)
  To: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Frank Li, Daniel Baluta
  Cc: linux-remoteproc, imx, linux-arm-kernel, linux-kernel, Peng Fan

There is no referring to the field method, it could be removed now.

No functional changes.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/remoteproc/imx_rproc.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 69b57cb4b251d9fb65a23e139a1960bf29c175ed..46fe7c147ce01ee07a610341b85544b79baadd13 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -1170,7 +1170,6 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mn_mmio = {
 	.gpr_wait	= IMX8M_GPR22_CM7_CPUWAIT,
 	.att		= imx_rproc_att_imx8mn,
 	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mn),
-	.method		= IMX_RPROC_MMIO,
 	.ops		= &imx_rproc_ops_mmio,
 	.flags		= IMX_RPROC_NEED_CLKS,
 };
@@ -1178,7 +1177,6 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mn_mmio = {
 static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mn = {
 	.att		= imx_rproc_att_imx8mn,
 	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mn),
-	.method		= IMX_RPROC_SMC,
 	.ops		= &imx_rproc_ops_arm_smc,
 	.flags		= IMX_RPROC_NEED_CLKS,
 };
@@ -1190,7 +1188,6 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mq = {
 	.src_stop	= IMX7D_M4_STOP,
 	.att		= imx_rproc_att_imx8mq,
 	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mq),
-	.method		= IMX_RPROC_MMIO,
 	.ops		= &imx_rproc_ops_mmio,
 	.flags		= IMX_RPROC_NEED_CLKS,
 };
@@ -1198,27 +1195,23 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mq = {
 static const struct imx_rproc_dcfg imx_rproc_cfg_imx8qm = {
 	.att            = imx_rproc_att_imx8qm,
 	.att_size       = ARRAY_SIZE(imx_rproc_att_imx8qm),
-	.method         = IMX_RPROC_SCU_API,
 	.ops		= &imx_rproc_ops_scu_api,
 };
 
 static const struct imx_rproc_dcfg imx_rproc_cfg_imx8qxp = {
 	.att		= imx_rproc_att_imx8qxp,
 	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8qxp),
-	.method		= IMX_RPROC_SCU_API,
 	.ops		= &imx_rproc_ops_scu_api,
 };
 
 static const struct imx_rproc_dcfg imx_rproc_cfg_imx8ulp = {
 	.att		= imx_rproc_att_imx8ulp,
 	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8ulp),
-	.method		= IMX_RPROC_NONE,
 };
 
 static const struct imx_rproc_dcfg imx_rproc_cfg_imx7ulp = {
 	.att		= imx_rproc_att_imx7ulp,
 	.att_size	= ARRAY_SIZE(imx_rproc_att_imx7ulp),
-	.method		= IMX_RPROC_NONE,
 	.flags		= IMX_RPROC_NEED_SYSTEM_OFF,
 };
 
@@ -1229,7 +1222,6 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx7d = {
 	.src_stop	= IMX7D_M4_STOP,
 	.att		= imx_rproc_att_imx7d,
 	.att_size	= ARRAY_SIZE(imx_rproc_att_imx7d),
-	.method		= IMX_RPROC_MMIO,
 	.ops		= &imx_rproc_ops_mmio,
 	.flags		= IMX_RPROC_NEED_CLKS,
 };
@@ -1241,7 +1233,6 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx6sx = {
 	.src_stop	= IMX6SX_M4_STOP,
 	.att		= imx_rproc_att_imx6sx,
 	.att_size	= ARRAY_SIZE(imx_rproc_att_imx6sx),
-	.method		= IMX_RPROC_MMIO,
 	.ops		= &imx_rproc_ops_mmio,
 	.flags		= IMX_RPROC_NEED_CLKS,
 };
@@ -1249,7 +1240,6 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx6sx = {
 static const struct imx_rproc_dcfg imx_rproc_cfg_imx93 = {
 	.att		= imx_rproc_att_imx93,
 	.att_size	= ARRAY_SIZE(imx_rproc_att_imx93),
-	.method		= IMX_RPROC_SMC,
 	.ops		= &imx_rproc_ops_arm_smc,
 	.flags		= IMX_RPROC_NEED_CLKS,
 };

-- 
2.37.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 5/5] MAINTAINERS: Add an entry for i.MX remoteproc driver
  2025-09-18 11:51 [PATCH 0/5] remoteproc: imx_rproc: misc clean up Peng Fan
                   ` (3 preceding siblings ...)
  2025-09-18 11:51 ` [PATCH 4/5] remoteproc: imx_rproc: Remove the assignement to method Peng Fan
@ 2025-09-18 11:51 ` Peng Fan
  4 siblings, 0 replies; 16+ messages in thread
From: Peng Fan @ 2025-09-18 11:51 UTC (permalink / raw)
  To: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Frank Li, Daniel Baluta
  Cc: linux-remoteproc, imx, linux-arm-kernel, linux-kernel, Peng Fan

Add an entry for the i.MX remoteproc driver

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 MAINTAINERS | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index df319f9762b369a2746ee7f41334be9b57e7bf9b..0bf57317c6607d72020e1401540cdbc77b70c4ff 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -18508,6 +18508,14 @@ F:	Documentation/devicetree/bindings/clock/*imx*
 F:	drivers/clk/imx/
 F:	include/dt-bindings/clock/*imx*
 
+NXP i.MX REMOTEPROC DRIVERS
+M:	Peng Fan <peng.fan@nxp.com>
+M:	Daniel Baluta <daniel.baluta@nxp.com>
+L:	linux-remoteproc@vger.kernel.org
+L:	imx@lists.linux.dev
+S:	Maintained
+F:	drivers/remoteproc/imx*
+
 NXP NETC TIMER PTP CLOCK DRIVER
 M:	Wei Fang <wei.fang@nxp.com>
 M:	Clark Wang <xiaoning.wang@nxp.com>

-- 
2.37.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/5] remoteproc: imx_rproc: Simplify clock enable logic using dcfg flags
  2025-09-18 11:51 ` [PATCH 1/5] remoteproc: imx_rproc: Simplify clock enable logic using dcfg flags Peng Fan
@ 2025-09-18 12:32   ` Daniel Baluta
  2025-09-19  2:02     ` Peng Fan
  2025-09-18 16:38   ` Frank Li
  1 sibling, 1 reply; 16+ messages in thread
From: Daniel Baluta @ 2025-09-18 12:32 UTC (permalink / raw)
  To: Peng Fan
  Cc: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Frank Li, Daniel Baluta,
	linux-remoteproc, imx, linux-arm-kernel, linux-kernel

On Thu, Sep 18, 2025 at 2:51 PM Peng Fan <peng.fan@nxp.com> wrote:
>
> Simplify the clock enable logic by removing the dedicated
> imx_rproc_clk_enable() function and integrate the clock handling directly
> into the probe function to simplify the code.
>
> Add a new IMX_RPROC_NEED_CLKS flag in dcfg to indicate whether clock
> management is required for a given SoC. Update probe logic to conditionally
> enable clocks based on the new flag.
>

<snip>

> -               return dev_err_probe(dev, ret, "failed to enable clks\n");
> +       /* Remote core is under control of Linux or clock is not managed by firmware */

I see that you negate the comment from imx_rproc_clk_enable but with
the negation
OR becomes AND.

So, the comment should be:

/* Handle clocks when remote core is under control of Linux AND the
clocks are not managed by remote side  FW */

Also, do we really need this flag?
Shouldn't we just make a decision based on the fact that clk is in the
device tree or not?

> +       if (dcfg->flags & IMX_RPROC_NEED_CLKS) {
> +               priv->clk = devm_clk_get_enabled(dev, NULL);
> +               if (IS_ERR(priv->clk))
> +                       return dev_err_probe(dev, PTR_ERR(priv->clk), "Failed to enable clock\n");

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/5] remoteproc: imx_rproc: Make detach operation platform-specific
  2025-09-18 11:51 ` [PATCH 2/5] remoteproc: imx_rproc: Make detach operation platform-specific Peng Fan
@ 2025-09-18 12:36   ` Daniel Baluta
  2025-09-18 16:39   ` Frank Li
  1 sibling, 0 replies; 16+ messages in thread
From: Daniel Baluta @ 2025-09-18 12:36 UTC (permalink / raw)
  To: Peng Fan
  Cc: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Frank Li, Daniel Baluta,
	linux-remoteproc, imx, linux-arm-kernel, linux-kernel

On Thu, Sep 18, 2025 at 2:52 PM Peng Fan <peng.fan@nxp.com> wrote:
>
> 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.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>

Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/5] remoteproc: imx_rproc: Enable PM runtime support unconditionally
  2025-09-18 11:51 ` [PATCH 3/5] remoteproc: imx_rproc: Enable PM runtime support unconditionally Peng Fan
@ 2025-09-18 12:37   ` Daniel Baluta
  2025-09-18 16:40   ` Frank Li
  1 sibling, 0 replies; 16+ messages in thread
From: Daniel Baluta @ 2025-09-18 12:37 UTC (permalink / raw)
  To: Peng Fan
  Cc: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Frank Li, Daniel Baluta,
	linux-remoteproc, imx, linux-arm-kernel, linux-kernel

On Thu, Sep 18, 2025 at 2:52 PM Peng Fan <peng.fan@nxp.com> wrote:
>
> PM runtime support is safe and applicable across all i.MX platforms, not
> just those using the SCU API. Remove the conditional check and enable PM
> runtime unconditionally to simplify the code and ensure consistent power
> management behavior.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>

Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/5] remoteproc: imx_rproc: Simplify clock enable logic using dcfg flags
  2025-09-18 11:51 ` [PATCH 1/5] remoteproc: imx_rproc: Simplify clock enable logic using dcfg flags Peng Fan
  2025-09-18 12:32   ` Daniel Baluta
@ 2025-09-18 16:38   ` Frank Li
  1 sibling, 0 replies; 16+ messages in thread
From: Frank Li @ 2025-09-18 16:38 UTC (permalink / raw)
  To: Peng Fan
  Cc: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Daniel Baluta,
	linux-remoteproc, imx, linux-arm-kernel, linux-kernel

On Thu, Sep 18, 2025 at 07:51:16PM +0800, Peng Fan wrote:
> Simplify the clock enable logic by removing the dedicated
> imx_rproc_clk_enable() function and integrate the clock handling directly
> into the probe function to simplify the code.
>
> Add a new IMX_RPROC_NEED_CLKS flag in dcfg to indicate whether clock
> management is required for a given SoC. Update probe logic to conditionally
> enable clocks based on the new flag.
>
> Set the flag for applicable SoCs (e.g., i.MX7D, i.MX8MQ, i.MX93, etc.).
>
> No functional changes.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> ---
>  drivers/remoteproc/imx_rproc.c | 37 ++++++++++++-------------------------
>  drivers/remoteproc/imx_rproc.h |  1 +
>  2 files changed, 13 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> index 694fbbb2f34061de22a3a815f8a6114159585f9e..71617b20f9d0ae698e7f655aae22e8895434f32c 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -1002,28 +1002,6 @@ static int imx_rproc_detect_mode(struct imx_rproc *priv)
>  	return dcfg->ops->detect_mode(priv->rproc);
>  }
>
> -static int imx_rproc_clk_enable(struct imx_rproc *priv)
> -{
> -	const struct imx_rproc_dcfg *dcfg = priv->dcfg;
> -	struct device *dev = priv->dev;
> -
> -	/* Remote core is not under control of Linux or it is managed by SCU API */
> -	if (dcfg->method == IMX_RPROC_NONE || dcfg->method == IMX_RPROC_SCU_API)
> -		return 0;
> -
> -	/*
> -	 * clk for M4 block including memory. Should be
> -	 * enabled before .start for FW transfer.
> -	 */
> -	priv->clk = devm_clk_get_enabled(dev, NULL);
> -	if (IS_ERR(priv->clk)) {
> -		dev_err(dev, "Failed to enable clock\n");
> -		return PTR_ERR(priv->clk);
> -	}
> -
> -	return 0;
> -}
> -
>  static int imx_rproc_sys_off_handler(struct sys_off_data *data)
>  {
>  	struct rproc *rproc = data->cb_data;
> @@ -1108,9 +1086,12 @@ static int imx_rproc_probe(struct platform_device *pdev)
>  	if (ret)
>  		return dev_err_probe(dev, ret, "failed on detect mode\n");
>
> -	ret = imx_rproc_clk_enable(priv);
> -	if (ret)
> -		return dev_err_probe(dev, ret, "failed to enable clks\n");
> +	/* Remote core is under control of Linux or clock is not managed by firmware */
> +	if (dcfg->flags & IMX_RPROC_NEED_CLKS) {
> +		priv->clk = devm_clk_get_enabled(dev, NULL);
> +		if (IS_ERR(priv->clk))
> +			return dev_err_probe(dev, PTR_ERR(priv->clk), "Failed to enable clock\n");
> +	}
>
>  	if (rproc->state != RPROC_DETACHED)
>  		rproc->auto_boot = of_property_read_bool(np, "fsl,auto-boot");
> @@ -1185,6 +1166,7 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mn_mmio = {
>  	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mn),
>  	.method		= IMX_RPROC_MMIO,
>  	.ops		= &imx_rproc_ops_mmio,
> +	.flags		= IMX_RPROC_NEED_CLKS,
>  };
>
>  static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mn = {
> @@ -1192,6 +1174,7 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mn = {
>  	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mn),
>  	.method		= IMX_RPROC_SMC,
>  	.ops		= &imx_rproc_ops_arm_smc,
> +	.flags		= IMX_RPROC_NEED_CLKS,
>  };
>
>  static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mq = {
> @@ -1203,6 +1186,7 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mq = {
>  	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mq),
>  	.method		= IMX_RPROC_MMIO,
>  	.ops		= &imx_rproc_ops_mmio,
> +	.flags		= IMX_RPROC_NEED_CLKS,
>  };
>
>  static const struct imx_rproc_dcfg imx_rproc_cfg_imx8qm = {
> @@ -1241,6 +1225,7 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx7d = {
>  	.att_size	= ARRAY_SIZE(imx_rproc_att_imx7d),
>  	.method		= IMX_RPROC_MMIO,
>  	.ops		= &imx_rproc_ops_mmio,
> +	.flags		= IMX_RPROC_NEED_CLKS,
>  };
>
>  static const struct imx_rproc_dcfg imx_rproc_cfg_imx6sx = {
> @@ -1252,6 +1237,7 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx6sx = {
>  	.att_size	= ARRAY_SIZE(imx_rproc_att_imx6sx),
>  	.method		= IMX_RPROC_MMIO,
>  	.ops		= &imx_rproc_ops_mmio,
> +	.flags		= IMX_RPROC_NEED_CLKS,
>  };
>
>  static const struct imx_rproc_dcfg imx_rproc_cfg_imx93 = {
> @@ -1259,6 +1245,7 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx93 = {
>  	.att_size	= ARRAY_SIZE(imx_rproc_att_imx93),
>  	.method		= IMX_RPROC_SMC,
>  	.ops		= &imx_rproc_ops_arm_smc,
> +	.flags		= IMX_RPROC_NEED_CLKS,
>  };
>
>  static const struct of_device_id imx_rproc_of_match[] = {
> diff --git a/drivers/remoteproc/imx_rproc.h b/drivers/remoteproc/imx_rproc.h
> index 3a9adaaf048b396102feeb45488cd2ff125a807a..a9cba623560c85ea37e47401c392c06dada500aa 100644
> --- a/drivers/remoteproc/imx_rproc.h
> +++ b/drivers/remoteproc/imx_rproc.h
> @@ -30,6 +30,7 @@ enum imx_rproc_method {
>
>  /* dcfg flags */
>  #define IMX_RPROC_NEED_SYSTEM_OFF	BIT(0)
> +#define IMX_RPROC_NEED_CLKS		BIT(1)
>
>  struct imx_rproc_plat_ops {
>  	int (*start)(struct rproc *rproc);
>
> --
> 2.37.1
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/5] remoteproc: imx_rproc: Make detach operation platform-specific
  2025-09-18 11:51 ` [PATCH 2/5] remoteproc: imx_rproc: Make detach operation platform-specific Peng Fan
  2025-09-18 12:36   ` Daniel Baluta
@ 2025-09-18 16:39   ` Frank Li
  1 sibling, 0 replies; 16+ messages in thread
From: Frank Li @ 2025-09-18 16:39 UTC (permalink / raw)
  To: Peng Fan
  Cc: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Daniel Baluta,
	linux-remoteproc, imx, linux-arm-kernel, linux-kernel

On Thu, Sep 18, 2025 at 07:51:17PM +0800, Peng Fan wrote:
> 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.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> ---
>  drivers/remoteproc/imx_rproc.c | 18 +++++++++++++-----
>  drivers/remoteproc/imx_rproc.h |  1 +
>  2 files changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> index 71617b20f9d0ae698e7f655aae22e8895434f32c..74c958d44611b66e024180d69d71daac5a2f9e76 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -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;
> @@ -1152,6 +1159,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,
>  };
>
> diff --git a/drivers/remoteproc/imx_rproc.h b/drivers/remoteproc/imx_rproc.h
> index a9cba623560c85ea37e47401c392c06dada500aa..aeed08bdfb5619c7afd7201589f417cfd6745818 100644
> --- a/drivers/remoteproc/imx_rproc.h
> +++ b/drivers/remoteproc/imx_rproc.h
> @@ -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);
>  };
>
>
> --
> 2.37.1
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/5] remoteproc: imx_rproc: Enable PM runtime support unconditionally
  2025-09-18 11:51 ` [PATCH 3/5] remoteproc: imx_rproc: Enable PM runtime support unconditionally Peng Fan
  2025-09-18 12:37   ` Daniel Baluta
@ 2025-09-18 16:40   ` Frank Li
  1 sibling, 0 replies; 16+ messages in thread
From: Frank Li @ 2025-09-18 16:40 UTC (permalink / raw)
  To: Peng Fan
  Cc: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Daniel Baluta,
	linux-remoteproc, imx, linux-arm-kernel, linux-kernel

On Thu, Sep 18, 2025 at 07:51:18PM +0800, Peng Fan wrote:
> PM runtime support is safe and applicable across all i.MX platforms, not
> just those using the SCU API. Remove the conditional check and enable PM
> runtime unconditionally to simplify the code and ensure consistent power
> management behavior.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
>  drivers/remoteproc/imx_rproc.c | 20 +++++++++-----------
>  1 file changed, 9 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> index 74c958d44611b66e024180d69d71daac5a2f9e76..69b57cb4b251d9fb65a23e139a1960bf29c175ed 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -1123,19 +1123,17 @@ static int imx_rproc_probe(struct platform_device *pdev)
>  			return dev_err_probe(dev, ret, "register restart handler failure\n");
>  	}
>
> -	if (dcfg->method == IMX_RPROC_SCU_API) {
> -		ret = devm_pm_runtime_enable(dev);
> -		if (ret)
> -			return dev_err_probe(dev, ret, "Failed to enable runtime PM\n");
> +	ret = devm_pm_runtime_enable(dev);
> +	if (ret)
> +		return dev_err_probe(dev, ret, "Failed to enable runtime PM\n");
>
> -		ret = pm_runtime_resume_and_get(dev);
> -		if (ret)
> -			return dev_err_probe(dev, ret, "pm_runtime get failed\n");
> +	ret = pm_runtime_resume_and_get(dev);
> +	if (ret)
> +		return dev_err_probe(dev, ret, "pm_runtime get failed\n");
>
> -		ret = devm_add_action_or_reset(dev, imx_rproc_pm_runtime_put, dev);
> -		if (ret)
> -			return dev_err_probe(dev, ret, "Failed to add devm disable pm action\n");
> -	}
> +	ret = devm_add_action_or_reset(dev, imx_rproc_pm_runtime_put, dev);
> +	if (ret)
> +		return dev_err_probe(dev, ret, "Failed to add devm disable pm action\n");
>
>  	ret = devm_rproc_add(dev, rproc);
>  	if (ret)
>
> --
> 2.37.1
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [PATCH 1/5] remoteproc: imx_rproc: Simplify clock enable logic using dcfg flags
  2025-09-18 12:32   ` Daniel Baluta
@ 2025-09-19  2:02     ` Peng Fan
  2025-09-19  8:25       ` Daniel Baluta
  0 siblings, 1 reply; 16+ messages in thread
From: Peng Fan @ 2025-09-19  2:02 UTC (permalink / raw)
  To: Daniel Baluta
  Cc: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Frank Li, Daniel Baluta,
	linux-remoteproc, imx, linux-arm-kernel, linux-kernel

Hi Daniel,

> Subject: Re: [PATCH 1/5] remoteproc: imx_rproc: Simplify clock enable
> logic using dcfg flags
> > +       /* Remote core is under control of Linux or clock is not
> > + managed by firmware */
> 
> I see that you negate the comment from imx_rproc_clk_enable but
> with the negation OR becomes AND.
> 
> So, the comment should be:
> 
> /* Handle clocks when remote core is under control of Linux AND the
> clocks are not managed by remote side  FW */

I thought this flag is clear that clk should be managed by driver.
I will update the comment.

> 
> Also, do we really need this flag?
> Shouldn't we just make a decision based on the fact that clk is in the
> device tree or not?

From hardware perspective, there is always clk for the remote cores.
So DT describe hardware, a clk property should be there.

But NXP system firmware manages the CLK automatically, no need
driver to do that.  So this flag is required here.

Thanks,
Peng.

> 
> > +       if (dcfg->flags & IMX_RPROC_NEED_CLKS) {
> > +               priv->clk = devm_clk_get_enabled(dev, NULL);
> > +               if (IS_ERR(priv->clk))
> > +                       return dev_err_probe(dev, PTR_ERR(priv->clk),
> > + "Failed to enable clock\n");

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/5] remoteproc: imx_rproc: Simplify clock enable logic using dcfg flags
  2025-09-19  2:02     ` Peng Fan
@ 2025-09-19  8:25       ` Daniel Baluta
  0 siblings, 0 replies; 16+ messages in thread
From: Daniel Baluta @ 2025-09-19  8:25 UTC (permalink / raw)
  To: Peng Fan
  Cc: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Frank Li, Daniel Baluta,
	linux-remoteproc, imx, linux-arm-kernel, linux-kernel

On Fri, Sep 19, 2025 at 5:02 AM Peng Fan <peng.fan@nxp.com> wrote:
>
> Hi Daniel,
>
> > Subject: Re: [PATCH 1/5] remoteproc: imx_rproc: Simplify clock enable
> > logic using dcfg flags
> > > +       /* Remote core is under control of Linux or clock is not
> > > + managed by firmware */
> >
> > I see that you negate the comment from imx_rproc_clk_enable but
> > with the negation OR becomes AND.
> >
> > So, the comment should be:
> >
> > /* Handle clocks when remote core is under control of Linux AND the
> > clocks are not managed by remote side  FW */
>
> I thought this flag is clear that clk should be managed by driver.
> I will update the comment.
>
> >
> > Also, do we really need this flag?
> > Shouldn't we just make a decision based on the fact that clk is in the
> > device tree or not?
>
> From hardware perspective, there is always clk for the remote cores.
> So DT describe hardware, a clk property should be there.
>
> But NXP system firmware manages the CLK automatically, no need
> driver to do that.  So this flag is required here.


OK, makes sense. Thanks. With comment changed you can add my

Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>


thanks,
Daniel.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/5] remoteproc: imx_rproc: Remove the assignement to method
  2025-09-18 11:51 ` [PATCH 4/5] remoteproc: imx_rproc: Remove the assignement to method Peng Fan
@ 2025-09-19 11:26   ` Daniel Baluta
  2025-09-19 14:52   ` Frank Li
  1 sibling, 0 replies; 16+ messages in thread
From: Daniel Baluta @ 2025-09-19 11:26 UTC (permalink / raw)
  To: Peng Fan
  Cc: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Frank Li, Daniel Baluta,
	linux-remoteproc, imx, linux-arm-kernel, linux-kernel

On Thu, Sep 18, 2025 at 2:53 PM Peng Fan <peng.fan@nxp.com> wrote:
>
> There is no referring to the field method, it could be removed now.
>
> No functional changes.

Please mention that you are no longer require to provide .method with
imx_rproc. We are still not
removing the filed in imx_rproc_dcfg struct because is used with imx_dsp_rproc.

With that,

Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/5] remoteproc: imx_rproc: Remove the assignement to method
  2025-09-18 11:51 ` [PATCH 4/5] remoteproc: imx_rproc: Remove the assignement to method Peng Fan
  2025-09-19 11:26   ` Daniel Baluta
@ 2025-09-19 14:52   ` Frank Li
  1 sibling, 0 replies; 16+ messages in thread
From: Frank Li @ 2025-09-19 14:52 UTC (permalink / raw)
  To: Peng Fan
  Cc: Bjorn Andersson, Mathieu Poirier, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Daniel Baluta,
	linux-remoteproc, imx, linux-arm-kernel, linux-kernel

On Thu, Sep 18, 2025 at 07:51:19PM +0800, Peng Fan wrote:
> There is no referring to the field method, it could be removed now.
>
> No functional changes.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>

Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
>  drivers/remoteproc/imx_rproc.c | 10 ----------
>  1 file changed, 10 deletions(-)
>
> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> index 69b57cb4b251d9fb65a23e139a1960bf29c175ed..46fe7c147ce01ee07a610341b85544b79baadd13 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -1170,7 +1170,6 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mn_mmio = {
>  	.gpr_wait	= IMX8M_GPR22_CM7_CPUWAIT,
>  	.att		= imx_rproc_att_imx8mn,
>  	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mn),
> -	.method		= IMX_RPROC_MMIO,
>  	.ops		= &imx_rproc_ops_mmio,
>  	.flags		= IMX_RPROC_NEED_CLKS,
>  };
> @@ -1178,7 +1177,6 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mn_mmio = {
>  static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mn = {
>  	.att		= imx_rproc_att_imx8mn,
>  	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mn),
> -	.method		= IMX_RPROC_SMC,
>  	.ops		= &imx_rproc_ops_arm_smc,
>  	.flags		= IMX_RPROC_NEED_CLKS,
>  };
> @@ -1190,7 +1188,6 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mq = {
>  	.src_stop	= IMX7D_M4_STOP,
>  	.att		= imx_rproc_att_imx8mq,
>  	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mq),
> -	.method		= IMX_RPROC_MMIO,
>  	.ops		= &imx_rproc_ops_mmio,
>  	.flags		= IMX_RPROC_NEED_CLKS,
>  };
> @@ -1198,27 +1195,23 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mq = {
>  static const struct imx_rproc_dcfg imx_rproc_cfg_imx8qm = {
>  	.att            = imx_rproc_att_imx8qm,
>  	.att_size       = ARRAY_SIZE(imx_rproc_att_imx8qm),
> -	.method         = IMX_RPROC_SCU_API,
>  	.ops		= &imx_rproc_ops_scu_api,
>  };
>
>  static const struct imx_rproc_dcfg imx_rproc_cfg_imx8qxp = {
>  	.att		= imx_rproc_att_imx8qxp,
>  	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8qxp),
> -	.method		= IMX_RPROC_SCU_API,
>  	.ops		= &imx_rproc_ops_scu_api,
>  };
>
>  static const struct imx_rproc_dcfg imx_rproc_cfg_imx8ulp = {
>  	.att		= imx_rproc_att_imx8ulp,
>  	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8ulp),
> -	.method		= IMX_RPROC_NONE,
>  };
>
>  static const struct imx_rproc_dcfg imx_rproc_cfg_imx7ulp = {
>  	.att		= imx_rproc_att_imx7ulp,
>  	.att_size	= ARRAY_SIZE(imx_rproc_att_imx7ulp),
> -	.method		= IMX_RPROC_NONE,
>  	.flags		= IMX_RPROC_NEED_SYSTEM_OFF,
>  };
>
> @@ -1229,7 +1222,6 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx7d = {
>  	.src_stop	= IMX7D_M4_STOP,
>  	.att		= imx_rproc_att_imx7d,
>  	.att_size	= ARRAY_SIZE(imx_rproc_att_imx7d),
> -	.method		= IMX_RPROC_MMIO,
>  	.ops		= &imx_rproc_ops_mmio,
>  	.flags		= IMX_RPROC_NEED_CLKS,
>  };
> @@ -1241,7 +1233,6 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx6sx = {
>  	.src_stop	= IMX6SX_M4_STOP,
>  	.att		= imx_rproc_att_imx6sx,
>  	.att_size	= ARRAY_SIZE(imx_rproc_att_imx6sx),
> -	.method		= IMX_RPROC_MMIO,
>  	.ops		= &imx_rproc_ops_mmio,
>  	.flags		= IMX_RPROC_NEED_CLKS,
>  };
> @@ -1249,7 +1240,6 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx6sx = {
>  static const struct imx_rproc_dcfg imx_rproc_cfg_imx93 = {
>  	.att		= imx_rproc_att_imx93,
>  	.att_size	= ARRAY_SIZE(imx_rproc_att_imx93),
> -	.method		= IMX_RPROC_SMC,
>  	.ops		= &imx_rproc_ops_arm_smc,
>  	.flags		= IMX_RPROC_NEED_CLKS,
>  };
>
> --
> 2.37.1
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2025-09-19 14:52 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-18 11:51 [PATCH 0/5] remoteproc: imx_rproc: misc clean up Peng Fan
2025-09-18 11:51 ` [PATCH 1/5] remoteproc: imx_rproc: Simplify clock enable logic using dcfg flags Peng Fan
2025-09-18 12:32   ` Daniel Baluta
2025-09-19  2:02     ` Peng Fan
2025-09-19  8:25       ` Daniel Baluta
2025-09-18 16:38   ` Frank Li
2025-09-18 11:51 ` [PATCH 2/5] remoteproc: imx_rproc: Make detach operation platform-specific Peng Fan
2025-09-18 12:36   ` Daniel Baluta
2025-09-18 16:39   ` Frank Li
2025-09-18 11:51 ` [PATCH 3/5] remoteproc: imx_rproc: Enable PM runtime support unconditionally Peng Fan
2025-09-18 12:37   ` Daniel Baluta
2025-09-18 16:40   ` Frank Li
2025-09-18 11:51 ` [PATCH 4/5] remoteproc: imx_rproc: Remove the assignement to method Peng Fan
2025-09-19 11:26   ` Daniel Baluta
2025-09-19 14:52   ` Frank Li
2025-09-18 11:51 ` [PATCH 5/5] MAINTAINERS: Add an entry for i.MX remoteproc driver Peng Fan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®