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 --- 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