rtw8852ce.c 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
  2. /* Copyright(c) 2020-2022 Realtek Corporation
  3. */
  4. #include <linux/module.h>
  5. #include <linux/pci.h>
  6. #include "pci.h"
  7. #include "reg.h"
  8. #include "rtw8852c.h"
  9. static const struct rtw89_pci_bd_idx_addr rtw8852c_bd_idx_addr_low_power = {
  10. .tx_bd_addrs = {R_AX_DRV_FW_HSK_0, R_AX_DRV_FW_HSK_1, R_AX_DRV_FW_HSK_2,
  11. R_AX_DRV_FW_HSK_3, 0, 0,
  12. 0, 0, R_AX_DRV_FW_HSK_4,
  13. 0, 0, 0,
  14. R_AX_DRV_FW_HSK_5},
  15. .rx_bd_addrs = {R_AX_DRV_FW_HSK_6, R_AX_DRV_FW_HSK_7},
  16. };
  17. static const struct rtw89_pci_info rtw8852c_pci_info = {
  18. .txbd_trunc_mode = MAC_AX_BD_TRUNC,
  19. .rxbd_trunc_mode = MAC_AX_BD_TRUNC,
  20. .rxbd_mode = MAC_AX_RXBD_PKT,
  21. .tag_mode = MAC_AX_TAG_MULTI,
  22. .tx_burst = MAC_AX_TX_BURST_V1_256B,
  23. .rx_burst = MAC_AX_RX_BURST_V1_128B,
  24. .wd_dma_idle_intvl = MAC_AX_WD_DMA_INTVL_256NS,
  25. .wd_dma_act_intvl = MAC_AX_WD_DMA_INTVL_256NS,
  26. .multi_tag_num = MAC_AX_TAG_NUM_8,
  27. .lbc_en = MAC_AX_PCIE_ENABLE,
  28. .lbc_tmr = MAC_AX_LBC_TMR_2MS,
  29. .autok_en = MAC_AX_PCIE_DISABLE,
  30. .io_rcy_en = MAC_AX_PCIE_ENABLE,
  31. .io_rcy_tmr = MAC_AX_IO_RCY_ANA_TMR_6MS,
  32. .init_cfg_reg = R_AX_HAXI_INIT_CFG1,
  33. .txhci_en_bit = B_AX_TXHCI_EN_V1,
  34. .rxhci_en_bit = B_AX_RXHCI_EN_V1,
  35. .rxbd_mode_bit = B_AX_RXBD_MODE_V1,
  36. .exp_ctrl_reg = R_AX_HAXI_EXP_CTRL,
  37. .max_tag_num_mask = B_AX_MAX_TAG_NUM_V1_MASK,
  38. .rxbd_rwptr_clr_reg = R_AX_RXBD_RWPTR_CLR_V1,
  39. .txbd_rwptr_clr2_reg = R_AX_TXBD_RWPTR_CLR2_V1,
  40. .dma_stop1 = {R_AX_HAXI_DMA_STOP1, B_AX_TX_STOP1_MASK},
  41. .dma_stop2 = {R_AX_HAXI_DMA_STOP2, B_AX_TX_STOP2_ALL},
  42. .dma_busy1 = {R_AX_HAXI_DMA_BUSY1, DMA_BUSY1_CHECK},
  43. .dma_busy2_reg = R_AX_HAXI_DMA_BUSY2,
  44. .dma_busy3_reg = R_AX_HAXI_DMA_BUSY3,
  45. .rpwm_addr = R_AX_PCIE_HRPWM_V1,
  46. .cpwm_addr = R_AX_PCIE_CRPWM,
  47. .tx_dma_ch_mask = 0,
  48. .bd_idx_addr_low_power = &rtw8852c_bd_idx_addr_low_power,
  49. .dma_addr_set = &rtw89_pci_ch_dma_addr_set_v1,
  50. .bd_ram_table = &rtw89_bd_ram_table_dual,
  51. .ltr_set = rtw89_pci_ltr_set_v1,
  52. .fill_txaddr_info = rtw89_pci_fill_txaddr_info_v1,
  53. .config_intr_mask = rtw89_pci_config_intr_mask_v1,
  54. .enable_intr = rtw89_pci_enable_intr_v1,
  55. .disable_intr = rtw89_pci_disable_intr_v1,
  56. .recognize_intrs = rtw89_pci_recognize_intrs_v1,
  57. };
  58. static const struct rtw89_driver_info rtw89_8852ce_info = {
  59. .chip = &rtw8852c_chip_info,
  60. .bus = {
  61. .pci = &rtw8852c_pci_info,
  62. },
  63. };
  64. static const struct pci_device_id rtw89_8852ce_id_table[] = {
  65. {
  66. PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0xc852),
  67. .driver_data = (kernel_ulong_t)&rtw89_8852ce_info,
  68. },
  69. {},
  70. };
  71. MODULE_DEVICE_TABLE(pci, rtw89_8852ce_id_table);
  72. static struct pci_driver rtw89_8852ce_driver = {
  73. .name = "rtw89_8852ce",
  74. .id_table = rtw89_8852ce_id_table,
  75. .probe = rtw89_pci_probe,
  76. .remove = rtw89_pci_remove,
  77. .driver.pm = &rtw89_pm_ops,
  78. };
  79. module_pci_driver(rtw89_8852ce_driver);
  80. MODULE_AUTHOR("Realtek Corporation");
  81. MODULE_DESCRIPTION("Realtek 802.11ax wireless 8852CE driver");
  82. MODULE_LICENSE("Dual BSD/GPL");