9ed1162ab8123632fdb0d8bf0e4dcf08eec5e5b3
[openwrt/openwrt.git] /
1 From 490340faddea461319652ce36dbc7c1b4482c35e Mon Sep 17 00:00:00 2001
2 From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
3 Date: Sat, 10 May 2025 15:21:25 +0300
4 Subject: [PATCH] wifi: rtw88: usb: Reduce control message timeout to 500 ms
5
6 RTL8811AU stops responding during the firmware download on some systems:
7
8 [ 809.256440] rtw_8821au 5-2.1:1.0: Firmware version 42.4.0, H2C version 0
9 [ 812.759142] rtw_8821au 5-2.1:1.0 wlp48s0f4u2u1: renamed from wlan0
10 [ 837.315388] rtw_8821au 1-4:1.0: write register 0x1ef4 failed with -110
11 [ 867.524259] rtw_8821au 1-4:1.0: write register 0x1ef8 failed with -110
12 [ 868.930976] rtw_8821au 5-2.1:1.0 wlp48s0f4u2u1: entered promiscuous mode
13 [ 897.730952] rtw_8821au 1-4:1.0: write register 0x1efc failed with -110
14
15 Each write takes 30 seconds to fail because that's the timeout currently
16 used for control messages in rtw_usb_write().
17
18 In this scenario the firmware download takes at least 2000 seconds.
19 Because this is done from the USB probe function, the long delay makes
20 other things in the system hang.
21
22 Reduce the timeout to 500 ms. This is the value used by the official USB
23 wifi drivers from Realtek.
24
25 Of course this only makes things hang for ~30 seconds instead of ~30
26 minutes. It doesn't fix the firmware download.
27
28 Tested with RTL8822CU, RTL8812BU, RTL8811CU, RTL8814AU, RTL8811AU,
29 RTL8812AU, RTL8821AU, RTL8723DU.
30
31 Cc: stable@vger.kernel.org
32 Fixes: a82dfd33d123 ("wifi: rtw88: Add common USB chip support")
33 Link: https://github.com/lwfinger/rtw88/issues/344
34 Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
35 Acked-by: Ping-Ke Shih <pkshih@realtek.com>
36 Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
37 Link: https://patch.msgid.link/1e35dd26-3f10-40b1-b2b4-f72184a26611@gmail.com
38 ---
39 drivers/net/wireless/realtek/rtw88/usb.c | 2 +-
40 1 file changed, 1 insertion(+), 1 deletion(-)
41
42 --- a/drivers/net/wireless/realtek/rtw88/usb.c
43 +++ b/drivers/net/wireless/realtek/rtw88/usb.c
44 @@ -139,7 +139,7 @@ static void rtw_usb_write(struct rtw_dev
45
46 ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
47 RTW_USB_CMD_REQ, RTW_USB_CMD_WRITE,
48 - addr, 0, data, len, 30000);
49 + addr, 0, data, len, 500);
50 if (ret < 0 && ret != -ENODEV && count++ < 4)
51 rtw_err(rtwdev, "write register 0x%x failed with %d\n",
52 addr, ret);