Skip to contentSkip to conversation

wifi: rtw89: Add support for RTL8922AU

PATCH Superseded Bitterblue Smith 3 participants 42 messages Mar 26 – Apr 16 Realtek wireless driver (rtw89)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover wifi: rtw89: Add support for RTL8922AU

Often one or more of these messages appears when the chip powers on:

[ +2.167037] rtw89_8922au 1-2:1.0: failed to wait RF DACK

[ +2.942749] rtw89_8922au 1-2:1.0: failed to wait RF TSSI

[ +0.019006] rtw89_8922au 2-4:1.0: failed to wait RF PRE_NTFY

[ +5.985900] rtw89_8922au 2-4:1.0: failed to wait RF DPK

It's unclear why.

It seems to work well anyway.

Bitterblue Smith (12):
wifi: rtw89: usb: Disable MLO for now
wifi: rtw89: usb: Support 2 bulk in endpoints
wifi: rtw89: Fix rtw89_usb_ops_mac_lv1_rcvy() for RTL8922AU
wifi: rtw89: Fix rtw89_usb_ops_mac_pre_init() for RTL8922AU
wifi: rtw89: Fix rtw89_usb_ops_mac_post_init() for RTL8922AU
wifi: rtw89: usb: Enable RX aggregation for RTL8922AU
wifi: rtw89: Fix rtw8922a_pwr_{on,off}_func() for USB
wifi: rtw89: Let hfc_param_ini have separate settings for USB 2/3
wifi: rtw89: Add rtw8922a_hfc_param_ini_usb{2,3}
wifi: rtw89: Add rtw8922a_dle_mem_usb{2,3}
wifi: rtw89: Add rtw8922au.c
wifi: rtw89: Enable the new rtw89_8922au module

 drivers/net/wireless/realtek/rtw89/Kconfig    |  12 +
 drivers/net/wireless/realtek/rtw89/Makefile   |   3 +
 drivers/net/wireless/realtek/rtw89/core.h     |   2 +-
 drivers/net/wireless/realtek/rtw89/mac.c      |  40 ++-
 drivers/net/wireless/realtek/rtw89/mac.h      |  25 ++
 drivers/net/wireless/realtek/rtw89/reg.h      |   4 +
 drivers/net/wireless/realtek/rtw89/rtw8851b.c |   1 +
 drivers/net/wireless/realtek/rtw89/rtw8852a.c |   1 +
 drivers/net/wireless/realtek/rtw89/rtw8852b.c |   1 +
 .../net/wireless/realtek/rtw89/rtw8852bt.c    |   2 +-
 drivers/net/wireless/realtek/rtw89/rtw8852c.c |   1 +
 drivers/net/wireless/realtek/rtw89/rtw8922a.c | 264 +++++++++++++++---
 .../net/wireless/realtek/rtw89/rtw8922au.c    |  81 ++++++
 drivers/net/wireless/realtek/rtw89/usb.c      |  31 +-
 drivers/net/wireless/realtek/rtw89/usb.h      |   3 +-
 15 files changed, 430 insertions(+), 41 deletions(-)
 create mode 100644 drivers/net/wireless/realtek/rtw89/rtw8922au.c
Signature · 1 line
2.53.0
#1 lore raw

PATCH 1/12 wifi: rtw89: usb: Disable MLO for now

It's not yet clear how the TX queue/channel selection is supposed to work for RTL8922AU with MLO, and I can't test MLO anyway.

---
 drivers/net/wireless/realtek/rtw89/usb.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/wireless/realtek/rtw89/usb.c +4 -0
index 581b8c05f930..7a46ace34c25 100644
@@ -1029,6 +1029,10 @@ int rtw89_usb_probe(struct usb_interface *intf,
 		return -ENOMEM;
 	}
 
+	rtw89_debug(rtwdev, RTW89_DBG_CHAN,
+		    "%s: disable MLO for now\n", __func__);
+	rtwdev->support_mlo = false;
+
 	rtwusb = rtw89_usb_priv(rtwdev);
 	rtwusb->rtwdev = rtwdev;
 	rtwusb->info = info->bus.usb;
Signature · 1 line
2.53.0
maintainer
#2 lore raw

RE: [PATCH rtw-next 01/12] wifi: rtw89: usb: Disable MLO for now

Quoted 2 lines · Bitterblue Smith

It's not yet clear how the TX queue/channel selection is supposed to work for RTL8922AU with MLO, and I can't test MLO anyway.

Currently, rtw89 work in MLSR mode by default, which means it works like legacy mode, so it's probably fine to enable MLO.

The debugfs can switch eMLSR mode, but it doesn't work very well for now.

Quoted 24 lines
---
 drivers/net/wireless/realtek/rtw89/usb.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/wireless/realtek/rtw89/usb.c +4 -1
index 581b8c05f930..7a46ace34c25 100644
@@ -1029,6 +1029,10 @@ int rtw89_usb_probe(struct usb_interface *intf,
                return -ENOMEM;
        }
 
+       rtw89_debug(rtwdev, RTW89_DBG_CHAN,
+                   "%s: disable MLO for now\n", __func__);
+       rtwdev->support_mlo = false;
+
        rtwusb = rtw89_usb_priv(rtwdev);
        rtwusb->rtwdev = rtwdev;
        rtwusb->info = info->bus.usb;
--

2.53.0

#3 lore raw

Re: [PATCH rtw-next 01/12] wifi: rtw89: usb: Disable MLO for now

Quoted 7 lines · Ping-Ke Shih
Quoted 2 lines · Bitterblue Smith

It's not yet clear how the TX queue/channel selection is supposed to work for RTL8922AU with MLO, and I can't test MLO anyway.

Currently, rtw89 work in MLSR mode by default, which means it works like legacy mode, so it's probably fine to enable MLO.

Someone tested MLO now (5 GHz + 6 GHz) so I will drop this patch from v2.

Quoted 27 lines

The debugfs can switch eMLSR mode, but it doesn't work very well for now.

Quoted 24 lines
---
 drivers/net/wireless/realtek/rtw89/usb.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/wireless/realtek/rtw89/usb.c +4 -1
index 581b8c05f930..7a46ace34c25 100644
@@ -1029,6 +1029,10 @@ int rtw89_usb_probe(struct usb_interface *intf,
                return -ENOMEM;
        }
 
+       rtw89_debug(rtwdev, RTW89_DBG_CHAN,
+                   "%s: disable MLO for now\n", __func__);
+       rtwdev->support_mlo = false;
+
        rtwusb = rtw89_usb_priv(rtwdev);
        rtwusb->rtwdev = rtwdev;
        rtwusb->info = info->bus.usb;
--

2.53.0

#4 lore raw

PATCH 2/12 wifi: rtw89: usb: Support 2 bulk in endpoints

In reply to Bitterblue Smith

RTL8912AU has 2 bulk in endpoints, not 1, so raise the limit.

It's not yet clear what the second bulk in endpoint is for.

---
 drivers/net/wireless/realtek/rtw89/usb.c | 15 +++++++++++----
 drivers/net/wireless/realtek/rtw89/usb.h |  3 ++-
 2 files changed, 13 insertions(+), 5 deletions(-)
