11bebcf08SPing-Ke Shih // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause 21bebcf08SPing-Ke Shih /* Copyright(c) 2020-2022 Realtek Corporation 31bebcf08SPing-Ke Shih */ 41bebcf08SPing-Ke Shih 51bebcf08SPing-Ke Shih #include <linux/module.h> 61bebcf08SPing-Ke Shih #include <linux/pci.h> 71bebcf08SPing-Ke Shih 81bebcf08SPing-Ke Shih #include "pci.h" 91bebcf08SPing-Ke Shih #include "reg.h" 10*9695dc2eSPing-Ke Shih #include "rtw8852b.h" 111bebcf08SPing-Ke Shih 121bebcf08SPing-Ke Shih static const struct rtw89_pci_info rtw8852b_pci_info = { 13*9695dc2eSPing-Ke Shih .txbd_trunc_mode = MAC_AX_BD_TRUNC, 14*9695dc2eSPing-Ke Shih .rxbd_trunc_mode = MAC_AX_BD_TRUNC, 15*9695dc2eSPing-Ke Shih .rxbd_mode = MAC_AX_RXBD_PKT, 16*9695dc2eSPing-Ke Shih .tag_mode = MAC_AX_TAG_MULTI, 17*9695dc2eSPing-Ke Shih .tx_burst = MAC_AX_TX_BURST_2048B, 18*9695dc2eSPing-Ke Shih .rx_burst = MAC_AX_RX_BURST_128B, 19*9695dc2eSPing-Ke Shih .wd_dma_idle_intvl = MAC_AX_WD_DMA_INTVL_256NS, 20*9695dc2eSPing-Ke Shih .wd_dma_act_intvl = MAC_AX_WD_DMA_INTVL_256NS, 21*9695dc2eSPing-Ke Shih .multi_tag_num = MAC_AX_TAG_NUM_8, 22*9695dc2eSPing-Ke Shih .lbc_en = MAC_AX_PCIE_ENABLE, 23*9695dc2eSPing-Ke Shih .lbc_tmr = MAC_AX_LBC_TMR_2MS, 24*9695dc2eSPing-Ke Shih .autok_en = MAC_AX_PCIE_DISABLE, 25*9695dc2eSPing-Ke Shih .io_rcy_en = MAC_AX_PCIE_DISABLE, 26*9695dc2eSPing-Ke Shih .io_rcy_tmr = MAC_AX_IO_RCY_ANA_TMR_6MS, 27*9695dc2eSPing-Ke Shih 28*9695dc2eSPing-Ke Shih .init_cfg_reg = R_AX_PCIE_INIT_CFG1, 29*9695dc2eSPing-Ke Shih .txhci_en_bit = B_AX_TXHCI_EN, 30*9695dc2eSPing-Ke Shih .rxhci_en_bit = B_AX_RXHCI_EN, 31*9695dc2eSPing-Ke Shih .rxbd_mode_bit = B_AX_RXBD_MODE, 32*9695dc2eSPing-Ke Shih .exp_ctrl_reg = R_AX_PCIE_EXP_CTRL, 33*9695dc2eSPing-Ke Shih .max_tag_num_mask = B_AX_MAX_TAG_NUM, 34*9695dc2eSPing-Ke Shih .rxbd_rwptr_clr_reg = R_AX_RXBD_RWPTR_CLR, 35*9695dc2eSPing-Ke Shih .txbd_rwptr_clr2_reg = 0, 3661bdf7aaSPing-Ke Shih .dma_stop1 = {R_AX_PCIE_DMA_STOP1, B_AX_TX_STOP1_MASK_V1}, 3761bdf7aaSPing-Ke Shih .dma_stop2 = {0}, 3861bdf7aaSPing-Ke Shih .dma_busy1 = {R_AX_PCIE_DMA_BUSY1, DMA_BUSY1_CHECK_V1}, 3961bdf7aaSPing-Ke Shih .dma_busy2_reg = 0, 4061bdf7aaSPing-Ke Shih .dma_busy3_reg = R_AX_PCIE_DMA_BUSY1, 4161bdf7aaSPing-Ke Shih 42*9695dc2eSPing-Ke Shih .rpwm_addr = R_AX_PCIE_HRPWM, 43*9695dc2eSPing-Ke Shih .cpwm_addr = R_AX_CPWM, 441bebcf08SPing-Ke Shih .tx_dma_ch_mask = BIT(RTW89_TXCH_ACH4) | BIT(RTW89_TXCH_ACH5) | 451bebcf08SPing-Ke Shih BIT(RTW89_TXCH_ACH6) | BIT(RTW89_TXCH_ACH7) | 461bebcf08SPing-Ke Shih BIT(RTW89_TXCH_CH10) | BIT(RTW89_TXCH_CH11), 47*9695dc2eSPing-Ke Shih .bd_idx_addr_low_power = NULL, 48*9695dc2eSPing-Ke Shih .dma_addr_set = &rtw89_pci_ch_dma_addr_set, 49*9695dc2eSPing-Ke Shih 50*9695dc2eSPing-Ke Shih .ltr_set = rtw89_pci_ltr_set, 51*9695dc2eSPing-Ke Shih .fill_txaddr_info = rtw89_pci_fill_txaddr_info, 52*9695dc2eSPing-Ke Shih .config_intr_mask = rtw89_pci_config_intr_mask, 53*9695dc2eSPing-Ke Shih .enable_intr = rtw89_pci_enable_intr, 54*9695dc2eSPing-Ke Shih .disable_intr = rtw89_pci_disable_intr, 55*9695dc2eSPing-Ke Shih .recognize_intrs = rtw89_pci_recognize_intrs, 561bebcf08SPing-Ke Shih }; 571bebcf08SPing-Ke Shih 58*9695dc2eSPing-Ke Shih static const struct rtw89_driver_info rtw89_8852be_info = { 59*9695dc2eSPing-Ke Shih .chip = &rtw8852b_chip_info, 60*9695dc2eSPing-Ke Shih .bus = { 61*9695dc2eSPing-Ke Shih .pci = &rtw8852b_pci_info, 62*9695dc2eSPing-Ke Shih }, 63*9695dc2eSPing-Ke Shih }; 64*9695dc2eSPing-Ke Shih 65*9695dc2eSPing-Ke Shih static const struct pci_device_id rtw89_8852be_id_table[] = { 66*9695dc2eSPing-Ke Shih { 67*9695dc2eSPing-Ke Shih PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0xb852), 68*9695dc2eSPing-Ke Shih .driver_data = (kernel_ulong_t)&rtw89_8852be_info, 69*9695dc2eSPing-Ke Shih }, 70*9695dc2eSPing-Ke Shih { 71*9695dc2eSPing-Ke Shih PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0xb85b), 72*9695dc2eSPing-Ke Shih .driver_data = (kernel_ulong_t)&rtw89_8852be_info, 73*9695dc2eSPing-Ke Shih }, 74*9695dc2eSPing-Ke Shih {}, 75*9695dc2eSPing-Ke Shih }; 76*9695dc2eSPing-Ke Shih MODULE_DEVICE_TABLE(pci, rtw89_8852be_id_table); 77*9695dc2eSPing-Ke Shih 78*9695dc2eSPing-Ke Shih static struct pci_driver rtw89_8852be_driver = { 79*9695dc2eSPing-Ke Shih .name = "rtw89_8852be", 80*9695dc2eSPing-Ke Shih .id_table = rtw89_8852be_id_table, 81*9695dc2eSPing-Ke Shih .probe = rtw89_pci_probe, 82*9695dc2eSPing-Ke Shih .remove = rtw89_pci_remove, 83*9695dc2eSPing-Ke Shih .driver.pm = &rtw89_pm_ops, 84*9695dc2eSPing-Ke Shih }; 85*9695dc2eSPing-Ke Shih module_pci_driver(rtw89_8852be_driver); 86*9695dc2eSPing-Ke Shih 871bebcf08SPing-Ke Shih MODULE_AUTHOR("Realtek Corporation"); 881bebcf08SPing-Ke Shih MODULE_DESCRIPTION("Realtek 802.11ax wireless 8852BE driver"); 891bebcf08SPing-Ke Shih MODULE_LICENSE("Dual BSD/GPL"); 90