]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mailbox: imx: Move the RX part of the mailbox into the threaded handler
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Wed, 17 Jun 2026 06:55:32 +0000 (08:55 +0200)
committerJassi Brar <jassisinghbrar@gmail.com>
Sun, 21 Jun 2026 02:18:39 +0000 (21:18 -0500)
Move RX callback handling into the threaded handler. This is similar to
the TX side except that we explicitly mask the source interrupt in the
primary handler and unmask it in the threaded handler again after
success. This was done automatically in the TX part.

The masking/ unmasking can be removed from imx_mu_specific_rx() since it
already happens in the primary/ threaded handler before invoking the
channel specific callback.

Move RX channel handling into threaded handler.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Jassi Brar <jassisinghbrar@gmail.com>
drivers/mailbox/imx-mailbox.c

index 87acc43cb99c45aecb17ac618b7deb76f5a49738..1219c35b116e4f12f3caeae98cbdae89cf6c09b9 100644 (file)
@@ -381,7 +381,6 @@ static int imx_mu_specific_rx(struct imx_mu_priv *priv, struct imx_mu_con_priv *
 
        data = (u32 *)priv->msg;
 
-       imx_mu_xcr_rmw(priv, IMX_MU_RCR, 0, IMX_MU_xCR_RIEn(priv->dcfg->type, cp->idx));
        *data++ = imx_mu_read(priv, priv->dcfg->xRR);
 
        if (priv->dcfg->type & IMX_MU_V2_S4) {
@@ -408,7 +407,6 @@ static int imx_mu_specific_rx(struct imx_mu_priv *priv, struct imx_mu_con_priv *
                *data++ = imx_mu_read(priv, priv->dcfg->xRR + (i % num_rr) * 4);
        }
 
-       imx_mu_xcr_set_act(priv, cp, IMX_MU_RCR, IMX_MU_xCR_RIEn(priv->dcfg->type, cp->idx));
        mbox_chan_received_data(cp->chan, (void *)priv->msg);
 
        return 0;
@@ -551,6 +549,11 @@ static irqreturn_t imx_mu_isr_th(int irq, void *p)
                mbox_chan_txdone(chan, 0);
                break;
 
+       case IMX_MU_TYPE_RX:
+               if (!priv->dcfg->rx(priv, cp))
+                       imx_mu_xcr_set_act(priv, cp, IMX_MU_RCR, IMX_MU_xCR_RIEn(priv->dcfg->type, cp->idx));
+               break;
+
        default:
                dev_warn_ratelimited(priv->dev, "Unhandled channel type %d\n",
                                     cp->type);
@@ -603,7 +606,8 @@ static irqreturn_t imx_mu_isr(int irq, void *p)
                ret = IRQ_WAKE_THREAD;
        } else if ((val == IMX_MU_xSR_RFn(priv->dcfg->type, cp->idx)) &&
                   (cp->type == IMX_MU_TYPE_RX)) {
-               priv->dcfg->rx(priv, cp);
+               imx_mu_xcr_rmw(priv, IMX_MU_RCR, 0, IMX_MU_xCR_RIEn(priv->dcfg->type, cp->idx));
+               ret = IRQ_WAKE_THREAD;
        } else if ((val == IMX_MU_xSR_GIPn(priv->dcfg->type, cp->idx)) &&
                   (cp->type == IMX_MU_TYPE_RXDB)) {
                priv->dcfg->rxdb(priv, cp);