]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
firmware: imx: scu-irq: Set mu_resource_id before get handle
authorPeng Fan <peng.fan@nxp.com>
Fri, 17 Oct 2025 01:56:27 +0000 (09:56 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jan 2026 12:10:19 +0000 (13:10 +0100)
commit ff3f9913bc0749364fbfd86ea62ba2d31c6136c8 upstream.

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.

Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
Fixes: 81fb53feb66a ("firmware: imx: scu-irq: Init workqueue before request mbox channel")
Cc: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/firmware/imx/imx-scu-irq.c

index 06c49a61a07901e2e034d76333987567016e385f..1f08b708e83db356da1d6386689785f58112d04b 100644 (file)
@@ -137,6 +137,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;
@@ -159,18 +171,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;
-
        return ret;
 }
 EXPORT_SYMBOL(imx_scu_enable_general_irq_channel);