Message ID | 20220518082318.3898514-10-s.hauer@pengutronix.de (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | RTW88: Add support for USB variants | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
On Wed, 2022-05-18 at 10:23 +0200, Sascha Hauer wrote: > Add support for the rtw8822bu chipset based on > https://github.com/ulli-kroll/rtw88-usb.git > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> > --- > drivers/net/wireless/realtek/rtw88/Kconfig | 11 ++++ > drivers/net/wireless/realtek/rtw88/Makefile | 3 + > drivers/net/wireless/realtek/rtw88/rtw8822b.c | 19 ++++++ > .../net/wireless/realtek/rtw88/rtw8822bu.c | 62 +++++++++++++++++++ > .../net/wireless/realtek/rtw88/rtw8822bu.h | 15 +++++ > 5 files changed, 110 insertions(+) > create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8822bu.c > create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8822bu.h > > [..] > diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822bu.h > b/drivers/net/wireless/realtek/rtw88/rtw8822bu.h > new file mode 100644 > index 0000000000000..20f01ecd74415 > --- /dev/null > +++ b/drivers/net/wireless/realtek/rtw88/rtw8822bu.h > @@ -0,0 +1,15 @@ > +/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ > +/* Copyright(c) 2018-2019 Realtek Corporation > + */ > + > +#ifndef __RTW_8822BU_H_ > +#define __RTW_8822BU_H_ > + > +/* USB Vendor/Product IDs */ > +#define RTW_USB_VENDOR_ID_REALTEK 0x0BDA like others, move this to usb.h -- Ping-Ke
Hi, here are all current known vender rtw8822bu devices IDs from my maintained Realtek driver. https://github.com/RinCat/RTL88x2BU-Linux-Driver/blob/master/os_dep/linux/usb_intf.c#L239= ASUS vender ID 0x0B05: 0x1841 ASUS AC1300 USB-AC55 B1 0x184C ASUS U2 0x19AA ASUS USB-AC58 Edimax vender ID 0x7392: 0xB822 Edimax EW-7822ULC 0xC822 Edimax EW-7822UTC 0xF822 Edimax EW-7822UAD Dlink vender ID 0x2001: 0x331E Dlink - DWA-181 0x331C Dlink - DWA-182 0x331F Dlink - DWA-183 Ver. D NetGear vender ID 0x0846: 0x9055 NetGear A6150 TP-Link vender ID 0x2357: 0x012D TP-Link Archer T3U 0x0138 TP-Link Archer T3U Plus 0x0115 TP-Link Archer T4U V3 TRENDnet vender ID 0x20F4: 0x808A TRENDnet TEW-808UBM Thanks. Signed-off-by: Rin Cat (鈴猫) <dev@rincat.ch> On 2022-05-18 04:23, Sascha Hauer wrote: > Add support for the rtw8822bu chipset based on > https://github.com/ulli-kroll/rtw88-usb.git > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> > --- > drivers/net/wireless/realtek/rtw88/Kconfig | 11 ++++ > drivers/net/wireless/realtek/rtw88/Makefile | 3 + > drivers/net/wireless/realtek/rtw88/rtw8822b.c | 19 ++++++ > .../net/wireless/realtek/rtw88/rtw8822bu.c | 62 +++++++++++++++++++ > .../net/wireless/realtek/rtw88/rtw8822bu.h | 15 +++++ > 5 files changed, 110 insertions(+) > create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8822bu.c > create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8822bu.h > > diff --git a/drivers/net/wireless/realtek/rtw88/Kconfig b/drivers/net/wireless/realtek/rtw88/Kconfig > index 5b1bafccd3d4c..e4c60f1449ec8 100644 > --- a/drivers/net/wireless/realtek/rtw88/Kconfig > +++ b/drivers/net/wireless/realtek/rtw88/Kconfig > @@ -42,6 +42,17 @@ config RTW88_8822BE > > 802.11ac PCIe wireless network adapter > > +config RTW88_8822BU > + tristate "Realtek 8822BU USB wireless network adapter" > + depends on USB > + select RTW88_CORE > + select RTW88_USB > + select RTW88_8822B > + help > + Select this option will enable support for 8822BU chipset > + > + 802.11ac USB wireless network adapter > + > config RTW88_8822CE > tristate "Realtek 8822CE PCI wireless network adapter" > depends on PCI > diff --git a/drivers/net/wireless/realtek/rtw88/Makefile b/drivers/net/wireless/realtek/rtw88/Makefile > index 5498e8bbcbf17..e4126ddf7d659 100644 > --- a/drivers/net/wireless/realtek/rtw88/Makefile > +++ b/drivers/net/wireless/realtek/rtw88/Makefile > @@ -26,6 +26,9 @@ rtw88_8822b-objs := rtw8822b.o rtw8822b_table.o > obj-$(CONFIG_RTW88_8822BE) += rtw88_8822be.o > rtw88_8822be-objs := rtw8822be.o > > +obj-$(CONFIG_RTW88_8822BU) += rtw88_8822bu.o > +rtw88_8822bu-objs := rtw8822bu.o > + > obj-$(CONFIG_RTW88_8822C) += rtw88_8822c.o > rtw88_8822c-objs := rtw8822c.o rtw8822c_table.o > > diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822b.c b/drivers/net/wireless/realtek/rtw88/rtw8822b.c > index eee7bf0354030..10497d351f229 100644 > --- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c > +++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c > @@ -26,6 +26,12 @@ static void rtw8822be_efuse_parsing(struct rtw_efuse *efuse, > ether_addr_copy(efuse->addr, map->e.mac_addr); > } > > +static void rtw8822bu_efuse_parsing(struct rtw_efuse *efuse, > + struct rtw8822b_efuse *map) > +{ > + ether_addr_copy(efuse->addr, map->u.mac_addr); > +} > + > static int rtw8822b_read_efuse(struct rtw_dev *rtwdev, u8 *log_map) > { > struct rtw_efuse *efuse = &rtwdev->efuse; > @@ -56,6 +62,9 @@ static int rtw8822b_read_efuse(struct rtw_dev *rtwdev, u8 *log_map) > case RTW_HCI_TYPE_PCIE: > rtw8822be_efuse_parsing(efuse, map); > break; > + case RTW_HCI_TYPE_USB: > + rtw8822bu_efuse_parsing(efuse, map); > + break; > default: > /* unsupported now */ > return -ENOTSUPP; > @@ -1588,6 +1597,15 @@ static void rtw8822b_adaptivity(struct rtw_dev *rtwdev) > rtw_phy_set_edcca_th(rtwdev, l2h, h2l); > } > > +static void rtw8822b_fill_txdesc_checksum(struct rtw_dev *rtwdev, > + struct rtw_tx_pkt_info *pkt_info, > + u8 *txdesc) > +{ > + size_t words = 32 / 2; /* calculate the first 32 bytes (16 words) */ > + > + fill_txdesc_checksum_common(txdesc, words); > +} > + > static const struct rtw_pwr_seq_cmd trans_carddis_to_cardemu_8822b[] = { > {0x0086, > RTW_PWR_CUT_ALL_MSK, > @@ -2163,6 +2181,7 @@ static struct rtw_chip_ops rtw8822b_ops = { > .cfg_csi_rate = rtw_bf_cfg_csi_rate, > .adaptivity_init = rtw8822b_adaptivity_init, > .adaptivity = rtw8822b_adaptivity, > + .fill_txdesc_checksum = rtw8822b_fill_txdesc_checksum, > > .coex_set_init = rtw8822b_coex_cfg_init, > .coex_set_ant_switch = rtw8822b_coex_cfg_ant_switch, > diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822bu.c b/drivers/net/wireless/realtek/rtw88/rtw8822bu.c > new file mode 100644 > index 0000000000000..5becebdc32471 > --- /dev/null > +++ b/drivers/net/wireless/realtek/rtw88/rtw8822bu.c > @@ -0,0 +1,62 @@ > +// 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 "rtw8822bu.h" > +#include "usb.h" > + > +#define RTW_USB_VENDER_ID_EDIMAX 0x7392 > + > +static const struct usb_device_id rtw_8822bu_id_table[] = { > + { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, > + RTW_USB_PRODUCT_ID_REALTEK_8812B, > + 0xff, 0xff, 0xff), > + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, > + { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, > + RTW_USB_PRODUCT_ID_REALTEK_8822B, > + 0xff, 0xff, 0xff), > + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, > + { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDER_ID_EDIMAX, > + 0xB822, > + 0xff, 0xff, 0xff), > + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, > + { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDER_ID_EDIMAX, > + 0xC822, > + 0xff, 0xff, 0xff), > + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, > + { USB_DEVICE(0x0b05, 0x184c), /* ASUS AC53 Nano */ > + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, > + { USB_DEVICE(0x0b05, 0x1841), /* ASUS AC55 B1 */ > + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, > + { USB_DEVICE(0x2001, 0x331c), /* D-Link DWA-182 rev D1 */ > + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, > + { USB_DEVICE(0x13b1, 0x0043), /* Linksys WUSB6400M */ > + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, > + { USB_DEVICE(0x2357, 0x012D), /* TP-Link AC1300 T3U */ > + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, > + { USB_DEVICE(0x2357, 0x0138), /* TP-Link AC1300 T3U */ > + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, > + {}, > +}; > +MODULE_DEVICE_TABLE(usb, rtw_8822bu_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_8822bu_driver = { > + .name = "rtw_8822bu", > + .id_table = rtw_8822bu_id_table, > + .probe = rtw8822bu_probe, > + .disconnect = rtw_usb_disconnect, > +}; > +module_usb_driver(rtw_8822bu_driver); > + > +MODULE_AUTHOR("Realtek Corporation"); > +MODULE_DESCRIPTION("Realtek 802.11ac wireless 8822bu driver"); > +MODULE_LICENSE("Dual BSD/GPL"); > diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822bu.h b/drivers/net/wireless/realtek/rtw88/rtw8822bu.h > new file mode 100644 > index 0000000000000..20f01ecd74415 > --- /dev/null > +++ b/drivers/net/wireless/realtek/rtw88/rtw8822bu.h > @@ -0,0 +1,15 @@ > +/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ > +/* Copyright(c) 2018-2019 Realtek Corporation > + */ > + > +#ifndef __RTW_8822BU_H_ > +#define __RTW_8822BU_H_ > + > +/* USB Vendor/Product IDs */ > +#define RTW_USB_VENDOR_ID_REALTEK 0x0BDA > +#define RTW_USB_PRODUCT_ID_REALTEK_8812B 0xB812 > +#define RTW_USB_PRODUCT_ID_REALTEK_8822B 0xB82C > + > +extern struct rtw_chip_info rtw8822b_hw_spec; > + > +#endif
On Mon, May 23, 2022 at 07:56:14AM -0400, Rin Cat (鈴猫) wrote: > Hi, here are all current known vender rtw8822bu devices IDs from my > maintained Realtek driver. > https://github.com/RinCat/RTL88x2BU-Linux-Driver/blob/master/os_dep/linux/usb_intf.c#L239= Man, how many incarnations of this driver are there? It's really about time to mainline it. Modulo the IDs posted by Nick Morrow already only this one is missing: {USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x331f, 0xff, 0xff, 0xff), .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec)}, /* Dlink - DWA-183 D Ver */ Will add it for the next round. Thanks, Sascha
diff --git a/drivers/net/wireless/realtek/rtw88/Kconfig b/drivers/net/wireless/realtek/rtw88/Kconfig index 5b1bafccd3d4c..e4c60f1449ec8 100644 --- a/drivers/net/wireless/realtek/rtw88/Kconfig +++ b/drivers/net/wireless/realtek/rtw88/Kconfig @@ -42,6 +42,17 @@ config RTW88_8822BE 802.11ac PCIe wireless network adapter +config RTW88_8822BU + tristate "Realtek 8822BU USB wireless network adapter" + depends on USB + select RTW88_CORE + select RTW88_USB + select RTW88_8822B + help + Select this option will enable support for 8822BU chipset + + 802.11ac USB wireless network adapter + config RTW88_8822CE tristate "Realtek 8822CE PCI wireless network adapter" depends on PCI diff --git a/drivers/net/wireless/realtek/rtw88/Makefile b/drivers/net/wireless/realtek/rtw88/Makefile index 5498e8bbcbf17..e4126ddf7d659 100644 --- a/drivers/net/wireless/realtek/rtw88/Makefile +++ b/drivers/net/wireless/realtek/rtw88/Makefile @@ -26,6 +26,9 @@ rtw88_8822b-objs := rtw8822b.o rtw8822b_table.o obj-$(CONFIG_RTW88_8822BE) += rtw88_8822be.o rtw88_8822be-objs := rtw8822be.o +obj-$(CONFIG_RTW88_8822BU) += rtw88_8822bu.o +rtw88_8822bu-objs := rtw8822bu.o + obj-$(CONFIG_RTW88_8822C) += rtw88_8822c.o rtw88_8822c-objs := rtw8822c.o rtw8822c_table.o diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822b.c b/drivers/net/wireless/realtek/rtw88/rtw8822b.c index eee7bf0354030..10497d351f229 100644 --- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c +++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c @@ -26,6 +26,12 @@ static void rtw8822be_efuse_parsing(struct rtw_efuse *efuse, ether_addr_copy(efuse->addr, map->e.mac_addr); } +static void rtw8822bu_efuse_parsing(struct rtw_efuse *efuse, + struct rtw8822b_efuse *map) +{ + ether_addr_copy(efuse->addr, map->u.mac_addr); +} + static int rtw8822b_read_efuse(struct rtw_dev *rtwdev, u8 *log_map) { struct rtw_efuse *efuse = &rtwdev->efuse; @@ -56,6 +62,9 @@ static int rtw8822b_read_efuse(struct rtw_dev *rtwdev, u8 *log_map) case RTW_HCI_TYPE_PCIE: rtw8822be_efuse_parsing(efuse, map); break; + case RTW_HCI_TYPE_USB: + rtw8822bu_efuse_parsing(efuse, map); + break; default: /* unsupported now */ return -ENOTSUPP; @@ -1588,6 +1597,15 @@ static void rtw8822b_adaptivity(struct rtw_dev *rtwdev) rtw_phy_set_edcca_th(rtwdev, l2h, h2l); } +static void rtw8822b_fill_txdesc_checksum(struct rtw_dev *rtwdev, + struct rtw_tx_pkt_info *pkt_info, + u8 *txdesc) +{ + size_t words = 32 / 2; /* calculate the first 32 bytes (16 words) */ + + fill_txdesc_checksum_common(txdesc, words); +} + static const struct rtw_pwr_seq_cmd trans_carddis_to_cardemu_8822b[] = { {0x0086, RTW_PWR_CUT_ALL_MSK, @@ -2163,6 +2181,7 @@ static struct rtw_chip_ops rtw8822b_ops = { .cfg_csi_rate = rtw_bf_cfg_csi_rate, .adaptivity_init = rtw8822b_adaptivity_init, .adaptivity = rtw8822b_adaptivity, + .fill_txdesc_checksum = rtw8822b_fill_txdesc_checksum, .coex_set_init = rtw8822b_coex_cfg_init, .coex_set_ant_switch = rtw8822b_coex_cfg_ant_switch, diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822bu.c b/drivers/net/wireless/realtek/rtw88/rtw8822bu.c new file mode 100644 index 0000000000000..5becebdc32471 --- /dev/null +++ b/drivers/net/wireless/realtek/rtw88/rtw8822bu.c @@ -0,0 +1,62 @@ +// 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 "rtw8822bu.h" +#include "usb.h" + +#define RTW_USB_VENDER_ID_EDIMAX 0x7392 + +static const struct usb_device_id rtw_8822bu_id_table[] = { + { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, + RTW_USB_PRODUCT_ID_REALTEK_8812B, + 0xff, 0xff, 0xff), + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, + { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, + RTW_USB_PRODUCT_ID_REALTEK_8822B, + 0xff, 0xff, 0xff), + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, + { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDER_ID_EDIMAX, + 0xB822, + 0xff, 0xff, 0xff), + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, + { USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDER_ID_EDIMAX, + 0xC822, + 0xff, 0xff, 0xff), + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, + { USB_DEVICE(0x0b05, 0x184c), /* ASUS AC53 Nano */ + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, + { USB_DEVICE(0x0b05, 0x1841), /* ASUS AC55 B1 */ + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, + { USB_DEVICE(0x2001, 0x331c), /* D-Link DWA-182 rev D1 */ + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, + { USB_DEVICE(0x13b1, 0x0043), /* Linksys WUSB6400M */ + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, + { USB_DEVICE(0x2357, 0x012D), /* TP-Link AC1300 T3U */ + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, + { USB_DEVICE(0x2357, 0x0138), /* TP-Link AC1300 T3U */ + .driver_info = (kernel_ulong_t)&(rtw8822b_hw_spec) }, + {}, +}; +MODULE_DEVICE_TABLE(usb, rtw_8822bu_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_8822bu_driver = { + .name = "rtw_8822bu", + .id_table = rtw_8822bu_id_table, + .probe = rtw8822bu_probe, + .disconnect = rtw_usb_disconnect, +}; +module_usb_driver(rtw_8822bu_driver); + +MODULE_AUTHOR("Realtek Corporation"); +MODULE_DESCRIPTION("Realtek 802.11ac wireless 8822bu driver"); +MODULE_LICENSE("Dual BSD/GPL"); diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822bu.h b/drivers/net/wireless/realtek/rtw88/rtw8822bu.h new file mode 100644 index 0000000000000..20f01ecd74415 --- /dev/null +++ b/drivers/net/wireless/realtek/rtw88/rtw8822bu.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ +/* Copyright(c) 2018-2019 Realtek Corporation + */ + +#ifndef __RTW_8822BU_H_ +#define __RTW_8822BU_H_ + +/* USB Vendor/Product IDs */ +#define RTW_USB_VENDOR_ID_REALTEK 0x0BDA +#define RTW_USB_PRODUCT_ID_REALTEK_8812B 0xB812 +#define RTW_USB_PRODUCT_ID_REALTEK_8822B 0xB82C + +extern struct rtw_chip_info rtw8822b_hw_spec; + +#endif
Add support for the rtw8822bu chipset based on https://github.com/ulli-kroll/rtw88-usb.git Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/net/wireless/realtek/rtw88/Kconfig | 11 ++++ drivers/net/wireless/realtek/rtw88/Makefile | 3 + drivers/net/wireless/realtek/rtw88/rtw8822b.c | 19 ++++++ .../net/wireless/realtek/rtw88/rtw8822bu.c | 62 +++++++++++++++++++ .../net/wireless/realtek/rtw88/rtw8822bu.h | 15 +++++ 5 files changed, 110 insertions(+) create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8822bu.c create mode 100644 drivers/net/wireless/realtek/rtw88/rtw8822bu.h