1 /*
2  * aQuantia Corporation Network Driver
3  * Copyright (C) 2014-2017 aQuantia Corporation. All rights reserved
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  */
9 
10 /* File hw_atl_llh.c: Definitions of bitfield and register access functions for
11  * Atlantic registers.
12  */
13 
14 #include "hw_atl_llh.h"
15 #include "hw_atl_llh_internal.h"
16 #include "../aq_hw_utils.h"
17 
18 /* global */
hw_atl_reg_glb_cpu_sem_set(struct aq_hw_s * aq_hw,u32 glb_cpu_sem,u32 semaphore)19 void hw_atl_reg_glb_cpu_sem_set(struct aq_hw_s *aq_hw, u32 glb_cpu_sem,
20 				u32 semaphore)
21 {
22 	aq_hw_write_reg(aq_hw, HW_ATL_GLB_CPU_SEM_ADR(semaphore), glb_cpu_sem);
23 }
24 
hw_atl_reg_glb_cpu_sem_get(struct aq_hw_s * aq_hw,u32 semaphore)25 u32 hw_atl_reg_glb_cpu_sem_get(struct aq_hw_s *aq_hw, u32 semaphore)
26 {
27 	return aq_hw_read_reg(aq_hw, HW_ATL_GLB_CPU_SEM_ADR(semaphore));
28 }
29 
hw_atl_glb_glb_reg_res_dis_set(struct aq_hw_s * aq_hw,u32 glb_reg_res_dis)30 void hw_atl_glb_glb_reg_res_dis_set(struct aq_hw_s *aq_hw, u32 glb_reg_res_dis)
31 {
32 	aq_hw_write_reg_bit(aq_hw, HW_ATL_GLB_REG_RES_DIS_ADR,
33 			    HW_ATL_GLB_REG_RES_DIS_MSK,
34 			    HW_ATL_GLB_REG_RES_DIS_SHIFT,
35 			    glb_reg_res_dis);
36 }
37 
hw_atl_glb_soft_res_set(struct aq_hw_s * aq_hw,u32 soft_res)38 void hw_atl_glb_soft_res_set(struct aq_hw_s *aq_hw, u32 soft_res)
39 {
40 	aq_hw_write_reg_bit(aq_hw, HW_ATL_GLB_SOFT_RES_ADR,
41 			    HW_ATL_GLB_SOFT_RES_MSK,
42 			    HW_ATL_GLB_SOFT_RES_SHIFT, soft_res);
43 }
44 
hw_atl_glb_soft_res_get(struct aq_hw_s * aq_hw)45 u32 hw_atl_glb_soft_res_get(struct aq_hw_s *aq_hw)
46 {
47 	return aq_hw_read_reg_bit(aq_hw, HW_ATL_GLB_SOFT_RES_ADR,
48 				  HW_ATL_GLB_SOFT_RES_MSK,
49 				  HW_ATL_GLB_SOFT_RES_SHIFT);
50 }
51 
hw_atl_reg_rx_dma_stat_counter7get(struct aq_hw_s * aq_hw)52 u32 hw_atl_reg_rx_dma_stat_counter7get(struct aq_hw_s *aq_hw)
53 {
54 	return aq_hw_read_reg(aq_hw, HW_ATL_RX_DMA_STAT_COUNTER7_ADR);
55 }
56 
hw_atl_reg_glb_mif_id_get(struct aq_hw_s * aq_hw)57 u32 hw_atl_reg_glb_mif_id_get(struct aq_hw_s *aq_hw)
58 {
59 	return aq_hw_read_reg(aq_hw, HW_ATL_GLB_MIF_ID_ADR);
60 }
61 
62 /* stats */
hw_atl_rpb_rx_dma_drop_pkt_cnt_get(struct aq_hw_s * aq_hw)63 u32 hw_atl_rpb_rx_dma_drop_pkt_cnt_get(struct aq_hw_s *aq_hw)
64 {
65 	return aq_hw_read_reg(aq_hw, HW_ATL_RPB_RX_DMA_DROP_PKT_CNT_ADR);
66 }
67 
hw_atl_stats_rx_dma_good_octet_counterlsw_get(struct aq_hw_s * aq_hw)68 u32 hw_atl_stats_rx_dma_good_octet_counterlsw_get(struct aq_hw_s *aq_hw)
69 {
70 	return aq_hw_read_reg(aq_hw, HW_ATL_STATS_RX_DMA_GOOD_OCTET_COUNTERLSW);
71 }
72 
hw_atl_stats_rx_dma_good_pkt_counterlsw_get(struct aq_hw_s * aq_hw)73 u32 hw_atl_stats_rx_dma_good_pkt_counterlsw_get(struct aq_hw_s *aq_hw)
74 {
75 	return aq_hw_read_reg(aq_hw, HW_ATL_STATS_RX_DMA_GOOD_PKT_COUNTERLSW);
76 }
77 
hw_atl_stats_tx_dma_good_octet_counterlsw_get(struct aq_hw_s * aq_hw)78 u32 hw_atl_stats_tx_dma_good_octet_counterlsw_get(struct aq_hw_s *aq_hw)
79 {
80 	return aq_hw_read_reg(aq_hw, HW_ATL_STATS_TX_DMA_GOOD_OCTET_COUNTERLSW);
81 }
82 
hw_atl_stats_tx_dma_good_pkt_counterlsw_get(struct aq_hw_s * aq_hw)83 u32 hw_atl_stats_tx_dma_good_pkt_counterlsw_get(struct aq_hw_s *aq_hw)
84 {
85 	return aq_hw_read_reg(aq_hw, HW_ATL_STATS_TX_DMA_GOOD_PKT_COUNTERLSW);
86 }
87 
hw_atl_stats_rx_dma_good_octet_countermsw_get(struct aq_hw_s * aq_hw)88 u32 hw_atl_stats_rx_dma_good_octet_countermsw_get(struct aq_hw_s *aq_hw)
89 {
90 	return aq_hw_read_reg(aq_hw, HW_ATL_STATS_RX_DMA_GOOD_OCTET_COUNTERMSW);
91 }
92 
hw_atl_stats_rx_dma_good_pkt_countermsw_get(struct aq_hw_s * aq_hw)93 u32 hw_atl_stats_rx_dma_good_pkt_countermsw_get(struct aq_hw_s *aq_hw)
94 {
95 	return aq_hw_read_reg(aq_hw, HW_ATL_STATS_RX_DMA_GOOD_PKT_COUNTERMSW);
96 }
97 
hw_atl_stats_tx_dma_good_octet_countermsw_get(struct aq_hw_s * aq_hw)98 u32 hw_atl_stats_tx_dma_good_octet_countermsw_get(struct aq_hw_s *aq_hw)
99 {
100 	return aq_hw_read_reg(aq_hw, HW_ATL_STATS_TX_DMA_GOOD_OCTET_COUNTERMSW);
101 }
102 
hw_atl_stats_tx_dma_good_pkt_countermsw_get(struct aq_hw_s * aq_hw)103 u32 hw_atl_stats_tx_dma_good_pkt_countermsw_get(struct aq_hw_s *aq_hw)
104 {
105 	return aq_hw_read_reg(aq_hw, HW_ATL_STATS_TX_DMA_GOOD_PKT_COUNTERMSW);
106 }
107 
108 /* interrupt */
hw_atl_itr_irq_auto_masklsw_set(struct aq_hw_s * aq_hw,u32 irq_auto_masklsw)109 void hw_atl_itr_irq_auto_masklsw_set(struct aq_hw_s *aq_hw,
110 				     u32 irq_auto_masklsw)
111 {
112 	aq_hw_write_reg(aq_hw, HW_ATL_ITR_IAMRLSW_ADR, irq_auto_masklsw);
113 }
114 
hw_atl_itr_irq_map_en_rx_set(struct aq_hw_s * aq_hw,u32 irq_map_en_rx,u32 rx)115 void hw_atl_itr_irq_map_en_rx_set(struct aq_hw_s *aq_hw, u32 irq_map_en_rx,
116 				  u32 rx)
117 {
118 /* register address for bitfield imr_rx{r}_en */
119 	static u32 itr_imr_rxren_adr[32] = {
120 			0x00002100U, 0x00002100U, 0x00002104U, 0x00002104U,
121 			0x00002108U, 0x00002108U, 0x0000210CU, 0x0000210CU,
122 			0x00002110U, 0x00002110U, 0x00002114U, 0x00002114U,
123 			0x00002118U, 0x00002118U, 0x0000211CU, 0x0000211CU,
124 			0x00002120U, 0x00002120U, 0x00002124U, 0x00002124U,
125 			0x00002128U, 0x00002128U, 0x0000212CU, 0x0000212CU,
126 			0x00002130U, 0x00002130U, 0x00002134U, 0x00002134U,
127 			0x00002138U, 0x00002138U, 0x0000213CU, 0x0000213CU
128 		};
129 
130 /* bitmask for bitfield imr_rx{r}_en */
131 	static u32 itr_imr_rxren_msk[32] = {
132 			0x00008000U, 0x00000080U, 0x00008000U, 0x00000080U,
133 			0x00008000U, 0x00000080U, 0x00008000U, 0x00000080U,
134 			0x00008000U, 0x00000080U, 0x00008000U, 0x00000080U,
135 			0x00008000U, 0x00000080U, 0x00008000U, 0x00000080U,
136 			0x00008000U, 0x00000080U, 0x00008000U, 0x00000080U,
137 			0x00008000U, 0x00000080U, 0x00008000U, 0x00000080U,
138 			0x00008000U, 0x00000080U, 0x00008000U, 0x00000080U,
139 			0x00008000U, 0x00000080U, 0x00008000U, 0x00000080U
140 		};
141 
142 /* lower bit position of bitfield imr_rx{r}_en */
143 	static u32 itr_imr_rxren_shift[32] = {
144 			15U, 7U, 15U, 7U, 15U, 7U, 15U, 7U,
145 			15U, 7U, 15U, 7U, 15U, 7U, 15U, 7U,
146 			15U, 7U, 15U, 7U, 15U, 7U, 15U, 7U,
147 			15U, 7U, 15U, 7U, 15U, 7U, 15U, 7U
148 		};
149 
150 	aq_hw_write_reg_bit(aq_hw, itr_imr_rxren_adr[rx],
151 			    itr_imr_rxren_msk[rx],
152 			    itr_imr_rxren_shift[rx],
153 			    irq_map_en_rx);
154 }
155 
hw_atl_itr_irq_map_en_tx_set(struct aq_hw_s * aq_hw,u32 irq_map_en_tx,u32 tx)156 void hw_atl_itr_irq_map_en_tx_set(struct aq_hw_s *aq_hw, u32 irq_map_en_tx,
157 				  u32 tx)
158 {
159 /* register address for bitfield imr_tx{t}_en */
160 	static u32 itr_imr_txten_adr[32] = {
161 			0x00002100U, 0x00002100U, 0x00002104U, 0x00002104U,
162 			0x00002108U, 0x00002108U, 0x0000210CU, 0x0000210CU,
163 			0x00002110U, 0x00002110U, 0x00002114U, 0x00002114U,
164 			0x00002118U, 0x00002118U, 0x0000211CU, 0x0000211CU,
165 			0x00002120U, 0x00002120U, 0x00002124U, 0x00002124U,
166 			0x00002128U, 0x00002128U, 0x0000212CU, 0x0000212CU,
167 			0x00002130U, 0x00002130U, 0x00002134U, 0x00002134U,
168 			0x00002138U, 0x00002138U, 0x0000213CU, 0x0000213CU
169 		};
170 
171 /* bitmask for bitfield imr_tx{t}_en */
172 	static u32 itr_imr_txten_msk[32] = {
173 			0x80000000U, 0x00800000U, 0x80000000U, 0x00800000U,
174 			0x80000000U, 0x00800000U, 0x80000000U, 0x00800000U,
175 			0x80000000U, 0x00800000U, 0x80000000U, 0x00800000U,
176 			0x80000000U, 0x00800000U, 0x80000000U, 0x00800000U,
177 			0x80000000U, 0x00800000U, 0x80000000U, 0x00800000U,
178 			0x80000000U, 0x00800000U, 0x80000000U, 0x00800000U,
179 			0x80000000U, 0x00800000U, 0x80000000U, 0x00800000U,
180 			0x80000000U, 0x00800000U, 0x80000000U, 0x00800000U
181 		};
182 
183 /* lower bit position of bitfield imr_tx{t}_en */
184 	static u32 itr_imr_txten_shift[32] = {
185 			31U, 23U, 31U, 23U, 31U, 23U, 31U, 23U,
186 			31U, 23U, 31U, 23U, 31U, 23U, 31U, 23U,
187 			31U, 23U, 31U, 23U, 31U, 23U, 31U, 23U,
188 			31U, 23U, 31U, 23U, 31U, 23U, 31U, 23U
189 		};
190 
191 	aq_hw_write_reg_bit(aq_hw, itr_imr_txten_adr[tx],
192 			    itr_imr_txten_msk[tx],
193 			    itr_imr_txten_shift[tx],
194 			    irq_map_en_tx);
195 }
196 
hw_atl_itr_irq_map_rx_set(struct aq_hw_s * aq_hw,u32 irq_map_rx,u32 rx)197 void hw_atl_itr_irq_map_rx_set(struct aq_hw_s *aq_hw, u32 irq_map_rx, u32 rx)
198 {
199 /* register address for bitfield imr_rx{r}[4:0] */
200 	static u32 itr_imr_rxr_adr[32] = {
201 			0x00002100U, 0x00002100U, 0x00002104U, 0x00002104U,
202 			0x00002108U, 0x00002108U, 0x0000210CU, 0x0000210CU,
203 			0x00002110U, 0x00002110U, 0x00002114U, 0x00002114U,
204 			0x00002118U, 0x00002118U, 0x0000211CU, 0x0000211CU,
205 			0x00002120U, 0x00002120U, 0x00002124U, 0x00002124U,
206 			0x00002128U, 0x00002128U, 0x0000212CU, 0x0000212CU,
207 			0x00002130U, 0x00002130U, 0x00002134U, 0x00002134U,
208 			0x00002138U, 0x00002138U, 0x0000213CU, 0x0000213CU
209 		};
210 
211 /* bitmask for bitfield imr_rx{r}[4:0] */
212 	static u32 itr_imr_rxr_msk[32] = {
213 			0x00001f00U, 0x0000001FU, 0x00001F00U, 0x0000001FU,
214 			0x00001f00U, 0x0000001FU, 0x00001F00U, 0x0000001FU,
215 			0x00001f00U, 0x0000001FU, 0x00001F00U, 0x0000001FU,
216 			0x00001f00U, 0x0000001FU, 0x00001F00U, 0x0000001FU,
217 			0x00001f00U, 0x0000001FU, 0x00001F00U, 0x0000001FU,
218 			0x00001f00U, 0x0000001FU, 0x00001F00U, 0x0000001FU,
219 			0x00001f00U, 0x0000001FU, 0x00001F00U, 0x0000001FU,
220 			0x00001f00U, 0x0000001FU, 0x00001F00U, 0x0000001FU
221 		};
222 
223 /* lower bit position of bitfield imr_rx{r}[4:0] */
224 	static u32 itr_imr_rxr_shift[32] = {
225 			8U, 0U, 8U, 0U, 8U, 0U, 8U, 0U,
226 			8U, 0U, 8U, 0U, 8U, 0U, 8U, 0U,
227 			8U, 0U, 8U, 0U, 8U, 0U, 8U, 0U,
228 			8U, 0U, 8U, 0U, 8U, 0U, 8U, 0U
229 		};
230 
231 	aq_hw_write_reg_bit(aq_hw, itr_imr_rxr_adr[rx],
232 			    itr_imr_rxr_msk[rx],
233 			    itr_imr_rxr_shift[rx],
234 			    irq_map_rx);
235 }
236 
hw_atl_itr_irq_map_tx_set(struct aq_hw_s * aq_hw,u32 irq_map_tx,u32 tx)237 void hw_atl_itr_irq_map_tx_set(struct aq_hw_s *aq_hw, u32 irq_map_tx, u32 tx)
238 {
239 /* register address for bitfield imr_tx{t}[4:0] */
240 	static u32 itr_imr_txt_adr[32] = {
241 			0x00002100U, 0x00002100U, 0x00002104U, 0x00002104U,
242 			0x00002108U, 0x00002108U, 0x0000210CU, 0x0000210CU,
243 			0x00002110U, 0x00002110U, 0x00002114U, 0x00002114U,
244 			0x00002118U, 0x00002118U, 0x0000211CU, 0x0000211CU,
245 			0x00002120U, 0x00002120U, 0x00002124U, 0x00002124U,
246 			0x00002128U, 0x00002128U, 0x0000212CU, 0x0000212CU,
247 			0x00002130U, 0x00002130U, 0x00002134U, 0x00002134U,
248 			0x00002138U, 0x00002138U, 0x0000213CU, 0x0000213CU
249 		};
250 
251 /* bitmask for bitfield imr_tx{t}[4:0] */
252 	static u32 itr_imr_txt_msk[32] = {
253 			0x1f000000U, 0x001F0000U, 0x1F000000U, 0x001F0000U,
254 			0x1f000000U, 0x001F0000U, 0x1F000000U, 0x001F0000U,
255 			0x1f000000U, 0x001F0000U, 0x1F000000U, 0x001F0000U,
256 			0x1f000000U, 0x001F0000U, 0x1F000000U, 0x001F0000U,
257 			0x1f000000U, 0x001F0000U, 0x1F000000U, 0x001F0000U,
258 			0x1f000000U, 0x001F0000U, 0x1F000000U, 0x001F0000U,
259 			0x1f000000U, 0x001F0000U, 0x1F000000U, 0x001F0000U,
260 			0x1f000000U, 0x001F0000U, 0x1F000000U, 0x001F0000U
261 		};
262 
263 /* lower bit position of bitfield imr_tx{t}[4:0] */
264 	static u32 itr_imr_txt_shift[32] = {
265 			24U, 16U, 24U, 16U, 24U, 16U, 24U, 16U,
266 			24U, 16U, 24U, 16U, 24U, 16U, 24U, 16U,
267 			24U, 16U, 24U, 16U, 24U, 16U, 24U, 16U,
268 			24U, 16U, 24U, 16U, 24U, 16U, 24U, 16U
269 		};
270 
271 	aq_hw_write_reg_bit(aq_hw, itr_imr_txt_adr[tx],
272 			    itr_imr_txt_msk[tx],
273 			    itr_imr_txt_shift[tx],
274 			    irq_map_tx);
275 }
276 
hw_atl_itr_irq_msk_clearlsw_set(struct aq_hw_s * aq_hw,u32 irq_msk_clearlsw)277 void hw_atl_itr_irq_msk_clearlsw_set(struct aq_hw_s *aq_hw,
278 				     u32 irq_msk_clearlsw)
279 {
280 	aq_hw_write_reg(aq_hw, HW_ATL_ITR_IMCRLSW_ADR, irq_msk_clearlsw);
281 }
282 
hw_atl_itr_irq_msk_setlsw_set(struct aq_hw_s * aq_hw,u32 irq_msk_setlsw)283 void hw_atl_itr_irq_msk_setlsw_set(struct aq_hw_s *aq_hw, u32 irq_msk_setlsw)
284 {
285 	aq_hw_write_reg(aq_hw, HW_ATL_ITR_IMSRLSW_ADR, irq_msk_setlsw);
286 }
287 
hw_atl_itr_irq_reg_res_dis_set(struct aq_hw_s * aq_hw,u32 irq_reg_res_dis)288 void hw_atl_itr_irq_reg_res_dis_set(struct aq_hw_s *aq_hw, u32 irq_reg_res_dis)
289 {
290 	aq_hw_write_reg_bit(aq_hw, HW_ATL_ITR_REG_RES_DSBL_ADR,
291 			    HW_ATL_ITR_REG_RES_DSBL_MSK,
292 			    HW_ATL_ITR_REG_RES_DSBL_SHIFT, irq_reg_res_dis);
293 }
294 
hw_atl_itr_irq_status_clearlsw_set(struct aq_hw_s * aq_hw,u32 irq_status_clearlsw)295 void hw_atl_itr_irq_status_clearlsw_set(struct aq_hw_s *aq_hw,
296 					u32 irq_status_clearlsw)
297 {
298 	aq_hw_write_reg(aq_hw, HW_ATL_ITR_ISCRLSW_ADR, irq_status_clearlsw);
299 }
300 
hw_atl_itr_irq_statuslsw_get(struct aq_hw_s * aq_hw)301 u32 hw_atl_itr_irq_statuslsw_get(struct aq_hw_s *aq_hw)
302 {
303 	return aq_hw_read_reg(aq_hw, HW_ATL_ITR_ISRLSW_ADR);
304 }
305 
hw_atl_itr_res_irq_get(struct aq_hw_s * aq_hw)306 u32 hw_atl_itr_res_irq_get(struct aq_hw_s *aq_hw)
307 {
308 	return aq_hw_read_reg_bit(aq_hw, HW_ATL_ITR_RES_ADR, HW_ATL_ITR_RES_MSK,
309 				  HW_ATL_ITR_RES_SHIFT);
310 }
311 
hw_atl_itr_res_irq_set(struct aq_hw_s * aq_hw,u32 res_irq)312 void hw_atl_itr_res_irq_set(struct aq_hw_s *aq_hw, u32 res_irq)
313 {
314 	aq_hw_write_reg_bit(aq_hw, HW_ATL_ITR_RES_ADR, HW_ATL_ITR_RES_MSK,
315 			    HW_ATL_ITR_RES_SHIFT, res_irq);
316 }
317 
318 /* rdm */
hw_atl_rdm_cpu_id_set(struct aq_hw_s * aq_hw,u32 cpuid,u32 dca)319 void hw_atl_rdm_cpu_id_set(struct aq_hw_s *aq_hw, u32 cpuid, u32 dca)
320 {
321 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RDM_DCADCPUID_ADR(dca),
322 			    HW_ATL_RDM_DCADCPUID_MSK,
323 			    HW_ATL_RDM_DCADCPUID_SHIFT, cpuid);
324 }
325 
hw_atl_rdm_rx_dca_en_set(struct aq_hw_s * aq_hw,u32 rx_dca_en)326 void hw_atl_rdm_rx_dca_en_set(struct aq_hw_s *aq_hw, u32 rx_dca_en)
327 {
328 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RDM_DCA_EN_ADR, HW_ATL_RDM_DCA_EN_MSK,
329 			    HW_ATL_RDM_DCA_EN_SHIFT, rx_dca_en);
330 }
331 
hw_atl_rdm_rx_dca_mode_set(struct aq_hw_s * aq_hw,u32 rx_dca_mode)332 void hw_atl_rdm_rx_dca_mode_set(struct aq_hw_s *aq_hw, u32 rx_dca_mode)
333 {
334 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RDM_DCA_MODE_ADR,
335 			    HW_ATL_RDM_DCA_MODE_MSK,
336 			    HW_ATL_RDM_DCA_MODE_SHIFT, rx_dca_mode);
337 }
338 
hw_atl_rdm_rx_desc_data_buff_size_set(struct aq_hw_s * aq_hw,u32 rx_desc_data_buff_size,u32 descriptor)339 void hw_atl_rdm_rx_desc_data_buff_size_set(struct aq_hw_s *aq_hw,
340 					   u32 rx_desc_data_buff_size,
341 					   u32 descriptor)
342 {
343 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RDM_DESCDDATA_SIZE_ADR(descriptor),
344 			    HW_ATL_RDM_DESCDDATA_SIZE_MSK,
345 			    HW_ATL_RDM_DESCDDATA_SIZE_SHIFT,
346 			    rx_desc_data_buff_size);
347 }
348 
hw_atl_rdm_rx_desc_dca_en_set(struct aq_hw_s * aq_hw,u32 rx_desc_dca_en,u32 dca)349 void hw_atl_rdm_rx_desc_dca_en_set(struct aq_hw_s *aq_hw, u32 rx_desc_dca_en,
350 				   u32 dca)
351 {
352 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RDM_DCADDESC_EN_ADR(dca),
353 			    HW_ATL_RDM_DCADDESC_EN_MSK,
354 			    HW_ATL_RDM_DCADDESC_EN_SHIFT,
355 			    rx_desc_dca_en);
356 }
357 
hw_atl_rdm_rx_desc_en_set(struct aq_hw_s * aq_hw,u32 rx_desc_en,u32 descriptor)358 void hw_atl_rdm_rx_desc_en_set(struct aq_hw_s *aq_hw, u32 rx_desc_en,
359 			       u32 descriptor)
360 {
361 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RDM_DESCDEN_ADR(descriptor),
362 			    HW_ATL_RDM_DESCDEN_MSK,
363 			    HW_ATL_RDM_DESCDEN_SHIFT,
364 			    rx_desc_en);
365 }
366 
hw_atl_rdm_rx_desc_head_buff_size_set(struct aq_hw_s * aq_hw,u32 rx_desc_head_buff_size,u32 descriptor)367 void hw_atl_rdm_rx_desc_head_buff_size_set(struct aq_hw_s *aq_hw,
368 					   u32 rx_desc_head_buff_size,
369 					   u32 descriptor)
370 {
371 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RDM_DESCDHDR_SIZE_ADR(descriptor),
372 			    HW_ATL_RDM_DESCDHDR_SIZE_MSK,
373 			    HW_ATL_RDM_DESCDHDR_SIZE_SHIFT,
374 			    rx_desc_head_buff_size);
375 }
376 
hw_atl_rdm_rx_desc_head_splitting_set(struct aq_hw_s * aq_hw,u32 rx_desc_head_splitting,u32 descriptor)377 void hw_atl_rdm_rx_desc_head_splitting_set(struct aq_hw_s *aq_hw,
378 					   u32 rx_desc_head_splitting,
379 					   u32 descriptor)
380 {
381 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RDM_DESCDHDR_SPLIT_ADR(descriptor),
382 			    HW_ATL_RDM_DESCDHDR_SPLIT_MSK,
383 			    HW_ATL_RDM_DESCDHDR_SPLIT_SHIFT,
384 			    rx_desc_head_splitting);
385 }
386 
hw_atl_rdm_rx_desc_head_ptr_get(struct aq_hw_s * aq_hw,u32 descriptor)387 u32 hw_atl_rdm_rx_desc_head_ptr_get(struct aq_hw_s *aq_hw, u32 descriptor)
388 {
389 	return aq_hw_read_reg_bit(aq_hw, HW_ATL_RDM_DESCDHD_ADR(descriptor),
390 				  HW_ATL_RDM_DESCDHD_MSK,
391 				  HW_ATL_RDM_DESCDHD_SHIFT);
392 }
393 
hw_atl_rdm_rx_desc_len_set(struct aq_hw_s * aq_hw,u32 rx_desc_len,u32 descriptor)394 void hw_atl_rdm_rx_desc_len_set(struct aq_hw_s *aq_hw, u32 rx_desc_len,
395 				u32 descriptor)
396 {
397 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RDM_DESCDLEN_ADR(descriptor),
398 			    HW_ATL_RDM_DESCDLEN_MSK, HW_ATL_RDM_DESCDLEN_SHIFT,
399 			    rx_desc_len);
400 }
401 
hw_atl_rdm_rx_desc_res_set(struct aq_hw_s * aq_hw,u32 rx_desc_res,u32 descriptor)402 void hw_atl_rdm_rx_desc_res_set(struct aq_hw_s *aq_hw, u32 rx_desc_res,
403 				u32 descriptor)
404 {
405 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RDM_DESCDRESET_ADR(descriptor),
406 			    HW_ATL_RDM_DESCDRESET_MSK,
407 			    HW_ATL_RDM_DESCDRESET_SHIFT,
408 			    rx_desc_res);
409 }
410 
hw_atl_rdm_rx_desc_wr_wb_irq_en_set(struct aq_hw_s * aq_hw,u32 rx_desc_wr_wb_irq_en)411 void hw_atl_rdm_rx_desc_wr_wb_irq_en_set(struct aq_hw_s *aq_hw,
412 					 u32 rx_desc_wr_wb_irq_en)
413 {
414 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RDM_INT_DESC_WRB_EN_ADR,
415 			    HW_ATL_RDM_INT_DESC_WRB_EN_MSK,
416 			    HW_ATL_RDM_INT_DESC_WRB_EN_SHIFT,
417 			    rx_desc_wr_wb_irq_en);
418 }
419 
hw_atl_rdm_rx_head_dca_en_set(struct aq_hw_s * aq_hw,u32 rx_head_dca_en,u32 dca)420 void hw_atl_rdm_rx_head_dca_en_set(struct aq_hw_s *aq_hw, u32 rx_head_dca_en,
421 				   u32 dca)
422 {
423 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RDM_DCADHDR_EN_ADR(dca),
424 			    HW_ATL_RDM_DCADHDR_EN_MSK,
425 			    HW_ATL_RDM_DCADHDR_EN_SHIFT,
426 			    rx_head_dca_en);
427 }
428 
hw_atl_rdm_rx_pld_dca_en_set(struct aq_hw_s * aq_hw,u32 rx_pld_dca_en,u32 dca)429 void hw_atl_rdm_rx_pld_dca_en_set(struct aq_hw_s *aq_hw, u32 rx_pld_dca_en,
430 				  u32 dca)
431 {
432 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RDM_DCADPAY_EN_ADR(dca),
433 			    HW_ATL_RDM_DCADPAY_EN_MSK,
434 			    HW_ATL_RDM_DCADPAY_EN_SHIFT,
435 			    rx_pld_dca_en);
436 }
437 
hw_atl_rdm_rdm_intr_moder_en_set(struct aq_hw_s * aq_hw,u32 rdm_intr_moder_en)438 void hw_atl_rdm_rdm_intr_moder_en_set(struct aq_hw_s *aq_hw,
439 				      u32 rdm_intr_moder_en)
440 {
441 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RDM_INT_RIM_EN_ADR,
442 			    HW_ATL_RDM_INT_RIM_EN_MSK,
443 			    HW_ATL_RDM_INT_RIM_EN_SHIFT,
444 			    rdm_intr_moder_en);
445 }
446 
447 /* reg */
hw_atl_reg_gen_irq_map_set(struct aq_hw_s * aq_hw,u32 gen_intr_map,u32 regidx)448 void hw_atl_reg_gen_irq_map_set(struct aq_hw_s *aq_hw, u32 gen_intr_map,
449 				u32 regidx)
450 {
451 	aq_hw_write_reg(aq_hw, HW_ATL_GEN_INTR_MAP_ADR(regidx), gen_intr_map);
452 }
453 
hw_atl_reg_gen_irq_status_get(struct aq_hw_s * aq_hw)454 u32 hw_atl_reg_gen_irq_status_get(struct aq_hw_s *aq_hw)
455 {
456 	return aq_hw_read_reg(aq_hw, HW_ATL_GEN_INTR_STAT_ADR);
457 }
458 
hw_atl_reg_irq_glb_ctl_set(struct aq_hw_s * aq_hw,u32 intr_glb_ctl)459 void hw_atl_reg_irq_glb_ctl_set(struct aq_hw_s *aq_hw, u32 intr_glb_ctl)
460 {
461 	aq_hw_write_reg(aq_hw, HW_ATL_INTR_GLB_CTL_ADR, intr_glb_ctl);
462 }
463 
hw_atl_reg_irq_thr_set(struct aq_hw_s * aq_hw,u32 intr_thr,u32 throttle)464 void hw_atl_reg_irq_thr_set(struct aq_hw_s *aq_hw, u32 intr_thr, u32 throttle)
465 {
466 	aq_hw_write_reg(aq_hw, HW_ATL_INTR_THR_ADR(throttle), intr_thr);
467 }
468 
hw_atl_reg_rx_dma_desc_base_addresslswset(struct aq_hw_s * aq_hw,u32 rx_dma_desc_base_addrlsw,u32 descriptor)469 void hw_atl_reg_rx_dma_desc_base_addresslswset(struct aq_hw_s *aq_hw,
470 					       u32 rx_dma_desc_base_addrlsw,
471 					       u32 descriptor)
472 {
473 	aq_hw_write_reg(aq_hw, HW_ATL_RX_DMA_DESC_BASE_ADDRLSW_ADR(descriptor),
474 			rx_dma_desc_base_addrlsw);
475 }
476 
hw_atl_reg_rx_dma_desc_base_addressmswset(struct aq_hw_s * aq_hw,u32 rx_dma_desc_base_addrmsw,u32 descriptor)477 void hw_atl_reg_rx_dma_desc_base_addressmswset(struct aq_hw_s *aq_hw,
478 					       u32 rx_dma_desc_base_addrmsw,
479 					       u32 descriptor)
480 {
481 	aq_hw_write_reg(aq_hw, HW_ATL_RX_DMA_DESC_BASE_ADDRMSW_ADR(descriptor),
482 			rx_dma_desc_base_addrmsw);
483 }
484 
hw_atl_reg_rx_dma_desc_status_get(struct aq_hw_s * aq_hw,u32 descriptor)485 u32 hw_atl_reg_rx_dma_desc_status_get(struct aq_hw_s *aq_hw, u32 descriptor)
486 {
487 	return aq_hw_read_reg(aq_hw, HW_ATL_RX_DMA_DESC_STAT_ADR(descriptor));
488 }
489 
hw_atl_reg_rx_dma_desc_tail_ptr_set(struct aq_hw_s * aq_hw,u32 rx_dma_desc_tail_ptr,u32 descriptor)490 void hw_atl_reg_rx_dma_desc_tail_ptr_set(struct aq_hw_s *aq_hw,
491 					 u32 rx_dma_desc_tail_ptr,
492 					 u32 descriptor)
493 {
494 	aq_hw_write_reg(aq_hw, HW_ATL_RX_DMA_DESC_TAIL_PTR_ADR(descriptor),
495 			rx_dma_desc_tail_ptr);
496 }
497 
hw_atl_reg_rx_flr_mcst_flr_msk_set(struct aq_hw_s * aq_hw,u32 rx_flr_mcst_flr_msk)498 void hw_atl_reg_rx_flr_mcst_flr_msk_set(struct aq_hw_s *aq_hw,
499 					u32 rx_flr_mcst_flr_msk)
500 {
501 	aq_hw_write_reg(aq_hw, HW_ATL_RX_FLR_MCST_FLR_MSK_ADR,
502 			rx_flr_mcst_flr_msk);
503 }
504 
hw_atl_reg_rx_flr_mcst_flr_set(struct aq_hw_s * aq_hw,u32 rx_flr_mcst_flr,u32 filter)505 void hw_atl_reg_rx_flr_mcst_flr_set(struct aq_hw_s *aq_hw, u32 rx_flr_mcst_flr,
506 				    u32 filter)
507 {
508 	aq_hw_write_reg(aq_hw, HW_ATL_RX_FLR_MCST_FLR_ADR(filter),
509 			rx_flr_mcst_flr);
510 }
511 
hw_atl_reg_rx_flr_rss_control1set(struct aq_hw_s * aq_hw,u32 rx_flr_rss_control1)512 void hw_atl_reg_rx_flr_rss_control1set(struct aq_hw_s *aq_hw,
513 				       u32 rx_flr_rss_control1)
514 {
515 	aq_hw_write_reg(aq_hw, HW_ATL_RX_FLR_RSS_CONTROL1_ADR,
516 			rx_flr_rss_control1);
517 }
518 
hw_atl_reg_rx_flr_control2_set(struct aq_hw_s * aq_hw,u32 rx_filter_control2)519 void hw_atl_reg_rx_flr_control2_set(struct aq_hw_s *aq_hw,
520 				    u32 rx_filter_control2)
521 {
522 	aq_hw_write_reg(aq_hw, HW_ATL_RX_FLR_CONTROL2_ADR, rx_filter_control2);
523 }
524 
hw_atl_reg_rx_intr_moder_ctrl_set(struct aq_hw_s * aq_hw,u32 rx_intr_moderation_ctl,u32 queue)525 void hw_atl_reg_rx_intr_moder_ctrl_set(struct aq_hw_s *aq_hw,
526 				       u32 rx_intr_moderation_ctl,
527 				       u32 queue)
528 {
529 	aq_hw_write_reg(aq_hw, HW_ATL_RX_INTR_MODERATION_CTL_ADR(queue),
530 			rx_intr_moderation_ctl);
531 }
532 
hw_atl_reg_tx_dma_debug_ctl_set(struct aq_hw_s * aq_hw,u32 tx_dma_debug_ctl)533 void hw_atl_reg_tx_dma_debug_ctl_set(struct aq_hw_s *aq_hw,
534 				     u32 tx_dma_debug_ctl)
535 {
536 	aq_hw_write_reg(aq_hw, HW_ATL_TX_DMA_DEBUG_CTL_ADR, tx_dma_debug_ctl);
537 }
538 
hw_atl_reg_tx_dma_desc_base_addresslswset(struct aq_hw_s * aq_hw,u32 tx_dma_desc_base_addrlsw,u32 descriptor)539 void hw_atl_reg_tx_dma_desc_base_addresslswset(struct aq_hw_s *aq_hw,
540 					       u32 tx_dma_desc_base_addrlsw,
541 					       u32 descriptor)
542 {
543 	aq_hw_write_reg(aq_hw, HW_ATL_TX_DMA_DESC_BASE_ADDRLSW_ADR(descriptor),
544 			tx_dma_desc_base_addrlsw);
545 }
546 
hw_atl_reg_tx_dma_desc_base_addressmswset(struct aq_hw_s * aq_hw,u32 tx_dma_desc_base_addrmsw,u32 descriptor)547 void hw_atl_reg_tx_dma_desc_base_addressmswset(struct aq_hw_s *aq_hw,
548 					       u32 tx_dma_desc_base_addrmsw,
549 					       u32 descriptor)
550 {
551 	aq_hw_write_reg(aq_hw, HW_ATL_TX_DMA_DESC_BASE_ADDRMSW_ADR(descriptor),
552 			tx_dma_desc_base_addrmsw);
553 }
554 
hw_atl_reg_tx_dma_desc_tail_ptr_set(struct aq_hw_s * aq_hw,u32 tx_dma_desc_tail_ptr,u32 descriptor)555 void hw_atl_reg_tx_dma_desc_tail_ptr_set(struct aq_hw_s *aq_hw,
556 					 u32 tx_dma_desc_tail_ptr,
557 					 u32 descriptor)
558 {
559 	aq_hw_write_reg(aq_hw, HW_ATL_TX_DMA_DESC_TAIL_PTR_ADR(descriptor),
560 			tx_dma_desc_tail_ptr);
561 }
562 
hw_atl_reg_tx_intr_moder_ctrl_set(struct aq_hw_s * aq_hw,u32 tx_intr_moderation_ctl,u32 queue)563 void hw_atl_reg_tx_intr_moder_ctrl_set(struct aq_hw_s *aq_hw,
564 				       u32 tx_intr_moderation_ctl,
565 				       u32 queue)
566 {
567 	aq_hw_write_reg(aq_hw, HW_ATL_TX_INTR_MODERATION_CTL_ADR(queue),
568 			tx_intr_moderation_ctl);
569 }
570 
571 /* RPB: rx packet buffer */
hw_atl_rpb_dma_sys_lbk_set(struct aq_hw_s * aq_hw,u32 dma_sys_lbk)572 void hw_atl_rpb_dma_sys_lbk_set(struct aq_hw_s *aq_hw, u32 dma_sys_lbk)
573 {
574 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPB_DMA_SYS_LBK_ADR,
575 			    HW_ATL_RPB_DMA_SYS_LBK_MSK,
576 			    HW_ATL_RPB_DMA_SYS_LBK_SHIFT, dma_sys_lbk);
577 }
578 
hw_atl_rpb_rpf_rx_traf_class_mode_set(struct aq_hw_s * aq_hw,u32 rx_traf_class_mode)579 void hw_atl_rpb_rpf_rx_traf_class_mode_set(struct aq_hw_s *aq_hw,
580 					   u32 rx_traf_class_mode)
581 {
582 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPB_RPF_RX_TC_MODE_ADR,
583 			    HW_ATL_RPB_RPF_RX_TC_MODE_MSK,
584 			    HW_ATL_RPB_RPF_RX_TC_MODE_SHIFT,
585 			    rx_traf_class_mode);
586 }
587 
hw_atl_rpb_rx_buff_en_set(struct aq_hw_s * aq_hw,u32 rx_buff_en)588 void hw_atl_rpb_rx_buff_en_set(struct aq_hw_s *aq_hw, u32 rx_buff_en)
589 {
590 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPB_RX_BUF_EN_ADR,
591 			    HW_ATL_RPB_RX_BUF_EN_MSK,
592 			    HW_ATL_RPB_RX_BUF_EN_SHIFT, rx_buff_en);
593 }
594 
hw_atl_rpb_rx_buff_hi_threshold_per_tc_set(struct aq_hw_s * aq_hw,u32 rx_buff_hi_threshold_per_tc,u32 buffer)595 void hw_atl_rpb_rx_buff_hi_threshold_per_tc_set(struct aq_hw_s *aq_hw,
596 						u32 rx_buff_hi_threshold_per_tc,
597 						u32 buffer)
598 {
599 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPB_RXBHI_THRESH_ADR(buffer),
600 			    HW_ATL_RPB_RXBHI_THRESH_MSK,
601 			    HW_ATL_RPB_RXBHI_THRESH_SHIFT,
602 			    rx_buff_hi_threshold_per_tc);
603 }
604 
hw_atl_rpb_rx_buff_lo_threshold_per_tc_set(struct aq_hw_s * aq_hw,u32 rx_buff_lo_threshold_per_tc,u32 buffer)605 void hw_atl_rpb_rx_buff_lo_threshold_per_tc_set(struct aq_hw_s *aq_hw,
606 						u32 rx_buff_lo_threshold_per_tc,
607 						u32 buffer)
608 {
609 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPB_RXBLO_THRESH_ADR(buffer),
610 			    HW_ATL_RPB_RXBLO_THRESH_MSK,
611 			    HW_ATL_RPB_RXBLO_THRESH_SHIFT,
612 			    rx_buff_lo_threshold_per_tc);
613 }
614 
hw_atl_rpb_rx_flow_ctl_mode_set(struct aq_hw_s * aq_hw,u32 rx_flow_ctl_mode)615 void hw_atl_rpb_rx_flow_ctl_mode_set(struct aq_hw_s *aq_hw, u32 rx_flow_ctl_mode)
616 {
617 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPB_RX_FC_MODE_ADR,
618 			    HW_ATL_RPB_RX_FC_MODE_MSK,
619 			    HW_ATL_RPB_RX_FC_MODE_SHIFT, rx_flow_ctl_mode);
620 }
621 
hw_atl_rpb_rx_pkt_buff_size_per_tc_set(struct aq_hw_s * aq_hw,u32 rx_pkt_buff_size_per_tc,u32 buffer)622 void hw_atl_rpb_rx_pkt_buff_size_per_tc_set(struct aq_hw_s *aq_hw,
623 					    u32 rx_pkt_buff_size_per_tc, u32 buffer)
624 {
625 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPB_RXBBUF_SIZE_ADR(buffer),
626 			    HW_ATL_RPB_RXBBUF_SIZE_MSK,
627 			    HW_ATL_RPB_RXBBUF_SIZE_SHIFT,
628 			    rx_pkt_buff_size_per_tc);
629 }
630 
hw_atl_rpb_rx_xoff_en_per_tc_set(struct aq_hw_s * aq_hw,u32 rx_xoff_en_per_tc,u32 buffer)631 void hw_atl_rpb_rx_xoff_en_per_tc_set(struct aq_hw_s *aq_hw, u32 rx_xoff_en_per_tc,
632 				      u32 buffer)
633 {
634 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPB_RXBXOFF_EN_ADR(buffer),
635 			    HW_ATL_RPB_RXBXOFF_EN_MSK,
636 			    HW_ATL_RPB_RXBXOFF_EN_SHIFT,
637 			    rx_xoff_en_per_tc);
638 }
639 
640 /* rpf */
641 
hw_atl_rpfl2broadcast_count_threshold_set(struct aq_hw_s * aq_hw,u32 l2broadcast_count_threshold)642 void hw_atl_rpfl2broadcast_count_threshold_set(struct aq_hw_s *aq_hw,
643 					       u32 l2broadcast_count_threshold)
644 {
645 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPFL2BC_THRESH_ADR,
646 			    HW_ATL_RPFL2BC_THRESH_MSK,
647 			    HW_ATL_RPFL2BC_THRESH_SHIFT,
648 			    l2broadcast_count_threshold);
649 }
650 
hw_atl_rpfl2broadcast_en_set(struct aq_hw_s * aq_hw,u32 l2broadcast_en)651 void hw_atl_rpfl2broadcast_en_set(struct aq_hw_s *aq_hw, u32 l2broadcast_en)
652 {
653 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPFL2BC_EN_ADR, HW_ATL_RPFL2BC_EN_MSK,
654 			    HW_ATL_RPFL2BC_EN_SHIFT, l2broadcast_en);
655 }
656 
hw_atl_rpfl2broadcast_flr_act_set(struct aq_hw_s * aq_hw,u32 l2broadcast_flr_act)657 void hw_atl_rpfl2broadcast_flr_act_set(struct aq_hw_s *aq_hw,
658 				       u32 l2broadcast_flr_act)
659 {
660 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPFL2BC_ACT_ADR,
661 			    HW_ATL_RPFL2BC_ACT_MSK,
662 			    HW_ATL_RPFL2BC_ACT_SHIFT, l2broadcast_flr_act);
663 }
664 
hw_atl_rpfl2multicast_flr_en_set(struct aq_hw_s * aq_hw,u32 l2multicast_flr_en,u32 filter)665 void hw_atl_rpfl2multicast_flr_en_set(struct aq_hw_s *aq_hw,
666 				      u32 l2multicast_flr_en,
667 				      u32 filter)
668 {
669 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPFL2MC_ENF_ADR(filter),
670 			    HW_ATL_RPFL2MC_ENF_MSK,
671 			    HW_ATL_RPFL2MC_ENF_SHIFT, l2multicast_flr_en);
672 }
673 
hw_atl_rpfl2promiscuous_mode_en_set(struct aq_hw_s * aq_hw,u32 l2promiscuous_mode_en)674 void hw_atl_rpfl2promiscuous_mode_en_set(struct aq_hw_s *aq_hw,
675 					 u32 l2promiscuous_mode_en)
676 {
677 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPFL2PROMIS_MODE_ADR,
678 			    HW_ATL_RPFL2PROMIS_MODE_MSK,
679 			    HW_ATL_RPFL2PROMIS_MODE_SHIFT,
680 			    l2promiscuous_mode_en);
681 }
682 
hw_atl_rpfl2unicast_flr_act_set(struct aq_hw_s * aq_hw,u32 l2unicast_flr_act,u32 filter)683 void hw_atl_rpfl2unicast_flr_act_set(struct aq_hw_s *aq_hw,
684 				     u32 l2unicast_flr_act,
685 				     u32 filter)
686 {
687 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPFL2UC_ACTF_ADR(filter),
688 			    HW_ATL_RPFL2UC_ACTF_MSK, HW_ATL_RPFL2UC_ACTF_SHIFT,
689 			    l2unicast_flr_act);
690 }
691 
hw_atl_rpfl2_uc_flr_en_set(struct aq_hw_s * aq_hw,u32 l2unicast_flr_en,u32 filter)692 void hw_atl_rpfl2_uc_flr_en_set(struct aq_hw_s *aq_hw, u32 l2unicast_flr_en,
693 				u32 filter)
694 {
695 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPFL2UC_ENF_ADR(filter),
696 			    HW_ATL_RPFL2UC_ENF_MSK,
697 			    HW_ATL_RPFL2UC_ENF_SHIFT, l2unicast_flr_en);
698 }
699 
hw_atl_rpfl2unicast_dest_addresslsw_set(struct aq_hw_s * aq_hw,u32 l2unicast_dest_addresslsw,u32 filter)700 void hw_atl_rpfl2unicast_dest_addresslsw_set(struct aq_hw_s *aq_hw,
701 					     u32 l2unicast_dest_addresslsw,
702 					     u32 filter)
703 {
704 	aq_hw_write_reg(aq_hw, HW_ATL_RPFL2UC_DAFLSW_ADR(filter),
705 			l2unicast_dest_addresslsw);
706 }
707 
hw_atl_rpfl2unicast_dest_addressmsw_set(struct aq_hw_s * aq_hw,u32 l2unicast_dest_addressmsw,u32 filter)708 void hw_atl_rpfl2unicast_dest_addressmsw_set(struct aq_hw_s *aq_hw,
709 					     u32 l2unicast_dest_addressmsw,
710 					     u32 filter)
711 {
712 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPFL2UC_DAFMSW_ADR(filter),
713 			    HW_ATL_RPFL2UC_DAFMSW_MSK,
714 			    HW_ATL_RPFL2UC_DAFMSW_SHIFT,
715 			    l2unicast_dest_addressmsw);
716 }
717 
hw_atl_rpfl2_accept_all_mc_packets_set(struct aq_hw_s * aq_hw,u32 l2_accept_all_mc_packets)718 void hw_atl_rpfl2_accept_all_mc_packets_set(struct aq_hw_s *aq_hw,
719 					    u32 l2_accept_all_mc_packets)
720 {
721 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPFL2MC_ACCEPT_ALL_ADR,
722 			    HW_ATL_RPFL2MC_ACCEPT_ALL_MSK,
723 			    HW_ATL_RPFL2MC_ACCEPT_ALL_SHIFT,
724 			    l2_accept_all_mc_packets);
725 }
726 
hw_atl_rpf_rpb_user_priority_tc_map_set(struct aq_hw_s * aq_hw,u32 user_priority_tc_map,u32 tc)727 void hw_atl_rpf_rpb_user_priority_tc_map_set(struct aq_hw_s *aq_hw,
728 					     u32 user_priority_tc_map, u32 tc)
729 {
730 /* register address for bitfield rx_tc_up{t}[2:0] */
731 	static u32 rpf_rpb_rx_tc_upt_adr[8] = {
732 			0x000054c4U, 0x000054C4U, 0x000054C4U, 0x000054C4U,
733 			0x000054c4U, 0x000054C4U, 0x000054C4U, 0x000054C4U
734 		};
735 
736 /* bitmask for bitfield rx_tc_up{t}[2:0] */
737 	static u32 rpf_rpb_rx_tc_upt_msk[8] = {
738 			0x00000007U, 0x00000070U, 0x00000700U, 0x00007000U,
739 			0x00070000U, 0x00700000U, 0x07000000U, 0x70000000U
740 		};
741 
742 /* lower bit position of bitfield rx_tc_up{t}[2:0] */
743 	static u32 rpf_rpb_rx_tc_upt_shft[8] = {
744 			0U, 4U, 8U, 12U, 16U, 20U, 24U, 28U
745 		};
746 
747 	aq_hw_write_reg_bit(aq_hw, rpf_rpb_rx_tc_upt_adr[tc],
748 			    rpf_rpb_rx_tc_upt_msk[tc],
749 			    rpf_rpb_rx_tc_upt_shft[tc],
750 			    user_priority_tc_map);
751 }
752 
hw_atl_rpf_rss_key_addr_set(struct aq_hw_s * aq_hw,u32 rss_key_addr)753 void hw_atl_rpf_rss_key_addr_set(struct aq_hw_s *aq_hw, u32 rss_key_addr)
754 {
755 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_RSS_KEY_ADDR_ADR,
756 			    HW_ATL_RPF_RSS_KEY_ADDR_MSK,
757 			    HW_ATL_RPF_RSS_KEY_ADDR_SHIFT,
758 			    rss_key_addr);
759 }
760 
hw_atl_rpf_rss_key_wr_data_set(struct aq_hw_s * aq_hw,u32 rss_key_wr_data)761 void hw_atl_rpf_rss_key_wr_data_set(struct aq_hw_s *aq_hw, u32 rss_key_wr_data)
762 {
763 	aq_hw_write_reg(aq_hw, HW_ATL_RPF_RSS_KEY_WR_DATA_ADR,
764 			rss_key_wr_data);
765 }
766 
hw_atl_rpf_rss_key_wr_en_get(struct aq_hw_s * aq_hw)767 u32 hw_atl_rpf_rss_key_wr_en_get(struct aq_hw_s *aq_hw)
768 {
769 	return aq_hw_read_reg_bit(aq_hw, HW_ATL_RPF_RSS_KEY_WR_ENI_ADR,
770 				  HW_ATL_RPF_RSS_KEY_WR_ENI_MSK,
771 				  HW_ATL_RPF_RSS_KEY_WR_ENI_SHIFT);
772 }
773 
hw_atl_rpf_rss_key_wr_en_set(struct aq_hw_s * aq_hw,u32 rss_key_wr_en)774 void hw_atl_rpf_rss_key_wr_en_set(struct aq_hw_s *aq_hw, u32 rss_key_wr_en)
775 {
776 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_RSS_KEY_WR_ENI_ADR,
777 			    HW_ATL_RPF_RSS_KEY_WR_ENI_MSK,
778 			    HW_ATL_RPF_RSS_KEY_WR_ENI_SHIFT,
779 			    rss_key_wr_en);
780 }
781 
hw_atl_rpf_rss_redir_tbl_addr_set(struct aq_hw_s * aq_hw,u32 rss_redir_tbl_addr)782 void hw_atl_rpf_rss_redir_tbl_addr_set(struct aq_hw_s *aq_hw,
783 				       u32 rss_redir_tbl_addr)
784 {
785 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_RSS_REDIR_ADDR_ADR,
786 			    HW_ATL_RPF_RSS_REDIR_ADDR_MSK,
787 			    HW_ATL_RPF_RSS_REDIR_ADDR_SHIFT,
788 			    rss_redir_tbl_addr);
789 }
790 
hw_atl_rpf_rss_redir_tbl_wr_data_set(struct aq_hw_s * aq_hw,u32 rss_redir_tbl_wr_data)791 void hw_atl_rpf_rss_redir_tbl_wr_data_set(struct aq_hw_s *aq_hw,
792 					  u32 rss_redir_tbl_wr_data)
793 {
794 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_RSS_REDIR_WR_DATA_ADR,
795 			    HW_ATL_RPF_RSS_REDIR_WR_DATA_MSK,
796 			    HW_ATL_RPF_RSS_REDIR_WR_DATA_SHIFT,
797 			    rss_redir_tbl_wr_data);
798 }
799 
hw_atl_rpf_rss_redir_wr_en_get(struct aq_hw_s * aq_hw)800 u32 hw_atl_rpf_rss_redir_wr_en_get(struct aq_hw_s *aq_hw)
801 {
802 	return aq_hw_read_reg_bit(aq_hw, HW_ATL_RPF_RSS_REDIR_WR_ENI_ADR,
803 				  HW_ATL_RPF_RSS_REDIR_WR_ENI_MSK,
804 				  HW_ATL_RPF_RSS_REDIR_WR_ENI_SHIFT);
805 }
806 
hw_atl_rpf_rss_redir_wr_en_set(struct aq_hw_s * aq_hw,u32 rss_redir_wr_en)807 void hw_atl_rpf_rss_redir_wr_en_set(struct aq_hw_s *aq_hw, u32 rss_redir_wr_en)
808 {
809 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_RSS_REDIR_WR_ENI_ADR,
810 			    HW_ATL_RPF_RSS_REDIR_WR_ENI_MSK,
811 			    HW_ATL_RPF_RSS_REDIR_WR_ENI_SHIFT, rss_redir_wr_en);
812 }
813 
hw_atl_rpf_tpo_to_rpf_sys_lbk_set(struct aq_hw_s * aq_hw,u32 tpo_to_rpf_sys_lbk)814 void hw_atl_rpf_tpo_to_rpf_sys_lbk_set(struct aq_hw_s *aq_hw,
815 				       u32 tpo_to_rpf_sys_lbk)
816 {
817 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_TPO_RPF_SYS_LBK_ADR,
818 			    HW_ATL_RPF_TPO_RPF_SYS_LBK_MSK,
819 			    HW_ATL_RPF_TPO_RPF_SYS_LBK_SHIFT,
820 			    tpo_to_rpf_sys_lbk);
821 }
822 
hw_atl_rpf_vlan_inner_etht_set(struct aq_hw_s * aq_hw,u32 vlan_inner_etht)823 void hw_atl_rpf_vlan_inner_etht_set(struct aq_hw_s *aq_hw, u32 vlan_inner_etht)
824 {
825 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_VL_INNER_TPID_ADR,
826 			    HW_ATL_RPF_VL_INNER_TPID_MSK,
827 			    HW_ATL_RPF_VL_INNER_TPID_SHIFT,
828 			    vlan_inner_etht);
829 }
830 
hw_atl_rpf_vlan_outer_etht_set(struct aq_hw_s * aq_hw,u32 vlan_outer_etht)831 void hw_atl_rpf_vlan_outer_etht_set(struct aq_hw_s *aq_hw, u32 vlan_outer_etht)
832 {
833 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_VL_OUTER_TPID_ADR,
834 			    HW_ATL_RPF_VL_OUTER_TPID_MSK,
835 			    HW_ATL_RPF_VL_OUTER_TPID_SHIFT,
836 			    vlan_outer_etht);
837 }
838 
hw_atl_rpf_vlan_prom_mode_en_set(struct aq_hw_s * aq_hw,u32 vlan_prom_mode_en)839 void hw_atl_rpf_vlan_prom_mode_en_set(struct aq_hw_s *aq_hw,
840 				      u32 vlan_prom_mode_en)
841 {
842 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_VL_PROMIS_MODE_ADR,
843 			    HW_ATL_RPF_VL_PROMIS_MODE_MSK,
844 			    HW_ATL_RPF_VL_PROMIS_MODE_SHIFT,
845 			    vlan_prom_mode_en);
846 }
847 
hw_atl_rpf_vlan_accept_untagged_packets_set(struct aq_hw_s * aq_hw,u32 vlan_acc_untagged_packets)848 void hw_atl_rpf_vlan_accept_untagged_packets_set(struct aq_hw_s *aq_hw,
849 						 u32 vlan_acc_untagged_packets)
850 {
851 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_VL_ACCEPT_UNTAGGED_MODE_ADR,
852 			    HW_ATL_RPF_VL_ACCEPT_UNTAGGED_MODE_MSK,
853 			    HW_ATL_RPF_VL_ACCEPT_UNTAGGED_MODE_SHIFT,
854 			    vlan_acc_untagged_packets);
855 }
856 
hw_atl_rpf_vlan_untagged_act_set(struct aq_hw_s * aq_hw,u32 vlan_untagged_act)857 void hw_atl_rpf_vlan_untagged_act_set(struct aq_hw_s *aq_hw,
858 				      u32 vlan_untagged_act)
859 {
860 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_VL_UNTAGGED_ACT_ADR,
861 			    HW_ATL_RPF_VL_UNTAGGED_ACT_MSK,
862 			    HW_ATL_RPF_VL_UNTAGGED_ACT_SHIFT,
863 			    vlan_untagged_act);
864 }
865 
hw_atl_rpf_vlan_flr_en_set(struct aq_hw_s * aq_hw,u32 vlan_flr_en,u32 filter)866 void hw_atl_rpf_vlan_flr_en_set(struct aq_hw_s *aq_hw, u32 vlan_flr_en,
867 				u32 filter)
868 {
869 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_VL_EN_F_ADR(filter),
870 			    HW_ATL_RPF_VL_EN_F_MSK,
871 			    HW_ATL_RPF_VL_EN_F_SHIFT,
872 			    vlan_flr_en);
873 }
874 
hw_atl_rpf_vlan_flr_act_set(struct aq_hw_s * aq_hw,u32 vlan_flr_act,u32 filter)875 void hw_atl_rpf_vlan_flr_act_set(struct aq_hw_s *aq_hw, u32 vlan_flr_act,
876 				 u32 filter)
877 {
878 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_VL_ACT_F_ADR(filter),
879 			    HW_ATL_RPF_VL_ACT_F_MSK,
880 			    HW_ATL_RPF_VL_ACT_F_SHIFT,
881 			    vlan_flr_act);
882 }
883 
hw_atl_rpf_vlan_id_flr_set(struct aq_hw_s * aq_hw,u32 vlan_id_flr,u32 filter)884 void hw_atl_rpf_vlan_id_flr_set(struct aq_hw_s *aq_hw, u32 vlan_id_flr,
885 				u32 filter)
886 {
887 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_VL_ID_F_ADR(filter),
888 			    HW_ATL_RPF_VL_ID_F_MSK,
889 			    HW_ATL_RPF_VL_ID_F_SHIFT,
890 			    vlan_id_flr);
891 }
892 
hw_atl_rpf_etht_flr_en_set(struct aq_hw_s * aq_hw,u32 etht_flr_en,u32 filter)893 void hw_atl_rpf_etht_flr_en_set(struct aq_hw_s *aq_hw, u32 etht_flr_en,
894 				u32 filter)
895 {
896 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_ET_ENF_ADR(filter),
897 			    HW_ATL_RPF_ET_ENF_MSK,
898 			    HW_ATL_RPF_ET_ENF_SHIFT, etht_flr_en);
899 }
900 
hw_atl_rpf_etht_user_priority_en_set(struct aq_hw_s * aq_hw,u32 etht_user_priority_en,u32 filter)901 void hw_atl_rpf_etht_user_priority_en_set(struct aq_hw_s *aq_hw,
902 					  u32 etht_user_priority_en, u32 filter)
903 {
904 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_ET_UPFEN_ADR(filter),
905 			    HW_ATL_RPF_ET_UPFEN_MSK, HW_ATL_RPF_ET_UPFEN_SHIFT,
906 			    etht_user_priority_en);
907 }
908 
hw_atl_rpf_etht_rx_queue_en_set(struct aq_hw_s * aq_hw,u32 etht_rx_queue_en,u32 filter)909 void hw_atl_rpf_etht_rx_queue_en_set(struct aq_hw_s *aq_hw,
910 				     u32 etht_rx_queue_en,
911 				     u32 filter)
912 {
913 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_ET_RXQFEN_ADR(filter),
914 			    HW_ATL_RPF_ET_RXQFEN_MSK,
915 			    HW_ATL_RPF_ET_RXQFEN_SHIFT,
916 			    etht_rx_queue_en);
917 }
918 
hw_atl_rpf_etht_user_priority_set(struct aq_hw_s * aq_hw,u32 etht_user_priority,u32 filter)919 void hw_atl_rpf_etht_user_priority_set(struct aq_hw_s *aq_hw,
920 				       u32 etht_user_priority,
921 				       u32 filter)
922 {
923 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_ET_UPF_ADR(filter),
924 			    HW_ATL_RPF_ET_UPF_MSK,
925 			    HW_ATL_RPF_ET_UPF_SHIFT, etht_user_priority);
926 }
927 
hw_atl_rpf_etht_rx_queue_set(struct aq_hw_s * aq_hw,u32 etht_rx_queue,u32 filter)928 void hw_atl_rpf_etht_rx_queue_set(struct aq_hw_s *aq_hw, u32 etht_rx_queue,
929 				  u32 filter)
930 {
931 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_ET_RXQF_ADR(filter),
932 			    HW_ATL_RPF_ET_RXQF_MSK,
933 			    HW_ATL_RPF_ET_RXQF_SHIFT, etht_rx_queue);
934 }
935 
hw_atl_rpf_etht_mgt_queue_set(struct aq_hw_s * aq_hw,u32 etht_mgt_queue,u32 filter)936 void hw_atl_rpf_etht_mgt_queue_set(struct aq_hw_s *aq_hw, u32 etht_mgt_queue,
937 				   u32 filter)
938 {
939 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_ET_MNG_RXQF_ADR(filter),
940 			    HW_ATL_RPF_ET_MNG_RXQF_MSK,
941 			    HW_ATL_RPF_ET_MNG_RXQF_SHIFT,
942 			    etht_mgt_queue);
943 }
944 
hw_atl_rpf_etht_flr_act_set(struct aq_hw_s * aq_hw,u32 etht_flr_act,u32 filter)945 void hw_atl_rpf_etht_flr_act_set(struct aq_hw_s *aq_hw, u32 etht_flr_act,
946 				 u32 filter)
947 {
948 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_ET_ACTF_ADR(filter),
949 			    HW_ATL_RPF_ET_ACTF_MSK,
950 			    HW_ATL_RPF_ET_ACTF_SHIFT, etht_flr_act);
951 }
952 
hw_atl_rpf_etht_flr_set(struct aq_hw_s * aq_hw,u32 etht_flr,u32 filter)953 void hw_atl_rpf_etht_flr_set(struct aq_hw_s *aq_hw, u32 etht_flr, u32 filter)
954 {
955 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPF_ET_VALF_ADR(filter),
956 			    HW_ATL_RPF_ET_VALF_MSK,
957 			    HW_ATL_RPF_ET_VALF_SHIFT, etht_flr);
958 }
959 
960 /* RPO: rx packet offload */
hw_atl_rpo_ipv4header_crc_offload_en_set(struct aq_hw_s * aq_hw,u32 ipv4header_crc_offload_en)961 void hw_atl_rpo_ipv4header_crc_offload_en_set(struct aq_hw_s *aq_hw,
962 					      u32 ipv4header_crc_offload_en)
963 {
964 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPO_IPV4CHK_EN_ADR,
965 			    HW_ATL_RPO_IPV4CHK_EN_MSK,
966 			    HW_ATL_RPO_IPV4CHK_EN_SHIFT,
967 			    ipv4header_crc_offload_en);
968 }
969 
hw_atl_rpo_rx_desc_vlan_stripping_set(struct aq_hw_s * aq_hw,u32 rx_desc_vlan_stripping,u32 descriptor)970 void hw_atl_rpo_rx_desc_vlan_stripping_set(struct aq_hw_s *aq_hw,
971 					   u32 rx_desc_vlan_stripping,
972 					   u32 descriptor)
973 {
974 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPO_DESCDVL_STRIP_ADR(descriptor),
975 			    HW_ATL_RPO_DESCDVL_STRIP_MSK,
976 			    HW_ATL_RPO_DESCDVL_STRIP_SHIFT,
977 			    rx_desc_vlan_stripping);
978 }
979 
hw_atl_rpo_tcp_udp_crc_offload_en_set(struct aq_hw_s * aq_hw,u32 tcp_udp_crc_offload_en)980 void hw_atl_rpo_tcp_udp_crc_offload_en_set(struct aq_hw_s *aq_hw,
981 					   u32 tcp_udp_crc_offload_en)
982 {
983 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPOL4CHK_EN_ADR,
984 			    HW_ATL_RPOL4CHK_EN_MSK,
985 			    HW_ATL_RPOL4CHK_EN_SHIFT, tcp_udp_crc_offload_en);
986 }
987 
hw_atl_rpo_lro_en_set(struct aq_hw_s * aq_hw,u32 lro_en)988 void hw_atl_rpo_lro_en_set(struct aq_hw_s *aq_hw, u32 lro_en)
989 {
990 	aq_hw_write_reg(aq_hw, HW_ATL_RPO_LRO_EN_ADR, lro_en);
991 }
992 
hw_atl_rpo_lro_patch_optimization_en_set(struct aq_hw_s * aq_hw,u32 lro_patch_optimization_en)993 void hw_atl_rpo_lro_patch_optimization_en_set(struct aq_hw_s *aq_hw,
994 					      u32 lro_patch_optimization_en)
995 {
996 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPO_LRO_PTOPT_EN_ADR,
997 			    HW_ATL_RPO_LRO_PTOPT_EN_MSK,
998 			    HW_ATL_RPO_LRO_PTOPT_EN_SHIFT,
999 			    lro_patch_optimization_en);
1000 }
1001 
hw_atl_rpo_lro_qsessions_lim_set(struct aq_hw_s * aq_hw,u32 lro_qsessions_lim)1002 void hw_atl_rpo_lro_qsessions_lim_set(struct aq_hw_s *aq_hw,
1003 				      u32 lro_qsessions_lim)
1004 {
1005 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPO_LRO_QSES_LMT_ADR,
1006 			    HW_ATL_RPO_LRO_QSES_LMT_MSK,
1007 			    HW_ATL_RPO_LRO_QSES_LMT_SHIFT,
1008 			    lro_qsessions_lim);
1009 }
1010 
hw_atl_rpo_lro_total_desc_lim_set(struct aq_hw_s * aq_hw,u32 lro_total_desc_lim)1011 void hw_atl_rpo_lro_total_desc_lim_set(struct aq_hw_s *aq_hw,
1012 				       u32 lro_total_desc_lim)
1013 {
1014 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPO_LRO_TOT_DSC_LMT_ADR,
1015 			    HW_ATL_RPO_LRO_TOT_DSC_LMT_MSK,
1016 			    HW_ATL_RPO_LRO_TOT_DSC_LMT_SHIFT,
1017 			    lro_total_desc_lim);
1018 }
1019 
hw_atl_rpo_lro_min_pay_of_first_pkt_set(struct aq_hw_s * aq_hw,u32 lro_min_pld_of_first_pkt)1020 void hw_atl_rpo_lro_min_pay_of_first_pkt_set(struct aq_hw_s *aq_hw,
1021 					     u32 lro_min_pld_of_first_pkt)
1022 {
1023 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPO_LRO_PKT_MIN_ADR,
1024 			    HW_ATL_RPO_LRO_PKT_MIN_MSK,
1025 			    HW_ATL_RPO_LRO_PKT_MIN_SHIFT,
1026 			    lro_min_pld_of_first_pkt);
1027 }
1028 
hw_atl_rpo_lro_pkt_lim_set(struct aq_hw_s * aq_hw,u32 lro_pkt_lim)1029 void hw_atl_rpo_lro_pkt_lim_set(struct aq_hw_s *aq_hw, u32 lro_pkt_lim)
1030 {
1031 	aq_hw_write_reg(aq_hw, HW_ATL_RPO_LRO_RSC_MAX_ADR, lro_pkt_lim);
1032 }
1033 
hw_atl_rpo_lro_max_num_of_descriptors_set(struct aq_hw_s * aq_hw,u32 lro_max_number_of_descriptors,u32 lro)1034 void hw_atl_rpo_lro_max_num_of_descriptors_set(struct aq_hw_s *aq_hw,
1035 					       u32 lro_max_number_of_descriptors,
1036 					       u32 lro)
1037 {
1038 /* Register address for bitfield lro{L}_des_max[1:0] */
1039 	static u32 rpo_lro_ldes_max_adr[32] = {
1040 			0x000055A0U, 0x000055A0U, 0x000055A0U, 0x000055A0U,
1041 			0x000055A0U, 0x000055A0U, 0x000055A0U, 0x000055A0U,
1042 			0x000055A4U, 0x000055A4U, 0x000055A4U, 0x000055A4U,
1043 			0x000055A4U, 0x000055A4U, 0x000055A4U, 0x000055A4U,
1044 			0x000055A8U, 0x000055A8U, 0x000055A8U, 0x000055A8U,
1045 			0x000055A8U, 0x000055A8U, 0x000055A8U, 0x000055A8U,
1046 			0x000055ACU, 0x000055ACU, 0x000055ACU, 0x000055ACU,
1047 			0x000055ACU, 0x000055ACU, 0x000055ACU, 0x000055ACU
1048 		};
1049 
1050 /* Bitmask for bitfield lro{L}_des_max[1:0] */
1051 	static u32 rpo_lro_ldes_max_msk[32] = {
1052 			0x00000003U, 0x00000030U, 0x00000300U, 0x00003000U,
1053 			0x00030000U, 0x00300000U, 0x03000000U, 0x30000000U,
1054 			0x00000003U, 0x00000030U, 0x00000300U, 0x00003000U,
1055 			0x00030000U, 0x00300000U, 0x03000000U, 0x30000000U,
1056 			0x00000003U, 0x00000030U, 0x00000300U, 0x00003000U,
1057 			0x00030000U, 0x00300000U, 0x03000000U, 0x30000000U,
1058 			0x00000003U, 0x00000030U, 0x00000300U, 0x00003000U,
1059 			0x00030000U, 0x00300000U, 0x03000000U, 0x30000000U
1060 		};
1061 
1062 /* Lower bit position of bitfield lro{L}_des_max[1:0] */
1063 	static u32 rpo_lro_ldes_max_shift[32] = {
1064 			0U, 4U, 8U, 12U, 16U, 20U, 24U, 28U,
1065 			0U, 4U, 8U, 12U, 16U, 20U, 24U, 28U,
1066 			0U, 4U, 8U, 12U, 16U, 20U, 24U, 28U,
1067 			0U, 4U, 8U, 12U, 16U, 20U, 24U, 28U
1068 		};
1069 
1070 	aq_hw_write_reg_bit(aq_hw, rpo_lro_ldes_max_adr[lro],
1071 			    rpo_lro_ldes_max_msk[lro],
1072 			    rpo_lro_ldes_max_shift[lro],
1073 			    lro_max_number_of_descriptors);
1074 }
1075 
hw_atl_rpo_lro_time_base_divider_set(struct aq_hw_s * aq_hw,u32 lro_time_base_divider)1076 void hw_atl_rpo_lro_time_base_divider_set(struct aq_hw_s *aq_hw,
1077 					  u32 lro_time_base_divider)
1078 {
1079 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPO_LRO_TB_DIV_ADR,
1080 			    HW_ATL_RPO_LRO_TB_DIV_MSK,
1081 			    HW_ATL_RPO_LRO_TB_DIV_SHIFT,
1082 			    lro_time_base_divider);
1083 }
1084 
hw_atl_rpo_lro_inactive_interval_set(struct aq_hw_s * aq_hw,u32 lro_inactive_interval)1085 void hw_atl_rpo_lro_inactive_interval_set(struct aq_hw_s *aq_hw,
1086 					  u32 lro_inactive_interval)
1087 {
1088 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPO_LRO_INA_IVAL_ADR,
1089 			    HW_ATL_RPO_LRO_INA_IVAL_MSK,
1090 			    HW_ATL_RPO_LRO_INA_IVAL_SHIFT,
1091 			    lro_inactive_interval);
1092 }
1093 
hw_atl_rpo_lro_max_coalescing_interval_set(struct aq_hw_s * aq_hw,u32 lro_max_coal_interval)1094 void hw_atl_rpo_lro_max_coalescing_interval_set(struct aq_hw_s *aq_hw,
1095 						u32 lro_max_coal_interval)
1096 {
1097 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RPO_LRO_MAX_IVAL_ADR,
1098 			    HW_ATL_RPO_LRO_MAX_IVAL_MSK,
1099 			    HW_ATL_RPO_LRO_MAX_IVAL_SHIFT,
1100 			    lro_max_coal_interval);
1101 }
1102 
1103 /* rx */
hw_atl_rx_rx_reg_res_dis_set(struct aq_hw_s * aq_hw,u32 rx_reg_res_dis)1104 void hw_atl_rx_rx_reg_res_dis_set(struct aq_hw_s *aq_hw, u32 rx_reg_res_dis)
1105 {
1106 	aq_hw_write_reg_bit(aq_hw, HW_ATL_RX_REG_RES_DSBL_ADR,
1107 			    HW_ATL_RX_REG_RES_DSBL_MSK,
1108 			    HW_ATL_RX_REG_RES_DSBL_SHIFT,
1109 			    rx_reg_res_dis);
1110 }
1111 
1112 /* tdm */
hw_atl_tdm_cpu_id_set(struct aq_hw_s * aq_hw,u32 cpuid,u32 dca)1113 void hw_atl_tdm_cpu_id_set(struct aq_hw_s *aq_hw, u32 cpuid, u32 dca)
1114 {
1115 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TDM_DCADCPUID_ADR(dca),
1116 			    HW_ATL_TDM_DCADCPUID_MSK,
1117 			    HW_ATL_TDM_DCADCPUID_SHIFT, cpuid);
1118 }
1119 
hw_atl_tdm_large_send_offload_en_set(struct aq_hw_s * aq_hw,u32 large_send_offload_en)1120 void hw_atl_tdm_large_send_offload_en_set(struct aq_hw_s *aq_hw,
1121 					  u32 large_send_offload_en)
1122 {
1123 	aq_hw_write_reg(aq_hw, HW_ATL_TDM_LSO_EN_ADR, large_send_offload_en);
1124 }
1125 
hw_atl_tdm_tx_dca_en_set(struct aq_hw_s * aq_hw,u32 tx_dca_en)1126 void hw_atl_tdm_tx_dca_en_set(struct aq_hw_s *aq_hw, u32 tx_dca_en)
1127 {
1128 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TDM_DCA_EN_ADR, HW_ATL_TDM_DCA_EN_MSK,
1129 			    HW_ATL_TDM_DCA_EN_SHIFT, tx_dca_en);
1130 }
1131 
hw_atl_tdm_tx_dca_mode_set(struct aq_hw_s * aq_hw,u32 tx_dca_mode)1132 void hw_atl_tdm_tx_dca_mode_set(struct aq_hw_s *aq_hw, u32 tx_dca_mode)
1133 {
1134 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TDM_DCA_MODE_ADR,
1135 			    HW_ATL_TDM_DCA_MODE_MSK,
1136 			    HW_ATL_TDM_DCA_MODE_SHIFT, tx_dca_mode);
1137 }
1138 
hw_atl_tdm_tx_desc_dca_en_set(struct aq_hw_s * aq_hw,u32 tx_desc_dca_en,u32 dca)1139 void hw_atl_tdm_tx_desc_dca_en_set(struct aq_hw_s *aq_hw, u32 tx_desc_dca_en,
1140 				   u32 dca)
1141 {
1142 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TDM_DCADDESC_EN_ADR(dca),
1143 			    HW_ATL_TDM_DCADDESC_EN_MSK,
1144 			    HW_ATL_TDM_DCADDESC_EN_SHIFT,
1145 			    tx_desc_dca_en);
1146 }
1147 
hw_atl_tdm_tx_desc_en_set(struct aq_hw_s * aq_hw,u32 tx_desc_en,u32 descriptor)1148 void hw_atl_tdm_tx_desc_en_set(struct aq_hw_s *aq_hw, u32 tx_desc_en,
1149 			       u32 descriptor)
1150 {
1151 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TDM_DESCDEN_ADR(descriptor),
1152 			    HW_ATL_TDM_DESCDEN_MSK,
1153 			    HW_ATL_TDM_DESCDEN_SHIFT,
1154 			    tx_desc_en);
1155 }
1156 
hw_atl_tdm_tx_desc_head_ptr_get(struct aq_hw_s * aq_hw,u32 descriptor)1157 u32 hw_atl_tdm_tx_desc_head_ptr_get(struct aq_hw_s *aq_hw, u32 descriptor)
1158 {
1159 	return aq_hw_read_reg_bit(aq_hw, HW_ATL_TDM_DESCDHD_ADR(descriptor),
1160 				  HW_ATL_TDM_DESCDHD_MSK,
1161 				  HW_ATL_TDM_DESCDHD_SHIFT);
1162 }
1163 
hw_atl_tdm_tx_desc_len_set(struct aq_hw_s * aq_hw,u32 tx_desc_len,u32 descriptor)1164 void hw_atl_tdm_tx_desc_len_set(struct aq_hw_s *aq_hw, u32 tx_desc_len,
1165 				u32 descriptor)
1166 {
1167 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TDM_DESCDLEN_ADR(descriptor),
1168 			    HW_ATL_TDM_DESCDLEN_MSK,
1169 			    HW_ATL_TDM_DESCDLEN_SHIFT,
1170 			    tx_desc_len);
1171 }
1172 
hw_atl_tdm_tx_desc_wr_wb_irq_en_set(struct aq_hw_s * aq_hw,u32 tx_desc_wr_wb_irq_en)1173 void hw_atl_tdm_tx_desc_wr_wb_irq_en_set(struct aq_hw_s *aq_hw,
1174 					 u32 tx_desc_wr_wb_irq_en)
1175 {
1176 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TDM_INT_DESC_WRB_EN_ADR,
1177 			    HW_ATL_TDM_INT_DESC_WRB_EN_MSK,
1178 			    HW_ATL_TDM_INT_DESC_WRB_EN_SHIFT,
1179 			    tx_desc_wr_wb_irq_en);
1180 }
1181 
hw_atl_tdm_tx_desc_wr_wb_threshold_set(struct aq_hw_s * aq_hw,u32 tx_desc_wr_wb_threshold,u32 descriptor)1182 void hw_atl_tdm_tx_desc_wr_wb_threshold_set(struct aq_hw_s *aq_hw,
1183 					    u32 tx_desc_wr_wb_threshold,
1184 					    u32 descriptor)
1185 {
1186 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TDM_DESCDWRB_THRESH_ADR(descriptor),
1187 			    HW_ATL_TDM_DESCDWRB_THRESH_MSK,
1188 			    HW_ATL_TDM_DESCDWRB_THRESH_SHIFT,
1189 			    tx_desc_wr_wb_threshold);
1190 }
1191 
hw_atl_tdm_tdm_intr_moder_en_set(struct aq_hw_s * aq_hw,u32 tdm_irq_moderation_en)1192 void hw_atl_tdm_tdm_intr_moder_en_set(struct aq_hw_s *aq_hw,
1193 				      u32 tdm_irq_moderation_en)
1194 {
1195 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TDM_INT_MOD_EN_ADR,
1196 			    HW_ATL_TDM_INT_MOD_EN_MSK,
1197 			    HW_ATL_TDM_INT_MOD_EN_SHIFT,
1198 			    tdm_irq_moderation_en);
1199 }
1200 
1201 /* thm */
hw_atl_thm_lso_tcp_flag_of_first_pkt_set(struct aq_hw_s * aq_hw,u32 lso_tcp_flag_of_first_pkt)1202 void hw_atl_thm_lso_tcp_flag_of_first_pkt_set(struct aq_hw_s *aq_hw,
1203 					      u32 lso_tcp_flag_of_first_pkt)
1204 {
1205 	aq_hw_write_reg_bit(aq_hw, HW_ATL_THM_LSO_TCP_FLAG_FIRST_ADR,
1206 			    HW_ATL_THM_LSO_TCP_FLAG_FIRST_MSK,
1207 			    HW_ATL_THM_LSO_TCP_FLAG_FIRST_SHIFT,
1208 			    lso_tcp_flag_of_first_pkt);
1209 }
1210 
hw_atl_thm_lso_tcp_flag_of_last_pkt_set(struct aq_hw_s * aq_hw,u32 lso_tcp_flag_of_last_pkt)1211 void hw_atl_thm_lso_tcp_flag_of_last_pkt_set(struct aq_hw_s *aq_hw,
1212 					     u32 lso_tcp_flag_of_last_pkt)
1213 {
1214 	aq_hw_write_reg_bit(aq_hw, HW_ATL_THM_LSO_TCP_FLAG_LAST_ADR,
1215 			    HW_ATL_THM_LSO_TCP_FLAG_LAST_MSK,
1216 			    HW_ATL_THM_LSO_TCP_FLAG_LAST_SHIFT,
1217 			    lso_tcp_flag_of_last_pkt);
1218 }
1219 
hw_atl_thm_lso_tcp_flag_of_middle_pkt_set(struct aq_hw_s * aq_hw,u32 lso_tcp_flag_of_middle_pkt)1220 void hw_atl_thm_lso_tcp_flag_of_middle_pkt_set(struct aq_hw_s *aq_hw,
1221 					       u32 lso_tcp_flag_of_middle_pkt)
1222 {
1223 	aq_hw_write_reg_bit(aq_hw, HW_ATL_THM_LSO_TCP_FLAG_MID_ADR,
1224 			    HW_ATL_THM_LSO_TCP_FLAG_MID_MSK,
1225 			    HW_ATL_THM_LSO_TCP_FLAG_MID_SHIFT,
1226 			    lso_tcp_flag_of_middle_pkt);
1227 }
1228 
1229 /* TPB: tx packet buffer */
hw_atl_tpb_tx_buff_en_set(struct aq_hw_s * aq_hw,u32 tx_buff_en)1230 void hw_atl_tpb_tx_buff_en_set(struct aq_hw_s *aq_hw, u32 tx_buff_en)
1231 {
1232 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TPB_TX_BUF_EN_ADR,
1233 			    HW_ATL_TPB_TX_BUF_EN_MSK,
1234 			    HW_ATL_TPB_TX_BUF_EN_SHIFT, tx_buff_en);
1235 }
1236 
hw_atl_tpb_tx_buff_hi_threshold_per_tc_set(struct aq_hw_s * aq_hw,u32 tx_buff_hi_threshold_per_tc,u32 buffer)1237 void hw_atl_tpb_tx_buff_hi_threshold_per_tc_set(struct aq_hw_s *aq_hw,
1238 						u32 tx_buff_hi_threshold_per_tc,
1239 					 u32 buffer)
1240 {
1241 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TPB_TXBHI_THRESH_ADR(buffer),
1242 			    HW_ATL_TPB_TXBHI_THRESH_MSK,
1243 			    HW_ATL_TPB_TXBHI_THRESH_SHIFT,
1244 			    tx_buff_hi_threshold_per_tc);
1245 }
1246 
hw_atl_tpb_tx_buff_lo_threshold_per_tc_set(struct aq_hw_s * aq_hw,u32 tx_buff_lo_threshold_per_tc,u32 buffer)1247 void hw_atl_tpb_tx_buff_lo_threshold_per_tc_set(struct aq_hw_s *aq_hw,
1248 						u32 tx_buff_lo_threshold_per_tc,
1249 					 u32 buffer)
1250 {
1251 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TPB_TXBLO_THRESH_ADR(buffer),
1252 			    HW_ATL_TPB_TXBLO_THRESH_MSK,
1253 			    HW_ATL_TPB_TXBLO_THRESH_SHIFT,
1254 			    tx_buff_lo_threshold_per_tc);
1255 }
1256 
hw_atl_tpb_tx_dma_sys_lbk_en_set(struct aq_hw_s * aq_hw,u32 tx_dma_sys_lbk_en)1257 void hw_atl_tpb_tx_dma_sys_lbk_en_set(struct aq_hw_s *aq_hw, u32 tx_dma_sys_lbk_en)
1258 {
1259 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TPB_DMA_SYS_LBK_ADR,
1260 			    HW_ATL_TPB_DMA_SYS_LBK_MSK,
1261 			    HW_ATL_TPB_DMA_SYS_LBK_SHIFT,
1262 			    tx_dma_sys_lbk_en);
1263 }
1264 
hw_atl_tpb_tx_pkt_buff_size_per_tc_set(struct aq_hw_s * aq_hw,u32 tx_pkt_buff_size_per_tc,u32 buffer)1265 void hw_atl_tpb_tx_pkt_buff_size_per_tc_set(struct aq_hw_s *aq_hw,
1266 					    u32 tx_pkt_buff_size_per_tc, u32 buffer)
1267 {
1268 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TPB_TXBBUF_SIZE_ADR(buffer),
1269 			    HW_ATL_TPB_TXBBUF_SIZE_MSK,
1270 			    HW_ATL_TPB_TXBBUF_SIZE_SHIFT,
1271 			    tx_pkt_buff_size_per_tc);
1272 }
1273 
hw_atl_tpb_tx_path_scp_ins_en_set(struct aq_hw_s * aq_hw,u32 tx_path_scp_ins_en)1274 void hw_atl_tpb_tx_path_scp_ins_en_set(struct aq_hw_s *aq_hw, u32 tx_path_scp_ins_en)
1275 {
1276 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TPB_TX_SCP_INS_EN_ADR,
1277 			    HW_ATL_TPB_TX_SCP_INS_EN_MSK,
1278 			    HW_ATL_TPB_TX_SCP_INS_EN_SHIFT,
1279 			    tx_path_scp_ins_en);
1280 }
1281 
1282 /* TPO: tx packet offload */
hw_atl_tpo_ipv4header_crc_offload_en_set(struct aq_hw_s * aq_hw,u32 ipv4header_crc_offload_en)1283 void hw_atl_tpo_ipv4header_crc_offload_en_set(struct aq_hw_s *aq_hw,
1284 					      u32 ipv4header_crc_offload_en)
1285 {
1286 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TPO_IPV4CHK_EN_ADR,
1287 			    HW_ATL_TPO_IPV4CHK_EN_MSK,
1288 			    HW_ATL_TPO_IPV4CHK_EN_SHIFT,
1289 			    ipv4header_crc_offload_en);
1290 }
1291 
hw_atl_tpo_tcp_udp_crc_offload_en_set(struct aq_hw_s * aq_hw,u32 tcp_udp_crc_offload_en)1292 void hw_atl_tpo_tcp_udp_crc_offload_en_set(struct aq_hw_s *aq_hw,
1293 					   u32 tcp_udp_crc_offload_en)
1294 {
1295 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TPOL4CHK_EN_ADR,
1296 			    HW_ATL_TPOL4CHK_EN_MSK,
1297 			    HW_ATL_TPOL4CHK_EN_SHIFT,
1298 			    tcp_udp_crc_offload_en);
1299 }
1300 
hw_atl_tpo_tx_pkt_sys_lbk_en_set(struct aq_hw_s * aq_hw,u32 tx_pkt_sys_lbk_en)1301 void hw_atl_tpo_tx_pkt_sys_lbk_en_set(struct aq_hw_s *aq_hw,
1302 				      u32 tx_pkt_sys_lbk_en)
1303 {
1304 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TPO_PKT_SYS_LBK_ADR,
1305 			    HW_ATL_TPO_PKT_SYS_LBK_MSK,
1306 			    HW_ATL_TPO_PKT_SYS_LBK_SHIFT,
1307 			    tx_pkt_sys_lbk_en);
1308 }
1309 
1310 /* TPS: tx packet scheduler */
hw_atl_tps_tx_pkt_shed_data_arb_mode_set(struct aq_hw_s * aq_hw,u32 tx_pkt_shed_data_arb_mode)1311 void hw_atl_tps_tx_pkt_shed_data_arb_mode_set(struct aq_hw_s *aq_hw,
1312 					      u32 tx_pkt_shed_data_arb_mode)
1313 {
1314 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TPS_DATA_TC_ARB_MODE_ADR,
1315 			    HW_ATL_TPS_DATA_TC_ARB_MODE_MSK,
1316 			    HW_ATL_TPS_DATA_TC_ARB_MODE_SHIFT,
1317 			    tx_pkt_shed_data_arb_mode);
1318 }
1319 
hw_atl_tps_tx_pkt_shed_desc_rate_curr_time_res_set(struct aq_hw_s * aq_hw,u32 curr_time_res)1320 void hw_atl_tps_tx_pkt_shed_desc_rate_curr_time_res_set(struct aq_hw_s *aq_hw,
1321 							u32 curr_time_res)
1322 {
1323 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TPS_DESC_RATE_TA_RST_ADR,
1324 			    HW_ATL_TPS_DESC_RATE_TA_RST_MSK,
1325 			    HW_ATL_TPS_DESC_RATE_TA_RST_SHIFT,
1326 			    curr_time_res);
1327 }
1328 
hw_atl_tps_tx_pkt_shed_desc_rate_lim_set(struct aq_hw_s * aq_hw,u32 tx_pkt_shed_desc_rate_lim)1329 void hw_atl_tps_tx_pkt_shed_desc_rate_lim_set(struct aq_hw_s *aq_hw,
1330 					      u32 tx_pkt_shed_desc_rate_lim)
1331 {
1332 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TPS_DESC_RATE_LIM_ADR,
1333 			    HW_ATL_TPS_DESC_RATE_LIM_MSK,
1334 			    HW_ATL_TPS_DESC_RATE_LIM_SHIFT,
1335 			    tx_pkt_shed_desc_rate_lim);
1336 }
1337 
hw_atl_tps_tx_pkt_shed_desc_tc_arb_mode_set(struct aq_hw_s * aq_hw,u32 arb_mode)1338 void hw_atl_tps_tx_pkt_shed_desc_tc_arb_mode_set(struct aq_hw_s *aq_hw,
1339 						 u32 arb_mode)
1340 {
1341 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TPS_DESC_TC_ARB_MODE_ADR,
1342 			    HW_ATL_TPS_DESC_TC_ARB_MODE_MSK,
1343 			    HW_ATL_TPS_DESC_TC_ARB_MODE_SHIFT,
1344 			    arb_mode);
1345 }
1346 
hw_atl_tps_tx_pkt_shed_desc_tc_max_credit_set(struct aq_hw_s * aq_hw,u32 max_credit,u32 tc)1347 void hw_atl_tps_tx_pkt_shed_desc_tc_max_credit_set(struct aq_hw_s *aq_hw,
1348 						   u32 max_credit,
1349 						   u32 tc)
1350 {
1351 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TPS_DESC_TCTCREDIT_MAX_ADR(tc),
1352 			    HW_ATL_TPS_DESC_TCTCREDIT_MAX_MSK,
1353 			    HW_ATL_TPS_DESC_TCTCREDIT_MAX_SHIFT,
1354 			    max_credit);
1355 }
1356 
hw_atl_tps_tx_pkt_shed_desc_tc_weight_set(struct aq_hw_s * aq_hw,u32 tx_pkt_shed_desc_tc_weight,u32 tc)1357 void hw_atl_tps_tx_pkt_shed_desc_tc_weight_set(struct aq_hw_s *aq_hw,
1358 					       u32 tx_pkt_shed_desc_tc_weight,
1359 					       u32 tc)
1360 {
1361 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TPS_DESC_TCTWEIGHT_ADR(tc),
1362 			    HW_ATL_TPS_DESC_TCTWEIGHT_MSK,
1363 			    HW_ATL_TPS_DESC_TCTWEIGHT_SHIFT,
1364 			    tx_pkt_shed_desc_tc_weight);
1365 }
1366 
hw_atl_tps_tx_pkt_shed_desc_vm_arb_mode_set(struct aq_hw_s * aq_hw,u32 arb_mode)1367 void hw_atl_tps_tx_pkt_shed_desc_vm_arb_mode_set(struct aq_hw_s *aq_hw,
1368 						 u32 arb_mode)
1369 {
1370 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TPS_DESC_VM_ARB_MODE_ADR,
1371 			    HW_ATL_TPS_DESC_VM_ARB_MODE_MSK,
1372 			    HW_ATL_TPS_DESC_VM_ARB_MODE_SHIFT,
1373 			    arb_mode);
1374 }
1375 
hw_atl_tps_tx_pkt_shed_tc_data_max_credit_set(struct aq_hw_s * aq_hw,u32 max_credit,u32 tc)1376 void hw_atl_tps_tx_pkt_shed_tc_data_max_credit_set(struct aq_hw_s *aq_hw,
1377 						   u32 max_credit,
1378 						   u32 tc)
1379 {
1380 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TPS_DATA_TCTCREDIT_MAX_ADR(tc),
1381 			    HW_ATL_TPS_DATA_TCTCREDIT_MAX_MSK,
1382 			    HW_ATL_TPS_DATA_TCTCREDIT_MAX_SHIFT,
1383 			    max_credit);
1384 }
1385 
hw_atl_tps_tx_pkt_shed_tc_data_weight_set(struct aq_hw_s * aq_hw,u32 tx_pkt_shed_tc_data_weight,u32 tc)1386 void hw_atl_tps_tx_pkt_shed_tc_data_weight_set(struct aq_hw_s *aq_hw,
1387 					       u32 tx_pkt_shed_tc_data_weight,
1388 					       u32 tc)
1389 {
1390 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TPS_DATA_TCTWEIGHT_ADR(tc),
1391 			    HW_ATL_TPS_DATA_TCTWEIGHT_MSK,
1392 			    HW_ATL_TPS_DATA_TCTWEIGHT_SHIFT,
1393 			    tx_pkt_shed_tc_data_weight);
1394 }
1395 
1396 /* tx */
hw_atl_tx_tx_reg_res_dis_set(struct aq_hw_s * aq_hw,u32 tx_reg_res_dis)1397 void hw_atl_tx_tx_reg_res_dis_set(struct aq_hw_s *aq_hw, u32 tx_reg_res_dis)
1398 {
1399 	aq_hw_write_reg_bit(aq_hw, HW_ATL_TX_REG_RES_DSBL_ADR,
1400 			    HW_ATL_TX_REG_RES_DSBL_MSK,
1401 			    HW_ATL_TX_REG_RES_DSBL_SHIFT, tx_reg_res_dis);
1402 }
1403 
1404 /* msm */
hw_atl_msm_reg_access_status_get(struct aq_hw_s * aq_hw)1405 u32 hw_atl_msm_reg_access_status_get(struct aq_hw_s *aq_hw)
1406 {
1407 	return aq_hw_read_reg_bit(aq_hw, HW_ATL_MSM_REG_ACCESS_BUSY_ADR,
1408 				  HW_ATL_MSM_REG_ACCESS_BUSY_MSK,
1409 				  HW_ATL_MSM_REG_ACCESS_BUSY_SHIFT);
1410 }
1411 
hw_atl_msm_reg_addr_for_indirect_addr_set(struct aq_hw_s * aq_hw,u32 reg_addr_for_indirect_addr)1412 void hw_atl_msm_reg_addr_for_indirect_addr_set(struct aq_hw_s *aq_hw,
1413 					       u32 reg_addr_for_indirect_addr)
1414 {
1415 	aq_hw_write_reg_bit(aq_hw, HW_ATL_MSM_REG_ADDR_ADR,
1416 			    HW_ATL_MSM_REG_ADDR_MSK,
1417 			    HW_ATL_MSM_REG_ADDR_SHIFT,
1418 			    reg_addr_for_indirect_addr);
1419 }
1420 
hw_atl_msm_reg_rd_strobe_set(struct aq_hw_s * aq_hw,u32 reg_rd_strobe)1421 void hw_atl_msm_reg_rd_strobe_set(struct aq_hw_s *aq_hw, u32 reg_rd_strobe)
1422 {
1423 	aq_hw_write_reg_bit(aq_hw, HW_ATL_MSM_REG_RD_STROBE_ADR,
1424 			    HW_ATL_MSM_REG_RD_STROBE_MSK,
1425 			    HW_ATL_MSM_REG_RD_STROBE_SHIFT,
1426 			    reg_rd_strobe);
1427 }
1428 
hw_atl_msm_reg_rd_data_get(struct aq_hw_s * aq_hw)1429 u32 hw_atl_msm_reg_rd_data_get(struct aq_hw_s *aq_hw)
1430 {
1431 	return aq_hw_read_reg(aq_hw, HW_ATL_MSM_REG_RD_DATA_ADR);
1432 }
1433 
hw_atl_msm_reg_wr_data_set(struct aq_hw_s * aq_hw,u32 reg_wr_data)1434 void hw_atl_msm_reg_wr_data_set(struct aq_hw_s *aq_hw, u32 reg_wr_data)
1435 {
1436 	aq_hw_write_reg(aq_hw, HW_ATL_MSM_REG_WR_DATA_ADR, reg_wr_data);
1437 }
1438 
hw_atl_msm_reg_wr_strobe_set(struct aq_hw_s * aq_hw,u32 reg_wr_strobe)1439 void hw_atl_msm_reg_wr_strobe_set(struct aq_hw_s *aq_hw, u32 reg_wr_strobe)
1440 {
1441 	aq_hw_write_reg_bit(aq_hw, HW_ATL_MSM_REG_WR_STROBE_ADR,
1442 			    HW_ATL_MSM_REG_WR_STROBE_MSK,
1443 			    HW_ATL_MSM_REG_WR_STROBE_SHIFT,
1444 			    reg_wr_strobe);
1445 }
1446 
1447 /* pci */
hw_atl_pci_pci_reg_res_dis_set(struct aq_hw_s * aq_hw,u32 pci_reg_res_dis)1448 void hw_atl_pci_pci_reg_res_dis_set(struct aq_hw_s *aq_hw, u32 pci_reg_res_dis)
1449 {
1450 	aq_hw_write_reg_bit(aq_hw, HW_ATL_PCI_REG_RES_DSBL_ADR,
1451 			    HW_ATL_PCI_REG_RES_DSBL_MSK,
1452 			    HW_ATL_PCI_REG_RES_DSBL_SHIFT,
1453 			    pci_reg_res_dis);
1454 }
1455 
hw_atl_reg_glb_cpu_scratch_scp_set(struct aq_hw_s * aq_hw,u32 glb_cpu_scratch_scp,u32 scratch_scp)1456 void hw_atl_reg_glb_cpu_scratch_scp_set(struct aq_hw_s *aq_hw,
1457 					u32 glb_cpu_scratch_scp,
1458 					u32 scratch_scp)
1459 {
1460 	aq_hw_write_reg(aq_hw, HW_ATL_GLB_CPU_SCRATCH_SCP_ADR(scratch_scp),
1461 			glb_cpu_scratch_scp);
1462 }
1463