imx.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Peng Fan <peng.fan@nxp.com>
To: Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	 Pengutronix Kernel Team <kernel@pengutronix.de>,
	 Fabio Estevam <festevam@gmail.com>, Frank Li <frank.li@nxp.com>,
	 Dong Aisheng <aisheng.dong@nxp.com>
Cc: imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	 linux-kernel@vger.kernel.org, Peng Fan <peng.fan@nxp.com>
Subject: [PATCH 4/8] firmware: imx: scu-irq: Set mu_resource_id before get handle
Date: Tue, 14 Oct 2025 12:54:41 +0800	[thread overview]
Message-ID: <20251014-imx-firmware-v1-4-ba00220613ca@nxp.com> (raw)
In-Reply-To: <20251014-imx-firmware-v1-0-ba00220613ca@nxp.com>

mu_resource_id is referenced in imx_scu_irq_get_status() and
imx_scu_irq_group_enable() which could be used by other modules, so
need to set correct value before using imx_sc_irq_ipc_handle in
SCU API call.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/firmware/imx/imx-scu-irq.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/firmware/imx/imx-scu-irq.c b/drivers/firmware/imx/imx-scu-irq.c
index a53ed2040c0cf7065474d681b2eb933a15877380..1346b75596293892ccd90a856d46f52171d88734 100644
--- a/drivers/firmware/imx/imx-scu-irq.c
+++ b/drivers/firmware/imx/imx-scu-irq.c
@@ -203,6 +203,18 @@ int imx_scu_enable_general_irq_channel(struct device *dev)
 	struct mbox_chan *ch;
 	int ret = 0, i = 0;
 
+	if (!of_parse_phandle_with_args(dev->of_node, "mboxes",
+				       "#mbox-cells", 0, &spec)) {
+		i = of_alias_get_id(spec.np, "mu");
+		of_node_put(spec.np);
+	}
+
+	/* use mu1 as general mu irq channel if failed */
+	if (i < 0)
+		i = 1;
+
+	mu_resource_id = IMX_SC_R_MU_0A + i;
+
 	ret = imx_scu_get_handle(&imx_sc_irq_ipc_handle);
 	if (ret)
 		return ret;
@@ -225,18 +237,6 @@ int imx_scu_enable_general_irq_channel(struct device *dev)
 		return ret;
 	}
 
-	if (!of_parse_phandle_with_args(dev->of_node, "mboxes",
-				       "#mbox-cells", 0, &spec)) {
-		i = of_alias_get_id(spec.np, "mu");
-		of_node_put(spec.np);
-	}
-
-	/* use mu1 as general mu irq channel if failed */
-	if (i < 0)
-		i = 1;
-
-	mu_resource_id = IMX_SC_R_MU_0A + i;
-
 	/* Create directory under /sysfs/firmware */
 	wakeup_obj = kobject_create_and_add("scu_wakeup_source", firmware_kobj);
 	if (!wakeup_obj) {

-- 
2.37.1


  parent reply	other threads:[~2025-10-14  4:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-14  4:54 [PATCH 0/8] firmware: imx: scu: Misc update Peng Fan
2025-10-14  4:54 ` [PATCH 1/8] firmware: imx: scu-irq: fix OF node leak in Peng Fan
2025-10-14 15:48   ` Frank Li
2025-10-14  4:54 ` [PATCH 2/8] firmware: imx: scu-irq: Free mailbox client on failure Peng Fan
2025-10-14 15:54   ` Frank Li
2025-10-15 13:55     ` Peng Fan
2025-10-15 14:32       ` Frank Li
2025-10-16  2:14         ` Peng Fan
2025-10-16 15:33           ` Frank Li
2025-10-14  4:54 ` [PATCH 3/8] firmware: imx: scu-irq: Init workqueue before request mbox channel Peng Fan
2025-10-14 15:55   ` Frank Li
2025-10-14  4:54 ` Peng Fan [this message]
2025-10-14 15:57   ` [PATCH 4/8] firmware: imx: scu-irq: Set mu_resource_id before get handle Frank Li
2025-10-14  4:54 ` [PATCH 5/8] firmware: imx: scu-irq: Remove unused export of imx_scu_enable_general_irq_channel Peng Fan
2025-10-14 15:59   ` Frank Li
2025-10-14  4:54 ` [PATCH 6/8] firmware: imx: scu: Update error code Peng Fan
2025-10-14 16:00   ` Frank Li
2025-10-14  4:54 ` [PATCH 7/8] firmware: imx: scu: Suppress bind attrs Peng Fan
2025-10-14 16:01   ` Frank Li
2025-10-14  4:54 ` [PATCH 8/8] firmware: imx: scu: Use devm_mutex_init Peng Fan
2025-10-14 16:02   ` Frank Li

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=20251014-imx-firmware-v1-4-ba00220613ca@nxp.com \
    --to=peng.fan@nxp.com \
    --cc=aisheng.dong@nxp.com \
    --cc=festevam@gmail.com \
    --cc=frank.li@nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).