drivers/net/wireless/realtek/rtw89/usb.c +11 -4
index 7a46ace34c25..327449141d8d 100644
@@ -497,7 +497,7 @@ static void rtw89_usb_rx_resubmit(struct rtw89_usb *rtwusb,
 	rxcb->rx_skb = rx_skb;
 
 	usb_fill_bulk_urb(rxcb->rx_urb, rtwusb->udev,
-			  usb_rcvbulkpipe(rtwusb->udev, rtwusb->in_pipe),
+			  usb_rcvbulkpipe(rtwusb->udev, rtwusb->in_pipe[0]),
 			  rxcb->rx_skb->data, RTW89_USB_RECVBUF_SZ,
 			  rtw89_usb_read_port_complete, rxcb);
 
@@ -932,6 +932,7 @@ static int rtw89_usb_parse(struct rtw89_dev *rtwdev,
 	struct rtw89_usb *rtwusb = rtw89_usb_priv(rtwdev);
 	struct usb_endpoint_descriptor *endpoint;
 	int num_out_pipes = 0;
+	int num_in_pipes = 0;
 	u8 num;
 	int i;
 
@@ -947,13 +948,14 @@ static int rtw89_usb_parse(struct rtw89_dev *rtwdev,
 
 		if (usb_endpoint_dir_in(endpoint) &&
 		    usb_endpoint_xfer_bulk(endpoint)) {
-			if (rtwusb->in_pipe) {
+			if (num_in_pipes >= RTW89_MAX_BULKIN_NUM) {
 				rtw89_err(rtwdev,
-					  "found more than 1 bulk in endpoint\n");
+					  "found more than %d bulk in endpoint\n",
+					  RTW89_MAX_BULKIN_NUM);
 				return -EINVAL;
 			}
 
-			rtwusb->in_pipe = num;
+			rtwusb->in_pipe[num_in_pipes++] = num;
 		}
 
 		if (usb_endpoint_dir_out(endpoint) &&
@@ -969,6 +971,11 @@ static int rtw89_usb_parse(struct rtw89_dev *rtwdev,
 		}
 	}
 
+	if (num_in_pipes < 1) {
+		rtw89_err(rtwdev, "no bulk in endpoints found\n");
+		return -EINVAL;
+	}
+
 	if (num_out_pipes < 1) {
 		rtw89_err(rtwdev, "no bulk out endpoints found\n");
 		return -EINVAL;
drivers/net/wireless/realtek/rtw89/usb.h +2 -1
index 3d17e514e346..7cb690f961bf 100644
@@ -18,6 +18,7 @@
 #define RTW89_USB_MOD512_PADDING	4
 
 #define RTW89_MAX_ENDPOINT_NUM		9
+#define RTW89_MAX_BULKIN_NUM		2
 #define RTW89_MAX_BULKOUT_NUM		7
 
 #define R_AX_RXAGG_0_V1			0x6000
@@ -63,7 +64,7 @@ struct rtw89_usb {
 
 	atomic_t continual_io_error;
 
-	u8 in_pipe;
+	u8 in_pipe[RTW89_MAX_BULKIN_NUM];
 	u8 out_pipe[RTW89_MAX_BULKOUT_NUM];
 
 	struct workqueue_struct *rxwq;
Signature · 1 line
2.53.0
maintainer Acked-by on v1 2/12
#5 lore raw

RE: [PATCH rtw-next 02/12] wifi: rtw89: usb: Support 2 bulk in endpoints

Quoted 3 lines · Bitterblue Smith

RTL8912AU has 2 bulk in endpoints, not 1, so raise the limit.

It's not yet clear what the second bulk in endpoint is for.

The second bulk-in is for USB interrupt mode for SER (system error recovery) flow, which you can reference ser.c to understand how it works for PCI WiFi devices. For now, you can totally ignore this.

Quoted 2 lines
#6 lore raw

PATCH 3/12 wifi: rtw89: Fix rtw89_usb_ops_mac_lv1_rcvy() for RTL8922AU

In reply to Bitterblue Smith

RTL8922AU uses a different register and mask to reset TX/RX. Add them here.

---
 drivers/net/wireless/realtek/rtw89/reg.h | 4 ++++
 drivers/net/wireless/realtek/rtw89/usb.c | 4 ++++
 2 files changed, 8 insertions(+)
drivers/net/wireless/realtek/rtw89/reg.h +4 -0
index 9b605617c3f0..200c08c97ad1 100644
@@ -4729,6 +4729,10 @@
 #define R_BE_LTR_LATENCY_IDX2_V1 0x361C
 #define R_BE_LTR_LATENCY_IDX3_V1 0x3620
 
+#define R_BE_USB2_WLAN_TRX_OPT_PAR2 0x41BC
+#define B_BE_USB2_USBRX_RST BIT(1)
+#define B_BE_USB2_USBTX_RST BIT(0)
+
 #define R_BE_HCI_BUF_IMR 0x6018
 #define B_BE_HCI_BUF_IMR_CLR 0xC0000303
 #define B_BE_HCI_BUF_IMR_SET 0xC0000301
drivers/net/wireless/realtek/rtw89/usb.c +4 -0
index 327449141d8d..eedc8dd2b070 100644
@@ -855,6 +855,10 @@ static int rtw89_usb_ops_mac_lv1_rcvy(struct rtw89_dev *rtwdev,
 		reg = R_AX_USB_WLAN0_1_V1;
 		mask = B_AX_USBRX_RST_V1 | B_AX_USBTX_RST_V1;
 		break;
+	case RTL8922A:
+		reg = R_BE_USB2_WLAN_TRX_OPT_PAR2;
+		mask = B_BE_USB2_USBRX_RST | B_BE_USB2_USBTX_RST;
+		break;
 	default:
 		rtw89_err(rtwdev, "%s: fix me\n", __func__);
 		return -EOPNOTSUPP;
Signature · 1 line
2.53.0
#8 lore raw

PATCH 4/12 wifi: rtw89: Fix rtw89_usb_ops_mac_pre_init() for RTL8922AU

In reply to Bitterblue Smith

Return early because RTL8922AU doesn't need to do anything here.

---
 drivers/net/wireless/realtek/rtw89/usb.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/wireless/realtek/rtw89/usb.c +3 -0
index eedc8dd2b070..9bd91dc1bb46 100644
@@ -740,6 +740,9 @@ static int rtw89_usb_ops_mac_pre_init(struct rtw89_dev *rtwdev)
 	const struct rtw89_usb_info *info = rtwusb->info;
 	u32 val32;
 
+	if (rtwdev->chip->chip_id == RTL8922A)
+		return 0;
+
 	rtw89_write32_set(rtwdev, info->usb_host_request_2,
 			  B_AX_R_USBIO_MODE);
 
Signature · 1 line
2.53.0
#10 lore raw

PATCH 5/12 wifi: rtw89: Fix rtw89_usb_ops_mac_post_init() for RTL8922AU

In reply to Bitterblue Smith

Skip most of the function because RTL8922AU only needs to configure the RX aggregation here.

---
 drivers/net/wireless/realtek/rtw89/usb.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/wireless/realtek/rtw89/usb.c +4 -0
index 9bd91dc1bb46..f058a8e9f818 100644
@@ -811,6 +811,9 @@ static int rtw89_usb_ops_mac_post_init(struct rtw89_dev *rtwdev)
 	enum usb_device_speed speed;
 	u32 ep;
 
+	if (rtwdev->chip->chip_id == RTL8922A)
+		goto rx_agg_cfg;
+
 	rtw89_write32_clr(rtwdev, info->usb3_mac_npi_config_intf_0,
 			  B_AX_SSPHY_LFPS_FILTER);
 
@@ -832,6 +835,7 @@ static int rtw89_usb_ops_mac_post_init(struct rtw89_dev *rtwdev)
 		rtw89_write8(rtwdev, info->usb_endpoint_2 + 1, NUMP);
 	}
 
+rx_agg_cfg:
 	rtw89_usb_rx_agg_cfg(rtwdev);
 
 	return 0;
Signature · 1 line
2.53.0
#12 lore raw

PATCH 6/12 wifi: rtw89: usb: Enable RX aggregation for RTL8922AU

In reply to Bitterblue Smith

It uses the same settings as RTL8852CU.

---
 drivers/net/wireless/realtek/rtw89/usb.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/wireless/realtek/rtw89/usb.c +1 -0
index f058a8e9f818..07c2176ccf21 100644
@@ -796,6 +796,7 @@ static void rtw89_usb_rx_agg_cfg(struct rtw89_dev *rtwdev)
 		rtw89_usb_rx_agg_cfg_v1(rtwdev);
 		break;
 	case RTL8852C:
+	case RTL8922A:
 		rtw89_usb_rx_agg_cfg_v2(rtwdev);
 		break;
 	default:
Signature · 1 line
2.53.0
maintainer
#13 lore raw

RE: [PATCH rtw-next 06/12] wifi: rtw89: usb: Enable RX aggregation for RTL8922AU

Quoted 1 line · Bitterblue Smith

It uses the same settings as RTL8852CU.

Though the values are the same, I'd prefer listing them individually, since naming is different in vendor driver.

#define R_AX_RXAGG_0_V1 0x6000
#define R_BE_RXAGG_0_V1 0x6000

How about you? (I don't strictly request to this change)

#14 lore raw

Re: [PATCH rtw-next 06/12] wifi: rtw89: usb: Enable RX aggregation for RTL8922AU

Quoted 11 lines · Ping-Ke Shih
Quoted 1 line · Bitterblue Smith

It uses the same settings as RTL8852CU.

Though the values are the same, I'd prefer listing them individually, since naming is different in vendor driver.

#define R_AX_RXAGG_0_V1 0x6000
#define R_BE_RXAGG_0_V1 0x6000

How about you? (I don't strictly request to this change)

Okay, I will do that for v2.

#15 lore raw

PATCH 7/12 wifi: rtw89: Fix rtw8922a_pwr_{on,off}_func() for USB

In reply to Bitterblue Smith

There are a few differences in the power on/off functions between PCIE and USB.

---
 drivers/net/wireless/realtek/rtw89/rtw8922a.c | 92 +++++++++++++------
 1 file changed, 63 insertions(+), 29 deletions(-)
drivers/net/wireless/realtek/rtw89/rtw8922a.c +63 -29
index a489aaf90f23..c745e5a58d12 100644
@@ -298,17 +298,24 @@ static int rtw8922a_pwr_on_func(struct rtw89_dev *rtwdev)
 	rtw89_write32_clr(rtwdev, R_BE_FEN_RST_ENABLE, B_BE_R_SYM_ISO_ADDA_P02PP |
 						       B_BE_R_SYM_ISO_ADDA_P12PP);
 	rtw89_write8_set(rtwdev, R_BE_PLATFORM_ENABLE, B_BE_PLATFORM_EN);
-	rtw89_write32_set(rtwdev, R_BE_HCI_OPT_CTRL, B_BE_HAXIDMA_IO_EN);
 
-	ret = read_poll_timeout(rtw89_read32, val32, val32 & B_BE_HAXIDMA_IO_ST,
-				1000, 3000000, false, rtwdev, R_BE_HCI_OPT_CTRL);
-	if (ret)
-		return ret;
+	if (rtwdev->hci.type == RTW89_HCI_TYPE_PCIE) {
+		rtw89_write32_set(rtwdev, R_BE_HCI_OPT_CTRL, B_BE_HAXIDMA_IO_EN);
 
-	ret = read_poll_timeout(rtw89_read32, val32, !(val32 & B_BE_HAXIDMA_BACKUP_RESTORE_ST),
-				1000, 3000000, false, rtwdev, R_BE_HCI_OPT_CTRL);
-	if (ret)
-		return ret;
+		ret = read_poll_timeout(rtw89_read32, val32,
+					val32 & B_BE_HAXIDMA_IO_ST,
+					1000, 3000000, false, rtwdev,
+					R_BE_HCI_OPT_CTRL);
+		if (ret)
+			return ret;
+
+		ret = read_poll_timeout(rtw89_read32, val32,
+					!(val32 & B_BE_HAXIDMA_BACKUP_RESTORE_ST),
+					1000, 3000000, false, rtwdev,
+					R_BE_HCI_OPT_CTRL);
+		if (ret)
+			return ret;
+	}
 
 	rtw89_write32_set(rtwdev, R_BE_HCI_OPT_CTRL, B_BE_HCI_WLAN_IO_EN);
 
@@ -317,7 +324,9 @@ static int rtw8922a_pwr_on_func(struct rtw89_dev *rtwdev)
 	if (ret)
 		return ret;
 
-	rtw89_write32_clr(rtwdev, R_BE_SYS_SDIO_CTRL, B_BE_PCIE_FORCE_IBX_EN);
+	if (rtwdev->hci.type == RTW89_HCI_TYPE_PCIE)
+		rtw89_write32_clr(rtwdev, R_BE_SYS_SDIO_CTRL,
+				  B_BE_PCIE_FORCE_IBX_EN);
 
 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_PLL, 0x02, 0x02);
 	if (ret)
@@ -371,6 +380,10 @@ static int rtw8922a_pwr_on_func(struct rtw89_dev *rtwdev)
 	if (ret)
 		return ret;
 
+	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_SRAM_CTRL, 0, XTAL_SI_SRAM_DIS);
+	if (ret)
+		return ret;
+
 	if (hal->cv != CHIP_CAV) {
 		rtw89_write32_set(rtwdev, R_BE_PMC_DBG_CTRL2, B_BE_SYSON_DIS_PMCR_BE_WRMSK);
 		rtw89_write32_set(rtwdev, R_BE_SYS_ISO_CTRL, B_BE_ISO_EB2CORE);
@@ -382,14 +395,16 @@ static int rtw8922a_pwr_on_func(struct rtw89_dev *rtwdev)
 		rtw89_write32_clr(rtwdev, R_BE_PMC_DBG_CTRL2, B_BE_SYSON_DIS_PMCR_BE_WRMSK);
 	}
 
-	rtw89_write32_set(rtwdev, R_BE_DMAC_FUNC_EN,
-			  B_BE_MAC_FUNC_EN | B_BE_DMAC_FUNC_EN | B_BE_MPDU_PROC_EN |
-			  B_BE_WD_RLS_EN | B_BE_DLE_WDE_EN | B_BE_TXPKT_CTRL_EN |
-			  B_BE_STA_SCH_EN | B_BE_DLE_PLE_EN | B_BE_PKT_BUF_EN |
-			  B_BE_DMAC_TBL_EN | B_BE_PKT_IN_EN | B_BE_DLE_CPUIO_EN |
-			  B_BE_DISPATCHER_EN | B_BE_BBRPT_EN | B_BE_MAC_SEC_EN |
-			  B_BE_H_AXIDMA_EN | B_BE_DMAC_MLO_EN | B_BE_PLRLS_EN |
-			  B_BE_P_AXIDMA_EN | B_BE_DLE_DATACPUIO_EN | B_BE_LTR_CTL_EN);
+	val32 = B_BE_MAC_FUNC_EN | B_BE_DMAC_FUNC_EN | B_BE_MPDU_PROC_EN |
+		B_BE_WD_RLS_EN | B_BE_DLE_WDE_EN | B_BE_TXPKT_CTRL_EN |
+		B_BE_STA_SCH_EN | B_BE_DLE_PLE_EN | B_BE_PKT_BUF_EN |
+		B_BE_DMAC_TBL_EN | B_BE_PKT_IN_EN | B_BE_DLE_CPUIO_EN |
+		B_BE_DISPATCHER_EN | B_BE_BBRPT_EN | B_BE_MAC_SEC_EN |
+		B_BE_H_AXIDMA_EN | B_BE_DMAC_MLO_EN | B_BE_PLRLS_EN |
+		B_BE_P_AXIDMA_EN | B_BE_DLE_DATACPUIO_EN;
+	if (rtwdev->hci.type == RTW89_HCI_TYPE_PCIE)
+		val32 |= B_BE_LTR_CTL_EN;
+	rtw89_write32_set(rtwdev, R_BE_DMAC_FUNC_EN, val32);
 
 	set_bit(RTW89_FLAG_DMAC_FUNC, rtwdev->flags);
 
@@ -465,17 +480,23 @@ static int rtw8922a_pwr_off_func(struct rtw89_dev *rtwdev)
 	if (ret)
 		return ret;
 
-	rtw89_write32_clr(rtwdev, R_BE_HCI_OPT_CTRL, B_BE_HAXIDMA_IO_EN);
+	if (rtwdev->hci.type == RTW89_HCI_TYPE_PCIE) {
+		rtw89_write32_clr(rtwdev, R_BE_HCI_OPT_CTRL, B_BE_HAXIDMA_IO_EN);
 
-	ret = read_poll_timeout(rtw89_read32, val32, !(val32 & B_BE_HAXIDMA_IO_ST),
-				1000, 3000000, false, rtwdev, R_BE_HCI_OPT_CTRL);
-	if (ret)
-		return ret;
+		ret = read_poll_timeout(rtw89_read32, val32,
+					!(val32 & B_BE_HAXIDMA_IO_ST),
+					1000, 3000000, false, rtwdev,
+					R_BE_HCI_OPT_CTRL);
+		if (ret)
+			return ret;
 
-	ret = read_poll_timeout(rtw89_read32, val32, !(val32 & B_BE_HAXIDMA_BACKUP_RESTORE_ST),
-				1000, 3000000, false, rtwdev, R_BE_HCI_OPT_CTRL);
-	if (ret)
-		return ret;
+		ret = read_poll_timeout(rtw89_read32, val32,
+					!(val32 & B_BE_HAXIDMA_BACKUP_RESTORE_ST),
+					1000, 3000000, false, rtwdev,
+					R_BE_HCI_OPT_CTRL);
+		if (ret)
+			return ret;
+	}
 
 	rtw89_write32_clr(rtwdev, R_BE_HCI_OPT_CTRL, B_BE_HCI_WLAN_IO_EN);
 
@@ -491,9 +512,22 @@ static int rtw8922a_pwr_off_func(struct rtw89_dev *rtwdev)
 	if (ret)
 		return ret;
 
-	rtw89_write32(rtwdev, R_BE_WLLPS_CTRL, 0x0000A1B2);
+	if (rtwdev->hci.type == RTW89_HCI_TYPE_PCIE)
+		rtw89_write32(rtwdev, R_BE_WLLPS_CTRL, 0x0000A1B2);
+	else if (rtwdev->hci.type == RTW89_HCI_TYPE_USB)
+		rtw89_write32_clr(rtwdev, R_BE_SYS_PW_CTRL, B_BE_SOP_EASWR);
+
 	rtw89_write32_clr(rtwdev, R_BE_SYS_PW_CTRL, B_BE_XTAL_OFF_A_DIE);
-	rtw89_write32_set(rtwdev, R_BE_SYS_PW_CTRL, B_BE_APFM_SWLPS);
+
+	if (rtwdev->hci.type == RTW89_HCI_TYPE_PCIE) {
+		rtw89_write32_set(rtwdev, R_BE_SYS_PW_CTRL, B_BE_APFM_SWLPS);
+	} else if (rtwdev->hci.type == RTW89_HCI_TYPE_USB) {
+		val32 = rtw89_read32(rtwdev, R_BE_SYS_PW_CTRL);
+		val32 |= B_BE_AFSM_WLSUS_EN;
+		val32 &= ~B_BE_AFSM_PCIE_SUS_EN;
+		rtw89_write32(rtwdev, R_BE_SYS_PW_CTRL, val32);
+	}
+
 	rtw89_write32(rtwdev, R_BE_UDM1, 0);
 
 	return 0;
Signature · 1 line
2.53.0
maintainer Acked-by on v1 7/12
#16 lore raw

RE: [PATCH rtw-next 07/12] wifi: rtw89: Fix rtw8922a_pwr_{on,off}_func() for USB

Quoted 4 lines · Bitterblue Smith

There are a few differences in the power on/off functions between PCIE and USB.

[...]

drivers/net/wireless/realtek/rtw89/rtw8922a.c static int rtw8922a_pwr_on_func(struct rtw89_dev *rtwdev) · line 386

Quoted 8 lines
drivers/net/wireless/realtek/rtw89/rtw8922a.c +4 -0
@@ -371,6 +380,10 @@ static int rtw8922a_pwr_on_func(struct rtw89_dev *rtwdev)
        if (ret)
                return ret;
 
+       ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_SRAM_CTRL, 0, XTAL_SI_SRAM_DIS);
+       if (ret)
+               return ret;
+

Thanks for this missed entry.

Quoted 3 lines
drivers/net/wireless/realtek/rtw89/rtw8922a.c +0 -0
        if (hal->cv != CHIP_CAV) {
                rtw89_write32_set(rtwdev, R_BE_PMC_DBG_CTRL2, B_BE_SYSON_DIS_PMCR_BE_WRMSK);
                rtw89_write32_set(rtwdev, R_BE_SYS_ISO_CTRL, B_BE_ISO_EB2CORE);
#17 lore raw

PATCH 8/12 wifi: rtw89: Let hfc_param_ini have separate settings for USB 2/3

In reply to Bitterblue Smith

RTL8912AU needs different settings for USB 2 and USB 3.

---
 drivers/net/wireless/realtek/rtw89/core.h      | 2 +-
 drivers/net/wireless/realtek/rtw89/mac.c       | 2 +-
 drivers/net/wireless/realtek/rtw89/rtw8851b.c  | 1 +
 drivers/net/wireless/realtek/rtw89/rtw8852a.c  | 1 +
 drivers/net/wireless/realtek/rtw89/rtw8852b.c  | 1 +
 drivers/net/wireless/realtek/rtw89/rtw8852bt.c | 2 +-
 drivers/net/wireless/realtek/rtw89/rtw8852c.c  | 1 +
 drivers/net/wireless/realtek/rtw89/rtw8922a.c  | 2 +-
 8 files changed, 8 insertions(+), 4 deletions(-)
drivers/net/wireless/realtek/rtw89/core.h +1 -1
index 94e4faf70e12..f462eb632eb0 100644
@@ -4525,7 +4525,7 @@ struct rtw89_chip_info {
 	u16 max_rx_agg_num;
 	bool dis_2g_40m_ul_ofdma;
 	u32 rsvd_ple_ofst;
-	const struct rtw89_hfc_param_ini *hfc_param_ini[RTW89_HCI_TYPE_NUM];
+	const struct rtw89_hfc_param_ini *hfc_param_ini[RTW89_HCI_DLE_TYPE_NUM];
 	const struct rtw89_dle_mem *dle_mem[RTW89_HCI_DLE_TYPE_NUM];
 	u8 wde_qempty_acq_grpnum;
 	u8 wde_qempty_mgq_grpsel;
drivers/net/wireless/realtek/rtw89/mac.c +1 -1
index 35fd18fe6470..3320797be26d 100644
@@ -898,7 +898,7 @@ static int hfc_reset_param(struct rtw89_dev *rtwdev)
 	struct rtw89_hfc_param *param = &rtwdev->mac.hfc_param;
 	u8 qta_mode = rtwdev->mac.dle_info.qta_mode;
 
-	param_inis = rtwdev->chip->hfc_param_ini[rtwdev->hci.type];
+	param_inis = rtwdev->chip->hfc_param_ini[rtwdev->hci.dle_type];
 	if (!param_inis)
 		return -EINVAL;
 
drivers/net/wireless/realtek/rtw89/rtw8851b.c +1 -0
index a3a5b6fbe46c..1c968484a823 100644
@@ -2600,6 +2600,7 @@ const struct rtw89_chip_info rtw8851b_chip_info = {
 	.dis_2g_40m_ul_ofdma	= true,
 	.rsvd_ple_ofst		= 0x2f800,
 	.hfc_param_ini		= {rtw8851b_hfc_param_ini_pcie,
+				   rtw8851b_hfc_param_ini_usb,
 				   rtw8851b_hfc_param_ini_usb,
 				   NULL},
 	.dle_mem		= {rtw8851b_dle_mem_pcie,
drivers/net/wireless/realtek/rtw89/rtw8852a.c +1 -0
index 898c534a5762..39b7b4da8d89 100644
@@ -2336,6 +2336,7 @@ const struct rtw89_chip_info rtw8852a_chip_info = {
 	.dis_2g_40m_ul_ofdma	= true,
 	.rsvd_ple_ofst		= 0x6f800,
 	.hfc_param_ini		= {rtw8852a_hfc_param_ini_pcie,
+				   rtw8852a_hfc_param_ini_usb,
 				   rtw8852a_hfc_param_ini_usb,
 				   NULL},
 	.dle_mem		= {rtw8852a_dle_mem_pcie,
drivers/net/wireless/realtek/rtw89/rtw8852b.c +1 -0
index 19a9f07e8714..bf802d7ec733 100644
@@ -931,6 +931,7 @@ const struct rtw89_chip_info rtw8852b_chip_info = {
 	.dis_2g_40m_ul_ofdma	= true,
 	.rsvd_ple_ofst		= 0x2f800,
 	.hfc_param_ini		= {rtw8852b_hfc_param_ini_pcie,
+				   rtw8852b_hfc_param_ini_usb,
 				   rtw8852b_hfc_param_ini_usb,
 				   NULL},
 	.dle_mem		= {rtw8852b_dle_mem_pcie,
drivers/net/wireless/realtek/rtw89/rtw8852bt.c +1 -1
index c86b995a7cb1..021c2a668d5b 100644
@@ -776,7 +776,7 @@ const struct rtw89_chip_info rtw8852bt_chip_info = {
 	.max_rx_agg_num		= 64,
 	.dis_2g_40m_ul_ofdma	= true,
 	.rsvd_ple_ofst		= 0x6f800,
-	.hfc_param_ini		= {rtw8852bt_hfc_param_ini_pcie, NULL, NULL},
+	.hfc_param_ini		= {rtw8852bt_hfc_param_ini_pcie, NULL, NULL, NULL},
 	.dle_mem		= {rtw8852bt_dle_mem_pcie, NULL, NULL, NULL},
 	.wde_qempty_acq_grpnum	= 4,
 	.wde_qempty_mgq_grpsel	= 4,
drivers/net/wireless/realtek/rtw89/rtw8852c.c +1 -0
index 7ea0a8905282..a13e576e200d 100644
@@ -3126,6 +3126,7 @@ const struct rtw89_chip_info rtw8852c_chip_info = {
 	.dis_2g_40m_ul_ofdma	= false,
 	.rsvd_ple_ofst		= 0x6f800,
 	.hfc_param_ini		= {rtw8852c_hfc_param_ini_pcie,
+				   rtw8852c_hfc_param_ini_usb,
 				   rtw8852c_hfc_param_ini_usb,
 				   NULL},
 	.dle_mem		= {rtw8852c_dle_mem_pcie,
drivers/net/wireless/realtek/rtw89/rtw8922a.c +1 -1
index c745e5a58d12..83497b4d7992 100644
@@ -2969,7 +2969,7 @@ const struct rtw89_chip_info rtw8922a_chip_info = {
 	.max_rx_agg_num		= 64,
 	.dis_2g_40m_ul_ofdma	= false,
 	.rsvd_ple_ofst		= 0x8f800,
-	.hfc_param_ini		= {rtw8922a_hfc_param_ini_pcie, NULL, NULL},
+	.hfc_param_ini		= {rtw8922a_hfc_param_ini_pcie, NULL, NULL, NULL},
 	.dle_mem		= {rtw8922a_dle_mem_pcie, NULL, NULL, NULL},
 	.wde_qempty_acq_grpnum	= 4,
 	.wde_qempty_mgq_grpsel	= 4,
Signature · 1 line
2.53.0
maintainer Acked-by on v1 8/12
#18 lore raw

RE: [PATCH rtw-next 08/12] wifi: rtw89: Let hfc_param_ini have separate settings for USB 2/3

Quoted 3 lines · Bitterblue Smith

RTL8912AU needs different settings for USB 2 and USB 3.

Quoted 9 lines
---
 drivers/net/wireless/realtek/rtw89/core.h      | 2 +-
 drivers/net/wireless/realtek/rtw89/mac.c       | 2 +-
 drivers/net/wireless/realtek/rtw89/rtw8851b.c  | 1 +
 drivers/net/wireless/realtek/rtw89/rtw8852a.c  | 1 +
 drivers/net/wireless/realtek/rtw89/rtw8852b.c  | 1 +
 drivers/net/wireless/realtek/rtw89/rtw8852bt.c | 2 +-
 drivers/net/wireless/realtek/rtw89/rtw8852c.c  | 1 +
 drivers/net/wireless/realtek/rtw89/rtw8922a.c  | 2 +-

I might miss this change by rtw8922d.c, since we are submitting at the same time. But no worries, it will be aligned when people are adding RTL8922DU.

#19 lore raw

PATCH 9/12 wifi: rtw89: Add rtw8922a_hfc_param_ini_usb{2,3}

In reply to Bitterblue Smith

"hfc" means "hci fc" which is "Host Control Interface Flow Control". These are some parameters needed for RTL8922AU.

---
 drivers/net/wireless/realtek/rtw89/mac.c      |   3 +
 drivers/net/wireless/realtek/rtw89/mac.h      |   3 +
 drivers/net/wireless/realtek/rtw89/rtw8922a.c | 125 +++++++++++++++++-
 3 files changed, 130 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/mac.c +3 -0
index 3320797be26d..57072b5d9feb 100644
@@ -1716,6 +1716,9 @@ const struct rtw89_mac_size_set rtw89_mac_size = {
 	.hfc_preccfg_pcie = {2, 40, 0, 0, 1, 0, 0, 0},
 	.hfc_prec_cfg_c0 = {2, 32, 0, 0, 0, 0, 0, 0, 2, 32, 0, 0},
 	.hfc_prec_cfg_c2 = {0, 256, 0, 0, 0, 0, 0, 0, 0, 256, 0, 0},
+	.hfc_prec_cfg_c3 = {18, 32, 148, 148, 1, 1, 1, 1},
+	.hfc_prec_cfg_c5 = {18, 32, 148, 148, 1, 1, 0, 1},
+	.hfc_prec_cfg_c6 = {8, 32, 148, 148, 1, 1, 0, 1},
 	/* PCIE 64 */
 	.wde_size0 = {RTW89_WDE_PG_64, 4095, 1,},
 	.wde_size0_v1 = {RTW89_WDE_PG_64, 3328, 0, 0,},
drivers/net/wireless/realtek/rtw89/mac.h +3 -0
index 88a877556cb3..f997d54faaf1 100644
@@ -925,6 +925,9 @@ struct rtw89_mac_size_set {
 	const struct rtw89_hfc_prec_cfg hfc_preccfg_pcie;
 	const struct rtw89_hfc_prec_cfg hfc_prec_cfg_c0;
 	const struct rtw89_hfc_prec_cfg hfc_prec_cfg_c2;
+	const struct rtw89_hfc_prec_cfg hfc_prec_cfg_c3;
+	const struct rtw89_hfc_prec_cfg hfc_prec_cfg_c5;
+	const struct rtw89_hfc_prec_cfg hfc_prec_cfg_c6;
 	const struct rtw89_dle_size wde_size0;
 	const struct rtw89_dle_size wde_size1;
 	const struct rtw89_dle_size wde_size0_v1;
drivers/net/wireless/realtek/rtw89/rtw8922a.c +124 -1

137 lines not on this page · raw message

Signature · 1 line
2.53.0
#21 lore raw

PATCH 10/12 wifi: rtw89: Add rtw8922a_dle_mem_usb{2,3}

In reply to Bitterblue Smith

Add rtw8922a_dle_mem_usb2 and rtw8922a_dle_mem_usb3 and their various quotas and sizes in struct rtw89_mac_size_set.

"dle" could be "Data Link Engine" or "Double Link Engine". These are some parameters needed for RTL8922AU.

Also rename wde_size4_v1 to wde_size3_v1 because the name seemed incorrect.

---
 drivers/net/wireless/realtek/rtw89/mac.c      | 35 +++++++++++++-
 drivers/net/wireless/realtek/rtw89/mac.h      | 22 +++++++++
 drivers/net/wireless/realtek/rtw89/rtw8922a.c | 47 ++++++++++++++++++-
 3 files changed, 101 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtw89/mac.c +34 -1
index 57072b5d9feb..5077433276e5 100644
@@ -1725,12 +1725,18 @@ const struct rtw89_mac_size_set rtw89_mac_size = {
 	/* 8852A USB */
 	.wde_size1 = {RTW89_WDE_PG_64, 768, 0,},
 	/* DLFW */
+	.wde_size3_v1 = {RTW89_WDE_PG_64, 0, 3328, 0,},
 	.wde_size4 = {RTW89_WDE_PG_64, 0, 4096,},
-	.wde_size4_v1 = {RTW89_WDE_PG_64, 0, 3328, 0,},
+	/* 8922A USB3.0 */
+	.wde_size4_v1 = {RTW89_WDE_PG_64, 892, 4, 0,},
+	.wde_size5_v1 = {RTW89_WDE_PG_64, 864, 32, 0,},
 	/* PCIE 64 */
 	.wde_size6 = {RTW89_WDE_PG_64, 512, 0,},
 	/* 8852B PCIE SCC */
 	.wde_size7 = {RTW89_WDE_PG_64, 510, 2,},
+	/* 8922A USB2.0 */
+	.wde_size7_v1 = {RTW89_WDE_PG_64, 508, 4,},
+	.wde_size8_v1 = {RTW89_WDE_PG_64, 634, 6,},
 	/* DLFW */
 	.wde_size9 = {RTW89_WDE_PG_64, 0, 1024,},
 	.wde_size16_v1 = {RTW89_WDE_PG_64, 639, 1, 0,},
@@ -1754,8 +1760,13 @@ const struct rtw89_mac_size_set rtw89_mac_size = {
 	.ple_size3_v1 = {RTW89_PLE_PG_128, 2928, 0, 212992,},
 	/* DLFW */
 	.ple_size4 = {RTW89_PLE_PG_128, 64, 1472,},
+	/* 8922A USB3.0 */
+	.ple_size4_v1 = {RTW89_PLE_PG_256, 1963, 109, 57344,},
 	/* PCIE 64 */
 	.ple_size6 = {RTW89_PLE_PG_128, 496, 16,},
+	/* 8922A USB2.0 */
+	.ple_size6_v1 = {RTW89_PLE_PG_256, 2059, 109, 32768,},
+	.ple_size7_v1 = {RTW89_PLE_PG_256, 2027, 109, 40960,},
 	/* DLFW */
 	.ple_size8 = {RTW89_PLE_PG_128, 64, 960,},
 	.ple_size9 = {RTW89_PLE_PG_128, 2288, 16,},
@@ -1781,10 +1792,16 @@ const struct rtw89_mac_size_set rtw89_mac_size = {
 	.wde_qt3 = {0, 0, 0, 0,},
 	/* DLFW */
 	.wde_qt4 = {0, 0, 0, 0,},
+	/* 8922A USB3.0 */
+	.wde_qt4_v1 = {876, 6, 0, 10,},
+	.wde_qt5_v1 = {838, 6, 0, 20,},
 	/* PCIE 64 */
 	.wde_qt6 = {448, 48, 0, 16,},
 	/* 8852B PCIE SCC */
 	.wde_qt7 = {446, 48, 0, 16,},
+	/* 8922A USB2.0 */
+	.wde_qt7_v1 = {492, 6, 0, 10,},
+	.wde_qt8_v1 = {608, 6, 0, 20,},
 	/* 8852C USB3.0 */
 	.wde_qt16 = {344, 2, 0, 8,},
 	/* 8852C DLFW */
@@ -1804,9 +1821,22 @@ const struct rtw89_mac_size_set rtw89_mac_size = {
 	/* PCIE SCC */
 	.ple_qt5 = {264, 0, 32, 20, 64, 13, 1101, 0, 64, 128, 120,},
 	.ple_qt5_v2 = {0, 0, 32, 256, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,},
+	/* 8922A USB3.0 */
+	.ple_qt6_v1 = {1806, 0, 16, 24, 7, 14, 57, 0, 12, 9, 1, 4, 0,},
+	.ple_qt7_v1 = {1806, 0, 16, 24, 20, 27, 70, 0, 25, 9, 1, 17, 0,},
+	.ple_qt8_v1 = {1638, 0, 16, 24, 7, 14, 99, 99, 24, 9, 1, 4, 0,},
+	/* PCIE SCC */
 	.ple_qt9 = {0, 0, 32, 256, 0, 0, 0, 0, 0, 0, 1, 0, 0,},
+	/* 8922A USB3.0 */
+	.ple_qt9_v1 = {1638, 0, 16, 24, 35, 42, 127, 127, 52, 9, 1, 32, 0,},
+	/* 8922A USB2.0 */
+	.ple_qt12_v1 = {463, 0, 16, 24, 7, 14, 57, 0, 12, 9, 1, 4, 0,},
 	/* DLFW */
 	.ple_qt13 = {0, 0, 16, 48, 0, 0, 0, 0, 0, 0, 0,},
+	/* 8922A USB2.0 */
+	.ple_qt13_v1 = {463, 0, 16, 24, 1459, 1466, 1509, 0, 1464, 9, 1, 1456, 0,},
+	.ple_qt14_v1 = {939, 0, 16, 24, 7, 14, 57, 57, 24, 9, 1, 4, 0,},
+	.ple_qt15_v1 = {939, 0, 16, 24, 882, 889, 932, 932, 899, 9, 1, 879, 0,},
 	/* PCIE 64 */
 	.ple_qt18 = {147, 0, 16, 20, 17, 13, 89, 0, 32, 14, 8, 0,},
 	/* 8852A USB SCC */
@@ -1850,8 +1880,11 @@ const struct rtw89_mac_size_set rtw89_mac_size = {
 	.ple_qt_51b_wow = {147, 0, 16, 20, 157, 13, 133, 0, 172, 14, 24, 0,},
 	.ple_rsvd_qt0 = {2, 107, 107, 6, 6, 6, 6, 0, 0, 0,},
 	.ple_rsvd_qt1 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
+	.ple_rsvd_qt2 = {1, 56, 28, 6, 6, 6, 6, 0, 0, 0,},
 	.ple_rsvd_qt9 = {1, 44, 44, 6, 6, 6, 6, 69, 0, 0,},
 	.rsvd0_size0 = {212992, 0,},
+	.rsvd0_size3 = {57344, 0,},
+	.rsvd0_size5 = {32768, 0,},
 	.rsvd0_size6 = {40960, 0,},
 	.rsvd1_size0 = {587776, 2048,},
 	.rsvd1_size2 = {391168, 2048,},
drivers/net/wireless/realtek/rtw89/mac.h +22 -0
index f997d54faaf1..9f9f261ef9ff 100644
@@ -931,10 +931,14 @@ struct rtw89_mac_size_set {
 	const struct rtw89_dle_size wde_size0;
 	const struct rtw89_dle_size wde_size1;
 	const struct rtw89_dle_size wde_size0_v1;
+	const struct rtw89_dle_size wde_size3_v1;
 	const struct rtw89_dle_size wde_size4;
 	const struct rtw89_dle_size wde_size4_v1;
+	const struct rtw89_dle_size wde_size5_v1;
 	const struct rtw89_dle_size wde_size6;
 	const struct rtw89_dle_size wde_size7;
+	const struct rtw89_dle_size wde_size7_v1;
+	const struct rtw89_dle_size wde_size8_v1;
 	const struct rtw89_dle_size wde_size9;
 	const struct rtw89_dle_size wde_size16_v1;
 	const struct rtw89_dle_size wde_size17;
@@ -948,8 +952,11 @@ struct rtw89_mac_size_set {
 	const struct rtw89_dle_size ple_size1;
 	const struct rtw89_dle_size ple_size0_v1;
 	const struct rtw89_dle_size ple_size3_v1;
+	const struct rtw89_dle_size ple_size4_v1;
 	const struct rtw89_dle_size ple_size4;
 	const struct rtw89_dle_size ple_size6;
+	const struct rtw89_dle_size ple_size6_v1;
+	const struct rtw89_dle_size ple_size7_v1;
 	const struct rtw89_dle_size ple_size8;
 	const struct rtw89_dle_size ple_size9;
 	const struct rtw89_dle_size ple_size17;
@@ -965,8 +972,12 @@ struct rtw89_mac_size_set {
 	const struct rtw89_wde_quota wde_qt0_v1;
 	const struct rtw89_wde_quota wde_qt3;
 	const struct rtw89_wde_quota wde_qt4;
+	const struct rtw89_wde_quota wde_qt4_v1;
+	const struct rtw89_wde_quota wde_qt5_v1;
 	const struct rtw89_wde_quota wde_qt6;
 	const struct rtw89_wde_quota wde_qt7;
+	const struct rtw89_wde_quota wde_qt7_v1;
+	const struct rtw89_wde_quota wde_qt8_v1;
 	const struct rtw89_wde_quota wde_qt16;
 	const struct rtw89_wde_quota wde_qt17;
 	const struct rtw89_wde_quota wde_qt18;
@@ -979,8 +990,16 @@ struct rtw89_mac_size_set {
 	const struct rtw89_ple_quota ple_qt4;
 	const struct rtw89_ple_quota ple_qt5;
 	const struct rtw89_ple_quota ple_qt5_v2;
+	const struct rtw89_ple_quota ple_qt6_v1;
+	const struct rtw89_ple_quota ple_qt7_v1;
+	const struct rtw89_ple_quota ple_qt8_v1;
 	const struct rtw89_ple_quota ple_qt9;
+	const struct rtw89_ple_quota ple_qt9_v1;
+	const struct rtw89_ple_quota ple_qt12_v1;
 	const struct rtw89_ple_quota ple_qt13;
+	const struct rtw89_ple_quota ple_qt13_v1;
+	const struct rtw89_ple_quota ple_qt14_v1;
+	const struct rtw89_ple_quota ple_qt15_v1;
 	const struct rtw89_ple_quota ple_qt18;
 	const struct rtw89_ple_quota ple_qt25;
 	const struct rtw89_ple_quota ple_qt26;
@@ -1008,8 +1027,11 @@ struct rtw89_mac_size_set {
 	const struct rtw89_rsvd_quota ple_rsvd_qt0;
 	const struct rtw89_rsvd_quota ple_rsvd_qt1;
 	const struct rtw89_rsvd_quota ple_rsvd_qt1_v1;
+	const struct rtw89_rsvd_quota ple_rsvd_qt2;
 	const struct rtw89_rsvd_quota ple_rsvd_qt9;
 	const struct rtw89_dle_rsvd_size rsvd0_size0;
+	const struct rtw89_dle_rsvd_size rsvd0_size3;
+	const struct rtw89_dle_rsvd_size rsvd0_size5;
 	const struct rtw89_dle_rsvd_size rsvd0_size6;
 	const struct rtw89_dle_rsvd_size rsvd1_size0;
 	const struct rtw89_dle_rsvd_size rsvd1_size2;
drivers/net/wireless/realtek/rtw89/rtw8922a.c +45 -2

59 lines not on this page · raw message

Signature · 1 line
2.53.0
maintainer Acked-by on v1 10/12
#22 lore raw

RE: [PATCH rtw-next 10/12] wifi: rtw89: Add rtw8922a_dle_mem_usb{2,3}

Quoted 8 lines · Bitterblue Smith

Add rtw8922a_dle_mem_usb2 and rtw8922a_dle_mem_usb3 and their various quotas and sizes in struct rtw89_mac_size_set.

"dle" could be "Data Link Engine" or "Double Link Engine". These are some parameters needed for RTL8922AU.

Also rename wde_size4_v1 to wde_size3_v1 because the name seemed incorrect.

Not sure if vendor driver did some changes for this, but I checked the latest version which it looks like as your changes.

Quoted 2 lines
#23 lore raw

PATCH 11/12 wifi: rtw89: Add rtw8922au.c

In reply to Bitterblue Smith

This is the entry point of the new rtw89_8922au module.

---
 .../net/wireless/realtek/rtw89/rtw8922au.c    | 81 +++++++++++++++++++
 1 file changed, 81 insertions(+)
 create mode 100644 drivers/net/wireless/realtek/rtw89/rtw8922au.c
drivers/net/wireless/realtek/rtw89/rtw8922au.c new file +81 -0
new file mode 100644
index 000000000000..a490a7474a3b
@@ -0,0 +1,81 @@
+// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
+/* Copyright(c) 2026  Realtek Corporation
+ */
+
+#include <linux/module.h>
+#include <linux/usb.h>
+#include "rtw8922a.h"
+#include "usb.h"
+
+static const struct rtw89_usb_info rtw8922a_usb_info = {
+	.usb_host_request_2		= 0,
+	.usb_wlan0_1			= 0,
+	.hci_func_en			= 0,
+	.usb3_mac_npi_config_intf_0	= 0,
+	.usb_endpoint_0			= 0,
+	.usb_endpoint_2			= 0,
+	.rx_agg_alignment		= 16,
+	.bulkout_id = {
+		[RTW89_DMA_ACH0] = 3,
+		[RTW89_DMA_ACH2] = 5,
+		[RTW89_DMA_ACH4] = 4,
+		[RTW89_DMA_ACH6] = 6,
+		[RTW89_DMA_B0MG] = 0,
+		[RTW89_DMA_B0HI] = 0,
+		[RTW89_DMA_B1MG] = 1,
+		[RTW89_DMA_B1HI] = 1,
+		[RTW89_DMA_H2C] = 2,
+	},
+};
+
+static const struct rtw89_driver_info rtw89_8922au_info = {
+	.chip = &rtw8922a_chip_info,
+	.variant = NULL,
+	.quirks = NULL,
+	.bus = {
+		.usb = &rtw8922a_usb_info,
+	},
+};
+
+static const struct usb_device_id rtw_8922au_id_table[] = {
+	{ USB_DEVICE_AND_INTERFACE_INFO(0x0411, 0x03ef, 0xff, 0xff, 0xff),
+	  .driver_info = (kernel_ulong_t)&rtw89_8922au_info },
+	{ USB_DEVICE_AND_INTERFACE_INFO(0x0502, 0x76d7, 0xff, 0xff, 0xff),
+	  .driver_info = (kernel_ulong_t)&rtw89_8922au_info },
+	{ USB_DEVICE_AND_INTERFACE_INFO(0x056e, 0x4025, 0xff, 0xff, 0xff),
+	  .driver_info = (kernel_ulong_t)&rtw89_8922au_info },
+	{ USB_DEVICE_AND_INTERFACE_INFO(0x0b05, 0x1bcf, 0xff, 0xff, 0xff),
+	  .driver_info = (kernel_ulong_t)&rtw89_8922au_info },
+	{ USB_DEVICE_AND_INTERFACE_INFO(0x0b05, 0x1bd2, 0xff, 0xff, 0xff),
+	  .driver_info = (kernel_ulong_t)&rtw89_8922au_info },
+	{ USB_DEVICE_AND_INTERFACE_INFO(0x0bda, 0x8912, 0xff, 0xff, 0xff),
+	  .driver_info = (kernel_ulong_t)&rtw89_8922au_info },
+	{ USB_DEVICE_AND_INTERFACE_INFO(0x0db0, 0xda0e, 0xff, 0xff, 0xff),
+	  .driver_info = (kernel_ulong_t)&rtw89_8922au_info },
+	{ USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x332b, 0xff, 0xff, 0xff),
+	  .driver_info = (kernel_ulong_t)&rtw89_8922au_info },
+	{ USB_DEVICE_AND_INTERFACE_INFO(0x3625, 0x010a, 0xff, 0xff, 0xff),
+	  .driver_info = (kernel_ulong_t)&rtw89_8922au_info },
+	{ USB_DEVICE_AND_INTERFACE_INFO(0x37ad, 0x0100, 0xff, 0xff, 0xff),
+	  .driver_info = (kernel_ulong_t)&rtw89_8922au_info },
+	{ USB_DEVICE_AND_INTERFACE_INFO(0x37ad, 0x0101, 0xff, 0xff, 0xff),
+	  .driver_info = (kernel_ulong_t)&rtw89_8922au_info },
+	{ USB_DEVICE_AND_INTERFACE_INFO(0x7392, 0x3822, 0xff, 0xff, 0xff),
+	  .driver_info = (kernel_ulong_t)&rtw89_8922au_info },
+	{ USB_DEVICE_AND_INTERFACE_INFO(0x7392, 0x4822, 0xff, 0xff, 0xff),
+	  .driver_info = (kernel_ulong_t)&rtw89_8922au_info },
+	{},
+};
+MODULE_DEVICE_TABLE(usb, rtw_8922au_id_table);
+
+static struct usb_driver rtw_8922au_driver = {
+	.name = KBUILD_MODNAME,
+	.id_table = rtw_8922au_id_table,
+	.probe = rtw89_usb_probe,
+	.disconnect = rtw89_usb_disconnect,
+};
+module_usb_driver(rtw_8922au_driver);
+
+MODULE_AUTHOR("Bitterblue Smith <[email protected]>");
+MODULE_DESCRIPTION("Realtek 802.11be wireless 8922AU driver");
+MODULE_LICENSE("Dual BSD/GPL");
Signature · 1 line
2.53.0
#25 lore raw

PATCH 12/12 wifi: rtw89: Enable the new rtw89_8922au module

In reply to Bitterblue Smith

Tested without MLO, mostly in station mode and a little in AP mode.

---
 drivers/net/wireless/realtek/rtw89/Kconfig  | 12 ++++++++++++
 drivers/net/wireless/realtek/rtw89/Makefile |  3 +++
 2 files changed, 15 insertions(+)
drivers/net/wireless/realtek/rtw89/Kconfig +12 -0
index 44d8a7f32bf2..43e3b0ef44da 100644
@@ -157,6 +157,18 @@ config RTW89_8922AE
 
 	  The variant 8922AE-VS has the same features except 1024-QAM.
 
+config RTW89_8922AU
+	tristate "Realtek 8922AU USB wireless network (Wi-Fi 7) adapter"
+	depends on USB
+	select RTW89_CORE
+	select RTW89_USB
+	select RTW89_8922A
+	help
+	  Select this option will enable support for 8922AU chipset
+
+	  802.11be USB wireless network (Wi-Fi 7) adapter
+	  supporting 2x2 2GHz/5GHz/6GHz 4096-QAM 160MHz channels.
+
 config RTW89_DEBUG
 	bool
 
drivers/net/wireless/realtek/rtw89/Makefile +3 -0
index 1be81f254fca..475bad743d75 100644
@@ -88,6 +88,9 @@ rtw89_8922a-objs := rtw8922a.o \
 obj-$(CONFIG_RTW89_8922AE) += rtw89_8922ae.o
 rtw89_8922ae-objs := rtw8922ae.o
 
+obj-$(CONFIG_RTW89_8922AU) += rtw89_8922au.o
+rtw89_8922au-objs := rtw8922au.o
+
 rtw89_core-$(CONFIG_RTW89_DEBUG) += debug.o
 
 obj-$(CONFIG_RTW89_PCI) += rtw89_pci.o
Signature · 1 line
2.53.0
maintainer Acked-by on v1 12/12
#26 lore raw

RE: [PATCH rtw-next 12/12] wifi: rtw89: Enable the new rtw89_8922au module

Quoted 1 line · Bitterblue Smith

Tested without MLO, mostly in station mode and a little in AP mode.

Could you share the result about throughput or data rate?

Since you noted warnings related to RF calibration, I'm very interested in the number.

Quoted 2 lines

Otherwise,

maintainer
#27 lore raw
In reply to Bitterblue Smith
Quoted 11 lines · Bitterblue Smith

Often one or more of these messages appears when the chip powers on:

[ +2.167037] rtw89_8922au 1-2:1.0: failed to wait RF DACK

[ +2.942749] rtw89_8922au 1-2:1.0: failed to wait RF TSSI

[ +0.019006] rtw89_8922au 2-4:1.0: failed to wait RF PRE_NTFY

[ +5.985900] rtw89_8922au 2-4:1.0: failed to wait RF DPK

It's unclear why.

RTL8922D done RF calibrations by firmware one by one, so driver should wait for previous one done, and trigger next one. However, it'd be well to just do waiting at the last to wait for all calibrations.

Try to enlarge waiting time in rtw8922a_rfk_channel().

Quoted 3 lines

It seems to work well anyway.

If you can yield the highest rate (MCS13), I'd say it is fine.

Ping-Ke

#28 lore raw
Quoted 11 lines · Ping-Ke Shih
Quoted 10 lines · Bitterblue Smith

Often one or more of these messages appears when the chip powers on:

[ +2.167037] rtw89_8922au 1-2:1.0: failed to wait RF DACK

[ +2.942749] rtw89_8922au 1-2:1.0: failed to wait RF TSSI

[ +0.019006] rtw89_8922au 2-4:1.0: failed to wait RF PRE_NTFY

[ +5.985900] rtw89_8922au 2-4:1.0: failed to wait RF DPK

Quoted 8 lines
Quoted 1 line

It's unclear why.

RTL8922D done RF calibrations by firmware one by one, so driver should wait for previous one done, and trigger next one. However, it'd be well to just do waiting at the last to wait for all calibrations.

Try to enlarge waiting time in rtw8922a_rfk_channel().

I was convinced I tried that already, but no.

After increasing all delays a bit the warnings are much more rare.

Quoted 8 lines
Quoted 3 lines

It seems to work well anyway.

If you can yield the highest rate (MCS13), I'd say it is fine.

Ping-Ke

Testing with RTL8832CU (Brostrend AX8) in AP mode, the RTL8912AU can reach 1.5 Gbps (MCS10) RX, 1 Gbps TX.

I used the RTL8832CU because my router is not working well with 160 MHz.

maintainer
#29 lore raw
Quoted 18 lines · Bitterblue Smith
Quoted 17 lines · Ping-Ke Shih
Quoted 11 lines · Bitterblue Smith

Often one or more of these messages appears when the chip powers on:

[ +2.167037] rtw89_8922au 1-2:1.0: failed to wait RF DACK

[ +2.942749] rtw89_8922au 1-2:1.0: failed to wait RF TSSI

[ +0.019006] rtw89_8922au 2-4:1.0: failed to wait RF PRE_NTFY

[ +5.985900] rtw89_8922au 2-4:1.0: failed to wait RF DPK

It's unclear why.

RTL8922D done RF calibrations by firmware one by one, so driver should wait for previous one done, and trigger next one. However, it'd be well to just do waiting at the last to wait for all calibrations.

Quoted 6 lines
Quoted 2 lines

Try to enlarge waiting time in rtw8922a_rfk_channel().

I was convinced I tried that already, but no.

After increasing all delays a bit the warnings are much more rare.

Turn of debug mask RTW89_DBG_RFK and set a very large timeout time, and do connection >20 times and then check "RF %s takes %lld ms to complete" to see the maximum value in your environment.

Please share the number for each RF calibration after your experiments.

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

It seems to work well anyway.

If you can yield the highest rate (MCS13), I'd say it is fine.

Quoted 8 lines
Quoted 2 lines

Ping-Ke

Testing with RTL8832CU (Brostrend AX8) in AP mode, the RTL8912AU can reach 1.5 Gbps (MCS10) RX, 1 Gbps TX.

I used the RTL8832CU because my router is not working well with 160 MHz.

Since rtw89 only support beamformee (no beamformer), beamforming can't work between two rtw89 devices. More, two antenna can't have good beamforming performance. I think this is a point that it is hard to yield the highest rate.

Another point may be the RF performance. If the warning messages of RF calibration disappeared, I'd say this might not a problem.

Let's mention this in commit message of 12/12.

Ping-Ke

#30 lore raw
Quoted 24 lines · Ping-Ke Shih
Quoted 23 lines · Bitterblue Smith
Quoted 11 lines · Ping-Ke Shih
Quoted 10 lines · Bitterblue Smith

Often one or more of these messages appears when the chip powers on:

[ +2.167037] rtw89_8922au 1-2:1.0: failed to wait RF DACK

[ +2.942749] rtw89_8922au 1-2:1.0: failed to wait RF TSSI

[ +0.019006] rtw89_8922au 2-4:1.0: failed to wait RF PRE_NTFY

[ +5.985900] rtw89_8922au 2-4:1.0: failed to wait RF DPK

Quoted 8 lines
Quoted 1 line

It's unclear why.

RTL8922D done RF calibrations by firmware one by one, so driver should wait for previous one done, and trigger next one. However, it'd be well to just do waiting at the last to wait for all calibrations.

Try to enlarge waiting time in rtw8922a_rfk_channel().

I was convinced I tried that already, but no.

Quoted 8 lines
Quoted 1 line

After increasing all delays a bit the warnings are much more rare.

Turn of debug mask RTW89_DBG_RFK and set a very large timeout time, and do connection >20 times and then check "RF %s takes %lld ms to complete" to see the maximum value in your environment.

Please share the number for each RF calibration after your experiments.

I changed every delay to 500, then ran this, once with the adapter in USB 2, once in USB 3:

for i in {01..20}; do nmcli connection up "<2.4 GHz SSID>"; sleep 10; nmcli connection up "<5 GHz SSID>"; sleep 10; done

There were no "failed to wait RF" warnings.

These are the results after processing with "sort --unique":

RF DACK takes 15 ms to complete RF DACK takes 16 ms to complete RF DACK takes 44 ms to complete RF DACK takes 72 ms to complete

RF DPK takes 23 ms to complete RF DPK takes 24 ms to complete RF DPK takes 27 ms to complete RF DPK takes 30 ms to complete

RF IQK takes 48 ms to complete RF IQK takes 49 ms to complete RF IQK takes 50 ms to complete

RF PRE_NTFY takes 0 ms to complete RF PRE_NTFY takes 1 ms to complete

RF RX_DCK takes 8 ms to complete RF RX_DCK takes 9 ms to complete RF RX_DCK takes 11 ms to complete RF RX_DCK takes 23 ms to complete RF RX_DCK takes 24 ms to complete RF RX_DCK takes 27 ms to complete RF RX_DCK takes 38 ms to complete RF RX_DCK takes 39 ms to complete RF RX_DCK takes 53 ms to complete RF RX_DCK takes 54 ms to complete RF RX_DCK takes 58 ms to complete RF RX_DCK takes 70 ms to complete RF RX_DCK takes 110 ms to complete

RF TSSI takes 1 ms to complete RF TSSI takes 2 ms to complete RF TSSI takes 23 ms to complete RF TSSI takes 24 ms to complete

RF TXGAPK takes 9 ms to complete RF TXGAPK takes 10 ms to complete RF TXGAPK takes 17 ms to complete RF TXGAPK takes 18 ms to complete

I also left it unconnected and constantly scanning for a few minutes. RTW89_TSSI_SCAN always takes 1-2 ms.

Quoted 28 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

It seems to work well anyway.

If you can yield the highest rate (MCS13), I'd say it is fine.

Quoted 8 lines
Quoted 2 lines

Ping-Ke

Testing with RTL8832CU (Brostrend AX8) in AP mode, the RTL8912AU can reach 1.5 Gbps (MCS10) RX, 1 Gbps TX.

I used the RTL8832CU because my router is not working well with 160 MHz.

Since rtw89 only support beamformee (no beamformer), beamforming can't work between two rtw89 devices. More, two antenna can't have good beamforming performance. I think this is a point that it is hard to yield the highest rate.

Another point may be the RF performance. If the warning messages of RF calibration disappeared, I'd say this might not a problem.

Let's mention this in commit message of 12/12.

Ping-Ke

maintainer
#31 lore raw
Quoted 81 lines · Bitterblue Smith
Quoted 24 lines · Ping-Ke Shih
Quoted 23 lines · Bitterblue Smith
Quoted 11 lines · Ping-Ke Shih
Quoted 10 lines · Bitterblue Smith

Often one or more of these messages appears when the chip powers on:

[ +2.167037] rtw89_8922au 1-2:1.0: failed to wait RF DACK

[ +2.942749] rtw89_8922au 1-2:1.0: failed to wait RF TSSI

[ +0.019006] rtw89_8922au 2-4:1.0: failed to wait RF PRE_NTFY

[ +5.985900] rtw89_8922au 2-4:1.0: failed to wait RF DPK

Quoted 8 lines
Quoted 1 line

It's unclear why.

RTL8922D done RF calibrations by firmware one by one, so driver should wait for previous one done, and trigger next one. However, it'd be well to just do waiting at the last to wait for all calibrations.

Try to enlarge waiting time in rtw8922a_rfk_channel().

I was convinced I tried that already, but no.

Quoted 8 lines
Quoted 1 line

After increasing all delays a bit the warnings are much more rare.

Turn of debug mask RTW89_DBG_RFK and set a very large timeout time, and do connection >20 times and then check "RF %s takes %lld ms to complete" to see the maximum value in your environment.

Please share the number for each RF calibration after your experiments.

I changed every delay to 500, then ran this, once with the adapter in USB 2, once in USB 3:

for i in {01..20}; do nmcli connection up "<2.4 GHz SSID>"; sleep 10; nmcli connection up "<5 GHz SSID>"; sleep 10; done

There were no "failed to wait RF" warnings.

These are the results after processing with "sort --unique":

RF DACK takes 15 ms to complete RF DACK takes 16 ms to complete RF DACK takes 44 ms to complete RF DACK takes 72 ms to complete

RF DPK takes 23 ms to complete RF DPK takes 24 ms to complete RF DPK takes 27 ms to complete RF DPK takes 30 ms to complete

RF IQK takes 48 ms to complete RF IQK takes 49 ms to complete RF IQK takes 50 ms to complete

RF PRE_NTFY takes 0 ms to complete RF PRE_NTFY takes 1 ms to complete

RF RX_DCK takes 8 ms to complete RF RX_DCK takes 9 ms to complete RF RX_DCK takes 11 ms to complete RF RX_DCK takes 23 ms to complete RF RX_DCK takes 24 ms to complete RF RX_DCK takes 27 ms to complete RF RX_DCK takes 38 ms to complete RF RX_DCK takes 39 ms to complete RF RX_DCK takes 53 ms to complete RF RX_DCK takes 54 ms to complete RF RX_DCK takes 58 ms to complete RF RX_DCK takes 70 ms to complete RF RX_DCK takes 110 ms to complete

RF TSSI takes 1 ms to complete RF TSSI takes 2 ms to complete RF TSSI takes 23 ms to complete RF TSSI takes 24 ms to complete

Quoted 8 lines

RF TXGAPK takes 9 ms to complete RF TXGAPK takes 10 ms to complete RF TXGAPK takes 17 ms to complete RF TXGAPK takes 18 ms to complete

I also left it unconnected and constantly scanning for a few minutes. RTW89_TSSI_SCAN always takes 1-2 ms.

You can make a set of number or a constant multiple for USB devices. As we want hardware restart flow including RF calibration within a limited time, I'd not enlarge these numbers for PCIE devices.

Ping-Ke

#32 lore raw

cover wifi: rtw89: fix RF calibration for USB transport

RF calibration on USB adapters (RTL8922AU) fails frequently because the timeout values in rtw89_phy_rfk_report_wait() are designed for PCIe and too tight for USB H2C/C2H round-trip latency.

Patch 1 applies a 4x timeout multiplier for USB devices, based on measured calibration times from two independent testers across 2.4GHz, 5GHz, and 6GHz bands.

Patch 2 makes calibration timeouts non-fatal on USB, since the radio continues to operate correctly despite occasional incomplete calibrations. PCIe error handling is unchanged.

This is based on Ping-Ke's suggestion in the RTL8922AU support thread:
https://lore.kernel.org/linux-wireless/[email protected]/

Louis Kotze (2):
wifi: rtw89: phy: increase RF calibration timeouts for USB transport
wifi: rtw89: phy: make RF calibration timeouts non-fatal on USB

 drivers/net/wireless/realtek/rtw89/phy.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
Signature · 1 line
2.53.0
#33 lore raw

PATCH 1/2 wifi: rtw89: phy: increase RF calibration timeouts for USB transport

USB transport adds significant latency to H2C/C2H round-trips used by RF calibration. The existing timeout values were designed for PCIe and are too tight for USB, causing "failed to wait RF DACK", "failed to wait RF TSSI" and similar errors on USB adapters.

Apply a 4x timeout multiplier when the device uses USB transport. The multiplier is applied in rtw89_phy_rfk_report_wait() so all calibrations benefit without changing any call sites or PCIe timeout values.

The 4x multiplier was chosen based on measured data from two independent testers (RTL8922AU, 6GHz MLO and 2.4/5GHz):

Calibration PCIe timeout Max measured (USB) 4x timeout
PRE_NTFY 5ms 1ms 20ms
DACK 58ms 72ms 232ms
RX_DCK 128ms 374ms 512ms

  TSSI normal       20ms             24ms              80ms
  TSSI scan          6ms             14ms              24ms
  TXGAPK            54ms             18ms             216ms
  IQK               84ms             53ms             336ms
  DPK               34ms             30ms             136ms

Tested with RTL8922AU on 6GHz MLO (5GHz + 6GHz simultaneous):
25 connect/disconnect cycles with zero failures.

---
 drivers/net/wireless/realtek/rtw89/phy.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/wireless/realtek/rtw89/phy.c +7 -0
index e70d0e283..4d809df8b 100644
@@ -3956,6 +3956,13 @@ int rtw89_phy_rfk_report_wait(struct rtw89_dev *rtwdev, const char *rfk_name,
 	struct rtw89_rfk_wait_info *wait = &rtwdev->rfk_wait;
 	unsigned long time_left;
 
+	/* USB transport adds latency to H2C/C2H round-trips, so RF
+	 * calibrations take longer than on PCIe. Apply a 4x multiplier
+	 * to avoid spurious timeouts.
+	 */
+	if (rtwdev->hci.type == RTW89_HCI_TYPE_USB)
+		ms *= 4;
+
 	/* Since we can't receive C2H event during SER, use a fixed delay. */
 	if (test_bit(RTW89_FLAG_SER_HANDLING, rtwdev->flags)) {
 		fsleep(1000 * ms / 2);
Signature · 1 line
2.53.0
maintainer
#34 lore raw

RE: [PATCH 1/2] wifi: rtw89: phy: increase RF calibration timeouts for USB transport

Quoted 23 lines · Louis Kotze

USB transport adds significant latency to H2C/C2H round-trips used by RF calibration. The existing timeout values were designed for PCIe and are too tight for USB, causing "failed to wait RF DACK", "failed to wait RF TSSI" and similar errors on USB adapters.

Apply a 4x timeout multiplier when the device uses USB transport. The multiplier is applied in rtw89_phy_rfk_report_wait() so all calibrations benefit without changing any call sites or PCIe timeout values.

The 4x multiplier was chosen based on measured data from two independent testers (RTL8922AU, 6GHz MLO and 2.4/5GHz):

Calibration PCIe timeout Max measured (USB) 4x timeout
PRE_NTFY 5ms 1ms 20ms
DACK 58ms 72ms 232ms
RX_DCK 128ms 374ms 512ms

  TSSI normal       20ms             24ms              80ms
  TSSI scan          6ms             14ms              24ms
  TXGAPK            54ms             18ms             216ms
  IQK               84ms             53ms             336ms
  DPK               34ms             30ms             136ms
Quoted 4 lines

Tested with RTL8922AU on 6GHz MLO (5GHz + 6GHz simultaneous):
25 connect/disconnect cycles with zero failures.

Looks good to me. But please change comment style.

Quoted 9 lines
---
 drivers/net/wireless/realtek/rtw89/phy.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/wireless/realtek/rtw89/phy.c +0 -0
index e70d0e283..4d809df8b 100644

drivers/net/wireless/realtek/rtw89/phy.c int rtw89_phy_rfk_report_wait(struct rtw89_dev *rtwdev, const char *rfk_name, · line 3962

Quoted 7 lines
drivers/net/wireless/realtek/rtw89/phy.c +4 -0
@@ -3956,6 +3956,13 @@ int rtw89_phy_rfk_report_wait(struct rtw89_dev *rtwdev, const char *rfk_name,
        struct rtw89_rfk_wait_info *wait = &rtwdev->rfk_wait;
        unsigned long time_left;
 
+       /* USB transport adds latency to H2C/C2H round-trips, so RF
+        * calibrations take longer than on PCIe. Apply a 4x multiplier
+        * to avoid spurious timeouts.
+        */

For now, we don't apply networking specific comment style. Keep first line '/*'.

Quoted 8 lines
drivers/net/wireless/realtek/rtw89/phy.c +3 -1
+       if (rtwdev->hci.type == RTW89_HCI_TYPE_USB)
+               ms *= 4;
+
        /* Since we can't receive C2H event during SER, use a fixed delay. */
        if (test_bit(RTW89_FLAG_SER_HANDLING, rtwdev->flags)) {
                fsleep(1000 * ms / 2);
--

2.53.0

#35 lore raw

Re: [PATCH 1/2] wifi: rtw89: phy: increase RF calibration timeouts for USB transport

Quoted 8 lines · Ping-Ke Shih

Looks good to me. But please change comment style.

drivers/net/wireless/realtek/rtw89/phy.c int rtw89_phy_rfk_report_wait(struct rtw89_dev *rtwdev, const char *rfk_name, · line 3962

Quoted 4 lines
drivers/net/wireless/realtek/rtw89/phy.c +4 -0
+	/* USB transport adds latency to H2C/C2H round-trips, so RF
+	 * calibrations take longer than on PCIe. Apply a 4x multiplier
+	 * to avoid spurious timeouts.
+	 */

For now, we don't apply networking specific comment style. Keep first line '/*'.

Will fix in v2 — thanks for the review.

Louis

#36 lore raw

PATCH 2/2 wifi: rtw89: phy: make RF calibration timeouts non-fatal on USB

In reply to Louis Kotze

On USB adapters, RF calibration timeouts can still occasionally occur despite the increased timeout values, particularly under system load or USB bus contention. However, the radio typically continues to operate correctly despite an incomplete calibration — the timeout does not indicate a hardware failure.

Make calibration timeouts and bad state returns non-fatal on USB by logging at debug level and continuing, rather than returning -ETIMEDOUT/-EFAULT which can cascade into a connection failure or disconnect.

PCIe error handling is unchanged — timeouts remain fatal on PCIe where they indicate a real problem.

---
 drivers/net/wireless/realtek/rtw89/phy.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/net/wireless/realtek/rtw89/phy.c +12 -0
index 4d809df8b..a06bea88e 100644
@@ -3972,9 +3972,21 @@ int rtw89_phy_rfk_report_wait(struct rtw89_dev *rtwdev, const char *rfk_name,
 	time_left = wait_for_completion_timeout(&wait->completion,
 						msecs_to_jiffies(ms));
 	if (time_left == 0) {
+		if (rtwdev->hci.type == RTW89_HCI_TYPE_USB) {
+			rtw89_debug(rtwdev, RTW89_DBG_RFK,
+				    "RF %s timeout (non-fatal on USB)\n",
+				    rfk_name);
+			goto out;
+		}
 		rtw89_warn(rtwdev, "failed to wait RF %s\n", rfk_name);
 		return -ETIMEDOUT;
 	} else if (wait->state != RTW89_RFK_STATE_OK) {
+		if (rtwdev->hci.type == RTW89_HCI_TYPE_USB) {
+			rtw89_debug(rtwdev, RTW89_DBG_RFK,
+				    "RF %s state %d (non-fatal on USB)\n",
+				    rfk_name, wait->state);
+			goto out;
+		}
 		rtw89_warn(rtwdev, "failed to do RF %s result from state %d\n",
 			   rfk_name, wait->state);
 		return -EFAULT;
Signature · 1 line
2.53.0
maintainer
#37 lore raw

RE: [PATCH 2/2] wifi: rtw89: phy: make RF calibration timeouts non-fatal on USB

Quoted 8 lines · Louis Kotze

On USB adapters, RF calibration timeouts can still occasionally occur despite the increased timeout values, particularly under system load or USB bus contention. However, the radio typically continues to operate correctly despite an incomplete calibration — the timeout does not indicate a hardware failure.

Make calibration timeouts and bad state returns non-fatal on USB by logging at debug level and continuing, rather than

If calibration timeouts, the performance might be bad. How about just to enlarge timeout time in 1/2 patch?

Quoted 3 lines

returning
-ETIMEDOUT/-EFAULT which can cascade into a connection failure or disconnect.

It seems like we don't actually handle the return code for now. Could you point out the path you encountered?

Quoted 37 lines

PCIe error handling is unchanged — timeouts remain fatal on PCIe where they indicate a real problem.

---
 drivers/net/wireless/realtek/rtw89/phy.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/net/wireless/realtek/rtw89/phy.c +12 -1
index 4d809df8b..a06bea88e 100644
@@ -3972,9 +3972,21 @@ int rtw89_phy_rfk_report_wait(struct rtw89_dev *rtwdev, const char *rfk_name,
        time_left = wait_for_completion_timeout(&wait->completion,
                                                msecs_to_jiffies(ms));
        if (time_left == 0) {
+               if (rtwdev->hci.type == RTW89_HCI_TYPE_USB) {
+                       rtw89_debug(rtwdev, RTW89_DBG_RFK,
+                                   "RF %s timeout (non-fatal on USB)\n",
+                                   rfk_name);
+                       goto out;
+               }
                rtw89_warn(rtwdev, "failed to wait RF %s\n", rfk_name);
                return -ETIMEDOUT;
        } else if (wait->state != RTW89_RFK_STATE_OK) {
+               if (rtwdev->hci.type == RTW89_HCI_TYPE_USB) {
+                       rtw89_debug(rtwdev, RTW89_DBG_RFK,
+                                   "RF %s state %d (non-fatal on USB)\n",
+                                   rfk_name, wait->state);
+                       goto out;
+               }
                rtw89_warn(rtwdev, "failed to do RF %s result from state %d\n",
                           rfk_name, wait->state);
                return -EFAULT;
--

2.53.0

#38 lore raw

Re: [PATCH 2/2] wifi: rtw89: phy: make RF calibration timeouts non-fatal on USB

Quoted 5 lines · Ping-Ke Shih

If calibration timeouts, the performance might be bad. How about just to enlarge timeout time in 1/2 patch?
[...]
It seems like we don't actually handle the return code for now. Could you point out the path you encountered?

You're right on both points — dropping this patch in v2.

On the return code: it is indeed discarded by all 8922a callers of rtw89_phy_rfk_*_and_wait() (11 call sites). My original "connection failure" report was the host dropping the link after repeated "failed to wait RF DACK" kernel warnings, not a return-code cascade. The 4x multiplier in 1/2 already fixes the observable symptom.

Also, on 8922d rtw8922d_rfk_tssi() does check the return and uses the failure to fall back by clearing is_tssi_mode — making the call non-fatal on USB would silently break that fallback. Not something I should ship, even for hardware I don't own.

On enlarging 1/2 only: re-verified the 4x multiplier under stress-ng (CPU, memory, combined). DACK peaks at 71ms on 5GHz in every scenario, including baseline idle — the calibrations are I/O bound on the USB H2C/C2H round-trip, not CPU/memory bound, so host stress doesn't move the numbers. 4x leaves ~3.3x headroom on the worst case. Full matrix is in the v2 1/2 commit message.

v2 keeps only 1/2, with the comment-style fix. Sending shortly.

Louis

#39 lore raw

PATCH v2 1/1 wifi: rtw89: phy: increase RF calibration timeouts for USB transport

In reply to Louis Kotze

USB transport adds significant latency to H2C/C2H round-trips used by RF calibration. The existing timeout values were designed for PCIe and are too tight for USB, causing "failed to wait RF DACK", "failed to wait RF TSSI" and similar errors on USB adapters.

Apply a 4x timeout multiplier when the device uses USB transport. The multiplier is applied in rtw89_phy_rfk_report_wait() so all calibrations benefit without changing any call sites or PCIe timeout values.

The 4x multiplier was chosen based on measured data from two independent testers (RTL8922AU, 6GHz MLO and 2.4/5GHz):

Calibration PCIe timeout Max measured (USB) 4x timeout
PRE_NTFY 5ms 1ms 20ms
DACK 58ms 72ms 232ms
RX_DCK 128ms 374ms 512ms

  TSSI normal       20ms             24ms              80ms
  TSSI scan          6ms             14ms              24ms
  TXGAPK            54ms             18ms             216ms
  IQK               84ms             53ms             336ms
  DPK               34ms             30ms             136ms

Tested with RTL8922AU on 6GHz MLO (5GHz + 6GHz simultaneous):
25 connect/disconnect cycles with zero failures.

In response to review feedback on v1, the 4x multiplier was also re-verified under adverse host conditions on 5GHz. 5 cycles per scenario, stress-ng as the load generator, max observed time per calibration:

Calibration PCIe 4x Baseline CPU stress Mem stress Combined
PRE_NTFY 5 20 0 0 0 1

  DACK          58  232    71 (!)    71 (!)      71 (!)      71 (!)
  RX_DCK       128  512    23        22          22          23
  IQK           84  336    53        53          53          53
  DPK           34  136    23        23          26          23
  TSSI          20   80     6         9          14           9
  TXGAPK        54  216    16        16          16          16

Legend: (!) = exceeds PCIe budget but within 4x budget.

Two observations from that matrix:

1. DACK exceeds the stock PCIe budget (58ms) in baseline on 5GHz on this hardware. Without the 4x multiplier, DACK fails -ETIMEDOUT deterministically on every connect, no stress needed. This is the specific bug the patch fixes.

2. Calibration times are I/O bound (USB H2C/C2H round-trip latency), not CPU or memory bound. DACK stays at 71ms across all four scenarios. Host-side stress has essentially zero effect on observed calibration duration. Bumping the multiplier above 4x would not address a failure mode that this stress matrix produces.

---
Changes since v1:
- Fix comment style per Ping-Ke Shih review (first line '/*' on its own line, kernel-standard format).
- Add stress-test verification table to the commit message. The 4x multiplier was re-measured on 5GHz under CPU stress, memory stress, and combined stress using stress-ng. DACK max is 71ms in all four scenarios, confirming calibration times are I/O bound (USB H2C/C2H round-trip) and not affected by host-side load.
- Drop v1 patch 2/2 ("make RF calibration timeouts non-fatal on USB"). As Ping-Ke noted, the return code from rtw89_phy_rfk_*_and_wait() is discarded by all 8922a callers, making the non-fatal change a no-op for 8922a. Worse, the one 8922d caller that does check the return (rtw8922d_rfk_tssi) uses it to fall back to non-TSSI mode on calibration failure — patch 2/2 would have silently broken that fallback. With patch 1/2's multiplier alone, 25 connect/disconnect cycles complete with zero failures, and the new stress matrix above confirms the margin.

 drivers/net/wireless/realtek/rtw89/phy.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/wireless/realtek/rtw89/phy.c +8 -0
index e70d0e283..1f249c297 100644
@@ -3956,6 +3956,14 @@ int rtw89_phy_rfk_report_wait(struct rtw89_dev *rtwdev, const char *rfk_name,
 	struct rtw89_rfk_wait_info *wait = &rtwdev->rfk_wait;
 	unsigned long time_left;
 
+	/*
+	 * USB transport adds latency to H2C/C2H round-trips, so RF
+	 * calibrations take longer than on PCIe. Apply a 4x multiplier
+	 * to avoid spurious timeouts.
+	 */
+	if (rtwdev->hci.type == RTW89_HCI_TYPE_USB)
+		ms *= 4;
+
 	/* Since we can't receive C2H event during SER, use a fixed delay. */
 	if (test_bit(RTW89_FLAG_SER_HANDLING, rtwdev->flags)) {
 		fsleep(1000 * ms / 2);
Signature · 1 line
2.53.0
maintainer Acked-by on v2 1/1
#40 lore raw

RE: [PATCH v2] wifi: rtw89: phy: increase RF calibration timeouts for USB transport

Quoted 23 lines · Louis Kotze

USB transport adds significant latency to H2C/C2H round-trips used by RF calibration. The existing timeout values were designed for PCIe and are too tight for USB, causing "failed to wait RF DACK", "failed to wait RF TSSI" and similar errors on USB adapters.

Apply a 4x timeout multiplier when the device uses USB transport. The multiplier is applied in rtw89_phy_rfk_report_wait() so all calibrations benefit without changing any call sites or PCIe timeout values.

The 4x multiplier was chosen based on measured data from two independent testers (RTL8922AU, 6GHz MLO and 2.4/5GHz):

Calibration PCIe timeout Max measured (USB) 4x timeout
PRE_NTFY 5ms 1ms 20ms
DACK 58ms 72ms 232ms
RX_DCK 128ms 374ms 512ms

  TSSI normal       20ms             24ms              80ms
  TSSI scan          6ms             14ms              24ms
  TXGAPK            54ms             18ms             216ms
  IQK               84ms             53ms             336ms
  DPK               34ms             30ms             136ms
Quoted 4 lines

Tested with RTL8922AU on 6GHz MLO (5GHz + 6GHz simultaneous):
25 connect/disconnect cycles with zero failures.

In response to review feedback on v1,

Can we remove this phrase? No need to mention v1 in commit message.

Quoted 14 lines

the 4x multiplier was also
re-verified under adverse host conditions on 5GHz. 5 cycles per scenario, stress-ng as the load generator, max observed time per calibration:

Calibration PCIe 4x Baseline CPU stress Mem stress Combined
PRE_NTFY 5 20 0 0 0 1

  DACK          58  232    71 (!)    71 (!)      71 (!)      71 (!)
  RX_DCK       128  512    23        22          22          23
  IQK           84  336    53        53          53          53
  DPK           34  136    23        23          26          23
  TSSI          20   80     6         9          14           9
  TXGAPK        54  216    16        16          16          16
Quoted 8 lines

Legend: (!) = exceeds PCIe budget but within 4x budget.

Two observations from that matrix:

1. DACK exceeds the stock PCIe budget (58ms) in baseline on 5GHz on this hardware. Without the 4x multiplier, DACK fails -ETIMEDOUT deterministically on every connect, no stress needed. This is the specific bug the patch fixes.

I'm not sure this should be called "bug", as Bitterblue has not adjusted these timeout time by earlier version.

Quoted 3 lines

2. Calibration times are I/O bound (USB H2C/C2H round-trip latency),

I'm also not sure if this is correct. The calibration time of DACK might rely on WiFi hardware and external components, not only I/O speed.

Quoted 7 lines

not CPU or memory bound. DACK stays at 71ms across
all four scenarios. Host-side stress has essentially zero effect on observed calibration duration. Bumping the multiplier above 4x would not address a failure mode that this stress matrix produces.

Otherwise, patch content looks good to me.

#41 lore raw

Re: [PATCH v2] wifi: rtw89: phy: increase RF calibration timeouts for USB transport

Quoted 1 line

Can we remove this phrase? No need to mention v1 in commit message.

Done -- reworded to stand alone without referencing prior versions.

Quoted 2 lines

I'm not sure this should be called "bug", as Bitterblue has not adjusted these timeout time by earlier version.

Fair point -- the timeouts were correct for PCIe; USB was not in scope yet. Changed to "condition" instead of "bug".

Quoted 3 lines

I'm also not sure if this is correct. The calibration time of DACK might rely on WiFi hardware and external components, not only I/O speed.

You're right, I overclaimed. Reworded to note that transport round-trip latency appears to dominate under these test conditions, but hardware and external component factors may also contribute.

All three changes applied in v3. Also added Tested-by tags from Devin Wittmayer across RTL8922AU/8852AU/8852BU/8852CU (Framework 13 and Raspberry Pi 5), and Reported-by with a link to his xHCI hard lockup evidence.

Thank you for the review.