Message ID | A9442D62405552CE+20240715094714.1553336-1-wangyuli@uniontech.com |
---|---|
State | New |
Headers | show |
Series | [RESEND.] drivers/mediatek: Fix some mt7601u vendor could not connect | expand |
On 15/07/2024 16:54, Jakub Kicinski wrote: > On Mon, 15 Jul 2024 17:47:14 +0800 WangYuli wrote: >> Some mt7601 devices cannot establish a connection properly. >> This patch fixes the issue. >> We do not know why, but it just works. > > Any chance we can gate this on the version of EEPROM or chip or > something else? It'd be good to avoid regressions on older devices. > Or possibly - could we issue the MCU command as a test and disable > the calibration if it fails? (Removed some people and lists from CC because they seemed unnecessary.) Hi Jakub, I have Tenda W311MI2 which works with vanilla mt7601u, and a no-name "free driver" device from Aliexpress which doesn't. They have the same USB IDs. The Tenda: Jan 09 22:39:40 ideapad2 kernel: mt7601u 1-2:1.0: ASIC revision: 76010001 MAC revision: 76010500 Jan 09 22:39:40 ideapad2 kernel: mt7601u 1-2:1.0: Firmware Version: 0.1.00 Build: 7640 Build time: 201302052146____ Jan 09 22:39:40 ideapad2 kernel: mt7601u 1-2:1.0: EEPROM ver:0d fae:00 00000000: 01 76 00 0d 50 2b 73 e8 19 76 ff ff ff ff ff ff .v..P+s..v...... 00000010: 01 02 8f 14 01 76 00 00 4a 00 01 00 80 50 08 00 .....v..J....P.. 00000020: 03 00 02 00 00 00 ff 01 40 60 80 ff ff ff ff ff ........@`...... 00000030: ff ff ff ff 11 ff 04 28 ff ff 78 01 ff ff 99 99 .......(..x..... 00000040: 8c 88 ff 07 08 00 00 00 00 00 00 00 00 00 00 00 ................ 00000050: 00 00 1b 1b 1b 1b 1b 1b 1c 1c 1c 1c 1c 1c 1c 1c ................ 00000060: ff ff ff ff ff ff ff ff ff ff ff ff ff ff 80 00 ................ 00000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................ 00000090: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................ 000000a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................ 000000b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................ 000000c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................ 000000d0: 20 f9 00 00 00 00 00 00 00 00 00 00 00 00 05 05 ............... 000000e0: 03 03 04 00 00 00 02 00 00 00 02 00 00 00 02 00 ................ 000000f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................ The no-name: Jan 09 21:50:34 ideapad2 kernel: mt7601u 1-4:1.0: ASIC revision: 76010001 MAC revision: 76010500 Jan 09 21:50:34 ideapad2 kernel: mt7601u 1-4:1.0: EEPROM ver:0d fae:00 00000000: 01 76 00 0d 00 50 11 00 5b 9b ff ff ff ff ff ff .v...P..[....... 00000010: 01 02 8f 14 01 76 00 00 4a 00 01 00 80 50 08 00 .....v..J....P.. 00000020: 03 00 02 00 00 00 ff 01 40 60 80 ff ff ff ff ff ........@`...... 00000030: ff ff ff ff 11 ff 04 10 ff ff 82 01 ff ff 99 99 ................ 00000040: 8c 88 ff 07 08 00 00 00 00 00 00 00 00 00 00 00 ................ 00000050: 00 00 05 05 05 04 04 04 05 05 06 06 07 07 07 07 ................ 00000060: ff ff ff ff ff ff ff ff ff ff ff ff ff ff 80 00 ................ 00000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00000080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................ 00000090: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................ 000000a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................ 000000b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................ 000000c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................ 000000d0: 1e f9 00 00 00 00 00 00 00 00 00 00 00 00 05 05 ................ 000000e0: 03 03 04 00 00 00 02 00 00 00 02 00 00 00 02 00 ................ 000000f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................ The no-name device seems to die after uploading the third chunk of the firmware: Jan 09 16:48:43 ideapad2 kernel: mt7601u 1-4:1.0: Firmware Version: 0.1.00 Build: 7640 Build time: 201302052146____ Jan 09 16:48:43 ideapad2 kernel: __mt7601u_dma_fw:327 len 14336 dst_addr 64 Jan 09 16:48:43 ideapad2 kernel: __mt7601u_dma_fw:327 len 14336 dst_addr 14400 Jan 09 16:48:43 ideapad2 kernel: __mt7601u_dma_fw:327 len 14336 dst_addr 28736 Jan 09 16:48:43 ideapad2 kernel: mt7601u 1-4:1.0: Vendor request req:07 off:09a8 failed:-110 Jan 09 16:48:43 ideapad2 kernel: mt7601u 1-4:1.0: Vendor request req:02 off:09a8 failed:-110 Jan 09 16:48:43 ideapad2 kernel: mt7601u 1-4:1.0: Vendor request req:07 off:0734 failed:-110 Jan 09 16:48:43 ideapad2 kernel: mt7601u 1-4:1.0: Vendor request req:42 off:0230 failed:-110 Jan 09 16:48:43 ideapad2 kernel: mt7601u 1-4:1.0: Vendor request req:07 off:0080 failed:-110 Jan 09 16:48:43 ideapad2 kernel: mt7601u 1-4:1.0: Vendor request req:02 off:0080 failed:-110 Jan 09 16:48:43 ideapad2 kernel: mt7601u 1-4:1.0: Vendor request req:02 off:0080 failed:-110 Jan 09 16:48:43 ideapad2 kernel: mt7601u 1-4:1.0: probe with driver mt7601u failed with error -110 Removing the call to mt7601u_vendor_reset() fixes that problem. The firmware uploads, the device connects to my network. The Tenda still works. The driver included in Windows 10 doesn't do that reset with either device. At first I tried with len=8192 because that's what the Windows driver does but it didn't help. After fixing the firmware upload, I had some USB disconnects with the no-name device. They were kind of random. Now I'm testing it with those two MCU_CAL_DPD removed. The Windows driver doesn't seem to use MCU_CAL_DPD with the Tenda. I didn't check with the other one. I hope this helps.
diff --git a/drivers/net/wireless/mediatek/mt7601u/mcu.c b/drivers/net/wireless/mediatek/mt7601u/mcu.c index 1b5cc271a9e1..15751d11b4dc 100644 --- a/drivers/net/wireless/mediatek/mt7601u/mcu.c +++ b/drivers/net/wireless/mediatek/mt7601u/mcu.c @@ -446,7 +446,6 @@ static int mt7601u_load_firmware(struct mt7601u_dev *dev) mt7601u_wr(dev, 0x94c, 0); mt7601u_wr(dev, MT_FCE_PSE_CTRL, 0); - mt7601u_vendor_reset(dev); msleep(5); mt7601u_wr(dev, 0xa44, 0); diff --git a/drivers/net/wireless/mediatek/mt7601u/phy.c b/drivers/net/wireless/mediatek/mt7601u/phy.c index d4cd2215aba9..f3c14a1552df 100644 --- a/drivers/net/wireless/mediatek/mt7601u/phy.c +++ b/drivers/net/wireless/mediatek/mt7601u/phy.c @@ -589,8 +589,6 @@ void mt7601u_phy_recalibrate_after_assoc(struct mt7601u_dev *dev) if (test_bit(MT7601U_STATE_REMOVED, &dev->state)) return; - mt7601u_mcu_calibrate(dev, MCU_CAL_DPD, dev->curr_temp); - mt7601u_rxdc_cal(dev); } @@ -1160,9 +1158,6 @@ static int mt7601u_init_cal(struct mt7601u_dev *dev) if (ret) return ret; ret = mt7601u_mcu_calibrate(dev, MCU_CAL_RXIQ, 0); - if (ret) - return ret; - ret = mt7601u_mcu_calibrate(dev, MCU_CAL_DPD, dev->dpd_temp); if (ret) return ret;