blob: 54ee436e6a6cb3b35014e3807e1ee4117ab493bb [file] [log] [blame]
developera46f6132024-03-26 14:09:54 +08001From a86c3c6d2be2e115540d0a6ce5166943fd6657ba Mon Sep 17 00:00:00 2001
developer1a173672023-12-21 14:49:33 +08002From: Bo Jiao <Bo.Jiao@mediatek.com>
3Date: Tue, 21 Nov 2023 09:55:46 +0800
developereb155692024-01-11 14:08:37 +08004Subject: [PATCH 1027/1044] mtk: wifi: mt76: mt7996: add SER overlap handle
developer1a173672023-12-21 14:49:33 +08005
6Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
7---
8 mcu.c | 3 ++-
9 mt7996/mac.c | 8 ++++++++
10 mt7996/mcu.c | 8 ++++++++
11 mt7996/mt7996.h | 2 ++
12 4 files changed, 20 insertions(+), 1 deletion(-)
13
14diff --git a/mcu.c b/mcu.c
15index 2926f715..a7afa2d7 100644
16--- a/mcu.c
17+++ b/mcu.c
18@@ -94,7 +94,8 @@ int mt76_mcu_skb_send_and_get_msg(struct mt76_dev *dev, struct sk_buff *skb,
19 if (retry && retry_cnt < MT76_MSG_MAX_RETRY_CNT) {
20 if (test_bit(MT76_MCU_RESET, &dev->phy.state))
21 usleep_range(200000, 500000);
22- dev_err(dev->dev, "send message %08x timeout, try again.\n", cmd);
23+ dev_err(dev->dev, "send message %08x timeout, try again(%d).\n",
24+ cmd, (MT76_MSG_MAX_RETRY_CNT - retry_cnt));
25 }
26
27 ret = dev->mcu_ops->mcu_skb_send_msg(dev, skb_tmp, cmd, &seq);
28diff --git a/mt7996/mac.c b/mt7996/mac.c
developera46f6132024-03-26 14:09:54 +080029index c6d79989..2e0fb5d9 100644
developer1a173672023-12-21 14:49:33 +080030--- a/mt7996/mac.c
31+++ b/mt7996/mac.c
developera46f6132024-03-26 14:09:54 +080032@@ -1889,6 +1889,7 @@ void mt7996_mac_reset_work(struct work_struct *work)
developer1a173672023-12-21 14:49:33 +080033 if (!(READ_ONCE(dev->recovery.state) & MT_MCU_CMD_STOP_DMA))
34 return;
35
36+ dev->recovery.l1_reset_last = dev->recovery.l1_reset;
37 dev_info(dev->mt76.dev,"\n%s L1 SER recovery start.",
38 wiphy_name(dev->mt76.hw->wiphy));
39
developera46f6132024-03-26 14:09:54 +080040@@ -1906,6 +1907,10 @@ void mt7996_mac_reset_work(struct work_struct *work)
developer1a173672023-12-21 14:49:33 +080041
42 set_bit(MT76_RESET, &dev->mphy.state);
43 set_bit(MT76_MCU_RESET, &dev->mphy.state);
44+ if (phy2)
45+ set_bit(MT76_RESET, &phy2->mt76->state);
46+ if (phy3)
47+ set_bit(MT76_RESET, &phy3->mt76->state);
48 wake_up(&dev->mt76.mcu.wait);
49
50 mt76_worker_disable(&dev->mt76.tx_worker);
developera46f6132024-03-26 14:09:54 +080051@@ -2120,6 +2125,9 @@ void mt7996_reset(struct mt7996_dev *dev)
developer1a173672023-12-21 14:49:33 +080052 return;
53 }
54
55+ if ((READ_ONCE(dev->recovery.state) & MT_MCU_CMD_STOP_DMA))
56+ dev->recovery.l1_reset++;
57+
58 queue_work(dev->mt76.wq, &dev->reset_work);
59 wake_up(&dev->reset_wait);
60 }
61diff --git a/mt7996/mcu.c b/mt7996/mcu.c
developera46f6132024-03-26 14:09:54 +080062index 03a2402d..c427ea20 100644
developer1a173672023-12-21 14:49:33 +080063--- a/mt7996/mcu.c
64+++ b/mt7996/mcu.c
65@@ -246,6 +246,14 @@ mt7996_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
66 u32 val;
67 u8 seq;
68
69+ if (dev->recovery.l1_reset_last != dev->recovery.l1_reset) {
70+ dev_info(dev->mt76.dev,"\n%s L1 SER recovery overlap, drop message %08x.",
71+ wiphy_name(dev->mt76.hw->wiphy), cmd);
72+
73+ dev_kfree_skb(skb);
74+ return -EPERM;
75+ }
76+
77 mdev->mcu.timeout = 20 * HZ;
78
79 seq = ++dev->mt76.mcu.msg_seq & 0xf;
80diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
developereb155692024-01-11 14:08:37 +080081index 23497b46..c590a8b8 100644
developer1a173672023-12-21 14:49:33 +080082--- a/mt7996/mt7996.h
83+++ b/mt7996/mt7996.h
developereb155692024-01-11 14:08:37 +080084@@ -392,6 +392,8 @@ struct mt7996_dev {
developer1a173672023-12-21 14:49:33 +080085 wait_queue_head_t reset_wait;
86 struct {
87 u32 state;
88+ u32 l1_reset;
89+ u32 l1_reset_last;
90 u32 wa_reset_count;
91 u32 wm_reset_count;
92 bool hw_full_reset:1;
93--
942.18.0
95