developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame] | 1 | From a86c3c6d2be2e115540d0a6ce5166943fd6657ba Mon Sep 17 00:00:00 2001 |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 2 | From: Bo Jiao <Bo.Jiao@mediatek.com> |
| 3 | Date: Tue, 21 Nov 2023 09:55:46 +0800 |
developer | eb15569 | 2024-01-11 14:08:37 +0800 | [diff] [blame] | 4 | Subject: [PATCH 1027/1044] mtk: wifi: mt76: mt7996: add SER overlap handle |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 5 | |
| 6 | Signed-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 | |
| 14 | diff --git a/mcu.c b/mcu.c |
| 15 | index 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); |
| 28 | diff --git a/mt7996/mac.c b/mt7996/mac.c |
developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame] | 29 | index c6d79989..2e0fb5d9 100644 |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 30 | --- a/mt7996/mac.c |
| 31 | +++ b/mt7996/mac.c |
developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame] | 32 | @@ -1889,6 +1889,7 @@ void mt7996_mac_reset_work(struct work_struct *work) |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 33 | 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 | |
developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame] | 40 | @@ -1906,6 +1907,10 @@ void mt7996_mac_reset_work(struct work_struct *work) |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 41 | |
| 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); |
developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame] | 51 | @@ -2120,6 +2125,9 @@ void mt7996_reset(struct mt7996_dev *dev) |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 52 | 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 | } |
| 61 | diff --git a/mt7996/mcu.c b/mt7996/mcu.c |
developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame] | 62 | index 03a2402d..c427ea20 100644 |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 63 | --- 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; |
| 80 | diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h |
developer | eb15569 | 2024-01-11 14:08:37 +0800 | [diff] [blame] | 81 | index 23497b46..c590a8b8 100644 |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 82 | --- a/mt7996/mt7996.h |
| 83 | +++ b/mt7996/mt7996.h |
developer | eb15569 | 2024-01-11 14:08:37 +0800 | [diff] [blame] | 84 | @@ -392,6 +392,8 @@ struct mt7996_dev { |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 85 | 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 | -- |
| 94 | 2.18.0 |
| 95 | |