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