From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
To: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Subject: [PATCH rtw-next 03/11] wifi: rtw89: usb: Fix rtw89_usb_ops_mac_pre_init() for RTL8852CU
Date: Fri, 1 Aug 2025 23:38:10 +0300 [thread overview]
Message-ID: <0fe03e30-0330-4674-aabf-aafe111810a4@gmail.com> (raw)
In-Reply-To: <2527e1be-3121-4f29-8539-72f4bfb225a6@gmail.com>
The registers used in this function are located at different offsets in
RTL8852CU compared to other chips. Use the right registers for each
chip.
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
drivers/net/wireless/realtek/rtw89/usb.c | 29 ++++++++++++++++++++----
1 file changed, 24 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw89/usb.c b/drivers/net/wireless/realtek/rtw89/usb.c
index eb9978a60d04..e749a37ac1b5 100644
--- a/drivers/net/wireless/realtek/rtw89/usb.c
+++ b/drivers/net/wireless/realtek/rtw89/usb.c
@@ -726,20 +726,39 @@ static int rtw89_usb_ops_deinit(struct rtw89_dev *rtwdev)
static int rtw89_usb_ops_mac_pre_init(struct rtw89_dev *rtwdev)
{
+ u32 usb_host_request_2, usb_wlan0_1, hci_func_en;
u32 val32;
- rtw89_write32_set(rtwdev, R_AX_USB_HOST_REQUEST_2, B_AX_R_USBIO_MODE);
+ switch (rtwdev->chip->chip_id) {
+ case RTL8851B:
+ case RTL8852A:
+ case RTL8852B:
+ usb_host_request_2 = R_AX_USB_HOST_REQUEST_2;
+ usb_wlan0_1 = R_AX_USB_WLAN0_1;
+ hci_func_en = R_AX_HCI_FUNC_EN;
+ break;
+ case RTL8852C:
+ usb_host_request_2 = R_AX_USB_HOST_REQUEST_2_V1;
+ usb_wlan0_1 = R_AX_USB_WLAN0_1_V1;
+ hci_func_en = R_AX_HCI_FUNC_EN_V1;
+ break;
+ default:
+ rtw89_err(rtwdev, "%s: unknown chip\n", __func__);
+ return -EOPNOTSUPP;
+ }
+
+ rtw89_write32_set(rtwdev, usb_host_request_2, B_AX_R_USBIO_MODE);
/* fix USB IO hang suggest by chihhanli@realtek.com */
- rtw89_write32_clr(rtwdev, R_AX_USB_WLAN0_1,
+ rtw89_write32_clr(rtwdev, usb_wlan0_1,
B_AX_USBRX_RST | B_AX_USBTX_RST);
- val32 = rtw89_read32(rtwdev, R_AX_HCI_FUNC_EN);
+ val32 = rtw89_read32(rtwdev, hci_func_en);
val32 &= ~(B_AX_HCI_RXDMA_EN | B_AX_HCI_TXDMA_EN);
- rtw89_write32(rtwdev, R_AX_HCI_FUNC_EN, val32);
+ rtw89_write32(rtwdev, hci_func_en, val32);
val32 |= B_AX_HCI_RXDMA_EN | B_AX_HCI_TXDMA_EN;
- rtw89_write32(rtwdev, R_AX_HCI_FUNC_EN, val32);
+ rtw89_write32(rtwdev, hci_func_en, val32);
/* fix USB TRX hang suggest by chihhanli@realtek.com */
return 0;
--
2.50.0
next prev parent reply other threads:[~2025-08-01 20:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-01 20:35 [PATCH rtw-next 00/11] wifi: rtw89: Add support for RTL8852CU Bitterblue Smith
2025-08-01 20:37 ` [PATCH rtw-next 01/11] wifi: rtw89: Fix rtw89_core_get_ch_dma() " Bitterblue Smith
2025-08-01 20:37 ` [PATCH rtw-next 02/11] wifi: rtw89: usb: Fix rtw89_usb_get_bulkout_id() " Bitterblue Smith
2025-08-01 20:38 ` Bitterblue Smith [this message]
2025-08-01 20:38 ` [PATCH rtw-next 04/11] wifi: rtw89: usb: Fix rtw89_usb_ops_mac_post_init() " Bitterblue Smith
2025-08-01 20:38 ` [PATCH rtw-next 05/11] wifi: rtw89: Fix rtw89_mac_dmac_func_pre_en_ax() for USB/SDIO Bitterblue Smith
2025-08-01 20:39 ` [PATCH rtw-next 06/11] wifi: rtw89: 8852c: Fix rtw8852c_pwr_{on,off}_func() for USB Bitterblue Smith
2025-08-01 20:40 ` [PATCH rtw-next 00/11] wifi: rtw89: Add support for RTL8852CU Bitterblue Smith
2025-08-01 20:41 ` [PATCH rtw-next 09/11] wifi: rtw89: 8852c: Accept USB devices and load their MAC address Bitterblue Smith
2025-08-01 20:44 ` [PATCH rtw-next 00/11] wifi: rtw89: Add support for RTL8852CU Bitterblue Smith
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0fe03e30-0330-4674-aabf-aafe111810a4@gmail.com \
--to=rtl8821cerfe2@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=pkshih@realtek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox