Commit aff5ffd7 authored by Sascha Hauer's avatar Sascha Hauer Committed by Kalle Valo

wifi: rtw88: Add rtw8821cu chipset support

Add support for the rtw8821cu chipset based on
https://github.com/ulli-kroll/rtw88-usb.gitSigned-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20221202081224.2779981-9-s.hauer@pengutronix.de
parent a82dfd33
...@@ -75,6 +75,17 @@ config RTW88_8821CE ...@@ -75,6 +75,17 @@ config RTW88_8821CE
802.11ac PCIe wireless network adapter 802.11ac PCIe wireless network adapter
config RTW88_8821CU
tristate "Realtek 8821CU USB wireless network adapter"
depends on USB
select RTW88_CORE
select RTW88_USB
select RTW88_8821C
help
Select this option will enable support for 8821CU chipset
802.11ac USB wireless network adapter
config RTW88_DEBUG config RTW88_DEBUG
bool "Realtek rtw88 debug support" bool "Realtek rtw88 debug support"
depends on RTW88_CORE depends on RTW88_CORE
......
...@@ -44,6 +44,9 @@ rtw88_8821c-objs := rtw8821c.o rtw8821c_table.o ...@@ -44,6 +44,9 @@ rtw88_8821c-objs := rtw8821c.o rtw8821c_table.o
obj-$(CONFIG_RTW88_8821CE) += rtw88_8821ce.o obj-$(CONFIG_RTW88_8821CE) += rtw88_8821ce.o
rtw88_8821ce-objs := rtw8821ce.o rtw88_8821ce-objs := rtw8821ce.o
obj-$(CONFIG_RTW88_8821CU) += rtw88_8821cu.o
rtw88_8821cu-objs := rtw8821cu.o
obj-$(CONFIG_RTW88_PCI) += rtw88_pci.o obj-$(CONFIG_RTW88_PCI) += rtw88_pci.o
rtw88_pci-objs := pci.o rtw88_pci-objs := pci.o
......
...@@ -26,6 +26,12 @@ static void rtw8821ce_efuse_parsing(struct rtw_efuse *efuse, ...@@ -26,6 +26,12 @@ static void rtw8821ce_efuse_parsing(struct rtw_efuse *efuse,
ether_addr_copy(efuse->addr, map->e.mac_addr); ether_addr_copy(efuse->addr, map->e.mac_addr);
} }
static void rtw8821cu_efuse_parsing(struct rtw_efuse *efuse,
struct rtw8821c_efuse *map)
{
ether_addr_copy(efuse->addr, map->u.mac_addr);
}
enum rtw8821ce_rf_set { enum rtw8821ce_rf_set {
SWITCH_TO_BTG, SWITCH_TO_BTG,
SWITCH_TO_WLG, SWITCH_TO_WLG,
...@@ -68,6 +74,9 @@ static int rtw8821c_read_efuse(struct rtw_dev *rtwdev, u8 *log_map) ...@@ -68,6 +74,9 @@ static int rtw8821c_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
case RTW_HCI_TYPE_PCIE: case RTW_HCI_TYPE_PCIE:
rtw8821ce_efuse_parsing(efuse, map); rtw8821ce_efuse_parsing(efuse, map);
break; break;
case RTW_HCI_TYPE_USB:
rtw8821cu_efuse_parsing(efuse, map);
break;
default: default:
/* unsupported now */ /* unsupported now */
return -ENOTSUPP; return -ENOTSUPP;
...@@ -1148,6 +1157,13 @@ static void rtw8821c_phy_cck_pd_set(struct rtw_dev *rtwdev, u8 new_lvl) ...@@ -1148,6 +1157,13 @@ static void rtw8821c_phy_cck_pd_set(struct rtw_dev *rtwdev, u8 new_lvl)
dm_info->cck_pd_default + new_lvl * 2); dm_info->cck_pd_default + new_lvl * 2);
} }
static void rtw8821c_fill_txdesc_checksum(struct rtw_dev *rtwdev,
struct rtw_tx_pkt_info *pkt_info,
u8 *txdesc)
{
fill_txdesc_checksum_common(txdesc, 16);
}
static struct rtw_pwr_seq_cmd trans_carddis_to_cardemu_8821c[] = { static struct rtw_pwr_seq_cmd trans_carddis_to_cardemu_8821c[] = {
{0x0086, {0x0086,
RTW_PWR_CUT_ALL_MSK, RTW_PWR_CUT_ALL_MSK,
...@@ -1521,6 +1537,7 @@ static const struct rtw_rfe_def rtw8821c_rfe_defs[] = { ...@@ -1521,6 +1537,7 @@ static const struct rtw_rfe_def rtw8821c_rfe_defs[] = {
[2] = RTW_DEF_RFE_EXT(8821c, 0, 0, 2), [2] = RTW_DEF_RFE_EXT(8821c, 0, 0, 2),
[4] = RTW_DEF_RFE_EXT(8821c, 0, 0, 2), [4] = RTW_DEF_RFE_EXT(8821c, 0, 0, 2),
[6] = RTW_DEF_RFE(8821c, 0, 0), [6] = RTW_DEF_RFE(8821c, 0, 0),
[34] = RTW_DEF_RFE(8821c, 0, 0),
}; };
static struct rtw_hw_reg rtw8821c_dig[] = { static struct rtw_hw_reg rtw8821c_dig[] = {
...@@ -1595,6 +1612,7 @@ static struct rtw_chip_ops rtw8821c_ops = { ...@@ -1595,6 +1612,7 @@ static struct rtw_chip_ops rtw8821c_ops = {
.config_bfee = rtw8821c_bf_config_bfee, .config_bfee = rtw8821c_bf_config_bfee,
.set_gid_table = rtw_bf_set_gid_table, .set_gid_table = rtw_bf_set_gid_table,
.cfg_csi_rate = rtw_bf_cfg_csi_rate, .cfg_csi_rate = rtw_bf_cfg_csi_rate,
.fill_txdesc_checksum = rtw8821c_fill_txdesc_checksum,
.coex_set_init = rtw8821c_coex_cfg_init, .coex_set_init = rtw8821c_coex_cfg_init,
.coex_set_ant_switch = rtw8821c_coex_cfg_ant_switch, .coex_set_ant_switch = rtw8821c_coex_cfg_ant_switch,
......
...@@ -9,6 +9,26 @@ ...@@ -9,6 +9,26 @@
#define RCR_VHT_ACK BIT(26) #define RCR_VHT_ACK BIT(26)
struct rtw8821cu_efuse {
u8 res4[4]; /* 0xd0 */
u8 usb_optional_function;
u8 res5[0x1e];
u8 res6[2];
u8 serial[0x0b]; /* 0xf5 */
u8 vid; /* 0x100 */
u8 res7;
u8 pid;
u8 res8[4];
u8 mac_addr[ETH_ALEN]; /* 0x107 */
u8 res9[2];
u8 vendor_name[0x07];
u8 res10[2];
u8 device_name[0x14];
u8 res11[0xcf];
u8 package_type; /* 0x1fb */
u8 res12[0x4];
};
struct rtw8821ce_efuse { struct rtw8821ce_efuse {
u8 mac_addr[ETH_ALEN]; /* 0xd0 */ u8 mac_addr[ETH_ALEN]; /* 0xd0 */
u8 vender_id[2]; u8 vender_id[2];
...@@ -73,6 +93,7 @@ struct rtw8821c_efuse { ...@@ -73,6 +93,7 @@ struct rtw8821c_efuse {
u8 res[3]; u8 res[3];
union { union {
struct rtw8821ce_efuse e; struct rtw8821ce_efuse e;
struct rtw8821cu_efuse u;
}; };
}; };
......
// 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 "rtw8821c.h"
#include "usb.h"
static const struct usb_device_id rtw_8821cu_id_table[] = {
{ USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0xb82b, 0xff, 0xff, 0xff),
.driver_info = (kernel_ulong_t)&(rtw8821c_hw_spec) }, /* 8821CU */
{ USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0xb820, 0xff, 0xff, 0xff),
.driver_info = (kernel_ulong_t)&(rtw8821c_hw_spec) }, /* 8821CU */
{ USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0xc821, 0xff, 0xff, 0xff),
.driver_info = (kernel_ulong_t)&(rtw8821c_hw_spec) }, /* 8821CU */
{ USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0xc820, 0xff, 0xff, 0xff),
.driver_info = (kernel_ulong_t)&(rtw8821c_hw_spec) }, /* 8821CU */
{ USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0xc82a, 0xff, 0xff, 0xff),
.driver_info = (kernel_ulong_t)&(rtw8821c_hw_spec) }, /* 8821CU */
{ USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0xc82b, 0xff, 0xff, 0xff),
.driver_info = (kernel_ulong_t)&(rtw8821c_hw_spec) }, /* 8821CU */
{ USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0xc811, 0xff, 0xff, 0xff),
.driver_info = (kernel_ulong_t)&(rtw8821c_hw_spec) }, /* 8811CU */
{ USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0x8811, 0xff, 0xff, 0xff),
.driver_info = (kernel_ulong_t)&(rtw8821c_hw_spec) }, /* 8811CU */
{ USB_DEVICE_AND_INTERFACE_INFO(RTW_USB_VENDOR_ID_REALTEK, 0x2006, 0xff, 0xff, 0xff),
.driver_info = (kernel_ulong_t)&(rtw8821c_hw_spec) }, /* TOTOLINK A650UA v3 */
{},
};
MODULE_DEVICE_TABLE(usb, rtw_8821cu_id_table);
static int rtw_8821cu_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
return rtw_usb_probe(intf, id);
}
static struct usb_driver rtw_8821cu_driver = {
.name = "rtw_8821cu",
.id_table = rtw_8821cu_id_table,
.probe = rtw_8821cu_probe,
.disconnect = rtw_usb_disconnect,
};
module_usb_driver(rtw_8821cu_driver);
MODULE_AUTHOR("Hans Ulli Kroll <linux@ulli-kroll.de>");
MODULE_DESCRIPTION("Realtek 802.11ac wireless 8821cu driver");
MODULE_LICENSE("Dual BSD/GPL");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment