mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 03:53:37 +02:00
wifi: rtw89: usb: Move bulk out map to new struct rtw89_usb_info
RTL8852AU, RTL8852CU, and RTL8922AU will need a different TX channel to bulk out endpoint mapping, so create a new struct rtw89_usb_info and move the mapping there. Initialise it in each chip's driver. Struct rtw89_usb_info will also hold some registers which are located at different offsets in RTL8852CU compared to the other wifi 6 chips. Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com> Acked-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://patch.msgid.link/de11cfae-1dc0-4514-95b2-02b1bbfa92be@gmail.com
This commit is contained in:
parent
89acd6c493
commit
994944aa58
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
struct rtw89_dev;
|
||||
struct rtw89_pci_info;
|
||||
struct rtw89_usb_info;
|
||||
struct rtw89_mac_gen_def;
|
||||
struct rtw89_phy_gen_def;
|
||||
struct rtw89_fw_blacklist;
|
||||
|
|
@ -4514,6 +4515,7 @@ struct rtw89_chip_variant {
|
|||
|
||||
union rtw89_bus_info {
|
||||
const struct rtw89_pci_info *pci;
|
||||
const struct rtw89_usb_info *usb;
|
||||
};
|
||||
|
||||
struct rtw89_driver_info {
|
||||
|
|
|
|||
|
|
@ -7,10 +7,25 @@
|
|||
#include "rtw8851b.h"
|
||||
#include "usb.h"
|
||||
|
||||
static const struct rtw89_usb_info rtw8851b_usb_info = {
|
||||
.bulkout_id = {
|
||||
[RTW89_DMA_ACH0] = 3,
|
||||
[RTW89_DMA_ACH1] = 4,
|
||||
[RTW89_DMA_ACH2] = 5,
|
||||
[RTW89_DMA_ACH3] = 6,
|
||||
[RTW89_DMA_B0MG] = 0,
|
||||
[RTW89_DMA_B0HI] = 1,
|
||||
[RTW89_DMA_H2C] = 2,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct rtw89_driver_info rtw89_8851bu_info = {
|
||||
.chip = &rtw8851b_chip_info,
|
||||
.variant = NULL,
|
||||
.quirks = NULL,
|
||||
.bus = {
|
||||
.usb = &rtw8851b_usb_info,
|
||||
}
|
||||
};
|
||||
|
||||
static const struct usb_device_id rtw_8851bu_id_table[] = {
|
||||
|
|
|
|||
|
|
@ -7,10 +7,25 @@
|
|||
#include "rtw8852b.h"
|
||||
#include "usb.h"
|
||||
|
||||
static const struct rtw89_usb_info rtw8852b_usb_info = {
|
||||
.bulkout_id = {
|
||||
[RTW89_DMA_ACH0] = 3,
|
||||
[RTW89_DMA_ACH1] = 4,
|
||||
[RTW89_DMA_ACH2] = 5,
|
||||
[RTW89_DMA_ACH3] = 6,
|
||||
[RTW89_DMA_B0MG] = 0,
|
||||
[RTW89_DMA_B0HI] = 1,
|
||||
[RTW89_DMA_H2C] = 2,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct rtw89_driver_info rtw89_8852bu_info = {
|
||||
.chip = &rtw8852b_chip_info,
|
||||
.variant = NULL,
|
||||
.quirks = NULL,
|
||||
.bus = {
|
||||
.usb = &rtw8852b_usb_info,
|
||||
}
|
||||
};
|
||||
|
||||
static const struct usb_device_id rtw_8852bu_id_table[] = {
|
||||
|
|
|
|||
|
|
@ -167,27 +167,6 @@ rtw89_usb_ops_check_and_reclaim_tx_resource(struct rtw89_dev *rtwdev,
|
|||
return 42; /* TODO some kind of calculation? */
|
||||
}
|
||||
|
||||
static u8 rtw89_usb_get_bulkout_id(u8 ch_dma)
|
||||
{
|
||||
switch (ch_dma) {
|
||||
case RTW89_DMA_ACH0:
|
||||
return 3;
|
||||
case RTW89_DMA_ACH1:
|
||||
return 4;
|
||||
case RTW89_DMA_ACH2:
|
||||
return 5;
|
||||
case RTW89_DMA_ACH3:
|
||||
return 6;
|
||||
default:
|
||||
case RTW89_DMA_B0MG:
|
||||
return 0;
|
||||
case RTW89_DMA_B0HI:
|
||||
return 1;
|
||||
case RTW89_DMA_H2C:
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
static void rtw89_usb_write_port_complete(struct urb *urb)
|
||||
{
|
||||
struct rtw89_usb_tx_ctrl_block *txcb = urb->context;
|
||||
|
|
@ -249,9 +228,10 @@ static int rtw89_usb_write_port(struct rtw89_dev *rtwdev, u8 ch_dma,
|
|||
void *data, int len, void *context)
|
||||
{
|
||||
struct rtw89_usb *rtwusb = rtw89_usb_priv(rtwdev);
|
||||
const struct rtw89_usb_info *info = rtwusb->info;
|
||||
struct usb_device *usbd = rtwusb->udev;
|
||||
struct urb *urb;
|
||||
u8 bulkout_id = rtw89_usb_get_bulkout_id(ch_dma);
|
||||
u8 bulkout_id = info->bulkout_id[ch_dma];
|
||||
unsigned int pipe;
|
||||
int ret;
|
||||
|
||||
|
|
@ -949,6 +929,7 @@ int rtw89_usb_probe(struct usb_interface *intf,
|
|||
|
||||
rtwusb = rtw89_usb_priv(rtwdev);
|
||||
rtwusb->rtwdev = rtwdev;
|
||||
rtwusb->info = info->bus.usb;
|
||||
|
||||
rtwdev->hci.ops = &rtw89_usb_ops;
|
||||
rtwdev->hci.type = RTW89_HCI_TYPE_USB;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@
|
|||
#define RTW89_MAX_ENDPOINT_NUM 9
|
||||
#define RTW89_MAX_BULKOUT_NUM 7
|
||||
|
||||
struct rtw89_usb_info {
|
||||
u8 bulkout_id[RTW89_DMA_CH_NUM];
|
||||
};
|
||||
|
||||
struct rtw89_usb_rx_ctrl_block {
|
||||
struct rtw89_dev *rtwdev;
|
||||
struct urb *rx_urb;
|
||||
|
|
@ -35,6 +39,7 @@ struct rtw89_usb_tx_ctrl_block {
|
|||
struct rtw89_usb {
|
||||
struct rtw89_dev *rtwdev;
|
||||
struct usb_device *udev;
|
||||
const struct rtw89_usb_info *info;
|
||||
|
||||
__le32 *vendor_req_buf;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user