2022-12-02 08:13:41

by Sascha Hauer

[permalink] [raw]
Subject: [PATCH v5 00/11] RTW88: Add support for USB variants

This has only small changes to the last version. I dropped the endless
loop check again and added the "Edimax EW-7611ULB V2" to the rtw8723du
id table.

Sascha

Sascha Hauer (11):
wifi: rtw88: print firmware type in info message
wifi: rtw88: Call rtw_fw_beacon_filter_config() with rtwdev->mutex
held
wifi: rtw88: Drop rf_lock
wifi: rtw88: Drop h2c.lock
wifi: rtw88: Drop coex mutex
wifi: rtw88: iterate over vif/sta list non-atomically
wifi: rtw88: Add common USB chip support
wifi: rtw88: Add rtw8821cu chipset support
wifi: rtw88: Add rtw8822bu chipset support
wifi: rtw88: Add rtw8822cu chipset support
wifi: rtw88: Add rtw8723du chipset support

drivers/net/wireless/realtek/rtw88/Kconfig | 47 +
drivers/net/wireless/realtek/rtw88/Makefile | 15 +
drivers/net/wireless/realtek/rtw88/coex.c | 3 +-
drivers/net/wireless/realtek/rtw88/debug.c | 15 +
drivers/net/wireless/realtek/rtw88/fw.c | 13 +-
drivers/net/wireless/realtek/rtw88/hci.h | 9 +-
drivers/net/wireless/realtek/rtw88/mac.c | 3 +
drivers/net/wireless/realtek/rtw88/mac80211.c | 2 +-
drivers/net/wireless/realtek/rtw88/main.c | 12 +-
drivers/net/wireless/realtek/rtw88/main.h | 12 +-
drivers/net/wireless/realtek/rtw88/phy.c | 6 +-
drivers/net/wireless/realtek/rtw88/ps.c | 2 +-
drivers/net/wireless/realtek/rtw88/reg.h | 1 +
drivers/net/wireless/realtek/rtw88/rtw8723d.c | 28 +
drivers/net/wireless/realtek/rtw88/rtw8723d.h | 13 +-
.../net/wireless/realtek/rtw88/rtw8723du.c | 36 +
drivers/net/wireless/realtek/rtw88/rtw8821c.c | 18 +
drivers/net/wireless/realtek/rtw88/rtw8821c.h | 21 +
.../net/wireless/realtek/rtw88/rtw8821cu.c | 50 +
drivers/net/wireless/realtek/rtw88/rtw8822b.c | 19 +
.../net/wireless/realtek/rtw88/rtw8822bu.c | 90 ++
drivers/net/wireless/realtek/rtw88/rtw8822c.c | 24 +
.../net/wireless/realtek/rtw88/rtw8822cu.c | 44 +
drivers/net/wireless/realtek/rtw88/tx.h | 31 +
drivers/net/wireless/realtek/rtw88/usb.c | 911 ++++++++++++++++++
drivers/net/wireless/realtek/rtw88/usb.h | 107 ++
drivers/net/wireless/realtek/rtw88/util.c | 103 ++
drivers/net/wireless/realtek/rtw88/util.h | 12 +-
28 files changed, 1609 insertions(+), 38 deletions(-)
create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8723du.c
create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8821cu.c
create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8822bu.c
create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8822cu.c
create mode 100644 drivers/net/wireless/realtek/rtw88/usb.c
create mode 100644 drivers/net/wireless/realtek/rtw88/usb.h

--
2.30.2


2022-12-02 08:13:47

by Sascha Hauer

[permalink] [raw]
Subject: [PATCH v5 10/11] wifi: rtw88: Add rtw8822cu chipset support

Add support for the rtw8822cu chipset based on
https://github.com/ulli-kroll/rtw88-usb.git

Signed-off-by: Sascha Hauer <[email protected]>
---

Notes:
Changes since v3:
- drop unnecessary rtw8822cu.h

Changes since v1:
- Add more Device IDs from https://github.com/morrownr/8821cu-20210118.git

drivers/net/wireless/realtek/rtw88/Kconfig | 11 +++++
drivers/net/wireless/realtek/rtw88/Makefile | 3 ++
drivers/net/wireless/realtek/rtw88/rtw8822c.c | 24 ++++++++++
.../net/wireless/realtek/rtw88/rtw8822cu.c | 44 +++++++++++++++++++
4 files changed, 82 insertions(+)
create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8822cu.c

diff --git a/drivers/net/wireless/realtek/rtw88/Kconfig b/drivers/net/wireless/realtek/rtw88/Kconfig
index 10f4e7f88b858..138289bc5ad0c 100644
--- a/drivers/net/wireless/realtek/rtw88/Kconfig
+++ b/drivers/net/wireless/realtek/rtw88/Kconfig
@@ -64,6 +64,17 @@ config RTW88_8822CE

802.11ac PCIe wireless network adapter

+config RTW88_8822CU
+ tristate "Realtek 8822CU USB wireless network adapter"
+ depends on USB
+ select RTW88_CORE
+ select RTW88_USB
+ select RTW88_8822C
+ help
+ Select this option will enable support for 8822CU chipset
+
+ 802.11ac USB wireless network adapter
+
config RTW88_8723DE
tristate "Realtek 8723DE PCI wireless network adapter"
depends on PCI
diff --git a/drivers/net/wireless/realtek/rtw88/Makefile b/drivers/net/wireless/realtek/rtw88/Makefile
index 6984bfb7a3170..fe2dd90204a78 100644
--- a/drivers/net/wireless/realtek/rtw88/Makefile
+++ b/drivers/net/wireless/realtek/rtw88/Makefile
@@ -35,6 +35,9 @@ rtw88_8822c-objs := rtw8822c.o rtw8822c_table.o
obj-$(CONFIG_RTW88_8822CE) += rtw88_8822ce.o
rtw88_8822ce-objs := rtw8822ce.o

+obj-$(CONFIG_RTW88_8822CU) += rtw88_8822cu.o
+rtw88_8822cu-objs := rtw8822cu.o
+
obj-$(CONFIG_RTW88_8723D) += rtw88_8723d.o
rtw88_8723d-objs := rtw8723d.o rtw8723d_table.o

diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.c b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
index fccb15dfb9595..964e27887fe2d 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
@@ -29,6 +29,12 @@ static void rtw8822ce_efuse_parsing(struct rtw_efuse *efuse,
ether_addr_copy(efuse->addr, map->e.mac_addr);
}

+static void rtw8822cu_efuse_parsing(struct rtw_efuse *efuse,
+ struct rtw8822c_efuse *map)
+{
+ ether_addr_copy(efuse->addr, map->u.mac_addr);
+}
+
static int rtw8822c_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
{
struct rtw_efuse *efuse = &rtwdev->efuse;
@@ -58,6 +64,9 @@ static int rtw8822c_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
case RTW_HCI_TYPE_PCIE:
rtw8822ce_efuse_parsing(efuse, map);
break;
+ case RTW_HCI_TYPE_USB:
+ rtw8822cu_efuse_parsing(efuse, map);
+ break;
default:
/* unsupported now */
return -ENOTSUPP;
@@ -4557,6 +4566,18 @@ static void rtw8822c_adaptivity(struct rtw_dev *rtwdev)
rtw_phy_set_edcca_th(rtwdev, l2h, h2l);
}

