LibreELEC.tv icon indicating copy to clipboard operation
LibreELEC.tv copied to clipboard

RTW88: Add support for USB/SDIO variants

Open heitbaum opened this issue 3 years ago • 2 comments

Add WIP upstream patches to support RTW88 USB and SDIO.

  • rebased for 6.0 #6829

These patches are incorporated into the linux/patches/default - and are enabled for USB on both Generic and Samsung. For Allwinner TX6 (which has the rtw8822BS/CS chip) the SDIO Kconfig has been enabled as a module.

The driver is running well on the Tanix TX6 - though there are the following observed issues:

  • powersave does look like it needs to be disabled on the TX6:
  • on suspend and resume the wireless firmware (8822CS) does not reconnect
    • refer the the below script to re-establish
  • deauthentication status code of 252 with Cisco access points due to session-timeout results in disconnection and manual connection to the wireless is required (this is more likely to be a connman / Cisco "feature".)
  • the v9.9.13 firmware is not yet in the mainline linux-firmware. The PRed patches work with both v9.9.11 and v9.9.13 firmware https://github.com/pkshih/linux-firmware/tree/main/rtw88 Driver
  • https://lore.kernel.org/linux-wireless/?q=Rtw88
  • https://lore.kernel.org/linux-wireless/[email protected]/
  • https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/log/

Tested:

  • Tanix TX6 with RTL8822BS - @jernejsk
  • Tanix TX6 with RTL8822CS - @heitbaum
# cat fix-wireless.sh
rmmod rtw88_8822cs
rmmod rtw88_8822c
rmmod rtw88_sdio
rmmod rtw88_core
rmmod mac80211
modprobe rtw88_8822cs

heitbaum avatar Jun 26 '22 13:06 heitbaum

This seems to work on Tanix TX6 with RTL8822BS.

jernejsk avatar Jun 26 '22 13:06 jernejsk

@sy6sy2 - you may want to test this on your device.

heitbaum avatar Jun 26 '22 15:06 heitbaum

@heitbaum if (vif->bss_conf.assoc) needs to be changed to if (vif->cfg.assoc) to apply on 6.0

dsx724 avatar Oct 26 '22 04:10 dsx724

FYI- v5 patches on LKML https://lore.kernel.org/linux-wireless/[email protected]/

There is also another accepted patch that supposedly resolve performance issues: https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

Testing w/ rtl8822bu dongle on RPi4 yields device lock ups, so not quite ready. Same experience with the v2 patch set here.

wagnerch avatar Dec 02 '22 15:12 wagnerch

Test running on Tanix TX6

sh testedon.sh

=== tested on ===
H6.arm-devel-20221211065715-b2cd447
Linux tx6 6.1.0-rc8 #1 SMP PREEMPT Sun Dec 11 07:34:26 UTC 2022 aarch64 GNU/Linux
Starting Kodi (20.0-RC1 (19.90.901) Git:20.0rc1-Nexus). Platform: Linux ARM 32-bit
Using Release Kodi x32
Kodi compiled 2022-12-11 by GCC 12.2.0 for Linux ARM 32-bit version 6.1.0 (393472)
Running on LibreELEC (heitbaum): devel-20221211065715-b2cd447 11.0, kernel: Linux ARM 64-bit version 6.1.0-rc8
FFmpeg version/source: 4.4.1-Kodi
4 CPU cores available
ARM Features: Neon enabled
CApplication::CreateGUI - using the gbm windowing system
EGL_VENDOR = Mesa Project
GL_VERSION = OpenGL ES 2.0 Mesa 22.3.0
tx6:~ # dmesg | grep -i -e rtl -e rtw
[    7.460679] rtw_8822cs mmc1:0001:1: Firmware version 9.9.13, H2C version 15
[    7.537489] Bluetooth: hci0: RTL: examining hci_ver=08 hci_rev=000c lmp_ver=08 lmp_subver=8822
[    7.541586] Bluetooth: hci0: RTL: rom_version status=0 version=3
[    7.541617] Bluetooth: hci0: RTL: loading rtl_bt/rtl8822cs_fw.bin
[    7.553331] Bluetooth: hci0: RTL: loading rtl_bt/rtl8822cs_config.bin
[    7.574873] Bluetooth: hci0: RTL: cfg_sz 33, total sz 36529
[    8.039882] Bluetooth: hci0: RTL: fw version 0xffb8abd6

[  415.362876] dwmac-sun8i 5020000.ethernet eth0: Link is Down
[  417.978944] wlan0: authenticate with c8:84:a1:d6:d2:6f
[  422.505820] wlan0: send auth to c8:84:a1:d6:d2:6f (try 1/3)
[  422.507626] wlan0: authenticated
[  422.510636] wlan0: associate with c8:84:a1:d6:d2:6f (try 1/3)
[  423.810612] wlan0: associate with c8:84:a1:d6:d2:6f (try 2/3)
[  424.806609] wlan0: associate with c8:84:a1:d6:d2:6f (try 3/3)
[  425.550385] wlan0: deauthenticated from c8:84:a1:d6:d2:6f while associating (Reason: 252=ADMIN_RESET)
[  428.170719] wlan0: authenticate with c8:84:a1:d6:d2:67
[  431.691419] wlan0: send auth to c8:84:a1:d6:d2:67 (try 1/3)
[  431.693440] wlan0: authenticated
[  431.694610] wlan0: associate with c8:84:a1:d6:d2:67 (try 1/3)
[  431.705982] wlan0: RX AssocResp from c8:84:a1:d6:d2:67 (capab=0x111 status=0 aid=1)
[  431.794297] wlan0: associated
[  431.811874] wlan0: Limiting TX power to 19 (22 - 3) dBm as advertised by c8:84:a1:d6:d2:67

