From: Sebastian Andrzej Siewior Date: Wed, 17 Jun 2026 06:55:32 +0000 (+0200) Subject: mailbox: imx: Move the RX part of the mailbox into the threaded handler X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=e55bea377d492f0fd4a7f657fc2a9247b5b96afb;p=thirdparty%2Fkernel%2Flinux.git mailbox: imx: Move the RX part of the mailbox into the threaded handler 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 Reviewed-by: Mathieu Poirier Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Jassi Brar --- diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c index 87acc43cb99c..1219c35b116e 100644 --- a/drivers/mailbox/imx-mailbox.c +++ b/drivers/mailbox/imx-mailbox.c @@ -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);