+static void rtw8822c_fill_txdesc_checksum(struct rtw_dev *rtwdev,
+ struct rtw_tx_pkt_info *pkt_info,
+ u8 *txdesc)
+{
+ const struct rtw_chip_info *chip = rtwdev->chip;
+ size_t words;
+
+ words = (pkt_info->pkt_offset * 8 + chip->tx_pkt_desc_sz) / 2;
+
+ fill_txdesc_checksum_common(txdesc, words);
+}
+
static const struct rtw_pwr_seq_cmd trans_carddis_to_cardemu_8822c[] = {
{0x0086,
RTW_PWR_CUT_ALL_MSK,
@@ -4895,6 +4916,8 @@ static const struct rtw_rfe_def rtw8822c_rfe_defs[] = {
[0] = RTW_DEF_RFE(8822c, 0, 0),
[1] = RTW_DEF_RFE(8822c, 0, 0),
[2] = RTW_DEF_RFE(8822c, 0, 0),
+ [3] = RTW_DEF_RFE(8822c, 0, 0),
+ [4] = RTW_DEF_RFE(8822c, 0, 0),
[5] = RTW_DEF_RFE(8822c, 0, 5),
[6] = RTW_DEF_RFE(8822c, 0, 0),
};
@@ -4978,6 +5001,7 @@ static struct rtw_chip_ops rtw8822c_ops = {
.cfo_track = rtw8822c_cfo_track,
.config_tx_path = rtw8822c_config_tx_path,
.config_txrx_mode = rtw8822c_config_trx_mode,
+ .fill_txdesc_checksum = rtw8822c_fill_txdesc_checksum,

.coex_set_init = rtw8822c_coex_cfg_init,
.coex_set_ant_switch = NULL,
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822cu.c b/drivers/net/wireless/realtek/rtw88/rtw8822cu.c
new file mode 100644
index 0000000000000..af28ca09d41fb
--- /dev/null
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822cu.c
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
+/* Copyright(c) 2018-2019 Realtek Corporation
+ */
+
+#include <linux/module.h>
+#include <linux/usb.h>
+#include "main.h"
+#include "rtw8822c.h"
+#include "usb.h"
+
+static const struct usb_device_id rtw_8822cu_id_table[] = {
+ { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0xc82c, 0xff, 0xff, 0xff),
+ .driver_info = (kernel_ulong_t)&(rtw8822c_hw_spec) },
+ { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0xc812, 0xff, 0xff, 0xff),
+ .driver_info = (kernel_ulong_t)&(rtw8822c_hw_spec) },
+ { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0xc82e, 0xff, 0xff, 0xff),
+ .driver_info = (kernel_ulong_t)&(rtw8822c_hw_spec) },
+ { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0xd820, 0xff, 0xff, 0xff),
+ .driver_info = (kernel_ulong_t)&(rtw8822c_hw_spec) },
+ { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0xd82b, 0xff, 0xff, 0xff),
+ .driver_info = (kernel_ulong_t)&(rtw8822c_hw_spec) },
+ { USB_DEVICE_AND_INTERFACE_INFO(0x13b1, 0x0043, 0xff, 0xff, 0xff),
+ .driver_info = (kernel_ulong_t)&(rtw8822c_hw_spec) }, /* Alpha - Alpha */
+ {},
+};
+MODULE_DEVICE_TABLE(usb, rtw_8822cu_id_table);
+
+static int rtw8822bu_probe(struct usb_interface *intf,
+ const struct usb_device_id *id)
+{
+ return rtw_usb_probe(intf, id);
+}
+
+static struct usb_driver rtw_8822cu_driver = {
+ .name = "rtw_8822cu",
+ .id_table = rtw_8822cu_id_table,
+ .probe = rtw8822bu_probe,
+ .disconnect = rtw_usb_disconnect,
+};
+module_usb_driver(rtw_8822cu_driver);
+
+MODULE_AUTHOR("Realtek Corporation");
+MODULE_DESCRIPTION("Realtek 802.11ac wireless 8822cu driver");
+MODULE_LICENSE("Dual BSD/GPL");
--
2.30.2

2022-12-05 01:47:01

by Ping-Ke Shih

[permalink] [raw]
Subject: RE: [PATCH v5 00/11] RTW88: Add support for USB variants



> -----Original Message-----
> From: Sascha Hauer <[email protected]>
> Sent: Friday, December 2, 2022 4:12 PM
> To: [email protected]
> Cc: Neo Jou <[email protected]>; Hans Ulli Kroll <[email protected]>; Ping-Ke Shih <[email protected]>;
> Yan-Hsuan Chuang <[email protected]>; Kalle Valo <[email protected]>; [email protected];
> [email protected]; Martin Blumenstingl <[email protected]>;
> [email protected]; Alexander Hochbaum <[email protected]>; Da Xue <[email protected]>; Bernie Huang
> <[email protected]>; Viktor Petrenko <[email protected]>; Sascha Hauer <[email protected]>
> Subject: [PATCH v5 00/11] RTW88: Add support for USB variants
>
> This has only small changes to the last version. I dropped the endless
> loop check again and added the "Edimax EW-7611ULB V2" to the rtw8723du
> id table.
>

v5 looks good to me, and I have tested 8822CE to confirm there is no regression
on PCI devices. Thank you for this nice work!

Reviewed-and-Tested-by: Ping-Ke Shih <[email protected]>

--
Ping-Ke