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