public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: Laurentiu Mihalcea <laurentiumihalcea111@gmail•com>
To: Bjorn Andersson <andersson@kernel•org>,
	Mathieu Poirier <mathieu.poirier@linaro•org>,
	Rob Herring <robh@kernel•org>,
	Krzysztof Kozlowski <krzk+dt@kernel•org>,
	Conor Dooley <conor+dt@kernel•org>, Frank Li <Frank.Li@nxp•com>,
	Sascha Hauer <s.hauer@pengutronix•de>,
	Peng Fan <peng.fan@nxp•com>, Fabio Estevam <festevam@gmail•com>
Cc: Pengutronix Kernel Team <kernel@pengutronix•de>,
	linux-remoteproc@vger•kernel.org, devicetree@vger•kernel.org,
	imx@lists•linux.dev, linux-arm-kernel@lists•infradead.org,
	linux-kernel@vger•kernel.org
Subject: [PATCH 2/5] remoteproc: imx_rpoc: fix carveout name parsing
Date: Fri, 22 May 2026 04:18:46 -0700	[thread overview]
Message-ID: <20260522111849.783-3-laurentiumihalcea111@gmail.com> (raw)
In-Reply-To: <20260522111849.783-1-laurentiumihalcea111@gmail.com>

From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp•com>

The imx remoteproc driver assumes that the names of the reserved memory
regions reflect their usage (e.g. "vdevbuffer", "vdev0vring0", etc.). This
conflicts with the devicetree specification's recommendation, which states
that the names of the devicetree nodes should be generic.

Therefore, instead of relying on the node names, use the names passed via
the "memory-region-names" property if present. Otherwise, keep the old
behavior.

The definition of imx_rproc_rmem_to_resource() is added to a common place
as imx_dsp_rproc.c can also use it given that it suffers from the same
aforementioned problem.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp•com>
---
 drivers/remoteproc/imx_rproc.c |  7 +++++--
 drivers/remoteproc/imx_rproc.h | 19 +++++++++++++++++++
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 7f54322244ac..1ee1c658dcc1 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -672,7 +672,7 @@ static int imx_rproc_prepare(struct rproc *rproc)
 		int err;
 		struct resource res;
 
-		err = of_reserved_mem_region_to_resource(np, i++, &res);
+		err = imx_rproc_rmem_to_resource(np, i++, &res);
 		if (err)
 			break;
 
@@ -850,11 +850,14 @@ static int imx_rproc_addr_init(struct imx_rproc *priv,
 	if (nph <= 0)
 		return 0;
 
+	if (!of_property_present(np, "memory-region-names"))
+		dev_warn(dev, "using node names for carveouts should be avoided\n");
+
 	/* remap optional addresses */
 	for (a = 0; a < nph; a++) {
 		struct resource res;
 
-		err = of_reserved_mem_region_to_resource(np, a, &res);
+		err = imx_rproc_rmem_to_resource(np, a, &res);
 		if (err) {
 			dev_err(dev, "unable to resolve memory region\n");
 			return err;
diff --git a/drivers/remoteproc/imx_rproc.h b/drivers/remoteproc/imx_rproc.h
index 0d7d48352a10..58e9daa41afe 100644
--- a/drivers/remoteproc/imx_rproc.h
+++ b/drivers/remoteproc/imx_rproc.h
@@ -45,4 +45,23 @@ struct imx_rproc_dcfg {
 	u32				reset_vector_mask;
 };
 
+static inline int imx_rproc_rmem_to_resource(struct device_node *np,
+					     int index,
+					     struct resource *res)
+{
+	int ret;
+
+	ret = of_reserved_mem_region_to_resource(np, index, res);
+	if (ret)
+		return ret;
+
+	/* "memory-region-names" is optional */
+	ret = of_property_read_string_index(np, "memory-region-names",
+					    index, &res->name);
+	if (ret == -EINVAL)
+		return 0;
+
+	return ret;
+}
+
 #endif /* _IMX_RPROC_H */
-- 
2.43.0



  parent reply	other threads:[~2026-05-22 11:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-22 11:18 [PATCH 0/5] Add RPROC support for the MX95-15x15-FRDM board Laurentiu Mihalcea
2026-05-22 11:18 ` [PATCH 1/5] dt-bindings: remoteproc: imx_rproc: document optional "memory-region-names" Laurentiu Mihalcea
2026-05-22 18:00   ` Frank Li
2026-05-25 12:52   ` Laurentiu Mihalcea
2026-05-30 10:45   ` Krzysztof Kozlowski
2026-05-22 11:18 ` Laurentiu Mihalcea [this message]
2026-05-25  2:13   ` [PATCH 2/5] remoteproc: imx_rpoc: fix carveout name parsing Peng Fan
2026-05-25 12:31     ` Laurentiu Mihalcea
2026-05-26  0:42       ` Peng Fan
2026-05-22 11:18 ` [PATCH 3/5] arm64: dts: freescale: imx95-toradex-smarc: move CM7 node to SoC DTSI Laurentiu Mihalcea
2026-05-22 14:02   ` Francesco Dolcini
2026-05-25  2:15   ` Peng Fan
2026-05-25  9:33     ` Laurentiu Mihalcea
2026-05-22 11:18 ` [PATCH 4/5] arm64: dts: freescale: imx95-15x15-frdm: remove common rmem regions Laurentiu Mihalcea
2026-05-22 11:18 ` [PATCH 5/5] arm64: dts: freescale: add DT overlay for MX95-15x15-FRDM RPMSG usage Laurentiu Mihalcea
2026-05-22 12:11   ` Daniel Baluta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260522111849.783-3-laurentiumihalcea111@gmail.com \
    --to=laurentiumihalcea111@gmail$(echo .)com \
    --cc=Frank.Li@nxp$(echo .)com \
    --cc=andersson@kernel$(echo .)org \
    --cc=conor+dt@kernel$(echo .)org \
    --cc=devicetree@vger$(echo .)kernel.org \
    --cc=festevam@gmail$(echo .)com \
    --cc=imx@lists$(echo .)linux.dev \
    --cc=kernel@pengutronix$(echo .)de \
    --cc=krzk+dt@kernel$(echo .)org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-remoteproc@vger$(echo .)kernel.org \
    --cc=mathieu.poirier@linaro$(echo .)org \
    --cc=peng.fan@nxp$(echo .)com \
    --cc=robh@kernel$(echo .)org \
    --cc=s.hauer@pengutronix$(echo .)de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox