[PATCH net 1/2] net: airoha: fix NPU mailbox notification ordering

Faliang Wang faliang.wang at airoha.com
Sun Nov 29 19:41:05 PST 2026


During automated reboot testing, NPU mailbox communication can fail
intermittently and prevent Wi-Fi from coming up.

The message counter in CTRL(2) notifies the NPU that a new message is
ready. Write the function information to CTRL(3) before updating that
counter, so the NPU receives the function information before the
notification.

Fixes: REAL_LINUX_SHA ("EXACT_ORIGINAL_COMMIT_SUBJECT")
Signed-off-by: Faliang Wang <faliang.wang at airoha.com>
---
 drivers/net/ethernet/airoha/airoha_npu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/airoha/airoha_npu.c b/drivers/net/ethernet/airoha/airoha_npu.c
index edec6b111895..7f7cdc2553ad 100644
--- a/drivers/net/ethernet/airoha/airoha_npu.c
+++ b/drivers/net/ethernet/airoha/airoha_npu.c
@@ -178,10 +178,10 @@ static int airoha_npu_send_msg(struct airoha_npu *npu, int func_id,
 
 	regmap_write(npu->regmap, REG_CR_MBQ0_CTRL(0) + offset, dma_addr);
 	regmap_write(npu->regmap, REG_CR_MBQ0_CTRL(1) + offset, size);
-	regmap_read(npu->regmap, REG_CR_MBQ0_CTRL(2) + offset, &val);
-	regmap_write(npu->regmap, REG_CR_MBQ0_CTRL(2) + offset, val + 1);
 	val = FIELD_PREP(MBOX_MSG_FUNC_ID, func_id) | MBOX_MSG_WAIT_RSP;
 	regmap_write(npu->regmap, REG_CR_MBQ0_CTRL(3) + offset, val);
+	regmap_read(npu->regmap, REG_CR_MBQ0_CTRL(2) + offset, &val);
+	regmap_write(npu->regmap, REG_CR_MBQ0_CTRL(2) + offset, val + 1);
 
 	ret = regmap_read_poll_timeout_atomic(npu->regmap,
 					      REG_CR_MBQ0_CTRL(3) + offset,
-- 
2.43.0




More information about the linux-arm-kernel mailing list