developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1 | From 0b6f875816c6849eaadae1cbf974ee1327af04f2 Mon Sep 17 00:00:00 2001 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2 | From: Bo Jiao <Bo.Jiao@mediatek.com> |
| 3 | Date: Tue, 21 Nov 2023 09:55:46 +0800 |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 4 | Subject: [PATCH 033/223] mtk: mt76: mt7996: add SER overlap handle |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 5 | |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 6 | Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com> |
| 7 | --- |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 8 | mt7996/mac.c | 11 +++++++++++ |
| 9 | mt7996/mcu.c | 8 ++++++++ |
| 10 | mt7996/mt7996.h | 2 ++ |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 11 | 3 files changed, 21 insertions(+) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 12 | |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 13 | diff --git a/mt7996/mac.c b/mt7996/mac.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 14 | index 3c9ee0c8..2ce9e839 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 15 | --- a/mt7996/mac.c |
| 16 | +++ b/mt7996/mac.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 17 | @@ -1906,6 +1906,7 @@ void mt7996_mac_reset_work(struct work_struct *work) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 18 | if (!(READ_ONCE(dev->recovery.state) & MT_MCU_CMD_STOP_DMA)) |
| 19 | return; |
| 20 | |
| 21 | + dev->recovery.l1_reset_last = dev->recovery.l1_reset; |
| 22 | dev_info(dev->mt76.dev,"\n%s L1 SER recovery start.", |
| 23 | wiphy_name(dev->mt76.hw->wiphy)); |
| 24 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 25 | @@ -1923,6 +1924,10 @@ void mt7996_mac_reset_work(struct work_struct *work) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 26 | |
| 27 | set_bit(MT76_RESET, &dev->mphy.state); |
| 28 | set_bit(MT76_MCU_RESET, &dev->mphy.state); |
| 29 | + if (phy2) |
| 30 | + set_bit(MT76_RESET, &phy2->mt76->state); |
| 31 | + if (phy3) |
| 32 | + set_bit(MT76_RESET, &phy3->mt76->state); |
| 33 | wake_up(&dev->mt76.mcu.wait); |
| 34 | |
| 35 | mt76_worker_disable(&dev->mt76.tx_worker); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 36 | @@ -2118,6 +2123,9 @@ void mt7996_coredump(struct mt7996_dev *dev, u8 state) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 37 | |
| 38 | void mt7996_reset(struct mt7996_dev *dev) |
| 39 | { |
| 40 | + dev_info(dev->mt76.dev, "%s SER recovery state: 0x%08x\n", |
| 41 | + wiphy_name(dev->mt76.hw->wiphy), READ_ONCE(dev->recovery.state)); |
| 42 | + |
| 43 | if (!dev->recovery.hw_init_done) |
| 44 | return; |
| 45 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 46 | @@ -2137,6 +2145,9 @@ void mt7996_reset(struct mt7996_dev *dev) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 47 | return; |
| 48 | } |
| 49 | |
| 50 | + if ((READ_ONCE(dev->recovery.state) & MT_MCU_CMD_STOP_DMA)) |
| 51 | + dev->recovery.l1_reset++; |
| 52 | + |
| 53 | queue_work(dev->mt76.wq, &dev->reset_work); |
| 54 | wake_up(&dev->reset_wait); |
| 55 | } |
| 56 | diff --git a/mt7996/mcu.c b/mt7996/mcu.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 57 | index 08234b3a..2a647b7b 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 58 | --- a/mt7996/mcu.c |
| 59 | +++ b/mt7996/mcu.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 60 | @@ -256,6 +256,14 @@ mt7996_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 61 | u32 val; |
| 62 | u8 seq; |
| 63 | |
| 64 | + if (dev->recovery.l1_reset_last != dev->recovery.l1_reset) { |
| 65 | + dev_info(dev->mt76.dev,"\n%s L1 SER recovery overlap, drop message %08x.", |
| 66 | + wiphy_name(dev->mt76.hw->wiphy), cmd); |
| 67 | + |
| 68 | + dev_kfree_skb(skb); |
| 69 | + return -EPERM; |
| 70 | + } |
| 71 | + |
| 72 | mdev->mcu.timeout = 20 * HZ; |
| 73 | |
| 74 | seq = ++dev->mt76.mcu.msg_seq & 0xf; |
| 75 | diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 76 | index 7bc5504e..22d44542 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 77 | --- a/mt7996/mt7996.h |
| 78 | +++ b/mt7996/mt7996.h |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 79 | @@ -406,6 +406,8 @@ struct mt7996_dev { |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 80 | wait_queue_head_t reset_wait; |
| 81 | struct { |
| 82 | u32 state; |
| 83 | + u32 l1_reset; |
| 84 | + u32 l1_reset_last; |
| 85 | u32 wa_reset_count; |
| 86 | u32 wm_reset_count; |
| 87 | bool hw_full_reset:1; |
| 88 | -- |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 89 | 2.45.2 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 90 | |