* [PATCH net 1/2] net: airoha: fix NPU mailbox notification ordering
2026-11-30 3:41 [PATCH net 0/2] net: airoha: fix NPU mailbox and WLAN initialization Faliang Wang
@ 2026-11-30 3:41 ` Faliang Wang
2026-11-30 3:41 ` [PATCH net 2/2] net: airoha: retry WLAN initialization commands Faliang Wang
2026-11-30 3:45 ` [PATCH net 0/2] net: airoha: fix NPU mailbox and WLAN initialization netdev-bot+sinfo
2 siblings, 0 replies; 4+ messages in thread
From: Faliang Wang @ 2026-11-30 3:41 UTC (permalink / raw)
To: netdev
Cc: lorenzo, andrew+netdev, davem, edumazet, kuba, pabeni,
linux-arm-kernel, linux-mediatek, Faliang Wang
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@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
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH net 2/2] net: airoha: retry WLAN initialization commands
2026-11-30 3:41 [PATCH net 0/2] net: airoha: fix NPU mailbox and WLAN initialization Faliang Wang
2026-11-30 3:41 ` [PATCH net 1/2] net: airoha: fix NPU mailbox notification ordering Faliang Wang
@ 2026-11-30 3:41 ` Faliang Wang
2026-11-30 3:45 ` [PATCH net 0/2] net: airoha: fix NPU mailbox and WLAN initialization netdev-bot+sinfo
2 siblings, 0 replies; 4+ messages in thread
From: Faliang Wang @ 2026-11-30 3:41 UTC (permalink / raw)
To: netdev
Cc: lorenzo, andrew+netdev, davem, edumazet, kuba, pabeni,
linux-arm-kernel, linux-mediatek, Faliang Wang
DESCRIBE_THE_CONFIRMED_FAILURE_AND_WHY_RETRYING_IS_SAFE.
Allow up to three total attempts for WLAN initialization commands,Sleep for 10 ms between failed attempts before reporting the final error.
Fixes: REAL_LINUX_SHA ("EXACT_ORIGINAL_COMMIT_SUBJECT")
Signed-off-by: Faliang Wang <faliang.wang@airoha.com>
---
drivers/net/ethernet/airoha/airoha_npu.c | 41 ++++++++++++++++++------
1 file changed, 31 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/airoha/airoha_npu.c b/drivers/net/ethernet/airoha/airoha_npu.c
index 7f7cdc2553ad..6fb4eec20c20 100644
--- a/drivers/net/ethernet/airoha/airoha_npu.c
+++ b/drivers/net/ethernet/airoha/airoha_npu.c
@@ -527,44 +527,65 @@ airoha_npu_wlan_set_reserved_memory(struct airoha_npu *npu,
return airoha_npu_wlan_msg_send(npu, ifindex, func_id, &val,
sizeof(val), GFP_KERNEL);
}
+static int airoha_npu_wlan_cmd_with_retry(struct airoha_npu *npu,
+ int ifindex,
+ enum airoha_npu_wlan_set_cmd cmd,
+ const char *name, bool is_msg_send,
+ u32 *val)
+{
+ int retry, err;
+
+ for (retry = 0; retry < 3; retry++) {
+ if (is_msg_send)
+ err = airoha_npu_wlan_msg_send(npu, ifindex, cmd, val,
+ sizeof(*val),
+ GFP_KERNEL);
+ else
+ err = airoha_npu_wlan_set_reserved_memory(npu, ifindex,
+ name, cmd);
+ if (!err)
+ return 0;
+
+ if (retry < 2)
+ msleep(10);
+ }
+ return err;
+}
static int airoha_npu_wlan_init_memory(struct airoha_npu *npu)
{
enum airoha_npu_wlan_set_cmd cmd = WLAN_FUNC_SET_WAIT_NPU_BAND0_ONCPU;
u32 val = 0;
- int err;
-
- err = airoha_npu_wlan_msg_send(npu, 1, cmd, &val, sizeof(val),
- GFP_KERNEL);
+ int err = 0;
+ err = airoha_npu_wlan_cmd_with_retry(npu, 1, cmd, "band0_oncpu",1, &val);
if (err)
return err;
cmd = WLAN_FUNC_SET_WAIT_TX_BUF_CHECK_ADDR;
- err = airoha_npu_wlan_set_reserved_memory(npu, 0, "tx-bufid", cmd);
+ err = airoha_npu_wlan_cmd_with_retry(npu, 0, cmd, "tx-bufid", 0, NULL);
if (err)
return err;
cmd = WLAN_FUNC_SET_WAIT_PKT_BUF_ADDR;
- err = airoha_npu_wlan_set_reserved_memory(npu, 0, "pkt", cmd);
+ err = airoha_npu_wlan_cmd_with_retry(npu, 0, cmd, "pkt", 0, NULL);
if (err)
return err;
cmd = WLAN_FUNC_SET_WAIT_TX_PKT_BUF_ADDR;
- err = airoha_npu_wlan_set_reserved_memory(npu, 0, "tx-pkt", cmd);
+ err = airoha_npu_wlan_cmd_with_retry(npu, 0, cmd, "tx-pkt", 0, NULL);
if (err)
return err;
if (of_property_match_string(npu->dev->of_node, "memory-region-names",
"ba") >= 0) {
cmd = WLAN_FUNC_SET_WAIT_DRAM_BA_NODE_ADDR;
- err = airoha_npu_wlan_set_reserved_memory(npu, 0, "ba", cmd);
+ err = airoha_npu_wlan_cmd_with_retry(npu, 0, cmd, "ba",false, NULL);
if (err)
return err;
}
cmd = WLAN_FUNC_SET_WAIT_IS_FORCE_TO_CPU;
- return airoha_npu_wlan_msg_send(npu, 0, cmd, &val, sizeof(val),
- GFP_KERNEL);
+ return airoha_npu_wlan_cmd_with_retry(npu, 0, cmd, "force_to_cpu", 1,&val);
}
static u32 airoha_npu_wlan_queue_addr_get(struct airoha_npu *npu, int qid,
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread