diff mbox series

[1/2] wifi: rtw88: Fix USB devices not transmitting beacons

Message ID 9174a776-4771-4351-85fa-476e240d8ace@gmail.com (mailing list archive)
State Superseded
Delegated to: Ping-Ke Shih
Headers show
Series [1/2] wifi: rtw88: Fix USB devices not transmitting beacons | expand

Commit Message

Bitterblue Smith July 28, 2024, 10:49 p.m. UTC
All USB devices supported by rtw88 have the same problem: they don't
transmit beacons in AP mode. The cause appears to be clearing
BIT_EN_BCNQ_DL of REG_FWHW_TXQ_CTRL before uploading the beacon reserved
page, so don't clear the bit for USB devices.

Tested with RTL8811CU and RTL8723DU.

Cc: stable@vger.kernel.org # 6.6.x
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
I'm not sure if SDIO devices have the same problem. Also, should
BIT_EN_BCNQ_DL ever be cleared in this function? The relevant code is
disabled in all these drivers:

https://github.com/morrownr/8821cu-20210916/blob/3eacc28b721950b51b0249508cc31e6e54988a0c/hal/rtl8821c/rtl8821c_ops.c#L1603

https://github.com/tomaspinho/rtl8821ce/blob/f119398d868b1a3395f40c1df2e08b57b2c882cd/hal/rtl8821c/rtl8821c_ops.c#L1668

https://github.com/alireza-tabatabaee/RTL8821CS/blob/2d8a102dd7399a243f11b13314c299e509cc4ef1/rtl8821cs/hal/rtl8821c/rtl8821c_ops.c#L1603

https://github.com/morrownr/88x2bu-20210702/blob/3c8f59b5b05e5090e8593da1940a8d3ccac3f878/hal/rtl8822b/rtl8822b_ops.c#L1771

https://github.com/thales-dis-dr/rtl8822CU/blob/4182c79e0c5362dcea46088dab9fed27795b5579/hal/rtl8822c/rtl8822c_ops.c#L1941
---
 drivers/net/wireless/realtek/rtw88/fw.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Comments

Ping-Ke Shih July 30, 2024, 7:36 a.m. UTC | #1
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> All USB devices supported by rtw88 have the same problem: they don't
> transmit beacons in AP mode. The cause appears to be clearing
> BIT_EN_BCNQ_DL of REG_FWHW_TXQ_CTRL before uploading the beacon reserved
> page, so don't clear the bit for USB devices.
> 
> Tested with RTL8811CU and RTL8723DU.
> 
> Cc: stable@vger.kernel.org # 6.6.x
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> ---
> I'm not sure if SDIO devices have the same problem. Also, should
> BIT_EN_BCNQ_DL ever be cleared in this function? The relevant code is
> disabled in all these drivers:

I checked internal the latest driver, which codes are changed again. 
We will check flow internally and prepare a patch for this problem.

This patch gives us good hints to address problem. Thanks.
Ping-Ke Shih Aug. 21, 2024, 6:25 a.m. UTC | #2
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> I'm not sure if SDIO devices have the same problem.

A SDIO user has confirmed this change can make SDIO devices send out beacon,
but still have other problems though. 

By v2, I will take this patch and change condition 
    if (rtw_hci_type(rtwdev) != RTW_HCI_TYPE_USB)
to
    if (rtw_hci_type(rtwdev) == RTW_HCI_TYPE_PCIE)
Michele Bisogno Aug. 21, 2024, 7:17 a.m. UTC | #3
> A SDIO user has confirmed this change can make SDIO devices send out beacon,
> but still have other problems though.
>

I am the other user. :-)
This is also a test message, sorry for spamming.
Bitterblue Smith Aug. 21, 2024, 11:17 a.m. UTC | #4
On 21/08/2024 09:25, Ping-Ke Shih wrote:
> Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
>> I'm not sure if SDIO devices have the same problem.
> 
> A SDIO user has confirmed this change can make SDIO devices send out beacon,
> but still have other problems though. 
> 
> By v2, I will take this patch and change condition 
>     if (rtw_hci_type(rtwdev) != RTW_HCI_TYPE_USB)
> to
>     if (rtw_hci_type(rtwdev) == RTW_HCI_TYPE_PCIE)
> 

That's great! I will send v2.
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c
index ab7d414d0ba6..782f3776e0a0 100644
--- a/drivers/net/wireless/realtek/rtw88/fw.c
+++ b/drivers/net/wireless/realtek/rtw88/fw.c
@@ -1468,10 +1468,12 @@  int rtw_fw_write_data_rsvd_page(struct rtw_dev *rtwdev, u16 pg_addr,
 	val |= BIT_ENSWBCN >> 8;
 	rtw_write8(rtwdev, REG_CR + 1, val);
 
-	val = rtw_read8(rtwdev, REG_FWHW_TXQ_CTRL + 2);
-	bckp[1] = val;
-	val &= ~(BIT_EN_BCNQ_DL >> 16);
-	rtw_write8(rtwdev, REG_FWHW_TXQ_CTRL + 2, val);
+	if (rtw_hci_type(rtwdev) != RTW_HCI_TYPE_USB) {
+		val = rtw_read8(rtwdev, REG_FWHW_TXQ_CTRL + 2);
+		bckp[1] = val;
+		val &= ~(BIT_EN_BCNQ_DL >> 16);
+		rtw_write8(rtwdev, REG_FWHW_TXQ_CTRL + 2, val);
+	}
 
 	ret = rtw_hci_write_data_rsvd_page(rtwdev, buf, size);
 	if (ret) {
@@ -1496,7 +1498,8 @@  int rtw_fw_write_data_rsvd_page(struct rtw_dev *rtwdev, u16 pg_addr,
 	rsvd_pg_head = rtwdev->fifo.rsvd_boundary;
 	rtw_write16(rtwdev, REG_FIFOPAGE_CTRL_2,
 		    rsvd_pg_head | BIT_BCN_VALID_V1);
-	rtw_write8(rtwdev, REG_FWHW_TXQ_CTRL + 2, bckp[1]);
+	if (rtw_hci_type(rtwdev) != RTW_HCI_TYPE_USB)
+		rtw_write8(rtwdev, REG_FWHW_TXQ_CTRL + 2, bckp[1]);
 	rtw_write8(rtwdev, REG_CR + 1, bckp[0]);
 
 	return ret;