tx6:~ # iw list
Wiphy phy0
        wiphy index: 0
        max # scan SSIDs: 4
        max scan IEs length: 323 bytes
        max # sched scan SSIDs: 0
        max # match sets: 0
        Retry short limit: 7
        Retry long limit: 4
        Coverage class: 0 (up to 0m)
        Device supports T-DLS.
        Supported Ciphers:
                * WEP40 (00-0f-ac:1)
                * WEP104 (00-0f-ac:5)
                * TKIP (00-0f-ac:2)
                * CCMP-128 (00-0f-ac:4)
                * CCMP-256 (00-0f-ac:10)
                * GCMP-128 (00-0f-ac:8)
                * GCMP-256 (00-0f-ac:9)
                * CMAC (00-0f-ac:6)
                * CMAC-256 (00-0f-ac:13)
                * GMAC-128 (00-0f-ac:11)
                * GMAC-256 (00-0f-ac:12)
        Available Antennas: TX 0x3 RX 0x3
        Configured Antennas: TX 0x3 RX 0x3
        Supported interface modes:
                 * IBSS
                 * managed
                 * AP
                 * AP/VLAN
                 * monitor
        Band 1:
                Capabilities: 0x19ef
                        RX LDPC
                        HT20/HT40
                        SM Power Save disabled
                        RX HT20 SGI
                        RX HT40 SGI
                        TX STBC
                        RX STBC 1-stream
                        Max AMSDU length: 7935 bytes
                        DSSS/CCK HT40
                Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
                Minimum RX AMPDU time spacing: 2 usec (0x04)
                HT Max RX data rate: 300 Mbps
                HT TX/RX MCS rate indexes supported: 0-15, 32
                Bitrates (non-HT):
                        * 1.0 Mbps
                        * 2.0 Mbps
                        * 5.5 Mbps
                        * 11.0 Mbps
                        * 6.0 Mbps
                        * 9.0 Mbps
                        * 12.0 Mbps
                        * 18.0 Mbps
                        * 24.0 Mbps
                        * 36.0 Mbps
                        * 48.0 Mbps
                        * 54.0 Mbps
                Frequencies:
                        * 2412 MHz [1] (36.0 dBm)
                        * 2417 MHz [2] (36.0 dBm)
                        * 2422 MHz [3] (36.0 dBm)
                        * 2427 MHz [4] (36.0 dBm)
                        * 2432 MHz [5] (36.0 dBm)
                        * 2437 MHz [6] (36.0 dBm)
                        * 2442 MHz [7] (36.0 dBm)
                        * 2447 MHz [8] (36.0 dBm)
                        * 2452 MHz [9] (36.0 dBm)
                        * 2457 MHz [10] (36.0 dBm)
                        * 2462 MHz [11] (36.0 dBm)
                        * 2467 MHz [12] (36.0 dBm)
                        * 2472 MHz [13] (36.0 dBm)
                        * 2484 MHz [14] (disabled)
        Band 2:
                Capabilities: 0x19ef
                        RX LDPC
                        HT20/HT40
                        SM Power Save disabled
                        RX HT20 SGI
                        RX HT40 SGI
                        TX STBC
                        RX STBC 1-stream
                        Max AMSDU length: 7935 bytes
                        DSSS/CCK HT40
                Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
                Minimum RX AMPDU time spacing: 2 usec (0x04)
                HT Max RX data rate: 300 Mbps
                HT TX/RX MCS rate indexes supported: 0-15, 32
                VHT Capabilities (0x03d071b2):
                        Max MPDU length: 11454
                        Supported Channel Width: neither 160 nor 80+80
                        RX LDPC
                        short GI (80 MHz)
                        TX STBC
                        SU Beamformee
                        MU Beamformee
                        +HTC-VHT
                VHT RX MCS set:
                        1 streams: MCS 0-9
                        2 streams: MCS 0-9
                        3 streams: not supported
                        4 streams: not supported
                        5 streams: not supported
                        6 streams: not supported
                        7 streams: not supported
                        8 streams: not supported
                VHT RX highest supported: 780 Mbps
                VHT TX MCS set:
                        1 streams: MCS 0-9
                        2 streams: MCS 0-9
                        3 streams: not supported
                        4 streams: not supported
                        5 streams: not supported
                        6 streams: not supported
                        7 streams: not supported
                        8 streams: not supported
                VHT TX highest supported: 780 Mbps
                VHT extended NSS: not supported
                Bitrates (non-HT):
                        * 6.0 Mbps
                        * 9.0 Mbps
                        * 12.0 Mbps
                        * 18.0 Mbps
                        * 24.0 Mbps
                        * 36.0 Mbps
                        * 48.0 Mbps
                        * 54.0 Mbps
                Frequencies:
                        * 5180 MHz [36] (23.0 dBm)
                        * 5200 MHz [40] (23.0 dBm)
                        * 5220 MHz [44] (23.0 dBm)
                        * 5240 MHz [48] (23.0 dBm)
                        * 5260 MHz [52] (20.0 dBm) (radar detection)
                        * 5280 MHz [56] (20.0 dBm) (radar detection)
                        * 5300 MHz [60] (20.0 dBm) (radar detection)
                        * 5320 MHz [64] (20.0 dBm) (radar detection)
                        * 5500 MHz [100] (27.0 dBm) (radar detection)
                        * 5520 MHz [104] (27.0 dBm) (radar detection)
                        * 5540 MHz [108] (27.0 dBm) (radar detection)
                        * 5560 MHz [112] (27.0 dBm) (radar detection)
                        * 5580 MHz [116] (27.0 dBm) (radar detection)
                        * 5600 MHz [120] (disabled)
                        * 5620 MHz [124] (disabled)
                        * 5640 MHz [128] (disabled)
                        * 5660 MHz [132] (27.0 dBm) (radar detection)
                        * 5680 MHz [136] (27.0 dBm) (radar detection)
                        * 5700 MHz [140] (27.0 dBm) (radar detection)
                        * 5720 MHz [144] (27.0 dBm) (radar detection)
                        * 5745 MHz [149] (36.0 dBm)
                        * 5765 MHz [153] (36.0 dBm)
                        * 5785 MHz [157] (36.0 dBm)
                        * 5805 MHz [161] (36.0 dBm)
                        * 5825 MHz [165] (36.0 dBm)
        Supported commands:
                 * new_interface
                 * set_interface
                 * new_key
                 * start_ap
                 * new_station
                 * set_bss
                 * authenticate
                 * associate
                 * deauthenticate
                 * disassociate
                 * join_ibss
                 * remain_on_channel
                 * set_tx_bitrate_mask
                 * frame
                 * frame_wait_cancel
                 * set_wiphy_netns
                 * set_channel
                 * tdls_mgmt
                 * tdls_oper
                 * probe_client
                 * set_noack_map
                 * register_beacons
                 * start_p2p_device
                 * set_mcast_rate
                 * connect
                 * disconnect
                 * set_qos_map
                 * set_multicast_to_unicast
                 * set_sar_specs
        software interface modes (can always be added):
                 * AP/VLAN
                 * monitor
        interface combinations are not supported
        HT Capability overrides:
                 * MCS: ff ff ff ff ff ff ff ff ff ff
                 * maximum A-MSDU length
                 * supported channel width
                 * short GI for 40 MHz
                 * max A-MPDU length exponent
                 * min MPDU start spacing
        Device supports TX status socket option.
        Device supports HT-IBSS.
        Device supports SAE with AUTHENTICATE command
        Device supports scan flush.
        Device supports per-vif TX power setting
        Driver supports full state transitions for AP/GO clients
        Driver supports a userspace MPM
        Device supports configuring vdev MAC-addr on create.
        Device supports randomizing MAC-addr in scans.
        max # scan plans: 1
        max scan plan interval: -1
        max scan plan iterations: 0
        Supported TX frame types:
                 * IBSS: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * mesh point: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * P2P-device: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
        Supported RX frame types:
                 * IBSS: 0x40 0xb0 0xc0 0xd0
                 * managed: 0x40 0xb0 0xd0
                 * AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
                 * AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
                 * mesh point: 0xb0 0xc0 0xd0
                 * P2P-client: 0x40 0xd0
                 * P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
                 * P2P-device: 0x40 0xd0
        Supported extended features:
                * [ RRM ]: RRM
                * [ SET_SCAN_DWELL ]: scan dwell setting
                * [ FILS_STA ]: STA FILS (Fast Initial Link Setup)
                * [ CONTROL_PORT_OVER_NL80211 ]: control port over nl80211
                * [ TXQS ]: FQ-CoDel-enabled intermediate TXQs
                * [ SCAN_RANDOM_SN ]: use random sequence numbers in scans
                * [ CAN_REPLACE_PTK0 ]: can safely replace PTK 0 when rekeying
                * [ CONTROL_PORT_NO_PREAUTH ]: disable pre-auth over nl80211 control port support
                * [ DEL_IBSS_STA ]: deletion of IBSS station support
                * [ SCAN_FREQ_KHZ ]: scan on kHz frequency support
                * [ CONTROL_PORT_OVER_NL80211_TX_STATUS ]: tx status for nl80211 control port support

heitbaum avatar Dec 11 '22 08:12 heitbaum

rtw88 USB is confirmed merged into kernel 6.2 - https://github.com/torvalds/linux/commit/fba119cee1412f49c472f3913241d00f830761fd

heitbaum avatar Dec 16 '22 07:12 heitbaum