Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
From: David Bauer <mail@david-bauer.net>
Date: Mon, 13 Jan 2025 11:52:37 +0100
Subject: mt76: import MT7915 recovery fixes
diff --git a/package/kernel/mt76/patches/0001-mt7915-mcu-lower-default-timeout.patch b/package/kernel/mt76/patches/0001-mt7915-mcu-lower-default-timeout.patch
new file mode 100644
index 0000000000000000000000000000000000000000..f05d6b830f6c323e8e0dce4ebaf1cc9689f43c86
--- /dev/null
+++ b/package/kernel/mt76/patches/0001-mt7915-mcu-lower-default-timeout.patch
@@ -0,0 +1,32 @@
+From 0a577333e89f49fd29f07b70d4d865d221451ac0 Mon Sep 17 00:00:00 2001
+From: David Bauer <mail@david-bauer.net>
+Date: Mon, 13 Jan 2025 08:48:41 +0100
+Subject: [PATCH 1/3] mt7915: mcu: lower default timeout
+
+The default timeout set in mt76_connac2_mcu_fill_message of 20 seconds
+leads to excessive stalling in case messages are lost.
+
+Testing showed that a much smaller timeout of 3 seconds is sufficient
+in normal operation.
+
+Signed-off-by: David Bauer <mail@david-bauer.net>
+---
+ mt7915/mcu.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/mt7915/mcu.c b/mt7915/mcu.c
+index 9d790f23..809d8f99 100644
+--- a/mt7915/mcu.c
++++ b/mt7915/mcu.c
+@@ -197,6 +197,8 @@ mt7915_mcu_parse_response(struct mt76_dev *mdev, int cmd,
+ static void
+ mt7915_mcu_set_timeout(struct mt76_dev *mdev, int cmd)
+ {
++ mdev->mcu.timeout = 3 * HZ;
++
+ if ((cmd & __MCU_CMD_FIELD_ID) != MCU_CMD_EXT_CID)
+ return;
+
+--
+2.45.2
+
diff --git a/package/kernel/mt76/patches/0002-mt7915-mcu-increase-command-timeout.patch b/package/kernel/mt76/patches/0002-mt7915-mcu-increase-command-timeout.patch
new file mode 100644
index 0000000000000000000000000000000000000000..2aedb9fd791912dd2800074762e316ad27f41d90
--- /dev/null
+++ b/package/kernel/mt76/patches/0002-mt7915-mcu-increase-command-timeout.patch
@@ -0,0 +1,34 @@
+From 49894f4ce805ccb73fe0a09c53ffcc8aeaf712b5 Mon Sep 17 00:00:00 2001
+From: David Bauer <mail@david-bauer.net>
+Date: Mon, 13 Jan 2025 08:51:30 +0100
+Subject: [PATCH 2/3] mt7915: mcu: increase command timeout
+
+Increase the timeout for MCU_EXT_CMD_EFUSE_BUFFER_MODE as
+well as MCU_EXT_CMD_TXBF_ACTION command types.
+
+Regular retries upon hardware-recovery have been observed. Increasing
+the timeout slightly remedies this problem.
+
+Signed-off-by: David Bauer <mail@david-bauer.net>
+---
+ mt7915/mcu.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/mt7915/mcu.c b/mt7915/mcu.c
+index 809d8f99..f3e9f9f0 100644
+--- a/mt7915/mcu.c
++++ b/mt7915/mcu.c
+@@ -210,6 +210,10 @@ mt7915_mcu_set_timeout(struct mt76_dev *mdev, int cmd)
+ case MCU_EXT_CMD_BSS_INFO_UPDATE:
+ mdev->mcu.timeout = 2 * HZ;
+ return;
++ case MCU_EXT_CMD_EFUSE_BUFFER_MODE:
++ case MCU_EXT_CMD_TXBF_ACTION:
++ mdev->mcu.timeout = 5 * HZ;
++ return;
+ default:
+ break;
+ }
+--
+2.45.2
+
diff --git a/package/kernel/mt76/patches/0003-mt7915-mcu-re-init-MCU-before-loading-FW-patch.patch b/package/kernel/mt76/patches/0003-mt7915-mcu-re-init-MCU-before-loading-FW-patch.patch
new file mode 100644
index 0000000000000000000000000000000000000000..c97d4b1d6fd61f3c231dee6971dd019561c313f3
--- /dev/null
+++ b/package/kernel/mt76/patches/0003-mt7915-mcu-re-init-MCU-before-loading-FW-patch.patch
@@ -0,0 +1,55 @@
+From 1177b55da6fbc3d095383b3bcfe4ac741985dbff Mon Sep 17 00:00:00 2001
+From: David Bauer <mail@david-bauer.net>
+Date: Sun, 12 Jan 2025 15:30:54 +0100
+Subject: [PATCH 3/3] mt7915: mcu: re-init MCU before loading FW patch
+
+Restart the MCU and release the patch semaphore before loading the MCU
+patch firmware from the host.
+
+This fixes failures upon error recovery in case the semaphore was
+previously taken and never released by the host.
+
+Signed-off-by: David Bauer <mail@david-bauer.net>
+---
+ mt7915/mcu.c | 25 +++++++++++++++----------
+ 1 file changed, 15 insertions(+), 10 deletions(-)
+
+diff --git a/mt7915/mcu.c b/mt7915/mcu.c
+index f3e9f9f0..e03292a8 100644
+--- a/mt7915/mcu.c
++++ b/mt7915/mcu.c
+@@ -2098,16 +2098,21 @@ static int mt7915_load_firmware(struct mt7915_dev *dev)
+ {
+ int ret;
+
+- /* make sure fw is download state */
+- if (mt7915_firmware_state(dev, false)) {
+- /* restart firmware once */
+- mt76_connac_mcu_restart(&dev->mt76);
+- ret = mt7915_firmware_state(dev, false);
+- if (ret) {
+- dev_err(dev->mt76.dev,
+- "Firmware is not ready for download\n");
+- return ret;
+- }
++ /* Release Semaphore if taken by previous failed attempt */
++ ret = mt76_connac_mcu_patch_sem_ctrl(&dev->mt76, false);
++ if (ret != PATCH_REL_SEM_SUCCESS) {
++ dev_err(dev->mt76.dev, "Could not release semaphore\n");
++ /* Continue anyways */
++ }
++
++ /* Always restart MCU firmware */
++ mt76_connac_mcu_restart(&dev->mt76);
++
++ /* Check if MCU is ready */
++ ret = mt7915_firmware_state(dev, false);
++ if (ret) {
++ dev_err(dev->mt76.dev, "Firmware did not enter download state\n");
++ return ret;
+ }
+
+ ret = mt76_connac2_load_patch(&dev->mt76, fw_name_var(dev, ROM_PATCH));
+--
+2.45.2
+