1 // SPDX-License-Identifier: BSD-3-Clause-Clear
3 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
7 #include <linux/types.h>
8 #include <linux/bitops.h>
9 #include <linux/bitfield.h>
18 static const guid_t wcn7850_uuid
= GUID_INIT(0xf634f534, 0x6147, 0x11ec,
19 0x90, 0xd6, 0x02, 0x42,
20 0xac, 0x12, 0x00, 0x03);
22 static u8
ath12k_hw_qcn9274_mac_from_pdev_id(int pdev_idx
)
27 static int ath12k_hw_mac_id_to_pdev_id_qcn9274(const struct ath12k_hw_params
*hw
,
33 static int ath12k_hw_mac_id_to_srng_id_qcn9274(const struct ath12k_hw_params
*hw
,
39 static u8
ath12k_hw_get_ring_selector_qcn9274(struct sk_buff
*skb
)
41 return smp_processor_id();
44 static bool ath12k_dp_srng_is_comp_ring_qcn9274(int ring_num
)
46 if (ring_num
< 3 || ring_num
== 4)
52 static int ath12k_hw_mac_id_to_pdev_id_wcn7850(const struct ath12k_hw_params
*hw
,
58 static int ath12k_hw_mac_id_to_srng_id_wcn7850(const struct ath12k_hw_params
*hw
,
64 static u8
ath12k_hw_get_ring_selector_wcn7850(struct sk_buff
*skb
)
66 return skb_get_queue_mapping(skb
);
69 static bool ath12k_dp_srng_is_comp_ring_wcn7850(int ring_num
)
71 if (ring_num
== 0 || ring_num
== 2 || ring_num
== 4)
77 static const struct ath12k_hw_ops qcn9274_ops
= {
78 .get_hw_mac_from_pdev_id
= ath12k_hw_qcn9274_mac_from_pdev_id
,
79 .mac_id_to_pdev_id
= ath12k_hw_mac_id_to_pdev_id_qcn9274
,
80 .mac_id_to_srng_id
= ath12k_hw_mac_id_to_srng_id_qcn9274
,
81 .rxdma_ring_sel_config
= ath12k_dp_rxdma_ring_sel_config_qcn9274
,
82 .get_ring_selector
= ath12k_hw_get_ring_selector_qcn9274
,
83 .dp_srng_is_tx_comp_ring
= ath12k_dp_srng_is_comp_ring_qcn9274
,
86 static const struct ath12k_hw_ops wcn7850_ops
= {
87 .get_hw_mac_from_pdev_id
= ath12k_hw_qcn9274_mac_from_pdev_id
,
88 .mac_id_to_pdev_id
= ath12k_hw_mac_id_to_pdev_id_wcn7850
,
89 .mac_id_to_srng_id
= ath12k_hw_mac_id_to_srng_id_wcn7850
,
90 .rxdma_ring_sel_config
= ath12k_dp_rxdma_ring_sel_config_wcn7850
,
91 .get_ring_selector
= ath12k_hw_get_ring_selector_wcn7850
,
92 .dp_srng_is_tx_comp_ring
= ath12k_dp_srng_is_comp_ring_wcn7850
,
95 #define ATH12K_TX_RING_MASK_0 0x1
96 #define ATH12K_TX_RING_MASK_1 0x2
97 #define ATH12K_TX_RING_MASK_2 0x4
98 #define ATH12K_TX_RING_MASK_3 0x8
99 #define ATH12K_TX_RING_MASK_4 0x10
101 #define ATH12K_RX_RING_MASK_0 0x1
102 #define ATH12K_RX_RING_MASK_1 0x2
103 #define ATH12K_RX_RING_MASK_2 0x4
104 #define ATH12K_RX_RING_MASK_3 0x8
106 #define ATH12K_RX_ERR_RING_MASK_0 0x1
108 #define ATH12K_RX_WBM_REL_RING_MASK_0 0x1
110 #define ATH12K_REO_STATUS_RING_MASK_0 0x1
112 #define ATH12K_HOST2RXDMA_RING_MASK_0 0x1
114 #define ATH12K_RX_MON_RING_MASK_0 0x1
115 #define ATH12K_RX_MON_RING_MASK_1 0x2
116 #define ATH12K_RX_MON_RING_MASK_2 0x4
118 #define ATH12K_TX_MON_RING_MASK_0 0x1
119 #define ATH12K_TX_MON_RING_MASK_1 0x2
121 /* Target firmware's Copy Engine configuration. */
122 static const struct ce_pipe_config ath12k_target_ce_config_wlan_qcn9274
[] = {
123 /* CE0: host->target HTC control and raw streams */
125 .pipenum
= __cpu_to_le32(0),
126 .pipedir
= __cpu_to_le32(PIPEDIR_OUT
),
127 .nentries
= __cpu_to_le32(32),
128 .nbytes_max
= __cpu_to_le32(2048),
129 .flags
= __cpu_to_le32(CE_ATTR_FLAGS
),
130 .reserved
= __cpu_to_le32(0),
133 /* CE1: target->host HTT + HTC control */
135 .pipenum
= __cpu_to_le32(1),
136 .pipedir
= __cpu_to_le32(PIPEDIR_IN
),
137 .nentries
= __cpu_to_le32(32),
138 .nbytes_max
= __cpu_to_le32(2048),
139 .flags
= __cpu_to_le32(CE_ATTR_FLAGS
),
140 .reserved
= __cpu_to_le32(0),
143 /* CE2: target->host WMI */
145 .pipenum
= __cpu_to_le32(2),
146 .pipedir
= __cpu_to_le32(PIPEDIR_IN
),
147 .nentries
= __cpu_to_le32(32),
148 .nbytes_max
= __cpu_to_le32(2048),
149 .flags
= __cpu_to_le32(CE_ATTR_FLAGS
),
150 .reserved
= __cpu_to_le32(0),
153 /* CE3: host->target WMI (mac0) */
155 .pipenum
= __cpu_to_le32(3),
156 .pipedir
= __cpu_to_le32(PIPEDIR_OUT
),
157 .nentries
= __cpu_to_le32(32),
158 .nbytes_max
= __cpu_to_le32(2048),
159 .flags
= __cpu_to_le32(CE_ATTR_FLAGS
),
160 .reserved
= __cpu_to_le32(0),
163 /* CE4: host->target HTT */
165 .pipenum
= __cpu_to_le32(4),
166 .pipedir
= __cpu_to_le32(PIPEDIR_OUT
),
167 .nentries
= __cpu_to_le32(256),
168 .nbytes_max
= __cpu_to_le32(256),
169 .flags
= __cpu_to_le32(CE_ATTR_FLAGS
| CE_ATTR_DIS_INTR
),
170 .reserved
= __cpu_to_le32(0),
173 /* CE5: target->host Pktlog */
175 .pipenum
= __cpu_to_le32(5),
176 .pipedir
= __cpu_to_le32(PIPEDIR_IN
),
177 .nentries
= __cpu_to_le32(32),
178 .nbytes_max
= __cpu_to_le32(2048),
179 .flags
= __cpu_to_le32(CE_ATTR_FLAGS
),
180 .reserved
= __cpu_to_le32(0),
183 /* CE6: Reserved for target autonomous hif_memcpy */
185 .pipenum
= __cpu_to_le32(6),
186 .pipedir
= __cpu_to_le32(PIPEDIR_INOUT
),
187 .nentries
= __cpu_to_le32(32),
188 .nbytes_max
= __cpu_to_le32(16384),
189 .flags
= __cpu_to_le32(CE_ATTR_FLAGS
),
190 .reserved
= __cpu_to_le32(0),
193 /* CE7: host->target WMI (mac1) */
195 .pipenum
= __cpu_to_le32(7),
196 .pipedir
= __cpu_to_le32(PIPEDIR_OUT
),
197 .nentries
= __cpu_to_le32(32),
198 .nbytes_max
= __cpu_to_le32(2048),
199 .flags
= __cpu_to_le32(CE_ATTR_FLAGS
),
200 .reserved
= __cpu_to_le32(0),
203 /* CE8: Reserved for target autonomous hif_memcpy */
205 .pipenum
= __cpu_to_le32(8),
206 .pipedir
= __cpu_to_le32(PIPEDIR_INOUT
),
207 .nentries
= __cpu_to_le32(32),
208 .nbytes_max
= __cpu_to_le32(16384),
209 .flags
= __cpu_to_le32(CE_ATTR_FLAGS
),
210 .reserved
= __cpu_to_le32(0),
213 /* CE9, 10 and 11: Reserved for MHI */
215 /* CE12: Target CV prefetch */
217 .pipenum
= __cpu_to_le32(12),
218 .pipedir
= __cpu_to_le32(PIPEDIR_OUT
),
219 .nentries
= __cpu_to_le32(32),
220 .nbytes_max
= __cpu_to_le32(2048),
221 .flags
= __cpu_to_le32(CE_ATTR_FLAGS
),
222 .reserved
= __cpu_to_le32(0),
225 /* CE13: Target CV prefetch */
227 .pipenum
= __cpu_to_le32(13),
228 .pipedir
= __cpu_to_le32(PIPEDIR_OUT
),
229 .nentries
= __cpu_to_le32(32),
230 .nbytes_max
= __cpu_to_le32(2048),
231 .flags
= __cpu_to_le32(CE_ATTR_FLAGS
),
232 .reserved
= __cpu_to_le32(0),
235 /* CE14: WMI logging/CFR/Spectral/Radar */
237 .pipenum
= __cpu_to_le32(14),
238 .pipedir
= __cpu_to_le32(PIPEDIR_IN
),
239 .nentries
= __cpu_to_le32(32),
240 .nbytes_max
= __cpu_to_le32(2048),
241 .flags
= __cpu_to_le32(CE_ATTR_FLAGS
),
242 .reserved
= __cpu_to_le32(0),
248 /* Target firmware's Copy Engine configuration. */
249 static const struct ce_pipe_config ath12k_target_ce_config_wlan_wcn7850
[] = {
250 /* CE0: host->target HTC control and raw streams */
252 .pipenum
= __cpu_to_le32(0),
253 .pipedir
= __cpu_to_le32(PIPEDIR_OUT
),
254 .nentries
= __cpu_to_le32(32),
255 .nbytes_max
= __cpu_to_le32(2048),
256 .flags
= __cpu_to_le32(CE_ATTR_FLAGS
),
257 .reserved
= __cpu_to_le32(0),
260 /* CE1: target->host HTT + HTC control */
262 .pipenum
= __cpu_to_le32(1),
263 .pipedir
= __cpu_to_le32(PIPEDIR_IN
),
264 .nentries
= __cpu_to_le32(32),
265 .nbytes_max
= __cpu_to_le32(2048),
266 .flags
= __cpu_to_le32(CE_ATTR_FLAGS
),
267 .reserved
= __cpu_to_le32(0),
270 /* CE2: target->host WMI */
272 .pipenum
= __cpu_to_le32(2),
273 .pipedir
= __cpu_to_le32(PIPEDIR_IN
),
274 .nentries
= __cpu_to_le32(32),
275 .nbytes_max
= __cpu_to_le32(2048),
276 .flags
= __cpu_to_le32(CE_ATTR_FLAGS
),
277 .reserved
= __cpu_to_le32(0),
280 /* CE3: host->target WMI */
282 .pipenum
= __cpu_to_le32(3),
283 .pipedir
= __cpu_to_le32(PIPEDIR_OUT
),
284 .nentries
= __cpu_to_le32(32),
285 .nbytes_max
= __cpu_to_le32(2048),
286 .flags
= __cpu_to_le32(CE_ATTR_FLAGS
),
287 .reserved
= __cpu_to_le32(0),
290 /* CE4: host->target HTT */
292 .pipenum
= __cpu_to_le32(4),
293 .pipedir
= __cpu_to_le32(PIPEDIR_OUT
),
294 .nentries
= __cpu_to_le32(256),
295 .nbytes_max
= __cpu_to_le32(256),
296 .flags
= __cpu_to_le32(CE_ATTR_FLAGS
| CE_ATTR_DIS_INTR
),
297 .reserved
= __cpu_to_le32(0),
300 /* CE5: target->host Pktlog */
302 .pipenum
= __cpu_to_le32(5),
303 .pipedir
= __cpu_to_le32(PIPEDIR_IN
),
304 .nentries
= __cpu_to_le32(32),
305 .nbytes_max
= __cpu_to_le32(2048),
306 .flags
= __cpu_to_le32(CE_ATTR_FLAGS
),
307 .reserved
= __cpu_to_le32(0),
310 /* CE6: Reserved for target autonomous hif_memcpy */
312 .pipenum
= __cpu_to_le32(6),
313 .pipedir
= __cpu_to_le32(PIPEDIR_INOUT
),
314 .nentries
= __cpu_to_le32(32),
315 .nbytes_max
= __cpu_to_le32(16384),
316 .flags
= __cpu_to_le32(CE_ATTR_FLAGS
),
317 .reserved
= __cpu_to_le32(0),
320 /* CE7 used only by Host */
322 .pipenum
= __cpu_to_le32(7),
323 .pipedir
= __cpu_to_le32(PIPEDIR_INOUT_H2H
),
324 .nentries
= __cpu_to_le32(0),
325 .nbytes_max
= __cpu_to_le32(0),
326 .flags
= __cpu_to_le32(CE_ATTR_FLAGS
| CE_ATTR_DIS_INTR
),
327 .reserved
= __cpu_to_le32(0),
330 /* CE8 target->host used only by IPA */
332 .pipenum
= __cpu_to_le32(8),
333 .pipedir
= __cpu_to_le32(PIPEDIR_INOUT
),
334 .nentries
= __cpu_to_le32(32),
335 .nbytes_max
= __cpu_to_le32(16384),
336 .flags
= __cpu_to_le32(CE_ATTR_FLAGS
),
337 .reserved
= __cpu_to_le32(0),
339 /* CE 9, 10, 11 are used by MHI driver */
342 /* Map from service/endpoint to Copy Engine.
343 * This table is derived from the CE_PCI TABLE, above.
344 * It is passed to the Target at startup for use by firmware.
346 static const struct service_to_pipe ath12k_target_service_to_ce_map_wlan_qcn9274
[] = {
348 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO
),
349 __cpu_to_le32(PIPEDIR_OUT
), /* out = UL = host -> target */
353 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO
),
354 __cpu_to_le32(PIPEDIR_IN
), /* in = DL = target -> host */
358 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK
),
359 __cpu_to_le32(PIPEDIR_OUT
), /* out = UL = host -> target */
363 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK
),
364 __cpu_to_le32(PIPEDIR_IN
), /* in = DL = target -> host */
368 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE
),
369 __cpu_to_le32(PIPEDIR_OUT
), /* out = UL = host -> target */
373 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE
),
374 __cpu_to_le32(PIPEDIR_IN
), /* in = DL = target -> host */
378 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI
),
379 __cpu_to_le32(PIPEDIR_OUT
), /* out = UL = host -> target */
383 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI
),
384 __cpu_to_le32(PIPEDIR_IN
), /* in = DL = target -> host */
388 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL
),
389 __cpu_to_le32(PIPEDIR_OUT
), /* out = UL = host -> target */
393 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL
),
394 __cpu_to_le32(PIPEDIR_IN
), /* in = DL = target -> host */
398 __cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL
),
399 __cpu_to_le32(PIPEDIR_OUT
), /* out = UL = host -> target */
403 __cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL
),
404 __cpu_to_le32(PIPEDIR_IN
), /* in = DL = target -> host */
408 __cpu_to_le32(ATH12K_HTC_SVC_ID_TEST_RAW_STREAMS
),
409 __cpu_to_le32(PIPEDIR_OUT
), /* out = UL = host -> target */
413 __cpu_to_le32(ATH12K_HTC_SVC_ID_TEST_RAW_STREAMS
),
414 __cpu_to_le32(PIPEDIR_IN
), /* in = DL = target -> host */
418 __cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG
),
419 __cpu_to_le32(PIPEDIR_OUT
), /* out = UL = host -> target */
423 __cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG
),
424 __cpu_to_le32(PIPEDIR_IN
), /* in = DL = target -> host */
428 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL_MAC1
),
429 __cpu_to_le32(PIPEDIR_OUT
), /* out = UL = host -> target */
433 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL_MAC1
),
434 __cpu_to_le32(PIPEDIR_IN
), /* in = DL = target -> host */
438 __cpu_to_le32(ATH12K_HTC_SVC_ID_PKT_LOG
),
439 __cpu_to_le32(PIPEDIR_IN
), /* in = DL = target -> host */
443 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL_DIAG
),
444 __cpu_to_le32(PIPEDIR_IN
), /* in = DL = target -> host */
448 /* (Additions here) */
457 static const struct service_to_pipe ath12k_target_service_to_ce_map_wlan_wcn7850
[] = {
459 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO
),
460 __cpu_to_le32(PIPEDIR_OUT
), /* out = UL = host -> target */
464 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO
),
465 __cpu_to_le32(PIPEDIR_IN
), /* in = DL = target -> host */
469 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK
),
470 __cpu_to_le32(PIPEDIR_OUT
), /* out = UL = host -> target */
474 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK
),
475 __cpu_to_le32(PIPEDIR_IN
), /* in = DL = target -> host */
479 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE
),
480 __cpu_to_le32(PIPEDIR_OUT
), /* out = UL = host -> target */
484 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE
),
485 __cpu_to_le32(PIPEDIR_IN
), /* in = DL = target -> host */
489 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI
),
490 __cpu_to_le32(PIPEDIR_OUT
), /* out = UL = host -> target */
494 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI
),
495 __cpu_to_le32(PIPEDIR_IN
), /* in = DL = target -> host */
499 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL
),
500 __cpu_to_le32(PIPEDIR_OUT
), /* out = UL = host -> target */
504 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL
),
505 __cpu_to_le32(PIPEDIR_IN
), /* in = DL = target -> host */
509 __cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL
),
510 __cpu_to_le32(PIPEDIR_OUT
), /* out = UL = host -> target */
514 __cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL
),
515 __cpu_to_le32(PIPEDIR_IN
), /* in = DL = target -> host */
519 __cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG
),
520 __cpu_to_le32(PIPEDIR_OUT
), /* out = UL = host -> target */
524 __cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG
),
525 __cpu_to_le32(PIPEDIR_IN
), /* in = DL = target -> host */
529 /* (Additions here) */
538 static const struct ath12k_hw_ring_mask ath12k_hw_ring_mask_qcn9274
= {
540 ATH12K_TX_RING_MASK_0
,
541 ATH12K_TX_RING_MASK_1
,
542 ATH12K_TX_RING_MASK_2
,
543 ATH12K_TX_RING_MASK_3
,
550 ATH12K_RX_RING_MASK_0
,
551 ATH12K_RX_RING_MASK_1
,
552 ATH12K_RX_RING_MASK_2
,
553 ATH12K_RX_RING_MASK_3
,
557 ATH12K_RX_ERR_RING_MASK_0
,
561 ATH12K_RX_WBM_REL_RING_MASK_0
,
565 ATH12K_REO_STATUS_RING_MASK_0
,
569 ATH12K_HOST2RXDMA_RING_MASK_0
,
576 static const struct ath12k_hw_ring_mask ath12k_hw_ring_mask_wcn7850
= {
578 ATH12K_TX_RING_MASK_0
,
579 ATH12K_TX_RING_MASK_1
,
580 ATH12K_TX_RING_MASK_2
,
586 ATH12K_RX_RING_MASK_0
,
587 ATH12K_RX_RING_MASK_1
,
588 ATH12K_RX_RING_MASK_2
,
589 ATH12K_RX_RING_MASK_3
,
592 ATH12K_RX_ERR_RING_MASK_0
,
595 ATH12K_RX_WBM_REL_RING_MASK_0
,
598 ATH12K_REO_STATUS_RING_MASK_0
,
606 static const struct ath12k_hw_regs qcn9274_v1_regs
= {
607 /* SW2TCL(x) R0 ring configuration address */
608 .hal_tcl1_ring_id
= 0x00000908,
609 .hal_tcl1_ring_misc
= 0x00000910,
610 .hal_tcl1_ring_tp_addr_lsb
= 0x0000091c,
611 .hal_tcl1_ring_tp_addr_msb
= 0x00000920,
612 .hal_tcl1_ring_consumer_int_setup_ix0
= 0x00000930,
613 .hal_tcl1_ring_consumer_int_setup_ix1
= 0x00000934,
614 .hal_tcl1_ring_msi1_base_lsb
= 0x00000948,
615 .hal_tcl1_ring_msi1_base_msb
= 0x0000094c,
616 .hal_tcl1_ring_msi1_data
= 0x00000950,
617 .hal_tcl_ring_base_lsb
= 0x00000b58,
619 /* TCL STATUS ring address */
620 .hal_tcl_status_ring_base_lsb
= 0x00000d38,
622 .hal_wbm_idle_ring_base_lsb
= 0x00000d0c,
623 .hal_wbm_idle_ring_misc_addr
= 0x00000d1c,
624 .hal_wbm_r0_idle_list_cntl_addr
= 0x00000210,
625 .hal_wbm_r0_idle_list_size_addr
= 0x00000214,
626 .hal_wbm_scattered_ring_base_lsb
= 0x00000220,
627 .hal_wbm_scattered_ring_base_msb
= 0x00000224,
628 .hal_wbm_scattered_desc_head_info_ix0
= 0x00000230,
629 .hal_wbm_scattered_desc_head_info_ix1
= 0x00000234,
630 .hal_wbm_scattered_desc_tail_info_ix0
= 0x00000240,
631 .hal_wbm_scattered_desc_tail_info_ix1
= 0x00000244,
632 .hal_wbm_scattered_desc_ptr_hp_addr
= 0x0000024c,
634 .hal_wbm_sw_release_ring_base_lsb
= 0x0000034c,
635 .hal_wbm_sw1_release_ring_base_lsb
= 0x000003c4,
636 .hal_wbm0_release_ring_base_lsb
= 0x00000dd8,
637 .hal_wbm1_release_ring_base_lsb
= 0x00000e50,
639 /* PCIe base address */
640 .pcie_qserdes_sysclk_en_sel
= 0x01e0c0a8,
641 .pcie_pcs_osc_dtct_config_base
= 0x01e0d45c,
643 /* PPE release ring address */
644 .hal_ppe_rel_ring_base
= 0x0000043c,
646 /* REO DEST ring address */
647 .hal_reo2_ring_base
= 0x0000055c,
648 .hal_reo1_misc_ctrl_addr
= 0x00000b7c,
649 .hal_reo1_sw_cookie_cfg0
= 0x00000050,
650 .hal_reo1_sw_cookie_cfg1
= 0x00000054,
651 .hal_reo1_qdesc_lut_base0
= 0x00000058,
652 .hal_reo1_qdesc_lut_base1
= 0x0000005c,
653 .hal_reo1_ring_base_lsb
= 0x000004e4,
654 .hal_reo1_ring_base_msb
= 0x000004e8,
655 .hal_reo1_ring_id
= 0x000004ec,
656 .hal_reo1_ring_misc
= 0x000004f4,
657 .hal_reo1_ring_hp_addr_lsb
= 0x000004f8,
658 .hal_reo1_ring_hp_addr_msb
= 0x000004fc,
659 .hal_reo1_ring_producer_int_setup
= 0x00000508,
660 .hal_reo1_ring_msi1_base_lsb
= 0x0000052C,
661 .hal_reo1_ring_msi1_base_msb
= 0x00000530,
662 .hal_reo1_ring_msi1_data
= 0x00000534,
663 .hal_reo1_aging_thres_ix0
= 0x00000b08,
664 .hal_reo1_aging_thres_ix1
= 0x00000b0c,
665 .hal_reo1_aging_thres_ix2
= 0x00000b10,
666 .hal_reo1_aging_thres_ix3
= 0x00000b14,
668 /* REO Exception ring address */
669 .hal_reo2_sw0_ring_base
= 0x000008a4,
671 /* REO Reinject ring address */
672 .hal_sw2reo_ring_base
= 0x00000304,
673 .hal_sw2reo1_ring_base
= 0x0000037c,
675 /* REO cmd ring address */
676 .hal_reo_cmd_ring_base
= 0x0000028c,
678 /* REO status ring address */
679 .hal_reo_status_ring_base
= 0x00000a84,
682 static const struct ath12k_hw_regs qcn9274_v2_regs
= {
683 /* SW2TCL(x) R0 ring configuration address */
684 .hal_tcl1_ring_id
= 0x00000908,
685 .hal_tcl1_ring_misc
= 0x00000910,
686 .hal_tcl1_ring_tp_addr_lsb
= 0x0000091c,
687 .hal_tcl1_ring_tp_addr_msb
= 0x00000920,
688 .hal_tcl1_ring_consumer_int_setup_ix0
= 0x00000930,
689 .hal_tcl1_ring_consumer_int_setup_ix1
= 0x00000934,
690 .hal_tcl1_ring_msi1_base_lsb
= 0x00000948,
691 .hal_tcl1_ring_msi1_base_msb
= 0x0000094c,
692 .hal_tcl1_ring_msi1_data
= 0x00000950,
693 .hal_tcl_ring_base_lsb
= 0x00000b58,
695 /* TCL STATUS ring address */
696 .hal_tcl_status_ring_base_lsb
= 0x00000d38,
698 /* WBM idle link ring address */
699 .hal_wbm_idle_ring_base_lsb
= 0x00000d3c,
700 .hal_wbm_idle_ring_misc_addr
= 0x00000d4c,
701 .hal_wbm_r0_idle_list_cntl_addr
= 0x00000240,
702 .hal_wbm_r0_idle_list_size_addr
= 0x00000244,
703 .hal_wbm_scattered_ring_base_lsb
= 0x00000250,
704 .hal_wbm_scattered_ring_base_msb
= 0x00000254,
705 .hal_wbm_scattered_desc_head_info_ix0
= 0x00000260,
706 .hal_wbm_scattered_desc_head_info_ix1
= 0x00000264,
707 .hal_wbm_scattered_desc_tail_info_ix0
= 0x00000270,
708 .hal_wbm_scattered_desc_tail_info_ix1
= 0x00000274,
709 .hal_wbm_scattered_desc_ptr_hp_addr
= 0x0000027c,
711 /* SW2WBM release ring address */
712 .hal_wbm_sw_release_ring_base_lsb
= 0x0000037c,
713 .hal_wbm_sw1_release_ring_base_lsb
= 0x000003f4,
715 /* WBM2SW release ring address */
716 .hal_wbm0_release_ring_base_lsb
= 0x00000e08,
717 .hal_wbm1_release_ring_base_lsb
= 0x00000e80,
719 /* PCIe base address */
720 .pcie_qserdes_sysclk_en_sel
= 0x01e0c0a8,
721 .pcie_pcs_osc_dtct_config_base
= 0x01e0d45c,
723 /* PPE release ring address */
724 .hal_ppe_rel_ring_base
= 0x0000046c,
726 /* REO DEST ring address */
727 .hal_reo2_ring_base
= 0x00000578,
728 .hal_reo1_misc_ctrl_addr
= 0x00000b9c,
729 .hal_reo1_sw_cookie_cfg0
= 0x0000006c,
730 .hal_reo1_sw_cookie_cfg1
= 0x00000070,
731 .hal_reo1_qdesc_lut_base0
= 0x00000074,
732 .hal_reo1_qdesc_lut_base1
= 0x00000078,
733 .hal_reo1_ring_base_lsb
= 0x00000500,
734 .hal_reo1_ring_base_msb
= 0x00000504,
735 .hal_reo1_ring_id
= 0x00000508,
736 .hal_reo1_ring_misc
= 0x00000510,
737 .hal_reo1_ring_hp_addr_lsb
= 0x00000514,
738 .hal_reo1_ring_hp_addr_msb
= 0x00000518,
739 .hal_reo1_ring_producer_int_setup
= 0x00000524,
740 .hal_reo1_ring_msi1_base_lsb
= 0x00000548,
741 .hal_reo1_ring_msi1_base_msb
= 0x0000054C,
742 .hal_reo1_ring_msi1_data
= 0x00000550,
743 .hal_reo1_aging_thres_ix0
= 0x00000B28,
744 .hal_reo1_aging_thres_ix1
= 0x00000B2C,
745 .hal_reo1_aging_thres_ix2
= 0x00000B30,
746 .hal_reo1_aging_thres_ix3
= 0x00000B34,
748 /* REO Exception ring address */
749 .hal_reo2_sw0_ring_base
= 0x000008c0,
751 /* REO Reinject ring address */
752 .hal_sw2reo_ring_base
= 0x00000320,
753 .hal_sw2reo1_ring_base
= 0x00000398,
755 /* REO cmd ring address */
756 .hal_reo_cmd_ring_base
= 0x000002A8,
758 /* REO status ring address */
759 .hal_reo_status_ring_base
= 0x00000aa0,
762 static const struct ath12k_hw_regs wcn7850_regs
= {
763 /* SW2TCL(x) R0 ring configuration address */
764 .hal_tcl1_ring_id
= 0x00000908,
765 .hal_tcl1_ring_misc
= 0x00000910,
766 .hal_tcl1_ring_tp_addr_lsb
= 0x0000091c,
767 .hal_tcl1_ring_tp_addr_msb
= 0x00000920,
768 .hal_tcl1_ring_consumer_int_setup_ix0
= 0x00000930,
769 .hal_tcl1_ring_consumer_int_setup_ix1
= 0x00000934,
770 .hal_tcl1_ring_msi1_base_lsb
= 0x00000948,
771 .hal_tcl1_ring_msi1_base_msb
= 0x0000094c,
772 .hal_tcl1_ring_msi1_data
= 0x00000950,
773 .hal_tcl_ring_base_lsb
= 0x00000b58,
775 /* TCL STATUS ring address */
776 .hal_tcl_status_ring_base_lsb
= 0x00000d38,
778 .hal_wbm_idle_ring_base_lsb
= 0x00000d3c,
779 .hal_wbm_idle_ring_misc_addr
= 0x00000d4c,
780 .hal_wbm_r0_idle_list_cntl_addr
= 0x00000240,
781 .hal_wbm_r0_idle_list_size_addr
= 0x00000244,
782 .hal_wbm_scattered_ring_base_lsb
= 0x00000250,
783 .hal_wbm_scattered_ring_base_msb
= 0x00000254,
784 .hal_wbm_scattered_desc_head_info_ix0
= 0x00000260,
785 .hal_wbm_scattered_desc_head_info_ix1
= 0x00000264,
786 .hal_wbm_scattered_desc_tail_info_ix0
= 0x00000270,
787 .hal_wbm_scattered_desc_tail_info_ix1
= 0x00000274,
788 .hal_wbm_scattered_desc_ptr_hp_addr
= 0x00000027c,
790 .hal_wbm_sw_release_ring_base_lsb
= 0x0000037c,
791 .hal_wbm_sw1_release_ring_base_lsb
= 0x00000284,
792 .hal_wbm0_release_ring_base_lsb
= 0x00000e08,
793 .hal_wbm1_release_ring_base_lsb
= 0x00000e80,
795 /* PCIe base address */
796 .pcie_qserdes_sysclk_en_sel
= 0x01e0e0a8,
797 .pcie_pcs_osc_dtct_config_base
= 0x01e0f45c,
799 /* PPE release ring address */
800 .hal_ppe_rel_ring_base
= 0x0000043c,
802 /* REO DEST ring address */
803 .hal_reo2_ring_base
= 0x0000055c,
804 .hal_reo1_misc_ctrl_addr
= 0x00000b7c,
805 .hal_reo1_sw_cookie_cfg0
= 0x00000050,
806 .hal_reo1_sw_cookie_cfg1
= 0x00000054,
807 .hal_reo1_qdesc_lut_base0
= 0x00000058,
808 .hal_reo1_qdesc_lut_base1
= 0x0000005c,
809 .hal_reo1_ring_base_lsb
= 0x000004e4,
810 .hal_reo1_ring_base_msb
= 0x000004e8,
811 .hal_reo1_ring_id
= 0x000004ec,
812 .hal_reo1_ring_misc
= 0x000004f4,
813 .hal_reo1_ring_hp_addr_lsb
= 0x000004f8,
814 .hal_reo1_ring_hp_addr_msb
= 0x000004fc,
815 .hal_reo1_ring_producer_int_setup
= 0x00000508,
816 .hal_reo1_ring_msi1_base_lsb
= 0x0000052C,
817 .hal_reo1_ring_msi1_base_msb
= 0x00000530,
818 .hal_reo1_ring_msi1_data
= 0x00000534,
819 .hal_reo1_aging_thres_ix0
= 0x00000b08,
820 .hal_reo1_aging_thres_ix1
= 0x00000b0c,
821 .hal_reo1_aging_thres_ix2
= 0x00000b10,
822 .hal_reo1_aging_thres_ix3
= 0x00000b14,
824 /* REO Exception ring address */
825 .hal_reo2_sw0_ring_base
= 0x000008a4,
827 /* REO Reinject ring address */
828 .hal_sw2reo_ring_base
= 0x00000304,
829 .hal_sw2reo1_ring_base
= 0x0000037c,
831 /* REO cmd ring address */
832 .hal_reo_cmd_ring_base
= 0x0000028c,
834 /* REO status ring address */
835 .hal_reo_status_ring_base
= 0x00000a84,
838 static const struct ath12k_hw_hal_params ath12k_hw_hal_params_qcn9274
= {
839 .rx_buf_rbm
= HAL_RX_BUF_RBM_SW3_BM
,
840 .wbm2sw_cc_enable
= HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW0_EN
|
841 HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW1_EN
|
842 HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW2_EN
|
843 HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW3_EN
|
844 HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW4_EN
,
847 static const struct ath12k_hw_hal_params ath12k_hw_hal_params_wcn7850
= {
848 .rx_buf_rbm
= HAL_RX_BUF_RBM_SW1_BM
,
849 .wbm2sw_cc_enable
= HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW0_EN
|
850 HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW2_EN
|
851 HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW3_EN
|
852 HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW4_EN
,
855 static const struct ath12k_hw_params ath12k_hw_params
[] = {
857 .name
= "qcn9274 hw1.0",
858 .hw_rev
= ATH12K_HW_QCN9274_HW10
,
860 .dir
= "QCN9274/hw1.0",
861 .board_size
= 256 * 1024,
862 .cal_offset
= 128 * 1024,
865 .single_pdev_only
= false,
866 .qmi_service_ins_id
= ATH12K_QMI_WLFW_SERVICE_INS_ID_V01_QCN9274
,
867 .internal_sleep_clock
= false,
869 .hw_ops
= &qcn9274_ops
,
870 .ring_mask
= &ath12k_hw_ring_mask_qcn9274
,
871 .regs
= &qcn9274_v1_regs
,
873 .host_ce_config
= ath12k_host_ce_config_qcn9274
,
875 .target_ce_config
= ath12k_target_ce_config_wlan_qcn9274
,
876 .target_ce_count
= 12,
877 .svc_to_ce_map
= ath12k_target_service_to_ce_map_wlan_qcn9274
,
878 .svc_to_ce_map_len
= 18,
880 .hal_params
= &ath12k_hw_hal_params_qcn9274
,
882 .rxdma1_enable
= false,
883 .num_rxdma_per_pdev
= 1,
884 .num_rxdma_dst_ring
= 0,
885 .rx_mac_buf_ring
= false,
886 .vdev_start_delay
= false,
888 .interface_modes
= BIT(NL80211_IFTYPE_STATION
) |
889 BIT(NL80211_IFTYPE_AP
) |
890 BIT(NL80211_IFTYPE_MESH_POINT
) |
891 BIT(NL80211_IFTYPE_AP_VLAN
),
892 .supports_monitor
= false,
895 .download_calib
= true,
896 .supports_suspend
= false,
897 .tcl_ring_retry
= true,
898 .reoq_lut_support
= false,
899 .supports_shadow_regs
= false,
904 .mhi_config
= &ath12k_mhi_config_qcn9274
,
906 .wmi_init
= ath12k_wmi_init_qcn9274
,
908 .hal_ops
= &hal_qcn9274_ops
,
910 .qmi_cnss_feature_bitmap
= BIT(CNSS_QDSS_CFG_MISS_V01
),
914 .rfkill_on_level
= 0,
916 .rddm_size
= 0x600000,
921 .otp_board_id_register
= QCN9274_QFPROM_RAW_RFA_PDET_ROW13_LSB
,
923 .supports_sta_ps
= false,
926 .supports_dynamic_smps_6ghz
= true,
930 .supports_aspm
= false,
933 .name
= "wcn7850 hw2.0",
934 .hw_rev
= ATH12K_HW_WCN7850_HW20
,
937 .dir
= "WCN7850/hw2.0",
938 .board_size
= 256 * 1024,
939 .cal_offset
= 256 * 1024,
943 .single_pdev_only
= true,
944 .qmi_service_ins_id
= ATH12K_QMI_WLFW_SERVICE_INS_ID_V01_WCN7850
,
945 .internal_sleep_clock
= true,
947 .hw_ops
= &wcn7850_ops
,
948 .ring_mask
= &ath12k_hw_ring_mask_wcn7850
,
949 .regs
= &wcn7850_regs
,
951 .host_ce_config
= ath12k_host_ce_config_wcn7850
,
953 .target_ce_config
= ath12k_target_ce_config_wlan_wcn7850
,
954 .target_ce_count
= 9,
955 .svc_to_ce_map
= ath12k_target_service_to_ce_map_wlan_wcn7850
,
956 .svc_to_ce_map_len
= 14,
958 .hal_params
= &ath12k_hw_hal_params_wcn7850
,
960 .rxdma1_enable
= false,
961 .num_rxdma_per_pdev
= 2,
962 .num_rxdma_dst_ring
= 1,
963 .rx_mac_buf_ring
= true,
964 .vdev_start_delay
= true,
966 .interface_modes
= BIT(NL80211_IFTYPE_STATION
) |
967 BIT(NL80211_IFTYPE_AP
) |
968 BIT(NL80211_IFTYPE_P2P_DEVICE
) |
969 BIT(NL80211_IFTYPE_P2P_CLIENT
) |
970 BIT(NL80211_IFTYPE_P2P_GO
),
971 .supports_monitor
= false,
974 .download_calib
= false,
975 .supports_suspend
= true,
976 .tcl_ring_retry
= false,
977 .reoq_lut_support
= false,
978 .supports_shadow_regs
= true,
983 .mhi_config
= &ath12k_mhi_config_wcn7850
,
985 .wmi_init
= ath12k_wmi_init_wcn7850
,
987 .hal_ops
= &hal_wcn7850_ops
,
989 .qmi_cnss_feature_bitmap
= BIT(CNSS_QDSS_CFG_MISS_V01
) |
990 BIT(CNSS_PCIE_PERST_NO_PULL_V01
),
994 .rfkill_on_level
= 1,
996 .rddm_size
= 0x780000,
1001 .otp_board_id_register
= 0,
1003 .supports_sta_ps
= true,
1005 .acpi_guid
= &wcn7850_uuid
,
1006 .supports_dynamic_smps_6ghz
= false,
1008 .iova_mask
= ATH12K_PCIE_MAX_PAYLOAD_SIZE
- 1,
1010 .supports_aspm
= true,
1013 .name
= "qcn9274 hw2.0",
1014 .hw_rev
= ATH12K_HW_QCN9274_HW20
,
1016 .dir
= "QCN9274/hw2.0",
1017 .board_size
= 256 * 1024,
1018 .cal_offset
= 128 * 1024,
1021 .single_pdev_only
= false,
1022 .qmi_service_ins_id
= ATH12K_QMI_WLFW_SERVICE_INS_ID_V01_QCN9274
,
1023 .internal_sleep_clock
= false,
1025 .hw_ops
= &qcn9274_ops
,
1026 .ring_mask
= &ath12k_hw_ring_mask_qcn9274
,
1027 .regs
= &qcn9274_v2_regs
,
1029 .host_ce_config
= ath12k_host_ce_config_qcn9274
,
1031 .target_ce_config
= ath12k_target_ce_config_wlan_qcn9274
,
1032 .target_ce_count
= 12,
1033 .svc_to_ce_map
= ath12k_target_service_to_ce_map_wlan_qcn9274
,
1034 .svc_to_ce_map_len
= 18,
1036 .hal_params
= &ath12k_hw_hal_params_qcn9274
,
1038 .rxdma1_enable
= false,
1039 .num_rxdma_per_pdev
= 1,
1040 .num_rxdma_dst_ring
= 0,
1041 .rx_mac_buf_ring
= false,
1042 .vdev_start_delay
= false,
1044 .interface_modes
= BIT(NL80211_IFTYPE_STATION
) |
1045 BIT(NL80211_IFTYPE_AP
) |
1046 BIT(NL80211_IFTYPE_MESH_POINT
) |
1047 BIT(NL80211_IFTYPE_AP_VLAN
),
1048 .supports_monitor
= false,
1051 .download_calib
= true,
1052 .supports_suspend
= false,
1053 .tcl_ring_retry
= true,
1054 .reoq_lut_support
= false,
1055 .supports_shadow_regs
= false,
1057 .num_tcl_banks
= 48,
1060 .mhi_config
= &ath12k_mhi_config_qcn9274
,
1062 .wmi_init
= ath12k_wmi_init_qcn9274
,
1064 .hal_ops
= &hal_qcn9274_ops
,
1066 .qmi_cnss_feature_bitmap
= BIT(CNSS_QDSS_CFG_MISS_V01
),
1070 .rfkill_on_level
= 0,
1072 .rddm_size
= 0x600000,
1075 .max_mlo_peer
= 256,
1077 .otp_board_id_register
= QCN9274_QFPROM_RAW_RFA_PDET_ROW13_LSB
,
1079 .supports_sta_ps
= false,
1082 .supports_dynamic_smps_6ghz
= true,
1086 .supports_aspm
= false,
1090 int ath12k_hw_init(struct ath12k_base
*ab
)
1092 const struct ath12k_hw_params
*hw_params
= NULL
;
1095 for (i
= 0; i
< ARRAY_SIZE(ath12k_hw_params
); i
++) {
1096 hw_params
= &ath12k_hw_params
[i
];
1098 if (hw_params
->hw_rev
== ab
->hw_rev
)
1102 if (i
== ARRAY_SIZE(ath12k_hw_params
)) {
1103 ath12k_err(ab
, "Unsupported hardware version: 0x%x\n", ab
->hw_rev
);
1107 ab
->hw_params
= hw_params
;
1109 ath12k_info(ab
, "Hardware name: %s\n", ab
->hw_params
->name
);