WIP FPC-III support
[linux/fpc-iii.git] / drivers / net / wireless / ath / ath11k / hw.c
blob66331da3501291f08039073604089c32e10bfa86
1 // SPDX-License-Identifier: BSD-3-Clause-Clear
2 /*
3 * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
4 */
6 #include <linux/types.h>
7 #include <linux/bitops.h>
8 #include <linux/bitfield.h>
10 #include "hw.h"
11 #include "core.h"
12 #include "ce.h"
14 /* Map from pdev index to hw mac index */
15 static u8 ath11k_hw_ipq8074_mac_from_pdev_id(int pdev_idx)
17 switch (pdev_idx) {
18 case 0:
19 return 0;
20 case 1:
21 return 2;
22 case 2:
23 return 1;
24 default:
25 return ATH11K_INVALID_HW_MAC_ID;
29 static u8 ath11k_hw_ipq6018_mac_from_pdev_id(int pdev_idx)
31 return pdev_idx;
34 static void ath11k_init_wmi_config_qca6390(struct ath11k_base *ab,
35 struct target_resource_config *config)
37 config->num_vdevs = 4;
38 config->num_peers = 16;
39 config->num_tids = 32;
41 config->num_offload_peers = 3;
42 config->num_offload_reorder_buffs = 3;
43 config->num_peer_keys = TARGET_NUM_PEER_KEYS;
44 config->ast_skid_limit = TARGET_AST_SKID_LIMIT;
45 config->tx_chain_mask = (1 << ab->target_caps.num_rf_chains) - 1;
46 config->rx_chain_mask = (1 << ab->target_caps.num_rf_chains) - 1;
47 config->rx_timeout_pri[0] = TARGET_RX_TIMEOUT_LO_PRI;
48 config->rx_timeout_pri[1] = TARGET_RX_TIMEOUT_LO_PRI;
49 config->rx_timeout_pri[2] = TARGET_RX_TIMEOUT_LO_PRI;
50 config->rx_timeout_pri[3] = TARGET_RX_TIMEOUT_HI_PRI;
51 config->rx_decap_mode = TARGET_DECAP_MODE_NATIVE_WIFI;
52 config->scan_max_pending_req = TARGET_SCAN_MAX_PENDING_REQS;
53 config->bmiss_offload_max_vdev = TARGET_BMISS_OFFLOAD_MAX_VDEV;
54 config->roam_offload_max_vdev = TARGET_ROAM_OFFLOAD_MAX_VDEV;
55 config->roam_offload_max_ap_profiles = TARGET_ROAM_OFFLOAD_MAX_AP_PROFILES;
56 config->num_mcast_groups = 0;
57 config->num_mcast_table_elems = 0;
58 config->mcast2ucast_mode = 0;
59 config->tx_dbg_log_size = TARGET_TX_DBG_LOG_SIZE;
60 config->num_wds_entries = 0;
61 config->dma_burst_size = 0;
62 config->rx_skip_defrag_timeout_dup_detection_check = 0;
63 config->vow_config = TARGET_VOW_CONFIG;
64 config->gtk_offload_max_vdev = 2;
65 config->num_msdu_desc = 0x400;
66 config->beacon_tx_offload_max_vdev = 2;
67 config->rx_batchmode = TARGET_RX_BATCHMODE;
69 config->peer_map_unmap_v2_support = 0;
70 config->use_pdev_id = 1;
71 config->max_frag_entries = 0xa;
72 config->num_tdls_vdevs = 0x1;
73 config->num_tdls_conn_table_entries = 8;
74 config->beacon_tx_offload_max_vdev = 0x2;
75 config->num_multicast_filter_entries = 0x20;
76 config->num_wow_filters = 0x16;
77 config->num_keep_alive_pattern = 0;
80 static void ath11k_init_wmi_config_ipq8074(struct ath11k_base *ab,
81 struct target_resource_config *config)
83 config->num_vdevs = ab->num_radios * TARGET_NUM_VDEVS;
85 if (ab->num_radios == 2) {
86 config->num_peers = TARGET_NUM_PEERS(DBS);
87 config->num_tids = TARGET_NUM_TIDS(DBS);
88 } else if (ab->num_radios == 3) {
89 config->num_peers = TARGET_NUM_PEERS(DBS_SBS);
90 config->num_tids = TARGET_NUM_TIDS(DBS_SBS);
91 } else {
92 /* Control should not reach here */
93 config->num_peers = TARGET_NUM_PEERS(SINGLE);
94 config->num_tids = TARGET_NUM_TIDS(SINGLE);
96 config->num_offload_peers = TARGET_NUM_OFFLD_PEERS;
97 config->num_offload_reorder_buffs = TARGET_NUM_OFFLD_REORDER_BUFFS;
98 config->num_peer_keys = TARGET_NUM_PEER_KEYS;
99 config->ast_skid_limit = TARGET_AST_SKID_LIMIT;
100 config->tx_chain_mask = (1 << ab->target_caps.num_rf_chains) - 1;
101 config->rx_chain_mask = (1 << ab->target_caps.num_rf_chains) - 1;
102 config->rx_timeout_pri[0] = TARGET_RX_TIMEOUT_LO_PRI;
103 config->rx_timeout_pri[1] = TARGET_RX_TIMEOUT_LO_PRI;
104 config->rx_timeout_pri[2] = TARGET_RX_TIMEOUT_LO_PRI;
105 config->rx_timeout_pri[3] = TARGET_RX_TIMEOUT_HI_PRI;
107 if (test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags))
108 config->rx_decap_mode = TARGET_DECAP_MODE_RAW;
109 else
110 config->rx_decap_mode = TARGET_DECAP_MODE_NATIVE_WIFI;
112 config->scan_max_pending_req = TARGET_SCAN_MAX_PENDING_REQS;
113 config->bmiss_offload_max_vdev = TARGET_BMISS_OFFLOAD_MAX_VDEV;
114 config->roam_offload_max_vdev = TARGET_ROAM_OFFLOAD_MAX_VDEV;
115 config->roam_offload_max_ap_profiles = TARGET_ROAM_OFFLOAD_MAX_AP_PROFILES;
116 config->num_mcast_groups = TARGET_NUM_MCAST_GROUPS;
117 config->num_mcast_table_elems = TARGET_NUM_MCAST_TABLE_ELEMS;
118 config->mcast2ucast_mode = TARGET_MCAST2UCAST_MODE;
119 config->tx_dbg_log_size = TARGET_TX_DBG_LOG_SIZE;
120 config->num_wds_entries = TARGET_NUM_WDS_ENTRIES;
121 config->dma_burst_size = TARGET_DMA_BURST_SIZE;
122 config->rx_skip_defrag_timeout_dup_detection_check =
123 TARGET_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK;
124 config->vow_config = TARGET_VOW_CONFIG;
125 config->gtk_offload_max_vdev = TARGET_GTK_OFFLOAD_MAX_VDEV;
126 config->num_msdu_desc = TARGET_NUM_MSDU_DESC;
127 config->beacon_tx_offload_max_vdev = ab->num_radios * TARGET_MAX_BCN_OFFLD;
128 config->rx_batchmode = TARGET_RX_BATCHMODE;
129 config->peer_map_unmap_v2_support = 1;
130 config->twt_ap_pdev_count = ab->num_radios;
131 config->twt_ap_sta_count = 1000;
134 static int ath11k_hw_mac_id_to_pdev_id_ipq8074(struct ath11k_hw_params *hw,
135 int mac_id)
137 return mac_id;
140 static int ath11k_hw_mac_id_to_srng_id_ipq8074(struct ath11k_hw_params *hw,
141 int mac_id)
143 return 0;
146 static int ath11k_hw_mac_id_to_pdev_id_qca6390(struct ath11k_hw_params *hw,
147 int mac_id)
149 return 0;
152 static int ath11k_hw_mac_id_to_srng_id_qca6390(struct ath11k_hw_params *hw,
153 int mac_id)
155 return mac_id;
158 const struct ath11k_hw_ops ipq8074_ops = {
159 .get_hw_mac_from_pdev_id = ath11k_hw_ipq8074_mac_from_pdev_id,
160 .wmi_init_config = ath11k_init_wmi_config_ipq8074,
161 .mac_id_to_pdev_id = ath11k_hw_mac_id_to_pdev_id_ipq8074,
162 .mac_id_to_srng_id = ath11k_hw_mac_id_to_srng_id_ipq8074,
165 const struct ath11k_hw_ops ipq6018_ops = {
166 .get_hw_mac_from_pdev_id = ath11k_hw_ipq6018_mac_from_pdev_id,
167 .wmi_init_config = ath11k_init_wmi_config_ipq8074,
168 .mac_id_to_pdev_id = ath11k_hw_mac_id_to_pdev_id_ipq8074,
169 .mac_id_to_srng_id = ath11k_hw_mac_id_to_srng_id_ipq8074,
172 const struct ath11k_hw_ops qca6390_ops = {
173 .get_hw_mac_from_pdev_id = ath11k_hw_ipq8074_mac_from_pdev_id,
174 .wmi_init_config = ath11k_init_wmi_config_qca6390,
175 .mac_id_to_pdev_id = ath11k_hw_mac_id_to_pdev_id_qca6390,
176 .mac_id_to_srng_id = ath11k_hw_mac_id_to_srng_id_qca6390,
179 #define ATH11K_TX_RING_MASK_0 0x1
180 #define ATH11K_TX_RING_MASK_1 0x2
181 #define ATH11K_TX_RING_MASK_2 0x4
183 #define ATH11K_RX_RING_MASK_0 0x1
184 #define ATH11K_RX_RING_MASK_1 0x2
185 #define ATH11K_RX_RING_MASK_2 0x4
186 #define ATH11K_RX_RING_MASK_3 0x8
188 #define ATH11K_RX_ERR_RING_MASK_0 0x1
190 #define ATH11K_RX_WBM_REL_RING_MASK_0 0x1
192 #define ATH11K_REO_STATUS_RING_MASK_0 0x1
194 #define ATH11K_RXDMA2HOST_RING_MASK_0 0x1
195 #define ATH11K_RXDMA2HOST_RING_MASK_1 0x2
196 #define ATH11K_RXDMA2HOST_RING_MASK_2 0x4
198 #define ATH11K_HOST2RXDMA_RING_MASK_0 0x1
199 #define ATH11K_HOST2RXDMA_RING_MASK_1 0x2
200 #define ATH11K_HOST2RXDMA_RING_MASK_2 0x4
202 #define ATH11K_RX_MON_STATUS_RING_MASK_0 0x1
203 #define ATH11K_RX_MON_STATUS_RING_MASK_1 0x2
204 #define ATH11K_RX_MON_STATUS_RING_MASK_2 0x4
206 const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_ipq8074 = {
207 .tx = {
208 ATH11K_TX_RING_MASK_0,
209 ATH11K_TX_RING_MASK_1,
210 ATH11K_TX_RING_MASK_2,
212 .rx_mon_status = {
213 0, 0, 0, 0,
214 ATH11K_RX_MON_STATUS_RING_MASK_0,
215 ATH11K_RX_MON_STATUS_RING_MASK_1,
216 ATH11K_RX_MON_STATUS_RING_MASK_2,
218 .rx = {
219 0, 0, 0, 0, 0, 0, 0,
220 ATH11K_RX_RING_MASK_0,
221 ATH11K_RX_RING_MASK_1,
222 ATH11K_RX_RING_MASK_2,
223 ATH11K_RX_RING_MASK_3,
225 .rx_err = {
226 ATH11K_RX_ERR_RING_MASK_0,
228 .rx_wbm_rel = {
229 ATH11K_RX_WBM_REL_RING_MASK_0,
231 .reo_status = {
232 ATH11K_REO_STATUS_RING_MASK_0,
234 .rxdma2host = {
235 ATH11K_RXDMA2HOST_RING_MASK_0,
236 ATH11K_RXDMA2HOST_RING_MASK_1,
237 ATH11K_RXDMA2HOST_RING_MASK_2,
239 .host2rxdma = {
240 ATH11K_HOST2RXDMA_RING_MASK_0,
241 ATH11K_HOST2RXDMA_RING_MASK_1,
242 ATH11K_HOST2RXDMA_RING_MASK_2,
246 const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_qca6390 = {
247 .tx = {
248 ATH11K_TX_RING_MASK_0,
249 ATH11K_TX_RING_MASK_1,
250 ATH11K_TX_RING_MASK_2,
252 .rx_mon_status = {
253 0, 0, 0, 0,
254 ATH11K_RX_MON_STATUS_RING_MASK_0,
255 ATH11K_RX_MON_STATUS_RING_MASK_1,
256 ATH11K_RX_MON_STATUS_RING_MASK_2,
258 .rx = {
259 0, 0, 0, 0, 0, 0, 0,
260 ATH11K_RX_RING_MASK_0,
261 ATH11K_RX_RING_MASK_1,
262 ATH11K_RX_RING_MASK_2,
263 ATH11K_RX_RING_MASK_3,
265 .rx_err = {
266 ATH11K_RX_ERR_RING_MASK_0,
268 .rx_wbm_rel = {
269 ATH11K_RX_WBM_REL_RING_MASK_0,
271 .reo_status = {
272 ATH11K_REO_STATUS_RING_MASK_0,
274 .rxdma2host = {
275 ATH11K_RXDMA2HOST_RING_MASK_0,
276 ATH11K_RXDMA2HOST_RING_MASK_1,
277 ATH11K_RXDMA2HOST_RING_MASK_2,
279 .host2rxdma = {
283 /* Target firmware's Copy Engine configuration. */
284 const struct ce_pipe_config ath11k_target_ce_config_wlan_ipq8074[] = {
285 /* CE0: host->target HTC control and raw streams */
287 .pipenum = __cpu_to_le32(0),
288 .pipedir = __cpu_to_le32(PIPEDIR_OUT),
289 .nentries = __cpu_to_le32(32),
290 .nbytes_max = __cpu_to_le32(2048),
291 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
292 .reserved = __cpu_to_le32(0),
295 /* CE1: target->host HTT + HTC control */
297 .pipenum = __cpu_to_le32(1),
298 .pipedir = __cpu_to_le32(PIPEDIR_IN),
299 .nentries = __cpu_to_le32(32),
300 .nbytes_max = __cpu_to_le32(2048),
301 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
302 .reserved = __cpu_to_le32(0),
305 /* CE2: target->host WMI */
307 .pipenum = __cpu_to_le32(2),
308 .pipedir = __cpu_to_le32(PIPEDIR_IN),
309 .nentries = __cpu_to_le32(32),
310 .nbytes_max = __cpu_to_le32(2048),
311 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
312 .reserved = __cpu_to_le32(0),
315 /* CE3: host->target WMI */
317 .pipenum = __cpu_to_le32(3),
318 .pipedir = __cpu_to_le32(PIPEDIR_OUT),
319 .nentries = __cpu_to_le32(32),
320 .nbytes_max = __cpu_to_le32(2048),
321 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
322 .reserved = __cpu_to_le32(0),
325 /* CE4: host->target HTT */
327 .pipenum = __cpu_to_le32(4),
328 .pipedir = __cpu_to_le32(PIPEDIR_OUT),
329 .nentries = __cpu_to_le32(256),
330 .nbytes_max = __cpu_to_le32(256),
331 .flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
332 .reserved = __cpu_to_le32(0),
335 /* CE5: target->host Pktlog */
337 .pipenum = __cpu_to_le32(5),
338 .pipedir = __cpu_to_le32(PIPEDIR_IN),
339 .nentries = __cpu_to_le32(32),
340 .nbytes_max = __cpu_to_le32(2048),
341 .flags = __cpu_to_le32(0),
342 .reserved = __cpu_to_le32(0),
345 /* CE6: Reserved for target autonomous hif_memcpy */
347 .pipenum = __cpu_to_le32(6),
348 .pipedir = __cpu_to_le32(PIPEDIR_INOUT),
349 .nentries = __cpu_to_le32(32),
350 .nbytes_max = __cpu_to_le32(65535),
351 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
352 .reserved = __cpu_to_le32(0),
355 /* CE7 used only by Host */
357 .pipenum = __cpu_to_le32(7),
358 .pipedir = __cpu_to_le32(PIPEDIR_OUT),
359 .nentries = __cpu_to_le32(32),
360 .nbytes_max = __cpu_to_le32(2048),
361 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
362 .reserved = __cpu_to_le32(0),
365 /* CE8 target->host used only by IPA */
367 .pipenum = __cpu_to_le32(8),
368 .pipedir = __cpu_to_le32(PIPEDIR_INOUT),
369 .nentries = __cpu_to_le32(32),
370 .nbytes_max = __cpu_to_le32(65535),
371 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
372 .reserved = __cpu_to_le32(0),
375 /* CE9 host->target HTT */
377 .pipenum = __cpu_to_le32(9),
378 .pipedir = __cpu_to_le32(PIPEDIR_OUT),
379 .nentries = __cpu_to_le32(32),
380 .nbytes_max = __cpu_to_le32(2048),
381 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
382 .reserved = __cpu_to_le32(0),
385 /* CE10 target->host HTT */
387 .pipenum = __cpu_to_le32(10),
388 .pipedir = __cpu_to_le32(PIPEDIR_INOUT_H2H),
389 .nentries = __cpu_to_le32(0),
390 .nbytes_max = __cpu_to_le32(0),
391 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
392 .reserved = __cpu_to_le32(0),
395 /* CE11 Not used */
398 /* Map from service/endpoint to Copy Engine.
399 * This table is derived from the CE_PCI TABLE, above.
400 * It is passed to the Target at startup for use by firmware.
402 const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_ipq8074[] = {
404 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO),
405 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
406 .pipenum = __cpu_to_le32(3),
409 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO),
410 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
411 .pipenum = __cpu_to_le32(2),
414 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK),
415 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
416 .pipenum = __cpu_to_le32(3),
419 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK),
420 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
421 .pipenum = __cpu_to_le32(2),
424 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE),
425 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
426 .pipenum = __cpu_to_le32(3),
429 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE),
430 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
431 .pipenum = __cpu_to_le32(2),
434 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI),
435 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
436 .pipenum = __cpu_to_le32(3),
439 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI),
440 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
441 .pipenum = __cpu_to_le32(2),
444 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL),
445 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
446 .pipenum = __cpu_to_le32(3),
449 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL),
450 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
451 .pipenum = __cpu_to_le32(2),
454 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL_MAC1),
455 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
456 .pipenum = __cpu_to_le32(7),
459 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL_MAC1),
460 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
461 .pipenum = __cpu_to_le32(2),
464 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL_MAC2),
465 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
466 .pipenum = __cpu_to_le32(9),
469 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL_MAC2),
470 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
471 .pipenum = __cpu_to_le32(2),
474 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL),
475 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
476 .pipenum = __cpu_to_le32(0),
479 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL),
480 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
481 .pipenum = __cpu_to_le32(1),
483 { /* not used */
484 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_TEST_RAW_STREAMS),
485 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
486 .pipenum = __cpu_to_le32(0),
488 { /* not used */
489 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_TEST_RAW_STREAMS),
490 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
491 .pipenum = __cpu_to_le32(1),
494 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG),
495 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
496 .pipenum = __cpu_to_le32(4),
499 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG),
500 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
501 .pipenum = __cpu_to_le32(1),
504 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_PKT_LOG),
505 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
506 .pipenum = __cpu_to_le32(5),
509 /* (Additions here) */
511 { /* terminator entry */ }
514 const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_ipq6018[] = {
516 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO),
517 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
518 .pipenum = __cpu_to_le32(3),
521 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO),
522 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
523 .pipenum = __cpu_to_le32(2),
526 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK),
527 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
528 .pipenum = __cpu_to_le32(3),
531 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK),
532 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
533 .pipenum = __cpu_to_le32(2),
536 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE),
537 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
538 .pipenum = __cpu_to_le32(3),
541 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE),
542 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
543 .pipenum = __cpu_to_le32(2),
546 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI),
547 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
548 .pipenum = __cpu_to_le32(3),
551 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI),
552 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
553 .pipenum = __cpu_to_le32(2),
556 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL),
557 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
558 .pipenum = __cpu_to_le32(3),
561 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL),
562 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
563 .pipenum = __cpu_to_le32(2),
566 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL_MAC1),
567 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
568 .pipenum = __cpu_to_le32(7),
571 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL_MAC1),
572 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
573 .pipenum = __cpu_to_le32(2),
576 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL),
577 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
578 .pipenum = __cpu_to_le32(0),
581 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL),
582 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
583 .pipenum = __cpu_to_le32(1),
585 { /* not used */
586 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_TEST_RAW_STREAMS),
587 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
588 .pipenum = __cpu_to_le32(0),
590 { /* not used */
591 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_TEST_RAW_STREAMS),
592 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
593 .pipenum = __cpu_to_le32(1),
596 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG),
597 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
598 .pipenum = __cpu_to_le32(4),
601 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG),
602 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
603 .pipenum = __cpu_to_le32(1),
606 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_PKT_LOG),
607 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
608 .pipenum = __cpu_to_le32(5),
611 /* (Additions here) */
613 { /* terminator entry */ }
616 /* Target firmware's Copy Engine configuration. */
617 const struct ce_pipe_config ath11k_target_ce_config_wlan_qca6390[] = {
618 /* CE0: host->target HTC control and raw streams */
620 .pipenum = __cpu_to_le32(0),
621 .pipedir = __cpu_to_le32(PIPEDIR_OUT),
622 .nentries = __cpu_to_le32(32),
623 .nbytes_max = __cpu_to_le32(2048),
624 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
625 .reserved = __cpu_to_le32(0),
628 /* CE1: target->host HTT + HTC control */
630 .pipenum = __cpu_to_le32(1),
631 .pipedir = __cpu_to_le32(PIPEDIR_IN),
632 .nentries = __cpu_to_le32(32),
633 .nbytes_max = __cpu_to_le32(2048),
634 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
635 .reserved = __cpu_to_le32(0),
638 /* CE2: target->host WMI */
640 .pipenum = __cpu_to_le32(2),
641 .pipedir = __cpu_to_le32(PIPEDIR_IN),
642 .nentries = __cpu_to_le32(32),
643 .nbytes_max = __cpu_to_le32(2048),
644 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
645 .reserved = __cpu_to_le32(0),
648 /* CE3: host->target WMI */
650 .pipenum = __cpu_to_le32(3),
651 .pipedir = __cpu_to_le32(PIPEDIR_OUT),
652 .nentries = __cpu_to_le32(32),
653 .nbytes_max = __cpu_to_le32(2048),
654 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
655 .reserved = __cpu_to_le32(0),
658 /* CE4: host->target HTT */
660 .pipenum = __cpu_to_le32(4),
661 .pipedir = __cpu_to_le32(PIPEDIR_OUT),
662 .nentries = __cpu_to_le32(256),
663 .nbytes_max = __cpu_to_le32(256),
664 .flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
665 .reserved = __cpu_to_le32(0),
668 /* CE5: target->host Pktlog */
670 .pipenum = __cpu_to_le32(5),
671 .pipedir = __cpu_to_le32(PIPEDIR_IN),
672 .nentries = __cpu_to_le32(32),
673 .nbytes_max = __cpu_to_le32(2048),
674 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
675 .reserved = __cpu_to_le32(0),
678 /* CE6: Reserved for target autonomous hif_memcpy */
680 .pipenum = __cpu_to_le32(6),
681 .pipedir = __cpu_to_le32(PIPEDIR_INOUT),
682 .nentries = __cpu_to_le32(32),
683 .nbytes_max = __cpu_to_le32(16384),
684 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
685 .reserved = __cpu_to_le32(0),
688 /* CE7 used only by Host */
690 .pipenum = __cpu_to_le32(7),
691 .pipedir = __cpu_to_le32(PIPEDIR_INOUT_H2H),
692 .nentries = __cpu_to_le32(0),
693 .nbytes_max = __cpu_to_le32(0),
694 .flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
695 .reserved = __cpu_to_le32(0),
698 /* CE8 target->host used only by IPA */
700 .pipenum = __cpu_to_le32(8),
701 .pipedir = __cpu_to_le32(PIPEDIR_INOUT),
702 .nentries = __cpu_to_le32(32),
703 .nbytes_max = __cpu_to_le32(16384),
704 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
705 .reserved = __cpu_to_le32(0),
707 /* CE 9, 10, 11 are used by MHI driver */
710 /* Map from service/endpoint to Copy Engine.
711 * This table is derived from the CE_PCI TABLE, above.
712 * It is passed to the Target at startup for use by firmware.
714 const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_qca6390[] = {
716 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO),
717 __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
718 __cpu_to_le32(3),
721 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO),
722 __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
723 __cpu_to_le32(2),
726 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK),
727 __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
728 __cpu_to_le32(3),
731 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK),
732 __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
733 __cpu_to_le32(2),
736 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE),
737 __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
738 __cpu_to_le32(3),
741 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE),
742 __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
743 __cpu_to_le32(2),
746 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI),
747 __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
748 __cpu_to_le32(3),
751 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI),
752 __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
753 __cpu_to_le32(2),
756 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL),
757 __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
758 __cpu_to_le32(3),
761 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL),
762 __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
763 __cpu_to_le32(2),
766 __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL),
767 __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
768 __cpu_to_le32(0),
771 __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL),
772 __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
773 __cpu_to_le32(2),
776 __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG),
777 __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
778 __cpu_to_le32(4),
781 __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG),
782 __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
783 __cpu_to_le32(1),
786 /* (Additions here) */
788 { /* must be last */
789 __cpu_to_le32(0),
790 __cpu_to_le32(0),
791 __cpu_to_le32(0),
795 const struct ath11k_hw_regs ipq8074_regs = {
796 /* SW2TCL(x) R0 ring configuration address */
797 .hal_tcl1_ring_base_lsb = 0x00000510,
798 .hal_tcl1_ring_base_msb = 0x00000514,
799 .hal_tcl1_ring_id = 0x00000518,
800 .hal_tcl1_ring_misc = 0x00000520,
801 .hal_tcl1_ring_tp_addr_lsb = 0x0000052c,
802 .hal_tcl1_ring_tp_addr_msb = 0x00000530,
803 .hal_tcl1_ring_consumer_int_setup_ix0 = 0x00000540,
804 .hal_tcl1_ring_consumer_int_setup_ix1 = 0x00000544,
805 .hal_tcl1_ring_msi1_base_lsb = 0x00000558,
806 .hal_tcl1_ring_msi1_base_msb = 0x0000055c,
807 .hal_tcl1_ring_msi1_data = 0x00000560,
808 .hal_tcl2_ring_base_lsb = 0x00000568,
809 .hal_tcl_ring_base_lsb = 0x00000618,
811 /* TCL STATUS ring address */
812 .hal_tcl_status_ring_base_lsb = 0x00000720,
814 /* REO2SW(x) R0 ring configuration address */
815 .hal_reo1_ring_base_lsb = 0x0000029c,
816 .hal_reo1_ring_base_msb = 0x000002a0,
817 .hal_reo1_ring_id = 0x000002a4,
818 .hal_reo1_ring_misc = 0x000002ac,
819 .hal_reo1_ring_hp_addr_lsb = 0x000002b0,
820 .hal_reo1_ring_hp_addr_msb = 0x000002b4,
821 .hal_reo1_ring_producer_int_setup = 0x000002c0,
822 .hal_reo1_ring_msi1_base_lsb = 0x000002e4,
823 .hal_reo1_ring_msi1_base_msb = 0x000002e8,
824 .hal_reo1_ring_msi1_data = 0x000002ec,
825 .hal_reo2_ring_base_lsb = 0x000002f4,
826 .hal_reo1_aging_thresh_ix_0 = 0x00000564,
827 .hal_reo1_aging_thresh_ix_1 = 0x00000568,
828 .hal_reo1_aging_thresh_ix_2 = 0x0000056c,
829 .hal_reo1_aging_thresh_ix_3 = 0x00000570,
831 /* REO2SW(x) R2 ring pointers (head/tail) address */
832 .hal_reo1_ring_hp = 0x00003038,
833 .hal_reo1_ring_tp = 0x0000303c,
834 .hal_reo2_ring_hp = 0x00003040,
836 /* REO2TCL R0 ring configuration address */
837 .hal_reo_tcl_ring_base_lsb = 0x000003fc,
838 .hal_reo_tcl_ring_hp = 0x00003058,
840 /* REO status address */
841 .hal_reo_status_ring_base_lsb = 0x00000504,
842 .hal_reo_status_hp = 0x00003070,
846 const struct ath11k_hw_regs qca6390_regs = {
847 /* SW2TCL(x) R0 ring configuration address */
848 .hal_tcl1_ring_base_lsb = 0x00000684,
849 .hal_tcl1_ring_base_msb = 0x00000688,
850 .hal_tcl1_ring_id = 0x0000068c,
851 .hal_tcl1_ring_misc = 0x00000694,
852 .hal_tcl1_ring_tp_addr_lsb = 0x000006a0,
853 .hal_tcl1_ring_tp_addr_msb = 0x000006a4,
854 .hal_tcl1_ring_consumer_int_setup_ix0 = 0x000006b4,
855 .hal_tcl1_ring_consumer_int_setup_ix1 = 0x000006b8,
856 .hal_tcl1_ring_msi1_base_lsb = 0x000006cc,
857 .hal_tcl1_ring_msi1_base_msb = 0x000006d0,
858 .hal_tcl1_ring_msi1_data = 0x000006d4,
859 .hal_tcl2_ring_base_lsb = 0x000006dc,
860 .hal_tcl_ring_base_lsb = 0x0000078c,
862 /* TCL STATUS ring address */
863 .hal_tcl_status_ring_base_lsb = 0x00000894,
865 /* REO2SW(x) R0 ring configuration address */
866 .hal_reo1_ring_base_lsb = 0x00000244,
867 .hal_reo1_ring_base_msb = 0x00000248,
868 .hal_reo1_ring_id = 0x0000024c,
869 .hal_reo1_ring_misc = 0x00000254,
870 .hal_reo1_ring_hp_addr_lsb = 0x00000258,
871 .hal_reo1_ring_hp_addr_msb = 0x0000025c,
872 .hal_reo1_ring_producer_int_setup = 0x00000268,
873 .hal_reo1_ring_msi1_base_lsb = 0x0000028c,
874 .hal_reo1_ring_msi1_base_msb = 0x00000290,
875 .hal_reo1_ring_msi1_data = 0x00000294,
876 .hal_reo2_ring_base_lsb = 0x0000029c,
877 .hal_reo1_aging_thresh_ix_0 = 0x0000050c,
878 .hal_reo1_aging_thresh_ix_1 = 0x00000510,
879 .hal_reo1_aging_thresh_ix_2 = 0x00000514,
880 .hal_reo1_aging_thresh_ix_3 = 0x00000518,
882 /* REO2SW(x) R2 ring pointers (head/tail) address */
883 .hal_reo1_ring_hp = 0x00003030,
884 .hal_reo1_ring_tp = 0x00003034,
885 .hal_reo2_ring_hp = 0x00003038,
887 /* REO2TCL R0 ring configuration address */
888 .hal_reo_tcl_ring_base_lsb = 0x000003a4,
889 .hal_reo_tcl_ring_hp = 0x00003050,
891 /* REO status address */
892 .hal_reo_status_ring_base_lsb = 0x000004ac,
893 .hal_reo_status_hp = 0x00003068,