Commit c77661d6 authored by Otto Pflüger's avatar Otto Pflüger Committed by Jassi Brar
Browse files

mailbox: sprd: clear delivery flag before handling TX done



If there are any pending messages in the mailbox queue, they are sent
as soon as a TX done event arrives from the driver. This may trigger a
new delivery interrupt while the previous one is still being handled.
If the delivery status is cleared after this, the interrupt is lost.
To prevent this from happening, clear the delivery status immediately
after checking it and before any new messages are sent.

Signed-off-by: default avatarOtto Pflüger <otto.pflueger@abscue.de>
Signed-off-by: default avatarJassi Brar <jassisinghbrar@gmail.com>
parent 0856aed5
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -166,6 +166,11 @@ static irqreturn_t sprd_mbox_inbox_isr(int irq, void *data)
		return IRQ_NONE;
	}

	/* Clear FIFO delivery and overflow status first */
	writel(fifo_sts &
	       (SPRD_INBOX_FIFO_DELIVER_MASK | SPRD_INBOX_FIFO_OVERLOW_MASK),
	       priv->inbox_base + SPRD_MBOX_FIFO_RST);

	while (send_sts) {
		id = __ffs(send_sts);
		send_sts &= (send_sts - 1);
@@ -181,11 +186,6 @@ static irqreturn_t sprd_mbox_inbox_isr(int irq, void *data)
			mbox_chan_txdone(chan, 0);
	}

	/* Clear FIFO delivery and overflow status */
	writel(fifo_sts &
	       (SPRD_INBOX_FIFO_DELIVER_MASK | SPRD_INBOX_FIFO_OVERLOW_MASK),
	       priv->inbox_base + SPRD_MBOX_FIFO_RST);

	/* Clear irq status */
	writel(SPRD_MBOX_IRQ_CLR, priv->inbox_base + SPRD_MBOX_IRQ_STS);