1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 2 /* Copyright(c) 2020 Realtek Corporation 3 */ 4 5 #ifndef __RTW89_PCI_H__ 6 #define __RTW89_PCI_H__ 7 8 #include "txrx.h" 9 10 #define MDIO_PG0_G1 0 11 #define MDIO_PG1_G1 1 12 #define MDIO_PG0_G2 2 13 #define MDIO_PG1_G2 3 14 #define RAC_CTRL_PPR 0x00 15 #define RAC_ANA03 0x03 16 #define OOBS_SEN_MASK GENMASK(5, 1) 17 #define RAC_ANA09 0x09 18 #define BAC_OOBS_SEL BIT(4) 19 #define RAC_ANA0A 0x0A 20 #define B_BAC_EQ_SEL BIT(5) 21 #define RAC_ANA0C 0x0C 22 #define B_PCIE_BIT_PSAVE BIT(15) 23 #define RAC_ANA0D 0x0D 24 #define BAC_RX_TEST_EN BIT(6) 25 #define RAC_ANA10 0x10 26 #define ADDR_SEL_PINOUT_DIS_VAL 0x3C4 27 #define B_PCIE_BIT_PINOUT_DIS BIT(3) 28 #define RAC_REG_REV2 0x1B 29 #define BAC_CMU_EN_DLY_MASK GENMASK(15, 12) 30 #define PCIE_DPHY_DLY_25US 0x1 31 #define RAC_ANA19 0x19 32 #define B_PCIE_BIT_RD_SEL BIT(2) 33 #define RAC_REG_FLD_0 0x1D 34 #define BAC_AUTOK_N_MASK GENMASK(3, 2) 35 #define PCIE_AUTOK_4 0x3 36 #define RAC_ANA1E 0x1E 37 #define RAC_ANA1E_G1_VAL 0x66EA 38 #define RAC_ANA1E_G2_VAL 0x6EEA 39 #define RAC_ANA1F 0x1F 40 #define OOBS_LEVEL_MASK GENMASK(12, 8) 41 #define RAC_ANA24 0x24 42 #define B_AX_DEGLITCH GENMASK(11, 8) 43 #define RAC_ANA26 0x26 44 #define B_AX_RXEN GENMASK(15, 14) 45 #define RAC_ANA2E 0x2E 46 #define RAC_ANA2E_VAL 0xFFFE 47 #define RAC_CTRL_PPR_V1 0x30 48 #define B_AX_CLK_CALIB_EN BIT(12) 49 #define B_AX_CALIB_EN BIT(13) 50 #define B_AX_DIV GENMASK(15, 14) 51 #define RAC_SET_PPR_V1 0x31 52 53 #define R_AX_DBI_FLAG 0x1090 54 #define B_AX_DBI_RFLAG BIT(17) 55 #define B_AX_DBI_WFLAG BIT(16) 56 #define B_AX_DBI_WREN_MSK GENMASK(15, 12) 57 #define B_AX_DBI_ADDR_MSK GENMASK(11, 2) 58 #define B_AX_DBI_2LSB GENMASK(1, 0) 59 #define R_AX_DBI_WDATA 0x1094 60 #define R_AX_DBI_RDATA 0x1098 61 62 #define R_AX_MDIO_WDATA 0x10A4 63 #define R_AX_MDIO_RDATA 0x10A6 64 65 #define R_AX_PCIE_PS_CTRL_V1 0x3008 66 #define B_AX_CMAC_EXIT_L1_EN BIT(7) 67 #define B_AX_DMAC0_EXIT_L1_EN BIT(6) 68 #define B_AX_SEL_XFER_PENDING BIT(3) 69 #define B_AX_SEL_REQ_ENTR_L1 BIT(2) 70 #define B_AX_SEL_REQ_EXIT_L1 BIT(0) 71 72 #define R_AX_PCIE_MIX_CFG_V1 0x300C 73 #define B_AX_ASPM_CTRL_L1 BIT(17) 74 #define B_AX_ASPM_CTRL_L0 BIT(16) 75 #define B_AX_ASPM_CTRL_MASK GENMASK(17, 16) 76 #define B_AX_XFER_PENDING_FW BIT(11) 77 #define B_AX_XFER_PENDING BIT(10) 78 #define B_AX_REQ_EXIT_L1 BIT(9) 79 #define B_AX_REQ_ENTR_L1 BIT(8) 80 #define B_AX_L1SUB_DISABLE BIT(0) 81 82 #define R_AX_L1_CLK_CTRL 0x3010 83 #define B_AX_CLK_REQ_N BIT(1) 84 85 #define R_AX_PCIE_BG_CLR 0x303C 86 #define B_AX_BG_CLR_ASYNC_M3 BIT(4) 87 88 #define R_AX_PCIE_LAT_CTRL 0x3044 89 #define B_AX_CLK_REQ_SEL_OPT BIT(1) 90 #define B_AX_CLK_REQ_SEL BIT(0) 91 92 #define R_AX_PCIE_IO_RCY_M1 0x3100 93 #define B_AX_PCIE_IO_RCY_P_M1 BIT(5) 94 #define B_AX_PCIE_IO_RCY_WDT_P_M1 BIT(4) 95 #define B_AX_PCIE_IO_RCY_WDT_MODE_M1 BIT(3) 96 #define B_AX_PCIE_IO_RCY_TRIG_M1 BIT(0) 97 98 #define R_AX_PCIE_WDT_TIMER_M1 0x3104 99 #define B_AX_PCIE_WDT_TIMER_M1_MASK GENMASK(31, 0) 100 101 #define R_AX_PCIE_IO_RCY_M2 0x310C 102 #define B_AX_PCIE_IO_RCY_P_M2 BIT(5) 103 #define B_AX_PCIE_IO_RCY_WDT_P_M2 BIT(4) 104 #define B_AX_PCIE_IO_RCY_WDT_MODE_M2 BIT(3) 105 #define B_AX_PCIE_IO_RCY_TRIG_M2 BIT(0) 106 107 #define R_AX_PCIE_WDT_TIMER_M2 0x3110 108 #define B_AX_PCIE_WDT_TIMER_M2_MASK GENMASK(31, 0) 109 110 #define R_AX_PCIE_IO_RCY_E0 0x3118 111 #define B_AX_PCIE_IO_RCY_P_E0 BIT(5) 112 #define B_AX_PCIE_IO_RCY_WDT_P_E0 BIT(4) 113 #define B_AX_PCIE_IO_RCY_WDT_MODE_E0 BIT(3) 114 #define B_AX_PCIE_IO_RCY_TRIG_E0 BIT(0) 115 116 #define R_AX_PCIE_WDT_TIMER_E0 0x311C 117 #define B_AX_PCIE_WDT_TIMER_E0_MASK GENMASK(31, 0) 118 119 #define R_AX_PCIE_IO_RCY_S1 0x3124 120 #define B_AX_PCIE_IO_RCY_RP_S1 BIT(7) 121 #define B_AX_PCIE_IO_RCY_WP_S1 BIT(6) 122 #define B_AX_PCIE_IO_RCY_WDT_RP_S1 BIT(5) 123 #define B_AX_PCIE_IO_RCY_WDT_WP_S1 BIT(4) 124 #define B_AX_PCIE_IO_RCY_WDT_MODE_S1 BIT(3) 125 #define B_AX_PCIE_IO_RCY_RTRIG_S1 BIT(1) 126 #define B_AX_PCIE_IO_RCY_WTRIG_S1 BIT(0) 127 128 #define R_AX_PCIE_WDT_TIMER_S1 0x3128 129 #define B_AX_PCIE_WDT_TIMER_S1_MASK GENMASK(31, 0) 130 131 #define R_RAC_DIRECT_OFFSET_G1 0x3800 132 #define FILTER_OUT_EQ_MASK GENMASK(14, 10) 133 #define R_RAC_DIRECT_OFFSET_G2 0x3880 134 #define REG_FILTER_OUT_MASK GENMASK(6, 2) 135 #define RAC_MULT 2 136 137 #define RTW89_PCI_WR_RETRY_CNT 20 138 139 /* Interrupts */ 140 #define R_AX_HIMR0 0x01A0 141 #define B_AX_WDT_TIMEOUT_INT_EN BIT(22) 142 #define B_AX_HALT_C2H_INT_EN BIT(21) 143 #define R_AX_HISR0 0x01A4 144 145 #define R_AX_HIMR1 0x01A8 146 #define B_AX_GPIO18_INT_EN BIT(2) 147 #define B_AX_GPIO17_INT_EN BIT(1) 148 #define B_AX_GPIO16_INT_EN BIT(0) 149 150 #define R_AX_HISR1 0x01AC 151 #define B_AX_GPIO18_INT BIT(2) 152 #define B_AX_GPIO17_INT BIT(1) 153 #define B_AX_GPIO16_INT BIT(0) 154 155 #define R_AX_MDIO_CFG 0x10A0 156 #define B_AX_MDIO_PHY_ADDR_MASK GENMASK(13, 12) 157 #define B_AX_MDIO_RFLAG BIT(9) 158 #define B_AX_MDIO_WFLAG BIT(8) 159 #define B_AX_MDIO_ADDR_MASK GENMASK(4, 0) 160 161 #define R_AX_PCIE_HIMR00 0x10B0 162 #define R_AX_HAXI_HIMR00 0x10B0 163 #define B_AX_HC00ISR_IND_INT_EN BIT(27) 164 #define B_AX_HD1ISR_IND_INT_EN BIT(26) 165 #define B_AX_HD0ISR_IND_INT_EN BIT(25) 166 #define B_AX_HS0ISR_IND_INT_EN BIT(24) 167 #define B_AX_HS0ISR_IND_INT_EN_WKARND BIT(23) 168 #define B_AX_RETRAIN_INT_EN BIT(21) 169 #define B_AX_RPQBD_FULL_INT_EN BIT(20) 170 #define B_AX_RDU_INT_EN BIT(19) 171 #define B_AX_RXDMA_STUCK_INT_EN BIT(18) 172 #define B_AX_TXDMA_STUCK_INT_EN BIT(17) 173 #define B_AX_PCIE_HOTRST_INT_EN BIT(16) 174 #define B_AX_PCIE_FLR_INT_EN BIT(15) 175 #define B_AX_PCIE_PERST_INT_EN BIT(14) 176 #define B_AX_TXDMA_CH12_INT_EN BIT(13) 177 #define B_AX_TXDMA_CH9_INT_EN BIT(12) 178 #define B_AX_TXDMA_CH8_INT_EN BIT(11) 179 #define B_AX_TXDMA_ACH7_INT_EN BIT(10) 180 #define B_AX_TXDMA_ACH6_INT_EN BIT(9) 181 #define B_AX_TXDMA_ACH5_INT_EN BIT(8) 182 #define B_AX_TXDMA_ACH4_INT_EN BIT(7) 183 #define B_AX_TXDMA_ACH3_INT_EN BIT(6) 184 #define B_AX_TXDMA_ACH2_INT_EN BIT(5) 185 #define B_AX_TXDMA_ACH1_INT_EN BIT(4) 186 #define B_AX_TXDMA_ACH0_INT_EN BIT(3) 187 #define B_AX_RPQDMA_INT_EN BIT(2) 188 #define B_AX_RXP1DMA_INT_EN BIT(1) 189 #define B_AX_RXDMA_INT_EN BIT(0) 190 191 #define R_AX_PCIE_HISR00 0x10B4 192 #define R_AX_HAXI_HISR00 0x10B4 193 #define B_AX_HC00ISR_IND_INT BIT(27) 194 #define B_AX_HD1ISR_IND_INT BIT(26) 195 #define B_AX_HD0ISR_IND_INT BIT(25) 196 #define B_AX_HS0ISR_IND_INT BIT(24) 197 #define B_AX_RETRAIN_INT BIT(21) 198 #define B_AX_RPQBD_FULL_INT BIT(20) 199 #define B_AX_RDU_INT BIT(19) 200 #define B_AX_RXDMA_STUCK_INT BIT(18) 201 #define B_AX_TXDMA_STUCK_INT BIT(17) 202 #define B_AX_PCIE_HOTRST_INT BIT(16) 203 #define B_AX_PCIE_FLR_INT BIT(15) 204 #define B_AX_PCIE_PERST_INT BIT(14) 205 #define B_AX_TXDMA_CH12_INT BIT(13) 206 #define B_AX_TXDMA_CH9_INT BIT(12) 207 #define B_AX_TXDMA_CH8_INT BIT(11) 208 #define B_AX_TXDMA_ACH7_INT BIT(10) 209 #define B_AX_TXDMA_ACH6_INT BIT(9) 210 #define B_AX_TXDMA_ACH5_INT BIT(8) 211 #define B_AX_TXDMA_ACH4_INT BIT(7) 212 #define B_AX_TXDMA_ACH3_INT BIT(6) 213 #define B_AX_TXDMA_ACH2_INT BIT(5) 214 #define B_AX_TXDMA_ACH1_INT BIT(4) 215 #define B_AX_TXDMA_ACH0_INT BIT(3) 216 #define B_AX_RPQDMA_INT BIT(2) 217 #define B_AX_RXP1DMA_INT BIT(1) 218 #define B_AX_RXDMA_INT BIT(0) 219 220 #define R_AX_HAXI_IDCT_MSK 0x10B8 221 #define B_AX_TXBD_LEN0_ERR_IDCT_MSK BIT(3) 222 #define B_AX_TXBD_4KBOUND_ERR_IDCT_MSK BIT(2) 223 #define B_AX_RXMDA_STUCK_IDCT_MSK BIT(1) 224 #define B_AX_TXMDA_STUCK_IDCT_MSK BIT(0) 225 226 #define R_AX_HAXI_IDCT 0x10BC 227 #define B_AX_TXBD_LEN0_ERR_IDCT BIT(3) 228 #define B_AX_TXBD_4KBOUND_ERR_IDCT BIT(2) 229 #define B_AX_RXMDA_STUCK_IDCT BIT(1) 230 #define B_AX_TXMDA_STUCK_IDCT BIT(0) 231 232 #define R_AX_HAXI_HIMR10 0x11E0 233 #define B_AX_TXDMA_CH11_INT_EN_V1 BIT(1) 234 #define B_AX_TXDMA_CH10_INT_EN_V1 BIT(0) 235 236 #define R_AX_PCIE_HIMR10 0x13B0 237 #define B_AX_HC10ISR_IND_INT_EN BIT(28) 238 #define B_AX_TXDMA_CH11_INT_EN BIT(12) 239 #define B_AX_TXDMA_CH10_INT_EN BIT(11) 240 241 #define R_AX_PCIE_HISR10 0x13B4 242 #define B_AX_HC10ISR_IND_INT BIT(28) 243 #define B_AX_TXDMA_CH11_INT BIT(12) 244 #define B_AX_TXDMA_CH10_INT BIT(11) 245 246 #define R_AX_PCIE_HIMR00_V1 0x30B0 247 #define B_AX_HCI_AXIDMA_INT_EN BIT(29) 248 #define B_AX_HC00ISR_IND_INT_EN_V1 BIT(28) 249 #define B_AX_HD1ISR_IND_INT_EN_V1 BIT(27) 250 #define B_AX_HD0ISR_IND_INT_EN_V1 BIT(26) 251 #define B_AX_HS1ISR_IND_INT_EN BIT(25) 252 #define B_AX_PCIE_DBG_STE_INT_EN BIT(13) 253 254 #define R_AX_PCIE_HISR00_V1 0x30B4 255 #define B_AX_HCI_AXIDMA_INT BIT(29) 256 #define B_AX_HC00ISR_IND_INT_V1 BIT(28) 257 #define B_AX_HD1ISR_IND_INT_V1 BIT(27) 258 #define B_AX_HD0ISR_IND_INT_V1 BIT(26) 259 #define B_AX_HS1ISR_IND_INT BIT(25) 260 #define B_AX_PCIE_DBG_STE_INT BIT(13) 261 262 #define R_BE_PCIE_FRZ_CLK 0x3004 263 #define B_BE_PCIE_FRZ_MAC_HW_RST BIT(31) 264 #define B_BE_PCIE_FRZ_CFG_SPC_RST BIT(30) 265 #define B_BE_PCIE_FRZ_ELBI_RST BIT(29) 266 #define B_BE_PCIE_MAC_IS_ACTIVE BIT(28) 267 #define B_BE_PCIE_FRZ_RTK_HW_RST BIT(27) 268 #define B_BE_PCIE_FRZ_REG_RST BIT(26) 269 #define B_BE_PCIE_FRZ_ANA_RST BIT(25) 270 #define B_BE_PCIE_FRZ_WLAN_RST BIT(24) 271 #define B_BE_PCIE_FRZ_FLR_RST BIT(23) 272 #define B_BE_PCIE_FRZ_RET_NON_STKY_RST BIT(22) 273 #define B_BE_PCIE_FRZ_RET_STKY_RST BIT(21) 274 #define B_BE_PCIE_FRZ_NON_STKY_RST BIT(20) 275 #define B_BE_PCIE_FRZ_STKY_RST BIT(19) 276 #define B_BE_PCIE_FRZ_RET_CORE_RST BIT(18) 277 #define B_BE_PCIE_FRZ_PWR_RST BIT(17) 278 #define B_BE_PCIE_FRZ_PERST_RST BIT(16) 279 #define B_BE_PCIE_FRZ_PHY_ALOAD BIT(15) 280 #define B_BE_PCIE_FRZ_PHY_HW_RST BIT(14) 281 #define B_BE_PCIE_DBG_CLK BIT(4) 282 #define B_BE_PCIE_EN_CLK BIT(3) 283 #define B_BE_PCIE_DBI_ACLK_ACT BIT(2) 284 #define B_BE_PCIE_S1_ACLK_ACT BIT(1) 285 #define B_BE_PCIE_EN_AUX_CLK BIT(0) 286 287 #define R_BE_PCIE_PS_CTRL 0x3008 288 #define B_BE_RSM_L0S_EN BIT(8) 289 #define B_BE_CMAC_EXIT_L1_EN BIT(7) 290 #define B_BE_DMAC0_EXIT_L1_EN BIT(6) 291 #define B_BE_FORCE_L0 BIT(5) 292 #define B_BE_DBI_RO_WR_DISABLE BIT(4) 293 #define B_BE_SEL_XFER_PENDING BIT(3) 294 #define B_BE_SEL_REQ_ENTR_L1 BIT(2) 295 #define B_BE_PCIE_EN_SWENT_L23 BIT(1) 296 #define B_BE_SEL_REQ_EXIT_L1 BIT(0) 297 298 #define R_BE_PCIE_MIX_CFG 0x300C 299 #define B_BE_L1SS_TIMEOUT_CTRL BIT(18) 300 #define B_BE_ASPM_CTRL_L1 BIT(17) 301 #define B_BE_ASPM_CTRL_L0 BIT(16) 302 #define B_BE_XFER_PENDING_FW BIT(11) 303 #define B_BE_XFER_PENDING BIT(10) 304 #define B_BE_REQ_EXIT_L1 BIT(9) 305 #define B_BE_REQ_ENTR_L1 BIT(8) 306 #define B_BE_L1SUB_ENABLE BIT(0) 307 308 #define R_BE_L1_CLK_CTRL 0x3010 309 #define B_BE_RAS_SD_HOLD_LTSSM BIT(12) 310 #define B_BE_CLK_REQ_N BIT(1) 311 #define B_BE_CLK_PM_EN BIT(0) 312 313 #define R_BE_PCIE_LAT_CTRL 0x3044 314 #define B_BE_ELBI_PHY_REMAP_MASK GENMASK(29, 24) 315 #define B_BE_SYS_SUS_L12_EN BIT(17) 316 #define B_BE_MDIO_S_EN BIT(16) 317 #define B_BE_SYM_AUX_CLK_SEL BIT(15) 318 #define B_BE_RTK_LDO_POWER_LATENCY_MASK GENMASK(11, 10) 319 #define B_BE_RTK_LDO_BIAS_LATENCY_MASK GENMASK(9, 8) 320 #define B_BE_CLK_REQ_LAT_MASK GENMASK(7, 4) 321 #define B_BE_RTK_PM_SEL_OPT BIT(1) 322 #define B_BE_CLK_REQ_SEL BIT(0) 323 324 #define R_BE_PCIE_HIMR0 0x30B0 325 #define B_BE_PCIE_HB1_IND_INTA_IMR BIT(31) 326 #define B_BE_PCIE_HB0_IND_INTA_IMR BIT(30) 327 #define B_BE_HCI_AXIDMA_INTA_IMR BIT(29) 328 #define B_BE_HC0_IND_INTA_IMR BIT(28) 329 #define B_BE_HD1_IND_INTA_IMR BIT(27) 330 #define B_BE_HD0_IND_INTA_IMR BIT(26) 331 #define B_BE_HS1_IND_INTA_IMR BIT(25) 332 #define B_BE_HS0_IND_INTA_IMR BIT(24) 333 #define B_BE_PCIE_HOTRST_INT_EN BIT(16) 334 #define B_BE_PCIE_FLR_INT_EN BIT(15) 335 #define B_BE_PCIE_PERST_INT_EN BIT(14) 336 #define B_BE_PCIE_DBG_STE_INT_EN BIT(13) 337 #define B_BE_HB1_IND_INT_EN0 BIT(9) 338 #define B_BE_HB0_IND_INT_EN0 BIT(8) 339 #define B_BE_HC1_IND_INT_EN0 BIT(7) 340 #define B_BE_HCI_AXIDMA_INT_EN0 BIT(5) 341 #define B_BE_HC0_IND_INT_EN0 BIT(4) 342 #define B_BE_HD1_IND_INT_EN0 BIT(3) 343 #define B_BE_HD0_IND_INT_EN0 BIT(2) 344 #define B_BE_HS1_IND_INT_EN0 BIT(1) 345 #define B_BE_HS0_IND_INT_EN0 BIT(0) 346 347 #define R_BE_PCIE_HISR 0x30B4 348 #define B_BE_PCIE_HOTRST_INT BIT(16) 349 #define B_BE_PCIE_FLR_INT BIT(15) 350 #define B_BE_PCIE_PERST_INT BIT(14) 351 #define B_BE_PCIE_DBG_STE_INT BIT(13) 352 #define B_BE_HB1IMR_IND BIT(9) 353 #define B_BE_HB0IMR_IND BIT(8) 354 #define B_BE_HC1ISR_IND_INT BIT(7) 355 #define B_BE_HCI_AXIDMA_INT BIT(5) 356 #define B_BE_HC0ISR_IND_INT BIT(4) 357 #define B_BE_HD1ISR_IND_INT BIT(3) 358 #define B_BE_HD0ISR_IND_INT BIT(2) 359 #define B_BE_HS1ISR_IND_INT BIT(1) 360 #define B_BE_HS0ISR_IND_INT BIT(0) 361 362 #define R_BE_PCIE_DMA_IMR_0_V1 0x30B8 363 #define B_BE_PCIE_RX_RX1P1_IMR0_V1 BIT(23) 364 #define B_BE_PCIE_RX_RX0P1_IMR0_V1 BIT(22) 365 #define B_BE_PCIE_RX_ROQ1_IMR0_V1 BIT(21) 366 #define B_BE_PCIE_RX_RPQ1_IMR0_V1 BIT(20) 367 #define B_BE_PCIE_RX_RX1P2_IMR0_V1 BIT(19) 368 #define B_BE_PCIE_RX_ROQ0_IMR0_V1 BIT(18) 369 #define B_BE_PCIE_RX_RPQ0_IMR0_V1 BIT(17) 370 #define B_BE_PCIE_RX_RX0P2_IMR0_V1 BIT(16) 371 #define B_BE_PCIE_TX_CH14_IMR0 BIT(14) 372 #define B_BE_PCIE_TX_CH13_IMR0 BIT(13) 373 #define B_BE_PCIE_TX_CH12_IMR0 BIT(12) 374 #define B_BE_PCIE_TX_CH11_IMR0 BIT(11) 375 #define B_BE_PCIE_TX_CH10_IMR0 BIT(10) 376 #define B_BE_PCIE_TX_CH9_IMR0 BIT(9) 377 #define B_BE_PCIE_TX_CH8_IMR0 BIT(8) 378 #define B_BE_PCIE_TX_CH7_IMR0 BIT(7) 379 #define B_BE_PCIE_TX_CH6_IMR0 BIT(6) 380 #define B_BE_PCIE_TX_CH5_IMR0 BIT(5) 381 #define B_BE_PCIE_TX_CH4_IMR0 BIT(4) 382 #define B_BE_PCIE_TX_CH3_IMR0 BIT(3) 383 #define B_BE_PCIE_TX_CH2_IMR0 BIT(2) 384 #define B_BE_PCIE_TX_CH1_IMR0 BIT(1) 385 #define B_BE_PCIE_TX_CH0_IMR0 BIT(0) 386 387 #define R_BE_PCIE_DMA_ISR 0x30BC 388 #define B_BE_PCIE_RX_RX1P1_ISR_V1 BIT(23) 389 #define B_BE_PCIE_RX_RX0P1_ISR_V1 BIT(22) 390 #define B_BE_PCIE_RX_ROQ1_ISR_V1 BIT(21) 391 #define B_BE_PCIE_RX_RPQ1_ISR_V1 BIT(20) 392 #define B_BE_PCIE_RX_RX1P2_ISR_V1 BIT(19) 393 #define B_BE_PCIE_RX_ROQ0_ISR_V1 BIT(18) 394 #define B_BE_PCIE_RX_RPQ0_ISR_V1 BIT(17) 395 #define B_BE_PCIE_RX_RX0P2_ISR_V1 BIT(16) 396 #define B_BE_PCIE_TX_CH14_ISR BIT(14) 397 #define B_BE_PCIE_TX_CH13_ISR BIT(13) 398 #define B_BE_PCIE_TX_CH12_ISR BIT(12) 399 #define B_BE_PCIE_TX_CH11_ISR BIT(11) 400 #define B_BE_PCIE_TX_CH10_ISR BIT(10) 401 #define B_BE_PCIE_TX_CH9_ISR BIT(9) 402 #define B_BE_PCIE_TX_CH8_ISR BIT(8) 403 #define B_BE_PCIE_TX_CH7_ISR BIT(7) 404 #define B_BE_PCIE_TX_CH6_ISR BIT(6) 405 #define B_BE_PCIE_TX_CH5_ISR BIT(5) 406 #define B_BE_PCIE_TX_CH4_ISR BIT(4) 407 #define B_BE_PCIE_TX_CH3_ISR BIT(3) 408 #define B_BE_PCIE_TX_CH2_ISR BIT(2) 409 #define B_BE_PCIE_TX_CH1_ISR BIT(1) 410 #define B_BE_PCIE_TX_CH0_ISR BIT(0) 411 412 #define R_BE_HAXI_HIMR00 0xB0B0 413 #define B_BE_RDU_CH5_INT_IMR_V1 BIT(30) 414 #define B_BE_RDU_CH4_INT_IMR_V1 BIT(29) 415 #define B_BE_RDU_CH3_INT_IMR_V1 BIT(28) 416 #define B_BE_RDU_CH2_INT_IMR_V1 BIT(27) 417 #define B_BE_RDU_CH1_INT_IMR_V1 BIT(26) 418 #define B_BE_RDU_CH0_INT_IMR_V1 BIT(25) 419 #define B_BE_RXDMA_STUCK_INT_EN_V1 BIT(24) 420 #define B_BE_TXDMA_STUCK_INT_EN_V1 BIT(23) 421 #define B_BE_TXDMA_CH14_INT_EN_V1 BIT(22) 422 #define B_BE_TXDMA_CH13_INT_EN_V1 BIT(21) 423 #define B_BE_TXDMA_CH12_INT_EN_V1 BIT(20) 424 #define B_BE_TXDMA_CH11_INT_EN_V1 BIT(19) 425 #define B_BE_TXDMA_CH10_INT_EN_V1 BIT(18) 426 #define B_BE_TXDMA_CH9_INT_EN_V1 BIT(17) 427 #define B_BE_TXDMA_CH8_INT_EN_V1 BIT(16) 428 #define B_BE_TXDMA_CH7_INT_EN_V1 BIT(15) 429 #define B_BE_TXDMA_CH6_INT_EN_V1 BIT(14) 430 #define B_BE_TXDMA_CH5_INT_EN_V1 BIT(13) 431 #define B_BE_TXDMA_CH4_INT_EN_V1 BIT(12) 432 #define B_BE_TXDMA_CH3_INT_EN_V1 BIT(11) 433 #define B_BE_TXDMA_CH2_INT_EN_V1 BIT(10) 434 #define B_BE_TXDMA_CH1_INT_EN_V1 BIT(9) 435 #define B_BE_TXDMA_CH0_INT_EN_V1 BIT(8) 436 #define B_BE_RX1P1DMA_INT_EN_V1 BIT(7) 437 #define B_BE_RX0P1DMA_INT_EN_V1 BIT(6) 438 #define B_BE_RO1DMA_INT_EN BIT(5) 439 #define B_BE_RP1DMA_INT_EN BIT(4) 440 #define B_BE_RX1DMA_INT_EN BIT(3) 441 #define B_BE_RO0DMA_INT_EN BIT(2) 442 #define B_BE_RP0DMA_INT_EN BIT(1) 443 #define B_BE_RX0DMA_INT_EN BIT(0) 444 445 #define R_BE_HAXI_HISR00 0xB0B4 446 #define B_BE_RDU_CH6_INT BIT(28) 447 #define B_BE_RDU_CH5_INT BIT(27) 448 #define B_BE_RDU_CH4_INT BIT(26) 449 #define B_BE_RDU_CH2_INT BIT(25) 450 #define B_BE_RDU_CH1_INT BIT(24) 451 #define B_BE_RDU_CH0_INT BIT(23) 452 #define B_BE_RXDMA_STUCK_INT BIT(22) 453 #define B_BE_TXDMA_STUCK_INT BIT(21) 454 #define B_BE_TXDMA_CH14_INT BIT(20) 455 #define B_BE_TXDMA_CH13_INT BIT(19) 456 #define B_BE_TXDMA_CH12_INT BIT(18) 457 #define B_BE_TXDMA_CH11_INT BIT(17) 458 #define B_BE_TXDMA_CH10_INT BIT(16) 459 #define B_BE_TXDMA_CH9_INT BIT(15) 460 #define B_BE_TXDMA_CH8_INT BIT(14) 461 #define B_BE_TXDMA_CH7_INT BIT(13) 462 #define B_BE_TXDMA_CH6_INT BIT(12) 463 #define B_BE_TXDMA_CH5_INT BIT(11) 464 #define B_BE_TXDMA_CH4_INT BIT(10) 465 #define B_BE_TXDMA_CH3_INT BIT(9) 466 #define B_BE_TXDMA_CH2_INT BIT(8) 467 #define B_BE_TXDMA_CH1_INT BIT(7) 468 #define B_BE_TXDMA_CH0_INT BIT(6) 469 #define B_BE_RPQ1DMA_INT BIT(5) 470 #define B_BE_RX1P1DMA_INT BIT(4) 471 #define B_BE_RX1DMA_INT BIT(3) 472 #define B_BE_RPQ0DMA_INT BIT(2) 473 #define B_BE_RX0P1DMA_INT BIT(1) 474 #define B_BE_RX0DMA_INT BIT(0) 475 476 /* TX/RX */ 477 #define R_AX_DRV_FW_HSK_0 0x01B0 478 #define R_AX_DRV_FW_HSK_1 0x01B4 479 #define R_AX_DRV_FW_HSK_2 0x01B8 480 #define R_AX_DRV_FW_HSK_3 0x01BC 481 #define R_AX_DRV_FW_HSK_4 0x01C0 482 #define R_AX_DRV_FW_HSK_5 0x01C4 483 #define R_AX_DRV_FW_HSK_6 0x01C8 484 #define R_AX_DRV_FW_HSK_7 0x01CC 485 486 #define R_AX_RXQ_RXBD_IDX 0x1050 487 #define R_AX_RPQ_RXBD_IDX 0x1054 488 #define R_AX_ACH0_TXBD_IDX 0x1058 489 #define R_AX_ACH1_TXBD_IDX 0x105C 490 #define R_AX_ACH2_TXBD_IDX 0x1060 491 #define R_AX_ACH3_TXBD_IDX 0x1064 492 #define R_AX_ACH4_TXBD_IDX 0x1068 493 #define R_AX_ACH5_TXBD_IDX 0x106C 494 #define R_AX_ACH6_TXBD_IDX 0x1070 495 #define R_AX_ACH7_TXBD_IDX 0x1074 496 #define R_AX_CH8_TXBD_IDX 0x1078 /* Management Queue band 0 */ 497 #define R_AX_CH9_TXBD_IDX 0x107C /* HI Queue band 0 */ 498 #define R_AX_CH10_TXBD_IDX 0x137C /* Management Queue band 1 */ 499 #define R_AX_CH11_TXBD_IDX 0x1380 /* HI Queue band 1 */ 500 #define R_AX_CH12_TXBD_IDX 0x1080 /* FWCMD Queue */ 501 #define R_AX_CH10_TXBD_IDX_V1 0x11D0 502 #define R_AX_CH11_TXBD_IDX_V1 0x11D4 503 #define R_AX_RXQ_RXBD_IDX_V1 0x1218 504 #define R_AX_RPQ_RXBD_IDX_V1 0x121C 505 #define TXBD_HW_IDX_MASK GENMASK(27, 16) 506 #define TXBD_HOST_IDX_MASK GENMASK(11, 0) 507 508 #define R_AX_ACH0_TXBD_DESA_L 0x1110 509 #define R_AX_ACH0_TXBD_DESA_H 0x1114 510 #define R_AX_ACH1_TXBD_DESA_L 0x1118 511 #define R_AX_ACH1_TXBD_DESA_H 0x111C 512 #define R_AX_ACH2_TXBD_DESA_L 0x1120 513 #define R_AX_ACH2_TXBD_DESA_H 0x1124 514 #define R_AX_ACH3_TXBD_DESA_L 0x1128 515 #define R_AX_ACH3_TXBD_DESA_H 0x112C 516 #define R_AX_ACH4_TXBD_DESA_L 0x1130 517 #define R_AX_ACH4_TXBD_DESA_H 0x1134 518 #define R_AX_ACH5_TXBD_DESA_L 0x1138 519 #define R_AX_ACH5_TXBD_DESA_H 0x113C 520 #define R_AX_ACH6_TXBD_DESA_L 0x1140 521 #define R_AX_ACH6_TXBD_DESA_H 0x1144 522 #define R_AX_ACH7_TXBD_DESA_L 0x1148 523 #define R_AX_ACH7_TXBD_DESA_H 0x114C 524 #define R_AX_CH8_TXBD_DESA_L 0x1150 525 #define R_AX_CH8_TXBD_DESA_H 0x1154 526 #define R_AX_CH9_TXBD_DESA_L 0x1158 527 #define R_AX_CH9_TXBD_DESA_H 0x115C 528 #define R_AX_CH10_TXBD_DESA_L 0x1358 529 #define R_AX_CH10_TXBD_DESA_H 0x135C 530 #define R_AX_CH11_TXBD_DESA_L 0x1360 531 #define R_AX_CH11_TXBD_DESA_H 0x1364 532 #define R_AX_CH12_TXBD_DESA_L 0x1160 533 #define R_AX_CH12_TXBD_DESA_H 0x1164 534 #define R_AX_RXQ_RXBD_DESA_L 0x1100 535 #define R_AX_RXQ_RXBD_DESA_H 0x1104 536 #define R_AX_RPQ_RXBD_DESA_L 0x1108 537 #define R_AX_RPQ_RXBD_DESA_H 0x110C 538 #define R_AX_RXQ_RXBD_DESA_L_V1 0x1220 539 #define R_AX_RXQ_RXBD_DESA_H_V1 0x1224 540 #define R_AX_RPQ_RXBD_DESA_L_V1 0x1228 541 #define R_AX_RPQ_RXBD_DESA_H_V1 0x122C 542 #define R_AX_ACH0_TXBD_DESA_L_V1 0x1230 543 #define R_AX_ACH0_TXBD_DESA_H_V1 0x1234 544 #define R_AX_ACH1_TXBD_DESA_L_V1 0x1238 545 #define R_AX_ACH1_TXBD_DESA_H_V1 0x123C 546 #define R_AX_ACH2_TXBD_DESA_L_V1 0x1240 547 #define R_AX_ACH2_TXBD_DESA_H_V1 0x1244 548 #define R_AX_ACH3_TXBD_DESA_L_V1 0x1248 549 #define R_AX_ACH3_TXBD_DESA_H_V1 0x124C 550 #define R_AX_ACH4_TXBD_DESA_L_V1 0x1250 551 #define R_AX_ACH4_TXBD_DESA_H_V1 0x1254 552 #define R_AX_ACH5_TXBD_DESA_L_V1 0x1258 553 #define R_AX_ACH5_TXBD_DESA_H_V1 0x125C 554 #define R_AX_ACH6_TXBD_DESA_L_V1 0x1260 555 #define R_AX_ACH6_TXBD_DESA_H_V1 0x1264 556 #define R_AX_ACH7_TXBD_DESA_L_V1 0x1268 557 #define R_AX_ACH7_TXBD_DESA_H_V1 0x126C 558 #define R_AX_CH8_TXBD_DESA_L_V1 0x1270 559 #define R_AX_CH8_TXBD_DESA_H_V1 0x1274 560 #define R_AX_CH9_TXBD_DESA_L_V1 0x1278 561 #define R_AX_CH9_TXBD_DESA_H_V1 0x127C 562 #define R_AX_CH12_TXBD_DESA_L_V1 0x1280 563 #define R_AX_CH12_TXBD_DESA_H_V1 0x1284 564 #define R_AX_CH10_TXBD_DESA_L_V1 0x1458 565 #define R_AX_CH10_TXBD_DESA_H_V1 0x145C 566 #define R_AX_CH11_TXBD_DESA_L_V1 0x1460 567 #define R_AX_CH11_TXBD_DESA_H_V1 0x1464 568 #define B_AX_DESC_NUM_MSK GENMASK(11, 0) 569 570 #define R_AX_RXQ_RXBD_NUM 0x1020 571 #define R_AX_RPQ_RXBD_NUM 0x1022 572 #define R_AX_ACH0_TXBD_NUM 0x1024 573 #define R_AX_ACH1_TXBD_NUM 0x1026 574 #define R_AX_ACH2_TXBD_NUM 0x1028 575 #define R_AX_ACH3_TXBD_NUM 0x102A 576 #define R_AX_ACH4_TXBD_NUM 0x102C 577 #define R_AX_ACH5_TXBD_NUM 0x102E 578 #define R_AX_ACH6_TXBD_NUM 0x1030 579 #define R_AX_ACH7_TXBD_NUM 0x1032 580 #define R_AX_CH8_TXBD_NUM 0x1034 581 #define R_AX_CH9_TXBD_NUM 0x1036 582 #define R_AX_CH10_TXBD_NUM 0x1338 583 #define R_AX_CH11_TXBD_NUM 0x133A 584 #define R_AX_CH12_TXBD_NUM 0x1038 585 #define R_AX_RXQ_RXBD_NUM_V1 0x1210 586 #define R_AX_RPQ_RXBD_NUM_V1 0x1212 587 #define R_AX_CH10_TXBD_NUM_V1 0x1438 588 #define R_AX_CH11_TXBD_NUM_V1 0x143A 589 590 #define R_AX_ACH0_BDRAM_CTRL 0x1200 591 #define R_AX_ACH1_BDRAM_CTRL 0x1204 592 #define R_AX_ACH2_BDRAM_CTRL 0x1208 593 #define R_AX_ACH3_BDRAM_CTRL 0x120C 594 #define R_AX_ACH4_BDRAM_CTRL 0x1210 595 #define R_AX_ACH5_BDRAM_CTRL 0x1214 596 #define R_AX_ACH6_BDRAM_CTRL 0x1218 597 #define R_AX_ACH7_BDRAM_CTRL 0x121C 598 #define R_AX_CH8_BDRAM_CTRL 0x1220 599 #define R_AX_CH9_BDRAM_CTRL 0x1224 600 #define R_AX_CH10_BDRAM_CTRL 0x1320 601 #define R_AX_CH11_BDRAM_CTRL 0x1324 602 #define R_AX_CH12_BDRAM_CTRL 0x1228 603 #define R_AX_ACH0_BDRAM_CTRL_V1 0x1300 604 #define R_AX_ACH1_BDRAM_CTRL_V1 0x1304 605 #define R_AX_ACH2_BDRAM_CTRL_V1 0x1308 606 #define R_AX_ACH3_BDRAM_CTRL_V1 0x130C 607 #define R_AX_ACH4_BDRAM_CTRL_V1 0x1310 608 #define R_AX_ACH5_BDRAM_CTRL_V1 0x1314 609 #define R_AX_ACH6_BDRAM_CTRL_V1 0x1318 610 #define R_AX_ACH7_BDRAM_CTRL_V1 0x131C 611 #define R_AX_CH8_BDRAM_CTRL_V1 0x1320 612 #define R_AX_CH9_BDRAM_CTRL_V1 0x1324 613 #define R_AX_CH12_BDRAM_CTRL_V1 0x1328 614 #define R_AX_CH10_BDRAM_CTRL_V1 0x1420 615 #define R_AX_CH11_BDRAM_CTRL_V1 0x1424 616 #define BDRAM_SIDX_MASK GENMASK(7, 0) 617 #define BDRAM_MAX_MASK GENMASK(15, 8) 618 #define BDRAM_MIN_MASK GENMASK(23, 16) 619 620 #define R_AX_PCIE_INIT_CFG1 0x1000 621 #define B_AX_PCIE_RXRST_KEEP_REG BIT(23) 622 #define B_AX_PCIE_TXRST_KEEP_REG BIT(22) 623 #define B_AX_PCIE_PERST_KEEP_REG BIT(21) 624 #define B_AX_PCIE_FLR_KEEP_REG BIT(20) 625 #define B_AX_PCIE_TRAIN_KEEP_REG BIT(19) 626 #define B_AX_RXBD_MODE BIT(18) 627 #define B_AX_PCIE_MAX_RXDMA_MASK GENMASK(16, 14) 628 #define B_AX_RXHCI_EN BIT(13) 629 #define B_AX_LATENCY_CONTROL BIT(12) 630 #define B_AX_TXHCI_EN BIT(11) 631 #define B_AX_PCIE_MAX_TXDMA_MASK GENMASK(10, 8) 632 #define B_AX_TX_TRUNC_MODE BIT(5) 633 #define B_AX_RX_TRUNC_MODE BIT(4) 634 #define B_AX_RST_BDRAM BIT(3) 635 #define B_AX_DIS_RXDMA_PRE BIT(2) 636 637 #define R_AX_TXDMA_ADDR_H 0x10F0 638 #define R_AX_RXDMA_ADDR_H 0x10F4 639 640 #define R_AX_PCIE_DMA_STOP1 0x1010 641 #define B_AX_STOP_PCIEIO BIT(20) 642 #define B_AX_STOP_WPDMA BIT(19) 643 #define B_AX_STOP_CH12 BIT(18) 644 #define B_AX_STOP_CH9 BIT(17) 645 #define B_AX_STOP_CH8 BIT(16) 646 #define B_AX_STOP_ACH7 BIT(15) 647 #define B_AX_STOP_ACH6 BIT(14) 648 #define B_AX_STOP_ACH5 BIT(13) 649 #define B_AX_STOP_ACH4 BIT(12) 650 #define B_AX_STOP_ACH3 BIT(11) 651 #define B_AX_STOP_ACH2 BIT(10) 652 #define B_AX_STOP_ACH1 BIT(9) 653 #define B_AX_STOP_ACH0 BIT(8) 654 #define B_AX_STOP_RPQ BIT(1) 655 #define B_AX_STOP_RXQ BIT(0) 656 #define B_AX_TX_STOP1_ALL GENMASK(18, 8) 657 #define B_AX_TX_STOP1_MASK (B_AX_STOP_ACH0 | B_AX_STOP_ACH1 | \ 658 B_AX_STOP_ACH2 | B_AX_STOP_ACH3 | \ 659 B_AX_STOP_ACH4 | B_AX_STOP_ACH5 | \ 660 B_AX_STOP_ACH6 | B_AX_STOP_ACH7 | \ 661 B_AX_STOP_CH8 | B_AX_STOP_CH9 | \ 662 B_AX_STOP_CH12) 663 #define B_AX_TX_STOP1_MASK_V1 (B_AX_STOP_ACH0 | B_AX_STOP_ACH1 | \ 664 B_AX_STOP_ACH2 | B_AX_STOP_ACH3 | \ 665 B_AX_STOP_CH8 | B_AX_STOP_CH9 | \ 666 B_AX_STOP_CH12) 667 668 #define R_AX_PCIE_DMA_STOP2 0x1310 669 #define B_AX_STOP_CH11 BIT(1) 670 #define B_AX_STOP_CH10 BIT(0) 671 #define B_AX_TX_STOP2_ALL GENMASK(1, 0) 672 673 #define R_AX_TXBD_RWPTR_CLR1 0x1014 674 #define B_AX_CLR_CH12_IDX BIT(10) 675 #define B_AX_CLR_CH9_IDX BIT(9) 676 #define B_AX_CLR_CH8_IDX BIT(8) 677 #define B_AX_CLR_ACH7_IDX BIT(7) 678 #define B_AX_CLR_ACH6_IDX BIT(6) 679 #define B_AX_CLR_ACH5_IDX BIT(5) 680 #define B_AX_CLR_ACH4_IDX BIT(4) 681 #define B_AX_CLR_ACH3_IDX BIT(3) 682 #define B_AX_CLR_ACH2_IDX BIT(2) 683 #define B_AX_CLR_ACH1_IDX BIT(1) 684 #define B_AX_CLR_ACH0_IDX BIT(0) 685 #define B_AX_TXBD_CLR1_ALL GENMASK(10, 0) 686 687 #define R_AX_RXBD_RWPTR_CLR 0x1018 688 #define B_AX_CLR_RPQ_IDX BIT(1) 689 #define B_AX_CLR_RXQ_IDX BIT(0) 690 #define B_AX_RXBD_CLR_ALL GENMASK(1, 0) 691 692 #define R_AX_TXBD_RWPTR_CLR2 0x1314 693 #define B_AX_CLR_CH11_IDX BIT(1) 694 #define B_AX_CLR_CH10_IDX BIT(0) 695 #define B_AX_TXBD_CLR2_ALL GENMASK(1, 0) 696 697 #define R_AX_PCIE_DMA_BUSY1 0x101C 698 #define B_AX_PCIEIO_RX_BUSY BIT(22) 699 #define B_AX_PCIEIO_TX_BUSY BIT(21) 700 #define B_AX_PCIEIO_BUSY BIT(20) 701 #define B_AX_WPDMA_BUSY BIT(19) 702 #define B_AX_CH12_BUSY BIT(18) 703 #define B_AX_CH9_BUSY BIT(17) 704 #define B_AX_CH8_BUSY BIT(16) 705 #define B_AX_ACH7_BUSY BIT(15) 706 #define B_AX_ACH6_BUSY BIT(14) 707 #define B_AX_ACH5_BUSY BIT(13) 708 #define B_AX_ACH4_BUSY BIT(12) 709 #define B_AX_ACH3_BUSY BIT(11) 710 #define B_AX_ACH2_BUSY BIT(10) 711 #define B_AX_ACH1_BUSY BIT(9) 712 #define B_AX_ACH0_BUSY BIT(8) 713 #define B_AX_RPQ_BUSY BIT(1) 714 #define B_AX_RXQ_BUSY BIT(0) 715 #define DMA_BUSY1_CHECK (B_AX_ACH0_BUSY | B_AX_ACH1_BUSY | B_AX_ACH2_BUSY | \ 716 B_AX_ACH3_BUSY | B_AX_ACH4_BUSY | B_AX_ACH5_BUSY | \ 717 B_AX_ACH6_BUSY | B_AX_ACH7_BUSY | B_AX_CH8_BUSY | \ 718 B_AX_CH9_BUSY | B_AX_CH12_BUSY) 719 #define DMA_BUSY1_CHECK_V1 (B_AX_ACH0_BUSY | B_AX_ACH1_BUSY | B_AX_ACH2_BUSY | \ 720 B_AX_ACH3_BUSY | B_AX_CH8_BUSY | B_AX_CH9_BUSY | \ 721 B_AX_CH12_BUSY) 722 723 #define R_AX_PCIE_DMA_BUSY2 0x131C 724 #define B_AX_CH11_BUSY BIT(1) 725 #define B_AX_CH10_BUSY BIT(0) 726 727 #define R_BE_HAXI_DMA_STOP1 0xB010 728 #define B_BE_STOP_WPDMA BIT(31) 729 #define B_BE_STOP_CH14 BIT(14) 730 #define B_BE_STOP_CH13 BIT(13) 731 #define B_BE_STOP_CH12 BIT(12) 732 #define B_BE_STOP_CH11 BIT(11) 733 #define B_BE_STOP_CH10 BIT(10) 734 #define B_BE_STOP_CH9 BIT(9) 735 #define B_BE_STOP_CH8 BIT(8) 736 #define B_BE_STOP_CH7 BIT(7) 737 #define B_BE_STOP_CH6 BIT(6) 738 #define B_BE_STOP_CH5 BIT(5) 739 #define B_BE_STOP_CH4 BIT(4) 740 #define B_BE_STOP_CH3 BIT(3) 741 #define B_BE_STOP_CH2 BIT(2) 742 #define B_BE_STOP_CH1 BIT(1) 743 #define B_BE_STOP_CH0 BIT(0) 744 #define B_BE_TX_STOP1_MASK (B_BE_STOP_CH0 | B_BE_STOP_CH1 | \ 745 B_BE_STOP_CH2 | B_BE_STOP_CH3 | \ 746 B_BE_STOP_CH4 | B_BE_STOP_CH5 | \ 747 B_BE_STOP_CH6 | B_BE_STOP_CH7 | \ 748 B_BE_STOP_CH8 | B_BE_STOP_CH9 | \ 749 B_BE_STOP_CH10 | B_BE_STOP_CH11 | \ 750 B_BE_STOP_CH12) 751 752 #define R_BE_CH0_TXBD_NUM_V1 0xB030 753 #define R_BE_CH1_TXBD_NUM_V1 0xB032 754 #define R_BE_CH2_TXBD_NUM_V1 0xB034 755 #define R_BE_CH3_TXBD_NUM_V1 0xB036 756 #define R_BE_CH4_TXBD_NUM_V1 0xB038 757 #define R_BE_CH5_TXBD_NUM_V1 0xB03A 758 #define R_BE_CH6_TXBD_NUM_V1 0xB03C 759 #define R_BE_CH7_TXBD_NUM_V1 0xB03E 760 #define R_BE_CH8_TXBD_NUM_V1 0xB040 761 #define R_BE_CH9_TXBD_NUM_V1 0xB042 762 #define R_BE_CH10_TXBD_NUM_V1 0xB044 763 #define R_BE_CH11_TXBD_NUM_V1 0xB046 764 #define R_BE_CH12_TXBD_NUM_V1 0xB048 765 #define R_BE_CH13_TXBD_NUM_V1 0xB04C 766 #define R_BE_CH14_TXBD_NUM_V1 0xB04E 767 768 #define R_BE_RXQ0_RXBD_NUM_V1 0xB050 769 #define R_BE_RPQ0_RXBD_NUM_V1 0xB052 770 771 #define R_BE_CH0_TXBD_IDX_V1 0xB100 772 #define R_BE_CH1_TXBD_IDX_V1 0xB104 773 #define R_BE_CH2_TXBD_IDX_V1 0xB108 774 #define R_BE_CH3_TXBD_IDX_V1 0xB10C 775 #define R_BE_CH4_TXBD_IDX_V1 0xB110 776 #define R_BE_CH5_TXBD_IDX_V1 0xB114 777 #define R_BE_CH6_TXBD_IDX_V1 0xB118 778 #define R_BE_CH7_TXBD_IDX_V1 0xB11C 779 #define R_BE_CH8_TXBD_IDX_V1 0xB120 780 #define R_BE_CH9_TXBD_IDX_V1 0xB124 781 #define R_BE_CH10_TXBD_IDX_V1 0xB128 782 #define R_BE_CH11_TXBD_IDX_V1 0xB12C 783 #define R_BE_CH12_TXBD_IDX_V1 0xB130 784 #define R_BE_CH13_TXBD_IDX_V1 0xB134 785 #define R_BE_CH14_TXBD_IDX_V1 0xB138 786 787 #define R_BE_RXQ0_RXBD_IDX_V1 0xB160 788 #define R_BE_RPQ0_RXBD_IDX_V1 0xB164 789 790 #define R_BE_CH0_TXBD_DESA_L_V1 0xB200 791 #define R_BE_CH0_TXBD_DESA_H_V1 0xB204 792 #define R_BE_CH1_TXBD_DESA_L_V1 0xB208 793 #define R_BE_CH1_TXBD_DESA_H_V1 0xB20C 794 #define R_BE_CH2_TXBD_DESA_L_V1 0xB210 795 #define R_BE_CH2_TXBD_DESA_H_V1 0xB214 796 #define R_BE_CH3_TXBD_DESA_L_V1 0xB218 797 #define R_BE_CH3_TXBD_DESA_H_V1 0xB21C 798 #define R_BE_CH4_TXBD_DESA_L_V1 0xB220 799 #define R_BE_CH4_TXBD_DESA_H_V1 0xB224 800 #define R_BE_CH5_TXBD_DESA_L_V1 0xB228 801 #define R_BE_CH5_TXBD_DESA_H_V1 0xB22C 802 #define R_BE_CH6_TXBD_DESA_L_V1 0xB230 803 #define R_BE_CH6_TXBD_DESA_H_V1 0xB234 804 #define R_BE_CH7_TXBD_DESA_L_V1 0xB238 805 #define R_BE_CH7_TXBD_DESA_H_V1 0xB23C 806 #define R_BE_CH8_TXBD_DESA_L_V1 0xB240 807 #define R_BE_CH8_TXBD_DESA_H_V1 0xB244 808 #define R_BE_CH9_TXBD_DESA_L_V1 0xB248 809 #define R_BE_CH9_TXBD_DESA_H_V1 0xB24C 810 #define R_BE_CH10_TXBD_DESA_L_V1 0xB250 811 #define R_BE_CH10_TXBD_DESA_H_V1 0xB254 812 #define R_BE_CH11_TXBD_DESA_L_V1 0xB258 813 #define R_BE_CH11_TXBD_DESA_H_V1 0xB25C 814 #define R_BE_CH12_TXBD_DESA_L_V1 0xB260 815 #define R_BE_CH12_TXBD_DESA_H_V1 0xB264 816 #define R_BE_CH13_TXBD_DESA_L_V1 0xB268 817 #define R_BE_CH13_TXBD_DESA_H_V1 0xB26C 818 #define R_BE_CH14_TXBD_DESA_L_V1 0xB270 819 #define R_BE_CH14_TXBD_DESA_H_V1 0xB274 820 821 #define R_BE_RXQ0_RXBD_DESA_L_V1 0xB300 822 #define R_BE_RXQ0_RXBD_DESA_H_V1 0xB304 823 #define R_BE_RPQ0_RXBD_DESA_L_V1 0xB308 824 #define R_BE_RPQ0_RXBD_DESA_H_V1 0xB30C 825 826 /* Configure */ 827 #define R_AX_PCIE_INIT_CFG2 0x1004 828 #define B_AX_WD_ITVL_IDLE GENMASK(27, 24) 829 #define B_AX_WD_ITVL_ACT GENMASK(19, 16) 830 #define B_AX_PCIE_RX_APPLEN_MASK GENMASK(13, 0) 831 832 #define R_AX_PCIE_PS_CTRL 0x1008 833 #define B_AX_L1OFF_PWR_OFF_EN BIT(5) 834 835 #define R_AX_INT_MIT_RX 0x10D4 836 #define B_AX_RXMIT_RXP2_SEL BIT(19) 837 #define B_AX_RXMIT_RXP1_SEL BIT(18) 838 #define B_AX_RXTIMER_UNIT_MASK GENMASK(17, 16) 839 #define AX_RXTIMER_UNIT_64US 0 840 #define AX_RXTIMER_UNIT_128US 1 841 #define AX_RXTIMER_UNIT_256US 2 842 #define AX_RXTIMER_UNIT_512US 3 843 #define B_AX_RXCOUNTER_MATCH_MASK GENMASK(15, 8) 844 #define B_AX_RXTIMER_MATCH_MASK GENMASK(7, 0) 845 846 #define R_AX_DBG_ERR_FLAG_V1 0x1104 847 848 #define R_AX_INT_MIT_RX_V1 0x1184 849 #define B_AX_RXMIT_RXP2_SEL_V1 BIT(19) 850 #define B_AX_RXMIT_RXP1_SEL_V1 BIT(18) 851 #define B_AX_MIT_RXTIMER_UNIT_MASK GENMASK(17, 16) 852 #define B_AX_MIT_RXCOUNTER_MATCH_MASK GENMASK(15, 8) 853 #define B_AX_MIT_RXTIMER_MATCH_MASK GENMASK(7, 0) 854 855 #define R_AX_DBG_ERR_FLAG 0x11C4 856 #define B_AX_PCIE_RPQ_FULL BIT(29) 857 #define B_AX_PCIE_RXQ_FULL BIT(28) 858 #define B_AX_CPL_STATUS_MASK GENMASK(27, 25) 859 #define B_AX_RX_STUCK BIT(22) 860 #define B_AX_TX_STUCK BIT(21) 861 #define B_AX_PCIEDBG_TXERR0 BIT(16) 862 #define B_AX_PCIE_RXP1_ERR0 BIT(4) 863 #define B_AX_PCIE_TXBD_LEN0 BIT(1) 864 #define B_AX_PCIE_TXBD_4KBOUD_LENERR BIT(0) 865 866 #define R_AX_TXBD_RWPTR_CLR2_V1 0x11C4 867 #define B_AX_CLR_CH11_IDX BIT(1) 868 #define B_AX_CLR_CH10_IDX BIT(0) 869 870 #define R_AX_LBC_WATCHDOG 0x11D8 871 #define B_AX_LBC_TIMER GENMASK(7, 4) 872 #define B_AX_LBC_FLAG BIT(1) 873 #define B_AX_LBC_EN BIT(0) 874 875 #define R_AX_RXBD_RWPTR_CLR_V1 0x1200 876 #define B_AX_CLR_RPQ_IDX BIT(1) 877 #define B_AX_CLR_RXQ_IDX BIT(0) 878 879 #define R_AX_HAXI_EXP_CTRL 0x1204 880 #define B_AX_MAX_TAG_NUM_V1_MASK GENMASK(2, 0) 881 882 #define R_AX_PCIE_EXP_CTRL 0x13F0 883 #define B_AX_EN_CHKDSC_NO_RX_STUCK BIT(20) 884 #define B_AX_MAX_TAG_NUM GENMASK(18, 16) 885 #define B_AX_SIC_EN_FORCE_CLKREQ BIT(4) 886 887 #define R_AX_PCIE_RX_PREF_ADV 0x13F4 888 #define B_AX_RXDMA_PREF_ADV_EN BIT(0) 889 890 #define R_AX_PCIE_HRPWM_V1 0x30C0 891 #define R_AX_PCIE_CRPWM 0x30C4 892 893 #define R_AX_LBC_WATCHDOG_V1 0x30D8 894 895 #define R_BE_PCIE_HRPWM 0x30C0 896 #define R_BE_PCIE_CRPWM 0x30C4 897 898 #define R_BE_L1_2_CTRL_HCILDO 0x3110 899 #define B_BE_PCIE_DIS_L1_2_CTRL_HCILDO BIT(0) 900 901 #define R_BE_PL1_DBG_INFO 0x3120 902 #define B_BE_END_PL1_CNT_MASK GENMASK(23, 16) 903 #define B_BE_START_PL1_CNT_MASK GENMASK(7, 0) 904 905 #define R_BE_PCIE_MIT0_TMR 0x3330 906 #define B_BE_PCIE_MIT0_RX_TMR_MASK GENMASK(5, 4) 907 #define BE_MIT0_TMR_UNIT_1MS 0 908 #define BE_MIT0_TMR_UNIT_2MS 1 909 #define BE_MIT0_TMR_UNIT_4MS 2 910 #define BE_MIT0_TMR_UNIT_8MS 3 911 #define B_BE_PCIE_MIT0_TX_TMR_MASK GENMASK(1, 0) 912 913 #define R_BE_PCIE_MIT0_CNT 0x3334 914 #define B_BE_PCIE_RX_MIT0_CNT_MASK GENMASK(31, 24) 915 #define B_BE_PCIE_TX_MIT0_CNT_MASK GENMASK(23, 16) 916 #define B_BE_PCIE_RX_MIT0_TMR_CNT_MASK GENMASK(15, 8) 917 #define B_BE_PCIE_TX_MIT0_TMR_CNT_MASK GENMASK(7, 0) 918 919 #define R_BE_PCIE_MIT_CH_EN 0x3338 920 #define B_BE_PCIE_MIT_RX1P1_EN BIT(23) 921 #define B_BE_PCIE_MIT_RX0P1_EN BIT(22) 922 #define B_BE_PCIE_MIT_ROQ1_EN BIT(21) 923 #define B_BE_PCIE_MIT_RPQ1_EN BIT(20) 924 #define B_BE_PCIE_MIT_RX1P2_EN BIT(19) 925 #define B_BE_PCIE_MIT_ROQ0_EN BIT(18) 926 #define B_BE_PCIE_MIT_RPQ0_EN BIT(17) 927 #define B_BE_PCIE_MIT_RX0P2_EN BIT(16) 928 #define B_BE_PCIE_MIT_TXCH14_EN BIT(14) 929 #define B_BE_PCIE_MIT_TXCH13_EN BIT(13) 930 #define B_BE_PCIE_MIT_TXCH12_EN BIT(12) 931 #define B_BE_PCIE_MIT_TXCH11_EN BIT(11) 932 #define B_BE_PCIE_MIT_TXCH10_EN BIT(10) 933 #define B_BE_PCIE_MIT_TXCH9_EN BIT(9) 934 #define B_BE_PCIE_MIT_TXCH8_EN BIT(8) 935 #define B_BE_PCIE_MIT_TXCH7_EN BIT(7) 936 #define B_BE_PCIE_MIT_TXCH6_EN BIT(6) 937 #define B_BE_PCIE_MIT_TXCH5_EN BIT(5) 938 #define B_BE_PCIE_MIT_TXCH4_EN BIT(4) 939 #define B_BE_PCIE_MIT_TXCH3_EN BIT(3) 940 #define B_BE_PCIE_MIT_TXCH2_EN BIT(2) 941 #define B_BE_PCIE_MIT_TXCH1_EN BIT(1) 942 #define B_BE_PCIE_MIT_TXCH0_EN BIT(0) 943 944 #define R_BE_SER_PL1_CTRL 0x34A8 945 #define B_BE_PL1_SER_PL1_EN BIT(31) 946 #define B_BE_PL1_IGNORE_HOT_RST BIT(30) 947 #define B_BE_PL1_TIMER_UNIT_MASK GENMASK(19, 17) 948 #define B_BE_PL1_TIMER_CLEAR BIT(0) 949 950 #define R_BE_REG_PL1_MASK 0x34B0 951 #define B_BE_SER_PCLKREQ_ACK_MASK BIT(5) 952 #define B_BE_SER_PM_CLK_MASK BIT(4) 953 #define B_BE_SER_LTSSM_IMR BIT(3) 954 #define B_BE_SER_PM_MASTER_IMR BIT(2) 955 #define B_BE_SER_L1SUB_IMR BIT(1) 956 #define B_BE_SER_PMU_IMR BIT(0) 957 958 #define R_BE_REG_PL1_ISR 0x34B4 959 960 #define R_BE_RX_APPEND_MODE 0x8920 961 #define B_BE_APPEND_OFFSET_MASK GENMASK(23, 16) 962 #define B_BE_APPEND_LEN_MASK GENMASK(15, 0) 963 964 #define R_BE_TXBD_RWPTR_CLR1 0xB014 965 #define B_BE_CLR_CH14_IDX BIT(14) 966 #define B_BE_CLR_CH13_IDX BIT(13) 967 #define B_BE_CLR_CH12_IDX BIT(12) 968 #define B_BE_CLR_CH11_IDX BIT(11) 969 #define B_BE_CLR_CH10_IDX BIT(10) 970 #define B_BE_CLR_CH9_IDX BIT(9) 971 #define B_BE_CLR_CH8_IDX BIT(8) 972 #define B_BE_CLR_CH7_IDX BIT(7) 973 #define B_BE_CLR_CH6_IDX BIT(6) 974 #define B_BE_CLR_CH5_IDX BIT(5) 975 #define B_BE_CLR_CH4_IDX BIT(4) 976 #define B_BE_CLR_CH3_IDX BIT(3) 977 #define B_BE_CLR_CH2_IDX BIT(2) 978 #define B_BE_CLR_CH1_IDX BIT(1) 979 #define B_BE_CLR_CH0_IDX BIT(0) 980 981 #define R_BE_RXBD_RWPTR_CLR1_V1 0xB018 982 #define B_BE_CLR_ROQ1_IDX_V1 BIT(5) 983 #define B_BE_CLR_RPQ1_IDX_V1 BIT(4) 984 #define B_BE_CLR_RXQ1_IDX_V1 BIT(3) 985 #define B_BE_CLR_ROQ0_IDX BIT(2) 986 #define B_BE_CLR_RPQ0_IDX BIT(1) 987 #define B_BE_CLR_RXQ0_IDX BIT(0) 988 989 #define R_BE_HAXI_DMA_BUSY1 0xB01C 990 #define B_BE_HAXI_MST_BUSY BIT(31) 991 #define B_BE_HAXI_RX_IDLE BIT(25) 992 #define B_BE_HAXI_TX_IDLE BIT(24) 993 #define B_BE_ROQ1_BUSY_V1 BIT(21) 994 #define B_BE_RPQ1_BUSY_V1 BIT(20) 995 #define B_BE_RXQ1_BUSY_V1 BIT(19) 996 #define B_BE_ROQ0_BUSY_V1 BIT(18) 997 #define B_BE_RPQ0_BUSY_V1 BIT(17) 998 #define B_BE_RXQ0_BUSY_V1 BIT(16) 999 #define B_BE_WPDMA_BUSY BIT(15) 1000 #define B_BE_CH14_BUSY BIT(14) 1001 #define B_BE_CH13_BUSY BIT(13) 1002 #define B_BE_CH12_BUSY BIT(12) 1003 #define B_BE_CH11_BUSY BIT(11) 1004 #define B_BE_CH10_BUSY BIT(10) 1005 #define B_BE_CH9_BUSY BIT(9) 1006 #define B_BE_CH8_BUSY BIT(8) 1007 #define B_BE_CH7_BUSY BIT(7) 1008 #define B_BE_CH6_BUSY BIT(6) 1009 #define B_BE_CH5_BUSY BIT(5) 1010 #define B_BE_CH4_BUSY BIT(4) 1011 #define B_BE_CH3_BUSY BIT(3) 1012 #define B_BE_CH2_BUSY BIT(2) 1013 #define B_BE_CH1_BUSY BIT(1) 1014 #define B_BE_CH0_BUSY BIT(0) 1015 #define DMA_BUSY1_CHECK_BE (B_BE_CH0_BUSY | B_BE_CH1_BUSY | B_BE_CH2_BUSY | \ 1016 B_BE_CH3_BUSY | B_BE_CH4_BUSY | B_BE_CH5_BUSY | \ 1017 B_BE_CH6_BUSY | B_BE_CH7_BUSY | B_BE_CH8_BUSY | \ 1018 B_BE_CH9_BUSY | B_BE_CH10_BUSY | B_BE_CH11_BUSY | \ 1019 B_BE_CH12_BUSY | B_BE_CH13_BUSY | B_BE_CH14_BUSY) 1020 1021 #define R_BE_HAXI_EXP_CTRL_V1 0xB020 1022 #define B_BE_R_NO_SEC_ACCESS BIT(31) 1023 #define B_BE_FORCE_EN_DMA_RX_GCLK BIT(5) 1024 #define B_BE_FORCE_EN_DMA_TX_GCLK BIT(4) 1025 #define B_BE_MAX_TAG_NUM_MASK GENMASK(3, 0) 1026 1027 #define RTW89_PCI_TXBD_NUM_MAX 256 1028 #define RTW89_PCI_RXBD_NUM_MAX 256 1029 #define RTW89_PCI_TXWD_NUM_MAX 512 1030 #define RTW89_PCI_TXWD_PAGE_SIZE 128 1031 #define RTW89_PCI_ADDRINFO_MAX 4 1032 #define RTW89_PCI_RX_BUF_SIZE (11454 + 40) /* +40 for rtw89_rxdesc_long_v2 */ 1033 1034 #define RTW89_PCI_POLL_BDRAM_RST_CNT 100 1035 #define RTW89_PCI_MULTITAG 8 1036 1037 /* PCIE CFG register */ 1038 #define RTW89_PCIE_CAPABILITY_SPEED 0x7C 1039 #define RTW89_PCIE_SUPPORT_GEN_MASK GENMASK(3, 0) 1040 #define RTW89_PCIE_L1_STS_V1 0x80 1041 #define RTW89_BCFG_LINK_SPEED_MASK GENMASK(19, 16) 1042 #define RTW89_PCIE_GEN1_SPEED 0x01 1043 #define RTW89_PCIE_GEN2_SPEED 0x02 1044 #define RTW89_PCIE_PHY_RATE 0x82 1045 #define RTW89_PCIE_PHY_RATE_MASK GENMASK(1, 0) 1046 #define RTW89_PCIE_LINK_CHANGE_SPEED 0xA0 1047 #define RTW89_PCIE_L1SS_STS_V1 0x0168 1048 #define RTW89_PCIE_BIT_ASPM_L11 BIT(3) 1049 #define RTW89_PCIE_BIT_ASPM_L12 BIT(2) 1050 #define RTW89_PCIE_BIT_PCI_L11 BIT(1) 1051 #define RTW89_PCIE_BIT_PCI_L12 BIT(0) 1052 #define RTW89_PCIE_ASPM_CTRL 0x070F 1053 #define RTW89_L1DLY_MASK GENMASK(5, 3) 1054 #define RTW89_L0DLY_MASK GENMASK(2, 0) 1055 #define RTW89_PCIE_TIMER_CTRL 0x0718 1056 #define RTW89_PCIE_BIT_L1SUB BIT(5) 1057 #define RTW89_PCIE_L1_CTRL 0x0719 1058 #define RTW89_PCIE_BIT_CLK BIT(4) 1059 #define RTW89_PCIE_BIT_L1 BIT(3) 1060 #define RTW89_PCIE_CLK_CTRL 0x0725 1061 #define RTW89_PCIE_FTS 0x080C 1062 #define RTW89_PCIE_POLLING_BIT BIT(17) 1063 #define RTW89_PCIE_RST_MSTATE 0x0B48 1064 #define RTW89_PCIE_BIT_CFG_RST_MSTATE BIT(0) 1065 1066 #define INTF_INTGRA_MINREF_V1 90 1067 #define INTF_INTGRA_HOSTREF_V1 100 1068 1069 enum rtw89_pcie_phy { 1070 PCIE_PHY_GEN1, 1071 PCIE_PHY_GEN2, 1072 PCIE_PHY_GEN1_UNDEFINE = 0x7F, 1073 }; 1074 1075 enum rtw89_pcie_l0sdly { 1076 PCIE_L0SDLY_1US = 0, 1077 PCIE_L0SDLY_2US = 1, 1078 PCIE_L0SDLY_3US = 2, 1079 PCIE_L0SDLY_4US = 3, 1080 PCIE_L0SDLY_5US = 4, 1081 PCIE_L0SDLY_6US = 5, 1082 PCIE_L0SDLY_7US = 6, 1083 }; 1084 1085 enum rtw89_pcie_l1dly { 1086 PCIE_L1DLY_16US = 4, 1087 PCIE_L1DLY_32US = 5, 1088 PCIE_L1DLY_64US = 6, 1089 PCIE_L1DLY_HW_INFI = 7, 1090 }; 1091 1092 enum rtw89_pcie_clkdly_hw { 1093 PCIE_CLKDLY_HW_0 = 0, 1094 PCIE_CLKDLY_HW_30US = 0x1, 1095 PCIE_CLKDLY_HW_50US = 0x2, 1096 PCIE_CLKDLY_HW_100US = 0x3, 1097 PCIE_CLKDLY_HW_150US = 0x4, 1098 PCIE_CLKDLY_HW_200US = 0x5, 1099 }; 1100 1101 enum rtw89_pcie_clkdly_hw_v1 { 1102 PCIE_CLKDLY_HW_V1_0 = 0, 1103 PCIE_CLKDLY_HW_V1_16US = 0x1, 1104 PCIE_CLKDLY_HW_V1_32US = 0x2, 1105 PCIE_CLKDLY_HW_V1_64US = 0x3, 1106 PCIE_CLKDLY_HW_V1_80US = 0x4, 1107 PCIE_CLKDLY_HW_V1_96US = 0x5, 1108 }; 1109 1110 enum mac_ax_bd_trunc_mode { 1111 MAC_AX_BD_NORM, 1112 MAC_AX_BD_TRUNC, 1113 MAC_AX_BD_DEF = 0xFE 1114 }; 1115 1116 enum mac_ax_rxbd_mode { 1117 MAC_AX_RXBD_PKT, 1118 MAC_AX_RXBD_SEP, 1119 MAC_AX_RXBD_DEF = 0xFE 1120 }; 1121 1122 enum mac_ax_tag_mode { 1123 MAC_AX_TAG_SGL, 1124 MAC_AX_TAG_MULTI, 1125 MAC_AX_TAG_DEF = 0xFE 1126 }; 1127 1128 enum mac_ax_tx_burst { 1129 MAC_AX_TX_BURST_16B = 0, 1130 MAC_AX_TX_BURST_32B = 1, 1131 MAC_AX_TX_BURST_64B = 2, 1132 MAC_AX_TX_BURST_V1_64B = 0, 1133 MAC_AX_TX_BURST_128B = 3, 1134 MAC_AX_TX_BURST_V1_128B = 1, 1135 MAC_AX_TX_BURST_256B = 4, 1136 MAC_AX_TX_BURST_V1_256B = 2, 1137 MAC_AX_TX_BURST_512B = 5, 1138 MAC_AX_TX_BURST_1024B = 6, 1139 MAC_AX_TX_BURST_2048B = 7, 1140 MAC_AX_TX_BURST_DEF = 0xFE 1141 }; 1142 1143 enum mac_ax_rx_burst { 1144 MAC_AX_RX_BURST_16B = 0, 1145 MAC_AX_RX_BURST_32B = 1, 1146 MAC_AX_RX_BURST_64B = 2, 1147 MAC_AX_RX_BURST_V1_64B = 0, 1148 MAC_AX_RX_BURST_128B = 3, 1149 MAC_AX_RX_BURST_V1_128B = 1, 1150 MAC_AX_RX_BURST_V1_256B = 0, 1151 MAC_AX_RX_BURST_DEF = 0xFE 1152 }; 1153 1154 enum mac_ax_wd_dma_intvl { 1155 MAC_AX_WD_DMA_INTVL_0S, 1156 MAC_AX_WD_DMA_INTVL_256NS, 1157 MAC_AX_WD_DMA_INTVL_512NS, 1158 MAC_AX_WD_DMA_INTVL_768NS, 1159 MAC_AX_WD_DMA_INTVL_1US, 1160 MAC_AX_WD_DMA_INTVL_1_5US, 1161 MAC_AX_WD_DMA_INTVL_2US, 1162 MAC_AX_WD_DMA_INTVL_4US, 1163 MAC_AX_WD_DMA_INTVL_8US, 1164 MAC_AX_WD_DMA_INTVL_16US, 1165 MAC_AX_WD_DMA_INTVL_DEF = 0xFE 1166 }; 1167 1168 enum mac_ax_multi_tag_num { 1169 MAC_AX_TAG_NUM_1, 1170 MAC_AX_TAG_NUM_2, 1171 MAC_AX_TAG_NUM_3, 1172 MAC_AX_TAG_NUM_4, 1173 MAC_AX_TAG_NUM_5, 1174 MAC_AX_TAG_NUM_6, 1175 MAC_AX_TAG_NUM_7, 1176 MAC_AX_TAG_NUM_8, 1177 MAC_AX_TAG_NUM_DEF = 0xFE 1178 }; 1179 1180 enum mac_ax_lbc_tmr { 1181 MAC_AX_LBC_TMR_8US = 0, 1182 MAC_AX_LBC_TMR_16US, 1183 MAC_AX_LBC_TMR_32US, 1184 MAC_AX_LBC_TMR_64US, 1185 MAC_AX_LBC_TMR_128US, 1186 MAC_AX_LBC_TMR_256US, 1187 MAC_AX_LBC_TMR_512US, 1188 MAC_AX_LBC_TMR_1MS, 1189 MAC_AX_LBC_TMR_2MS, 1190 MAC_AX_LBC_TMR_4MS, 1191 MAC_AX_LBC_TMR_8MS, 1192 MAC_AX_LBC_TMR_DEF = 0xFE 1193 }; 1194 1195 enum mac_ax_pcie_func_ctrl { 1196 MAC_AX_PCIE_DISABLE = 0, 1197 MAC_AX_PCIE_ENABLE = 1, 1198 MAC_AX_PCIE_DEFAULT = 0xFE, 1199 MAC_AX_PCIE_IGNORE = 0xFF 1200 }; 1201 1202 enum mac_ax_io_rcy_tmr { 1203 MAC_AX_IO_RCY_ANA_TMR_2MS = 24000, 1204 MAC_AX_IO_RCY_ANA_TMR_4MS = 48000, 1205 MAC_AX_IO_RCY_ANA_TMR_6MS = 72000, 1206 MAC_AX_IO_RCY_ANA_TMR_DEF = 0xFE 1207 }; 1208 1209 enum rtw89_pci_intr_mask_cfg { 1210 RTW89_PCI_INTR_MASK_RESET, 1211 RTW89_PCI_INTR_MASK_NORMAL, 1212 RTW89_PCI_INTR_MASK_LOW_POWER, 1213 RTW89_PCI_INTR_MASK_RECOVERY_START, 1214 RTW89_PCI_INTR_MASK_RECOVERY_COMPLETE, 1215 }; 1216 1217 struct rtw89_pci_isrs; 1218 struct rtw89_pci; 1219 1220 struct rtw89_pci_bd_idx_addr { 1221 u32 tx_bd_addrs[RTW89_TXCH_NUM]; 1222 u32 rx_bd_addrs[RTW89_RXCH_NUM]; 1223 }; 1224 1225 struct rtw89_pci_ch_dma_addr { 1226 u32 num; 1227 u32 idx; 1228 u32 bdram; 1229 u32 desa_l; 1230 u32 desa_h; 1231 }; 1232 1233 struct rtw89_pci_ch_dma_addr_set { 1234 struct rtw89_pci_ch_dma_addr tx[RTW89_TXCH_NUM]; 1235 struct rtw89_pci_ch_dma_addr rx[RTW89_RXCH_NUM]; 1236 }; 1237 1238 struct rtw89_pci_bd_ram { 1239 u8 start_idx; 1240 u8 max_num; 1241 u8 min_num; 1242 }; 1243 1244 struct rtw89_pci_gen_def { 1245 u32 isr_rdu; 1246 u32 isr_halt_c2h; 1247 u32 isr_wdt_timeout; 1248 struct rtw89_reg2_def isr_clear_rpq; 1249 struct rtw89_reg2_def isr_clear_rxq; 1250 1251 int (*mac_pre_init)(struct rtw89_dev *rtwdev); 1252 int (*mac_pre_deinit)(struct rtw89_dev *rtwdev); 1253 int (*mac_post_init)(struct rtw89_dev *rtwdev); 1254 1255 void (*clr_idx_all)(struct rtw89_dev *rtwdev); 1256 int (*rst_bdram)(struct rtw89_dev *rtwdev); 1257 1258 int (*lv1rst_stop_dma)(struct rtw89_dev *rtwdev); 1259 int (*lv1rst_start_dma)(struct rtw89_dev *rtwdev); 1260 1261 void (*ctrl_txdma_ch)(struct rtw89_dev *rtwdev, bool enable); 1262 void (*ctrl_txdma_fw_ch)(struct rtw89_dev *rtwdev, bool enable); 1263 int (*poll_txdma_ch_idle)(struct rtw89_dev *rtwdev); 1264 1265 void (*aspm_set)(struct rtw89_dev *rtwdev, bool enable); 1266 void (*clkreq_set)(struct rtw89_dev *rtwdev, bool enable); 1267 void (*l1ss_set)(struct rtw89_dev *rtwdev, bool enable); 1268 }; 1269 1270 struct rtw89_pci_info { 1271 const struct rtw89_pci_gen_def *gen_def; 1272 enum mac_ax_bd_trunc_mode txbd_trunc_mode; 1273 enum mac_ax_bd_trunc_mode rxbd_trunc_mode; 1274 enum mac_ax_rxbd_mode rxbd_mode; 1275 enum mac_ax_tag_mode tag_mode; 1276 enum mac_ax_tx_burst tx_burst; 1277 enum mac_ax_rx_burst rx_burst; 1278 enum mac_ax_wd_dma_intvl wd_dma_idle_intvl; 1279 enum mac_ax_wd_dma_intvl wd_dma_act_intvl; 1280 enum mac_ax_multi_tag_num multi_tag_num; 1281 enum mac_ax_pcie_func_ctrl lbc_en; 1282 enum mac_ax_lbc_tmr lbc_tmr; 1283 enum mac_ax_pcie_func_ctrl autok_en; 1284 enum mac_ax_pcie_func_ctrl io_rcy_en; 1285 enum mac_ax_io_rcy_tmr io_rcy_tmr; 1286 bool rx_ring_eq_is_full; 1287 bool check_rx_tag; 1288 1289 u32 init_cfg_reg; 1290 u32 txhci_en_bit; 1291 u32 rxhci_en_bit; 1292 u32 rxbd_mode_bit; 1293 u32 exp_ctrl_reg; 1294 u32 max_tag_num_mask; 1295 u32 rxbd_rwptr_clr_reg; 1296 u32 txbd_rwptr_clr2_reg; 1297 struct rtw89_reg_def dma_io_stop; 1298 struct rtw89_reg_def dma_stop1; 1299 struct rtw89_reg_def dma_stop2; 1300 struct rtw89_reg_def dma_busy1; 1301 u32 dma_busy2_reg; 1302 u32 dma_busy3_reg; 1303 1304 u32 rpwm_addr; 1305 u32 cpwm_addr; 1306 u32 mit_addr; 1307 u32 tx_dma_ch_mask; 1308 const struct rtw89_pci_bd_idx_addr *bd_idx_addr_low_power; 1309 const struct rtw89_pci_ch_dma_addr_set *dma_addr_set; 1310 const struct rtw89_pci_bd_ram (*bd_ram_table)[RTW89_TXCH_NUM]; 1311 1312 int (*ltr_set)(struct rtw89_dev *rtwdev, bool en); 1313 u32 (*fill_txaddr_info)(struct rtw89_dev *rtwdev, 1314 void *txaddr_info_addr, u32 total_len, 1315 dma_addr_t dma, u8 *add_info_nr); 1316 void (*config_intr_mask)(struct rtw89_dev *rtwdev); 1317 void (*enable_intr)(struct rtw89_dev *rtwdev, struct rtw89_pci *rtwpci); 1318 void (*disable_intr)(struct rtw89_dev *rtwdev, struct rtw89_pci *rtwpci); 1319 void (*recognize_intrs)(struct rtw89_dev *rtwdev, 1320 struct rtw89_pci *rtwpci, 1321 struct rtw89_pci_isrs *isrs); 1322 }; 1323 1324 struct rtw89_pci_tx_data { 1325 dma_addr_t dma; 1326 }; 1327 1328 struct rtw89_pci_rx_info { 1329 dma_addr_t dma; 1330 u32 fs:1, ls:1, tag:13, len:14; 1331 }; 1332 1333 #define RTW89_PCI_TXBD_OPTION_LS BIT(14) 1334 1335 struct rtw89_pci_tx_bd_32 { 1336 __le16 length; 1337 __le16 option; 1338 __le32 dma; 1339 } __packed; 1340 1341 #define RTW89_PCI_TXWP_VALID BIT(15) 1342 1343 struct rtw89_pci_tx_wp_info { 1344 __le16 seq0; 1345 __le16 seq1; 1346 __le16 seq2; 1347 __le16 seq3; 1348 } __packed; 1349 1350 #define RTW89_PCI_ADDR_MSDU_LS BIT(15) 1351 #define RTW89_PCI_ADDR_LS BIT(14) 1352 #define RTW89_PCI_ADDR_HIGH(a) (((a) << 6) & GENMASK(13, 6)) 1353 #define RTW89_PCI_ADDR_NUM(x) ((x) & GENMASK(5, 0)) 1354 1355 struct rtw89_pci_tx_addr_info_32 { 1356 __le16 length; 1357 __le16 option; 1358 __le32 dma; 1359 } __packed; 1360 1361 #define RTW89_TXADDR_INFO_NR_V1 10 1362 1363 struct rtw89_pci_tx_addr_info_32_v1 { 1364 __le16 length_opt; 1365 #define B_PCIADDR_LEN_V1_MASK GENMASK(10, 0) 1366 #define B_PCIADDR_HIGH_SEL_V1_MASK GENMASK(14, 11) 1367 #define B_PCIADDR_LS_V1_MASK BIT(15) 1368 #define TXADDR_INFO_LENTHG_V1_MAX ALIGN_DOWN(BIT(11) - 1, 4) 1369 __le16 dma_low_lsb; 1370 __le16 dma_low_msb; 1371 } __packed; 1372 1373 #define RTW89_PCI_RPP_POLLUTED BIT(31) 1374 #define RTW89_PCI_RPP_SEQ GENMASK(30, 16) 1375 #define RTW89_PCI_RPP_TX_STATUS GENMASK(15, 13) 1376 #define RTW89_TX_DONE 0x0 1377 #define RTW89_TX_RETRY_LIMIT 0x1 1378 #define RTW89_TX_LIFE_TIME 0x2 1379 #define RTW89_TX_MACID_DROP 0x3 1380 #define RTW89_PCI_RPP_QSEL GENMASK(12, 8) 1381 #define RTW89_PCI_RPP_MACID GENMASK(7, 0) 1382 1383 struct rtw89_pci_rpp_fmt { 1384 __le32 dword; 1385 } __packed; 1386 1387 struct rtw89_pci_rx_bd_32 { 1388 __le16 buf_size; 1389 __le16 rsvd; 1390 __le32 dma; 1391 } __packed; 1392 1393 #define RTW89_PCI_RXBD_FS BIT(15) 1394 #define RTW89_PCI_RXBD_LS BIT(14) 1395 #define RTW89_PCI_RXBD_WRITE_SIZE GENMASK(13, 0) 1396 #define RTW89_PCI_RXBD_TAG GENMASK(28, 16) 1397 1398 struct rtw89_pci_rxbd_info { 1399 __le32 dword; 1400 }; 1401 1402 struct rtw89_pci_tx_wd { 1403 struct list_head list; 1404 struct sk_buff_head queue; 1405 1406 void *vaddr; 1407 dma_addr_t paddr; 1408 u32 len; 1409 u32 seq; 1410 }; 1411 1412 struct rtw89_pci_dma_ring { 1413 void *head; 1414 u8 desc_size; 1415 dma_addr_t dma; 1416 1417 struct rtw89_pci_ch_dma_addr addr; 1418 1419 u32 len; 1420 u32 wp; /* host idx */ 1421 u32 rp; /* hw idx */ 1422 }; 1423 1424 struct rtw89_pci_tx_wd_ring { 1425 void *head; 1426 dma_addr_t dma; 1427 1428 struct rtw89_pci_tx_wd pages[RTW89_PCI_TXWD_NUM_MAX]; 1429 struct list_head free_pages; 1430 1431 u32 page_size; 1432 u32 page_num; 1433 u32 curr_num; 1434 }; 1435 1436 #define RTW89_RX_TAG_MAX 0x1fff 1437 1438 struct rtw89_pci_tx_ring { 1439 struct rtw89_pci_tx_wd_ring wd_ring; 1440 struct rtw89_pci_dma_ring bd_ring; 1441 struct list_head busy_pages; 1442 u8 txch; 1443 bool dma_enabled; 1444 u16 tag; /* range from 0x0001 ~ 0x1fff */ 1445 1446 u64 tx_cnt; 1447 u64 tx_acked; 1448 u64 tx_retry_lmt; 1449 u64 tx_life_time; 1450 u64 tx_mac_id_drop; 1451 }; 1452 1453 struct rtw89_pci_rx_ring { 1454 struct rtw89_pci_dma_ring bd_ring; 1455 struct sk_buff *buf[RTW89_PCI_RXBD_NUM_MAX]; 1456 u32 buf_sz; 1457 struct sk_buff *diliver_skb; 1458 struct rtw89_rx_desc_info diliver_desc; 1459 u32 target_rx_tag:13; 1460 }; 1461 1462 struct rtw89_pci_isrs { 1463 u32 ind_isrs; 1464 u32 halt_c2h_isrs; 1465 u32 isrs[2]; 1466 }; 1467 1468 struct rtw89_pci { 1469 struct pci_dev *pdev; 1470 1471 /* protect HW irq related registers */ 1472 spinlock_t irq_lock; 1473 /* protect TRX resources (exclude RXQ) */ 1474 spinlock_t trx_lock; 1475 bool running; 1476 bool low_power; 1477 bool under_recovery; 1478 struct rtw89_pci_tx_ring tx_rings[RTW89_TXCH_NUM]; 1479 struct rtw89_pci_rx_ring rx_rings[RTW89_RXCH_NUM]; 1480 struct sk_buff_head h2c_queue; 1481 struct sk_buff_head h2c_release_queue; 1482 DECLARE_BITMAP(kick_map, RTW89_TXCH_NUM); 1483 1484 u32 ind_intrs; 1485 u32 halt_c2h_intrs; 1486 u32 intrs[2]; 1487 void __iomem *mmap; 1488 }; 1489 1490 static inline struct rtw89_pci_rx_info *RTW89_PCI_RX_SKB_CB(struct sk_buff *skb) 1491 { 1492 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1493 1494 BUILD_BUG_ON(sizeof(struct rtw89_pci_tx_data) > 1495 sizeof(info->status.status_driver_data)); 1496 1497 return (struct rtw89_pci_rx_info *)skb->cb; 1498 } 1499 1500 static inline struct rtw89_pci_rx_bd_32 * 1501 RTW89_PCI_RX_BD(struct rtw89_pci_rx_ring *rx_ring, u32 idx) 1502 { 1503 struct rtw89_pci_dma_ring *bd_ring = &rx_ring->bd_ring; 1504 u8 *head = bd_ring->head; 1505 u32 desc_size = bd_ring->desc_size; 1506 u32 offset = idx * desc_size; 1507 1508 return (struct rtw89_pci_rx_bd_32 *)(head + offset); 1509 } 1510 1511 static inline void 1512 rtw89_pci_rxbd_increase(struct rtw89_pci_rx_ring *rx_ring, u32 cnt) 1513 { 1514 struct rtw89_pci_dma_ring *bd_ring = &rx_ring->bd_ring; 1515 1516 bd_ring->wp += cnt; 1517 1518 if (bd_ring->wp >= bd_ring->len) 1519 bd_ring->wp -= bd_ring->len; 1520 } 1521 1522 static inline struct rtw89_pci_tx_data *RTW89_PCI_TX_SKB_CB(struct sk_buff *skb) 1523 { 1524 struct rtw89_tx_skb_data *data = RTW89_TX_SKB_CB(skb); 1525 1526 return (struct rtw89_pci_tx_data *)data->hci_priv; 1527 } 1528 1529 static inline struct rtw89_pci_tx_bd_32 * 1530 rtw89_pci_get_next_txbd(struct rtw89_pci_tx_ring *tx_ring) 1531 { 1532 struct rtw89_pci_dma_ring *bd_ring = &tx_ring->bd_ring; 1533 struct rtw89_pci_tx_bd_32 *tx_bd, *head; 1534 1535 head = bd_ring->head; 1536 tx_bd = head + bd_ring->wp; 1537 1538 return tx_bd; 1539 } 1540 1541 static inline struct rtw89_pci_tx_wd * 1542 rtw89_pci_dequeue_txwd(struct rtw89_pci_tx_ring *tx_ring) 1543 { 1544 struct rtw89_pci_tx_wd_ring *wd_ring = &tx_ring->wd_ring; 1545 struct rtw89_pci_tx_wd *txwd; 1546 1547 txwd = list_first_entry_or_null(&wd_ring->free_pages, 1548 struct rtw89_pci_tx_wd, list); 1549 if (!txwd) 1550 return NULL; 1551 1552 list_del_init(&txwd->list); 1553 txwd->len = 0; 1554 wd_ring->curr_num--; 1555 1556 return txwd; 1557 } 1558 1559 static inline void 1560 rtw89_pci_enqueue_txwd(struct rtw89_pci_tx_ring *tx_ring, 1561 struct rtw89_pci_tx_wd *txwd) 1562 { 1563 struct rtw89_pci_tx_wd_ring *wd_ring = &tx_ring->wd_ring; 1564 1565 memset(txwd->vaddr, 0, wd_ring->page_size); 1566 list_add_tail(&txwd->list, &wd_ring->free_pages); 1567 wd_ring->curr_num++; 1568 } 1569 1570 static inline bool rtw89_pci_ltr_is_err_reg_val(u32 val) 1571 { 1572 return val == 0xffffffff || val == 0xeaeaeaea; 1573 } 1574 1575 extern const struct dev_pm_ops rtw89_pm_ops; 1576 extern const struct dev_pm_ops rtw89_pm_ops_be; 1577 extern const struct rtw89_pci_ch_dma_addr_set rtw89_pci_ch_dma_addr_set; 1578 extern const struct rtw89_pci_ch_dma_addr_set rtw89_pci_ch_dma_addr_set_v1; 1579 extern const struct rtw89_pci_ch_dma_addr_set rtw89_pci_ch_dma_addr_set_be; 1580 extern const struct rtw89_pci_bd_ram rtw89_bd_ram_table_dual[RTW89_TXCH_NUM]; 1581 extern const struct rtw89_pci_bd_ram rtw89_bd_ram_table_single[RTW89_TXCH_NUM]; 1582 extern const struct rtw89_pci_gen_def rtw89_pci_gen_ax; 1583 extern const struct rtw89_pci_gen_def rtw89_pci_gen_be; 1584 1585 struct pci_device_id; 1586 1587 int rtw89_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id); 1588 void rtw89_pci_remove(struct pci_dev *pdev); 1589 void rtw89_pci_ops_reset(struct rtw89_dev *rtwdev); 1590 int rtw89_pci_ltr_set(struct rtw89_dev *rtwdev, bool en); 1591 int rtw89_pci_ltr_set_v1(struct rtw89_dev *rtwdev, bool en); 1592 int rtw89_pci_ltr_set_v2(struct rtw89_dev *rtwdev, bool en); 1593 u32 rtw89_pci_fill_txaddr_info(struct rtw89_dev *rtwdev, 1594 void *txaddr_info_addr, u32 total_len, 1595 dma_addr_t dma, u8 *add_info_nr); 1596 u32 rtw89_pci_fill_txaddr_info_v1(struct rtw89_dev *rtwdev, 1597 void *txaddr_info_addr, u32 total_len, 1598 dma_addr_t dma, u8 *add_info_nr); 1599 void rtw89_pci_ctrl_dma_all(struct rtw89_dev *rtwdev, bool enable); 1600 void rtw89_pci_config_intr_mask(struct rtw89_dev *rtwdev); 1601 void rtw89_pci_config_intr_mask_v1(struct rtw89_dev *rtwdev); 1602 void rtw89_pci_config_intr_mask_v2(struct rtw89_dev *rtwdev); 1603 void rtw89_pci_enable_intr(struct rtw89_dev *rtwdev, struct rtw89_pci *rtwpci); 1604 void rtw89_pci_disable_intr(struct rtw89_dev *rtwdev, struct rtw89_pci *rtwpci); 1605 void rtw89_pci_enable_intr_v1(struct rtw89_dev *rtwdev, struct rtw89_pci *rtwpci); 1606 void rtw89_pci_disable_intr_v1(struct rtw89_dev *rtwdev, struct rtw89_pci *rtwpci); 1607 void rtw89_pci_enable_intr_v2(struct rtw89_dev *rtwdev, struct rtw89_pci *rtwpci); 1608 void rtw89_pci_disable_intr_v2(struct rtw89_dev *rtwdev, struct rtw89_pci *rtwpci); 1609 void rtw89_pci_recognize_intrs(struct rtw89_dev *rtwdev, 1610 struct rtw89_pci *rtwpci, 1611 struct rtw89_pci_isrs *isrs); 1612 void rtw89_pci_recognize_intrs_v1(struct rtw89_dev *rtwdev, 1613 struct rtw89_pci *rtwpci, 1614 struct rtw89_pci_isrs *isrs); 1615 void rtw89_pci_recognize_intrs_v2(struct rtw89_dev *rtwdev, 1616 struct rtw89_pci *rtwpci, 1617 struct rtw89_pci_isrs *isrs); 1618 1619 static inline 1620 u32 rtw89_chip_fill_txaddr_info(struct rtw89_dev *rtwdev, 1621 void *txaddr_info_addr, u32 total_len, 1622 dma_addr_t dma, u8 *add_info_nr) 1623 { 1624 const struct rtw89_pci_info *info = rtwdev->pci_info; 1625 1626 return info->fill_txaddr_info(rtwdev, txaddr_info_addr, total_len, 1627 dma, add_info_nr); 1628 } 1629 1630 static inline void rtw89_chip_config_intr_mask(struct rtw89_dev *rtwdev, 1631 enum rtw89_pci_intr_mask_cfg cfg) 1632 { 1633 struct rtw89_pci *rtwpci = (struct rtw89_pci *)rtwdev->priv; 1634 const struct rtw89_pci_info *info = rtwdev->pci_info; 1635 1636 switch (cfg) { 1637 default: 1638 case RTW89_PCI_INTR_MASK_RESET: 1639 rtwpci->low_power = false; 1640 rtwpci->under_recovery = false; 1641 break; 1642 case RTW89_PCI_INTR_MASK_NORMAL: 1643 rtwpci->low_power = false; 1644 break; 1645 case RTW89_PCI_INTR_MASK_LOW_POWER: 1646 rtwpci->low_power = true; 1647 break; 1648 case RTW89_PCI_INTR_MASK_RECOVERY_START: 1649 rtwpci->under_recovery = true; 1650 break; 1651 case RTW89_PCI_INTR_MASK_RECOVERY_COMPLETE: 1652 rtwpci->under_recovery = false; 1653 break; 1654 } 1655 1656 rtw89_debug(rtwdev, RTW89_DBG_HCI, 1657 "Configure PCI interrupt mask mode low_power=%d under_recovery=%d\n", 1658 rtwpci->low_power, rtwpci->under_recovery); 1659 1660 info->config_intr_mask(rtwdev); 1661 } 1662 1663 static inline 1664 void rtw89_chip_enable_intr(struct rtw89_dev *rtwdev, struct rtw89_pci *rtwpci) 1665 { 1666 const struct rtw89_pci_info *info = rtwdev->pci_info; 1667 1668 info->enable_intr(rtwdev, rtwpci); 1669 } 1670 1671 static inline 1672 void rtw89_chip_disable_intr(struct rtw89_dev *rtwdev, struct rtw89_pci *rtwpci) 1673 { 1674 const struct rtw89_pci_info *info = rtwdev->pci_info; 1675 1676 info->disable_intr(rtwdev, rtwpci); 1677 } 1678 1679 static inline 1680 void rtw89_chip_recognize_intrs(struct rtw89_dev *rtwdev, 1681 struct rtw89_pci *rtwpci, 1682 struct rtw89_pci_isrs *isrs) 1683 { 1684 const struct rtw89_pci_info *info = rtwdev->pci_info; 1685 1686 info->recognize_intrs(rtwdev, rtwpci, isrs); 1687 } 1688 1689 static inline int rtw89_pci_ops_mac_pre_init(struct rtw89_dev *rtwdev) 1690 { 1691 const struct rtw89_pci_info *info = rtwdev->pci_info; 1692 const struct rtw89_pci_gen_def *gen_def = info->gen_def; 1693 1694 return gen_def->mac_pre_init(rtwdev); 1695 } 1696 1697 static inline int rtw89_pci_ops_mac_pre_deinit(struct rtw89_dev *rtwdev) 1698 { 1699 const struct rtw89_pci_info *info = rtwdev->pci_info; 1700 const struct rtw89_pci_gen_def *gen_def = info->gen_def; 1701 1702 if (!gen_def->mac_pre_deinit) 1703 return 0; 1704 1705 return gen_def->mac_pre_deinit(rtwdev); 1706 } 1707 1708 static inline int rtw89_pci_ops_mac_post_init(struct rtw89_dev *rtwdev) 1709 { 1710 const struct rtw89_pci_info *info = rtwdev->pci_info; 1711 const struct rtw89_pci_gen_def *gen_def = info->gen_def; 1712 1713 return gen_def->mac_post_init(rtwdev); 1714 } 1715 1716 static inline void rtw89_pci_clr_idx_all(struct rtw89_dev *rtwdev) 1717 { 1718 const struct rtw89_pci_info *info = rtwdev->pci_info; 1719 const struct rtw89_pci_gen_def *gen_def = info->gen_def; 1720 1721 gen_def->clr_idx_all(rtwdev); 1722 } 1723 1724 static inline int rtw89_pci_reset_bdram(struct rtw89_dev *rtwdev) 1725 { 1726 const struct rtw89_pci_info *info = rtwdev->pci_info; 1727 const struct rtw89_pci_gen_def *gen_def = info->gen_def; 1728 1729 return gen_def->rst_bdram(rtwdev); 1730 } 1731 1732 static inline void rtw89_pci_ctrl_txdma_ch(struct rtw89_dev *rtwdev, bool enable) 1733 { 1734 const struct rtw89_pci_info *info = rtwdev->pci_info; 1735 const struct rtw89_pci_gen_def *gen_def = info->gen_def; 1736 1737 return gen_def->ctrl_txdma_ch(rtwdev, enable); 1738 } 1739 1740 static inline void rtw89_pci_ctrl_txdma_fw_ch(struct rtw89_dev *rtwdev, bool enable) 1741 { 1742 const struct rtw89_pci_info *info = rtwdev->pci_info; 1743 const struct rtw89_pci_gen_def *gen_def = info->gen_def; 1744 1745 return gen_def->ctrl_txdma_fw_ch(rtwdev, enable); 1746 } 1747 1748 static inline int rtw89_pci_poll_txdma_ch_idle(struct rtw89_dev *rtwdev) 1749 { 1750 const struct rtw89_pci_info *info = rtwdev->pci_info; 1751 const struct rtw89_pci_gen_def *gen_def = info->gen_def; 1752 1753 return gen_def->poll_txdma_ch_idle(rtwdev); 1754 } 1755 #endif 1756