mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 19:43:40 +02:00
wifi: rtw89: usb: Prepare rtw89_usb_ops_mac_pre_init() for RTL8852CU
The registers used in rtw89_usb_ops_mac_pre_init() are located at different offsets in RTL8852CU, so move them to struct rtw89_usb_info, which is filled in each chip's driver. 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/36b823c9-2cb5-4191-8492-2a291f9dc1db@gmail.com
This commit is contained in:
parent
994944aa58
commit
7697701d6c
|
|
@ -5,9 +5,13 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/usb.h>
|
||||
#include "rtw8851b.h"
|
||||
#include "reg.h"
|
||||
#include "usb.h"
|
||||
|
||||
static const struct rtw89_usb_info rtw8851b_usb_info = {
|
||||
.usb_host_request_2 = R_AX_USB_HOST_REQUEST_2,
|
||||
.usb_wlan0_1 = R_AX_USB_WLAN0_1,
|
||||
.hci_func_en = R_AX_HCI_FUNC_EN,
|
||||
.bulkout_id = {
|
||||
[RTW89_DMA_ACH0] = 3,
|
||||
[RTW89_DMA_ACH1] = 4,
|
||||
|
|
|
|||
|
|
@ -5,9 +5,13 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/usb.h>
|
||||
#include "rtw8852b.h"
|
||||
#include "reg.h"
|
||||
#include "usb.h"
|
||||
|
||||
static const struct rtw89_usb_info rtw8852b_usb_info = {
|
||||
.usb_host_request_2 = R_AX_USB_HOST_REQUEST_2,
|
||||
.usb_wlan0_1 = R_AX_USB_WLAN0_1,
|
||||
.hci_func_en = R_AX_HCI_FUNC_EN,
|
||||
.bulkout_id = {
|
||||
[RTW89_DMA_ACH0] = 3,
|
||||
[RTW89_DMA_ACH1] = 4,
|
||||
|
|
|
|||
|
|
@ -678,20 +678,23 @@ static int rtw89_usb_ops_deinit(struct rtw89_dev *rtwdev)
|
|||
|
||||
static int rtw89_usb_ops_mac_pre_init(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
struct rtw89_usb *rtwusb = rtw89_usb_priv(rtwdev);
|
||||
const struct rtw89_usb_info *info = rtwusb->info;
|
||||
u32 val32;
|
||||
|
||||
rtw89_write32_set(rtwdev, R_AX_USB_HOST_REQUEST_2, B_AX_R_USBIO_MODE);
|
||||
rtw89_write32_set(rtwdev, info->usb_host_request_2,
|
||||
B_AX_R_USBIO_MODE);
|
||||
|
||||
/* fix USB IO hang suggest by chihhanli@realtek.com */
|
||||
rtw89_write32_clr(rtwdev, R_AX_USB_WLAN0_1,
|
||||
rtw89_write32_clr(rtwdev, info->usb_wlan0_1,
|
||||
B_AX_USBRX_RST | B_AX_USBTX_RST);
|
||||
|
||||
val32 = rtw89_read32(rtwdev, R_AX_HCI_FUNC_EN);
|
||||
val32 = rtw89_read32(rtwdev, info->hci_func_en);
|
||||
val32 &= ~(B_AX_HCI_RXDMA_EN | B_AX_HCI_TXDMA_EN);
|
||||
rtw89_write32(rtwdev, R_AX_HCI_FUNC_EN, val32);
|
||||
rtw89_write32(rtwdev, info->hci_func_en, val32);
|
||||
|
||||
val32 |= B_AX_HCI_RXDMA_EN | B_AX_HCI_TXDMA_EN;
|
||||
rtw89_write32(rtwdev, R_AX_HCI_FUNC_EN, val32);
|
||||
rtw89_write32(rtwdev, info->hci_func_en, val32);
|
||||
/* fix USB TRX hang suggest by chihhanli@realtek.com */
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@
|
|||
#define RTW89_MAX_BULKOUT_NUM 7
|
||||
|
||||
struct rtw89_usb_info {
|
||||
u32 usb_host_request_2;
|
||||
u32 usb_wlan0_1;
|
||||
u32 hci_func_en;
|
||||
u8 bulkout_id[RTW89_DMA_CH_NUM];
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user