mailbox: imx: ONLY IPC MU needs IRQF_NO_SUSPEND flag
authorAnson Huang <Anson.Huang@nxp.com>
Wed, 3 Jun 2020 05:15:44 +0000 (13:15 +0800)
committerJassi Brar <jaswinder.singh@linaro.org>
Sun, 7 Jun 2020 21:11:35 +0000 (16:11 -0500)
IPC MU has no power domain assigned and there could be IPC during
noirq suspend phase, so IRQF_NO_SUSPEND flag is needed for IPC MU.
However, for other MUs, they have power domain assigned and their
power will be turned off during noirq suspend phase, but with
IRQF_NO_SUSPEND set, their interrupts are NOT disabled even after
their power turned off, it will cause system crash when mailbox
driver trys to handle pending interrupts but the MU power is already
turned off.

So, IRQF_NO_SUSPEND flag should ONLY be added to IPC MU which has
power domain managed by SCU, then all other MUs' pending interrupts
after noirq suspend phase will be handled after system resume.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
drivers/mailbox/imx-mailbox.c

index 080b60849e48d53bb944298e2a7adf4b8c362631..7205b825c8b547fb0dcee86027f1e38e73206f5d 100644 (file)
@@ -292,6 +292,7 @@ static int imx_mu_startup(struct mbox_chan *chan)
 {
        struct imx_mu_priv *priv = to_imx_mu_priv(chan->mbox);
        struct imx_mu_con_priv *cp = chan->con_priv;
+       unsigned long irq_flag = IRQF_SHARED;
        int ret;
 
        pm_runtime_get_sync(priv->dev);
@@ -302,8 +303,12 @@ static int imx_mu_startup(struct mbox_chan *chan)
                return 0;
        }
 
-       ret = request_irq(priv->irq, imx_mu_isr, IRQF_SHARED |
-                         IRQF_NO_SUSPEND, cp->irq_desc, chan);
+       /* IPC MU should be with IRQF_NO_SUSPEND set */
+       if (!priv->dev->pm_domain)
+               irq_flag |= IRQF_NO_SUSPEND;
+
+       ret = request_irq(priv->irq, imx_mu_isr, irq_flag,
+                         cp->irq_desc, chan);
        if (ret) {
                dev_err(priv->dev,
                        "Unable to acquire IRQ %d\n", priv->irq);