Initial commit
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
From 213dfa630285bb0241f3eaeb778db8ff128f10ba Mon Sep 17 00:00:00 2001
|
||||
From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
|
||||
Date: Fri, 8 Nov 2024 01:41:08 +0200
|
||||
Subject: [PATCH 3/6] wifi: rtw88: usb: Support USB 3 with RTL8812AU
|
||||
|
||||
Add the function to automatically switch the RTL8812AU into USB 3 mode.
|
||||
|
||||
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
|
||||
---
|
||||
drivers/net/wireless/realtek/rtw88/usb.c | 34 ++++++++++++++++++++++--
|
||||
1 file changed, 32 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/net/wireless/realtek/rtw88/usb.c
|
||||
+++ b/drivers/net/wireless/realtek/rtw88/usb.c
|
||||
@@ -929,6 +929,32 @@ static void rtw_usb_intf_deinit(struct r
|
||||
usb_set_intfdata(intf, NULL);
|
||||
}
|
||||
|
||||
+static int rtw_usb_switch_mode_old(struct rtw_dev *rtwdev)
|
||||
+{
|
||||
+ struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev);
|
||||
+ enum usb_device_speed cur_speed = rtwusb->udev->speed;
|
||||
+ u8 hci_opt;
|
||||
+
|
||||
+ if (cur_speed == USB_SPEED_HIGH) {
|
||||
+ hci_opt = rtw_read8(rtwdev, REG_HCI_OPT_CTRL);
|
||||
+
|
||||
+ if ((hci_opt & (BIT(2) | BIT(3))) != BIT(3)) {
|
||||
+ rtw_write8(rtwdev, REG_HCI_OPT_CTRL, 0x8);
|
||||
+ rtw_write8(rtwdev, REG_SYS_SDIO_CTRL, 0x2);
|
||||
+ rtw_write8(rtwdev, REG_ACLK_MON, 0x1);
|
||||
+ rtw_write8(rtwdev, 0x3d, 0x3);
|
||||
+ /* usb disconnect */
|
||||
+ rtw_write8(rtwdev, REG_SYS_PW_CTRL + 1, 0x80);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ } else if (cur_speed == USB_SPEED_SUPER) {
|
||||
+ rtw_write8_clr(rtwdev, REG_SYS_SDIO_CTRL, BIT(1));
|
||||
+ rtw_write8_clr(rtwdev, REG_ACLK_MON, BIT(0));
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int rtw_usb_switch_mode_new(struct rtw_dev *rtwdev)
|
||||
{
|
||||
enum usb_device_speed cur_speed;
|
||||
@@ -982,7 +1008,8 @@ static int rtw_usb_switch_mode(struct rt
|
||||
{
|
||||
u8 id = rtwdev->chip->id;
|
||||
|
||||
- if (id != RTW_CHIP_TYPE_8822C && id != RTW_CHIP_TYPE_8822B)
|
||||
+ if (id != RTW_CHIP_TYPE_8822C && id != RTW_CHIP_TYPE_8822B &&
|
||||
+ id != RTW_CHIP_TYPE_8812A)
|
||||
return 0;
|
||||
|
||||
if (!rtwdev->efuse.usb_mode_switch) {
|
||||
@@ -997,7 +1024,10 @@ static int rtw_usb_switch_mode(struct rt
|
||||
return 0;
|
||||
}
|
||||
|
||||
- return rtw_usb_switch_mode_new(rtwdev);
|
||||
+ if (id == RTW_CHIP_TYPE_8812A)
|
||||
+ return rtw_usb_switch_mode_old(rtwdev);
|
||||
+ else /* RTL8822CU, RTL8822BU */
|
||||
+ return rtw_usb_switch_mode_new(rtwdev);
|
||||
}
|
||||
|
||||
int rtw_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
|
||||
Reference in New Issue
Block a user