1 // SPDX-License-Identifier: BSD-3-Clause-Clear 2 /* 3 * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved. 4 */ 5 6 #include <linux/types.h> 7 #include <linux/bitops.h> 8 #include <linux/bitfield.h> 9 10 #include "core.h" 11 #include "ce.h" 12 #include "hif.h" 13 #include "hal.h" 14 #include "hw.h" 15 16 /* Map from pdev index to hw mac index */ 17 static u8 ath11k_hw_ipq8074_mac_from_pdev_id(int pdev_idx) 18 { 19 switch (pdev_idx) { 20 case 0: 21 return 0; 22 case 1: 23 return 2; 24 case 2: 25 return 1; 26 default: 27 return ATH11K_INVALID_HW_MAC_ID; 28 } 29 } 30 31 static u8 ath11k_hw_ipq6018_mac_from_pdev_id(int pdev_idx) 32 { 33 return pdev_idx; 34 } 35 36 static void ath11k_hw_ipq8074_tx_mesh_enable(struct ath11k_base *ab, 37 struct hal_tcl_data_cmd *tcl_cmd) 38 { 39 tcl_cmd->info2 |= FIELD_PREP(HAL_IPQ8074_TCL_DATA_CMD_INFO2_MESH_ENABLE, 40 true); 41 } 42 43 static void ath11k_hw_qcn9074_tx_mesh_enable(struct ath11k_base *ab, 44 struct hal_tcl_data_cmd *tcl_cmd) 45 { 46 tcl_cmd->info3 |= FIELD_PREP(HAL_QCN9074_TCL_DATA_CMD_INFO3_MESH_ENABLE, 47 true); 48 } 49 50 static void ath11k_hw_wcn6855_tx_mesh_enable(struct ath11k_base *ab, 51 struct hal_tcl_data_cmd *tcl_cmd) 52 { 53 tcl_cmd->info3 |= FIELD_PREP(HAL_QCN9074_TCL_DATA_CMD_INFO3_MESH_ENABLE, 54 true); 55 } 56 57 static void ath11k_init_wmi_config_qca6390(struct ath11k_base *ab, 58 struct target_resource_config *config) 59 { 60 config->num_vdevs = 4; 61 config->num_peers = 16; 62 config->num_tids = 32; 63 64 config->num_offload_peers = 3; 65 config->num_offload_reorder_buffs = 3; 66 config->num_peer_keys = TARGET_NUM_PEER_KEYS; 67 config->ast_skid_limit = TARGET_AST_SKID_LIMIT; 68 config->tx_chain_mask = (1 << ab->target_caps.num_rf_chains) - 1; 69 config->rx_chain_mask = (1 << ab->target_caps.num_rf_chains) - 1; 70 config->rx_timeout_pri[0] = TARGET_RX_TIMEOUT_LO_PRI; 71 config->rx_timeout_pri[1] = TARGET_RX_TIMEOUT_LO_PRI; 72 config->rx_timeout_pri[2] = TARGET_RX_TIMEOUT_LO_PRI; 73 config->rx_timeout_pri[3] = TARGET_RX_TIMEOUT_HI_PRI; 74 config->rx_decap_mode = TARGET_DECAP_MODE_NATIVE_WIFI; 75 config->scan_max_pending_req = TARGET_SCAN_MAX_PENDING_REQS; 76 config->bmiss_offload_max_vdev = TARGET_BMISS_OFFLOAD_MAX_VDEV; 77 config->roam_offload_max_vdev = TARGET_ROAM_OFFLOAD_MAX_VDEV; 78 config->roam_offload_max_ap_profiles = TARGET_ROAM_OFFLOAD_MAX_AP_PROFILES; 79 config->num_mcast_groups = 0; 80 config->num_mcast_table_elems = 0; 81 config->mcast2ucast_mode = 0; 82 config->tx_dbg_log_size = TARGET_TX_DBG_LOG_SIZE; 83 config->num_wds_entries = 0; 84 config->dma_burst_size = 0; 85 config->rx_skip_defrag_timeout_dup_detection_check = 0; 86 config->vow_config = TARGET_VOW_CONFIG; 87 config->gtk_offload_max_vdev = 2; 88 config->num_msdu_desc = 0x400; 89 config->beacon_tx_offload_max_vdev = 2; 90 config->rx_batchmode = TARGET_RX_BATCHMODE; 91 92 config->peer_map_unmap_v2_support = 0; 93 config->use_pdev_id = 1; 94 config->max_frag_entries = 0xa; 95 config->num_tdls_vdevs = 0x1; 96 config->num_tdls_conn_table_entries = 8; 97 config->beacon_tx_offload_max_vdev = 0x2; 98 config->num_multicast_filter_entries = 0x20; 99 config->num_wow_filters = 0x16; 100 config->num_keep_alive_pattern = 0; 101 config->flag1 |= WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64; 102 } 103 104 static void ath11k_hw_ipq8074_reo_setup(struct ath11k_base *ab) 105 { 106 u32 reo_base = HAL_SEQ_WCSS_UMAC_REO_REG; 107 u32 val; 108 /* Each hash entry uses three bits to map to a particular ring. */ 109 u32 ring_hash_map = HAL_HASH_ROUTING_RING_SW1 << 0 | 110 HAL_HASH_ROUTING_RING_SW2 << 3 | 111 HAL_HASH_ROUTING_RING_SW3 << 6 | 112 HAL_HASH_ROUTING_RING_SW4 << 9 | 113 HAL_HASH_ROUTING_RING_SW1 << 12 | 114 HAL_HASH_ROUTING_RING_SW2 << 15 | 115 HAL_HASH_ROUTING_RING_SW3 << 18 | 116 HAL_HASH_ROUTING_RING_SW4 << 21; 117 118 val = ath11k_hif_read32(ab, reo_base + HAL_REO1_GEN_ENABLE); 119 120 val &= ~HAL_REO1_GEN_ENABLE_FRAG_DST_RING; 121 val |= FIELD_PREP(HAL_REO1_GEN_ENABLE_FRAG_DST_RING, 122 HAL_SRNG_RING_ID_REO2SW1) | 123 FIELD_PREP(HAL_REO1_GEN_ENABLE_AGING_LIST_ENABLE, 1) | 124 FIELD_PREP(HAL_REO1_GEN_ENABLE_AGING_FLUSH_ENABLE, 1); 125 ath11k_hif_write32(ab, reo_base + HAL_REO1_GEN_ENABLE, val); 126 127 ath11k_hif_write32(ab, reo_base + HAL_REO1_AGING_THRESH_IX_0(ab), 128 HAL_DEFAULT_REO_TIMEOUT_USEC); 129 ath11k_hif_write32(ab, reo_base + HAL_REO1_AGING_THRESH_IX_1(ab), 130 HAL_DEFAULT_REO_TIMEOUT_USEC); 131 ath11k_hif_write32(ab, reo_base + HAL_REO1_AGING_THRESH_IX_2(ab), 132 HAL_DEFAULT_REO_TIMEOUT_USEC); 133 ath11k_hif_write32(ab, reo_base + HAL_REO1_AGING_THRESH_IX_3(ab), 134 HAL_DEFAULT_REO_TIMEOUT_USEC); 135 136 ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_0, 137 FIELD_PREP(HAL_REO_DEST_RING_CTRL_HASH_RING_MAP, 138 ring_hash_map)); 139 ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_1, 140 FIELD_PREP(HAL_REO_DEST_RING_CTRL_HASH_RING_MAP, 141 ring_hash_map)); 142 ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_2, 143 FIELD_PREP(HAL_REO_DEST_RING_CTRL_HASH_RING_MAP, 144 ring_hash_map)); 145 ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_3, 146 FIELD_PREP(HAL_REO_DEST_RING_CTRL_HASH_RING_MAP, 147 ring_hash_map)); 148 } 149 150 static void ath11k_init_wmi_config_ipq8074(struct ath11k_base *ab, 151 struct target_resource_config *config) 152 { 153 config->num_vdevs = ab->num_radios * TARGET_NUM_VDEVS(ab); 154 155 if (ab->num_radios == 2) { 156 config->num_peers = TARGET_NUM_PEERS(ab, DBS); 157 config->num_tids = TARGET_NUM_TIDS(ab, DBS); 158 } else if (ab->num_radios == 3) { 159 config->num_peers = TARGET_NUM_PEERS(ab, DBS_SBS); 160 config->num_tids = TARGET_NUM_TIDS(ab, DBS_SBS); 161 } else { 162 /* Control should not reach here */ 163 config->num_peers = TARGET_NUM_PEERS(ab, SINGLE); 164 config->num_tids = TARGET_NUM_TIDS(ab, SINGLE); 165 } 166 config->num_offload_peers = TARGET_NUM_OFFLD_PEERS; 167 config->num_offload_reorder_buffs = TARGET_NUM_OFFLD_REORDER_BUFFS; 168 config->num_peer_keys = TARGET_NUM_PEER_KEYS; 169 config->ast_skid_limit = TARGET_AST_SKID_LIMIT; 170 config->tx_chain_mask = (1 << ab->target_caps.num_rf_chains) - 1; 171 config->rx_chain_mask = (1 << ab->target_caps.num_rf_chains) - 1; 172 config->rx_timeout_pri[0] = TARGET_RX_TIMEOUT_LO_PRI; 173 config->rx_timeout_pri[1] = TARGET_RX_TIMEOUT_LO_PRI; 174 config->rx_timeout_pri[2] = TARGET_RX_TIMEOUT_LO_PRI; 175 config->rx_timeout_pri[3] = TARGET_RX_TIMEOUT_HI_PRI; 176 177 if (test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) 178 config->rx_decap_mode = TARGET_DECAP_MODE_RAW; 179 else 180 config->rx_decap_mode = TARGET_DECAP_MODE_NATIVE_WIFI; 181 182 config->scan_max_pending_req = TARGET_SCAN_MAX_PENDING_REQS; 183 config->bmiss_offload_max_vdev = TARGET_BMISS_OFFLOAD_MAX_VDEV; 184 config->roam_offload_max_vdev = TARGET_ROAM_OFFLOAD_MAX_VDEV; 185 config->roam_offload_max_ap_profiles = TARGET_ROAM_OFFLOAD_MAX_AP_PROFILES; 186 config->num_mcast_groups = TARGET_NUM_MCAST_GROUPS; 187 config->num_mcast_table_elems = TARGET_NUM_MCAST_TABLE_ELEMS; 188 config->mcast2ucast_mode = TARGET_MCAST2UCAST_MODE; 189 config->tx_dbg_log_size = TARGET_TX_DBG_LOG_SIZE; 190 config->num_wds_entries = TARGET_NUM_WDS_ENTRIES; 191 config->dma_burst_size = TARGET_DMA_BURST_SIZE; 192 config->rx_skip_defrag_timeout_dup_detection_check = 193 TARGET_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK; 194 config->vow_config = TARGET_VOW_CONFIG; 195 config->gtk_offload_max_vdev = TARGET_GTK_OFFLOAD_MAX_VDEV; 196 config->num_msdu_desc = TARGET_NUM_MSDU_DESC; 197 config->beacon_tx_offload_max_vdev = ab->num_radios * TARGET_MAX_BCN_OFFLD; 198 config->rx_batchmode = TARGET_RX_BATCHMODE; 199 config->peer_map_unmap_v2_support = 1; 200 config->twt_ap_pdev_count = ab->num_radios; 201 config->twt_ap_sta_count = 1000; 202 config->flag1 |= WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64; 203 } 204 205 static int ath11k_hw_mac_id_to_pdev_id_ipq8074(struct ath11k_hw_params *hw, 206 int mac_id) 207 { 208 return mac_id; 209 } 210 211 static int ath11k_hw_mac_id_to_srng_id_ipq8074(struct ath11k_hw_params *hw, 212 int mac_id) 213 { 214 return 0; 215 } 216 217 static int ath11k_hw_mac_id_to_pdev_id_qca6390(struct ath11k_hw_params *hw, 218 int mac_id) 219 { 220 return 0; 221 } 222 223 static int ath11k_hw_mac_id_to_srng_id_qca6390(struct ath11k_hw_params *hw, 224 int mac_id) 225 { 226 return mac_id; 227 } 228 229 static bool ath11k_hw_ipq8074_rx_desc_get_first_msdu(struct hal_rx_desc *desc) 230 { 231 return !!FIELD_GET(RX_MSDU_END_INFO2_FIRST_MSDU, 232 __le32_to_cpu(desc->u.ipq8074.msdu_end.info2)); 233 } 234 235 static bool ath11k_hw_ipq8074_rx_desc_get_last_msdu(struct hal_rx_desc *desc) 236 { 237 return !!FIELD_GET(RX_MSDU_END_INFO2_LAST_MSDU, 238 __le32_to_cpu(desc->u.ipq8074.msdu_end.info2)); 239 } 240 241 static u8 ath11k_hw_ipq8074_rx_desc_get_l3_pad_bytes(struct hal_rx_desc *desc) 242 { 243 return FIELD_GET(RX_MSDU_END_INFO2_L3_HDR_PADDING, 244 __le32_to_cpu(desc->u.ipq8074.msdu_end.info2)); 245 } 246 247 static u8 *ath11k_hw_ipq8074_rx_desc_get_hdr_status(struct hal_rx_desc *desc) 248 { 249 return desc->u.ipq8074.hdr_status; 250 } 251 252 static bool ath11k_hw_ipq8074_rx_desc_encrypt_valid(struct hal_rx_desc *desc) 253 { 254 return __le32_to_cpu(desc->u.ipq8074.mpdu_start.info1) & 255 RX_MPDU_START_INFO1_ENCRYPT_INFO_VALID; 256 } 257 258 static u32 ath11k_hw_ipq8074_rx_desc_get_encrypt_type(struct hal_rx_desc *desc) 259 { 260 return FIELD_GET(RX_MPDU_START_INFO2_ENC_TYPE, 261 __le32_to_cpu(desc->u.ipq8074.mpdu_start.info2)); 262 } 263 264 static u8 ath11k_hw_ipq8074_rx_desc_get_decap_type(struct hal_rx_desc *desc) 265 { 266 return FIELD_GET(RX_MSDU_START_INFO2_DECAP_FORMAT, 267 __le32_to_cpu(desc->u.ipq8074.msdu_start.info2)); 268 } 269 270 static u8 ath11k_hw_ipq8074_rx_desc_get_mesh_ctl(struct hal_rx_desc *desc) 271 { 272 return FIELD_GET(RX_MSDU_START_INFO2_MESH_CTRL_PRESENT, 273 __le32_to_cpu(desc->u.ipq8074.msdu_start.info2)); 274 } 275 276 static bool ath11k_hw_ipq8074_rx_desc_get_mpdu_seq_ctl_vld(struct hal_rx_desc *desc) 277 { 278 return !!FIELD_GET(RX_MPDU_START_INFO1_MPDU_SEQ_CTRL_VALID, 279 __le32_to_cpu(desc->u.ipq8074.mpdu_start.info1)); 280 } 281 282 static bool ath11k_hw_ipq8074_rx_desc_get_mpdu_fc_valid(struct hal_rx_desc *desc) 283 { 284 return !!FIELD_GET(RX_MPDU_START_INFO1_MPDU_FCTRL_VALID, 285 __le32_to_cpu(desc->u.ipq8074.mpdu_start.info1)); 286 } 287 288 static u16 ath11k_hw_ipq8074_rx_desc_get_mpdu_start_seq_no(struct hal_rx_desc *desc) 289 { 290 return FIELD_GET(RX_MPDU_START_INFO1_MPDU_SEQ_NUM, 291 __le32_to_cpu(desc->u.ipq8074.mpdu_start.info1)); 292 } 293 294 static u16 ath11k_hw_ipq8074_rx_desc_get_msdu_len(struct hal_rx_desc *desc) 295 { 296 return FIELD_GET(RX_MSDU_START_INFO1_MSDU_LENGTH, 297 __le32_to_cpu(desc->u.ipq8074.msdu_start.info1)); 298 } 299 300 static u8 ath11k_hw_ipq8074_rx_desc_get_msdu_sgi(struct hal_rx_desc *desc) 301 { 302 return FIELD_GET(RX_MSDU_START_INFO3_SGI, 303 __le32_to_cpu(desc->u.ipq8074.msdu_start.info3)); 304 } 305 306 static u8 ath11k_hw_ipq8074_rx_desc_get_msdu_rate_mcs(struct hal_rx_desc *desc) 307 { 308 return FIELD_GET(RX_MSDU_START_INFO3_RATE_MCS, 309 __le32_to_cpu(desc->u.ipq8074.msdu_start.info3)); 310 } 311 312 static u8 ath11k_hw_ipq8074_rx_desc_get_msdu_rx_bw(struct hal_rx_desc *desc) 313 { 314 return FIELD_GET(RX_MSDU_START_INFO3_RECV_BW, 315 __le32_to_cpu(desc->u.ipq8074.msdu_start.info3)); 316 } 317 318 static u32 ath11k_hw_ipq8074_rx_desc_get_msdu_freq(struct hal_rx_desc *desc) 319 { 320 return __le32_to_cpu(desc->u.ipq8074.msdu_start.phy_meta_data); 321 } 322 323 static u8 ath11k_hw_ipq8074_rx_desc_get_msdu_pkt_type(struct hal_rx_desc *desc) 324 { 325 return FIELD_GET(RX_MSDU_START_INFO3_PKT_TYPE, 326 __le32_to_cpu(desc->u.ipq8074.msdu_start.info3)); 327 } 328 329 static u8 ath11k_hw_ipq8074_rx_desc_get_msdu_nss(struct hal_rx_desc *desc) 330 { 331 return FIELD_GET(RX_MSDU_START_INFO3_MIMO_SS_BITMAP, 332 __le32_to_cpu(desc->u.ipq8074.msdu_start.info3)); 333 } 334 335 static u8 ath11k_hw_ipq8074_rx_desc_get_mpdu_tid(struct hal_rx_desc *desc) 336 { 337 return FIELD_GET(RX_MPDU_START_INFO2_TID, 338 __le32_to_cpu(desc->u.ipq8074.mpdu_start.info2)); 339 } 340 341 static u16 ath11k_hw_ipq8074_rx_desc_get_mpdu_peer_id(struct hal_rx_desc *desc) 342 { 343 return __le16_to_cpu(desc->u.ipq8074.mpdu_start.sw_peer_id); 344 } 345 346 static void ath11k_hw_ipq8074_rx_desc_copy_attn_end(struct hal_rx_desc *fdesc, 347 struct hal_rx_desc *ldesc) 348 { 349 memcpy((u8 *)&fdesc->u.ipq8074.msdu_end, (u8 *)&ldesc->u.ipq8074.msdu_end, 350 sizeof(struct rx_msdu_end_ipq8074)); 351 memcpy((u8 *)&fdesc->u.ipq8074.attention, (u8 *)&ldesc->u.ipq8074.attention, 352 sizeof(struct rx_attention)); 353 memcpy((u8 *)&fdesc->u.ipq8074.mpdu_end, (u8 *)&ldesc->u.ipq8074.mpdu_end, 354 sizeof(struct rx_mpdu_end)); 355 } 356 357 static u32 ath11k_hw_ipq8074_rx_desc_get_mpdu_start_tag(struct hal_rx_desc *desc) 358 { 359 return FIELD_GET(HAL_TLV_HDR_TAG, 360 __le32_to_cpu(desc->u.ipq8074.mpdu_start_tag)); 361 } 362 363 static u32 ath11k_hw_ipq8074_rx_desc_get_mpdu_ppdu_id(struct hal_rx_desc *desc) 364 { 365 return __le16_to_cpu(desc->u.ipq8074.mpdu_start.phy_ppdu_id); 366 } 367 368 static void ath11k_hw_ipq8074_rx_desc_set_msdu_len(struct hal_rx_desc *desc, u16 len) 369 { 370 u32 info = __le32_to_cpu(desc->u.ipq8074.msdu_start.info1); 371 372 info &= ~RX_MSDU_START_INFO1_MSDU_LENGTH; 373 info |= FIELD_PREP(RX_MSDU_START_INFO1_MSDU_LENGTH, len); 374 375 desc->u.ipq8074.msdu_start.info1 = __cpu_to_le32(info); 376 } 377 378 static bool ath11k_hw_ipq8074_rx_desc_mac_addr2_valid(struct hal_rx_desc *desc) 379 { 380 return __le32_to_cpu(desc->u.ipq8074.mpdu_start.info1) & 381 RX_MPDU_START_INFO1_MAC_ADDR2_VALID; 382 } 383 384 static u8 *ath11k_hw_ipq8074_rx_desc_mpdu_start_addr2(struct hal_rx_desc *desc) 385 { 386 return desc->u.ipq8074.mpdu_start.addr2; 387 } 388 389 static 390 struct rx_attention *ath11k_hw_ipq8074_rx_desc_get_attention(struct hal_rx_desc *desc) 391 { 392 return &desc->u.ipq8074.attention; 393 } 394 395 static u8 *ath11k_hw_ipq8074_rx_desc_get_msdu_payload(struct hal_rx_desc *desc) 396 { 397 return &desc->u.ipq8074.msdu_payload[0]; 398 } 399 400 static bool ath11k_hw_qcn9074_rx_desc_get_first_msdu(struct hal_rx_desc *desc) 401 { 402 return !!FIELD_GET(RX_MSDU_END_INFO4_FIRST_MSDU, 403 __le16_to_cpu(desc->u.qcn9074.msdu_end.info4)); 404 } 405 406 static bool ath11k_hw_qcn9074_rx_desc_get_last_msdu(struct hal_rx_desc *desc) 407 { 408 return !!FIELD_GET(RX_MSDU_END_INFO4_LAST_MSDU, 409 __le16_to_cpu(desc->u.qcn9074.msdu_end.info4)); 410 } 411 412 static u8 ath11k_hw_qcn9074_rx_desc_get_l3_pad_bytes(struct hal_rx_desc *desc) 413 { 414 return FIELD_GET(RX_MSDU_END_INFO4_L3_HDR_PADDING, 415 __le16_to_cpu(desc->u.qcn9074.msdu_end.info4)); 416 } 417 418 static u8 *ath11k_hw_qcn9074_rx_desc_get_hdr_status(struct hal_rx_desc *desc) 419 { 420 return desc->u.qcn9074.hdr_status; 421 } 422 423 static bool ath11k_hw_qcn9074_rx_desc_encrypt_valid(struct hal_rx_desc *desc) 424 { 425 return __le32_to_cpu(desc->u.qcn9074.mpdu_start.info11) & 426 RX_MPDU_START_INFO11_ENCRYPT_INFO_VALID; 427 } 428 429 static u32 ath11k_hw_qcn9074_rx_desc_get_encrypt_type(struct hal_rx_desc *desc) 430 { 431 return FIELD_GET(RX_MPDU_START_INFO9_ENC_TYPE, 432 __le32_to_cpu(desc->u.qcn9074.mpdu_start.info9)); 433 } 434 435 static u8 ath11k_hw_qcn9074_rx_desc_get_decap_type(struct hal_rx_desc *desc) 436 { 437 return FIELD_GET(RX_MSDU_START_INFO2_DECAP_FORMAT, 438 __le32_to_cpu(desc->u.qcn9074.msdu_start.info2)); 439 } 440 441 static u8 ath11k_hw_qcn9074_rx_desc_get_mesh_ctl(struct hal_rx_desc *desc) 442 { 443 return FIELD_GET(RX_MSDU_START_INFO2_MESH_CTRL_PRESENT, 444 __le32_to_cpu(desc->u.qcn9074.msdu_start.info2)); 445 } 446 447 static bool ath11k_hw_qcn9074_rx_desc_get_mpdu_seq_ctl_vld(struct hal_rx_desc *desc) 448 { 449 return !!FIELD_GET(RX_MPDU_START_INFO11_MPDU_SEQ_CTRL_VALID, 450 __le32_to_cpu(desc->u.qcn9074.mpdu_start.info11)); 451 } 452 453 static bool ath11k_hw_qcn9074_rx_desc_get_mpdu_fc_valid(struct hal_rx_desc *desc) 454 { 455 return !!FIELD_GET(RX_MPDU_START_INFO11_MPDU_FCTRL_VALID, 456 __le32_to_cpu(desc->u.qcn9074.mpdu_start.info11)); 457 } 458 459 static u16 ath11k_hw_qcn9074_rx_desc_get_mpdu_start_seq_no(struct hal_rx_desc *desc) 460 { 461 return FIELD_GET(RX_MPDU_START_INFO11_MPDU_SEQ_NUM, 462 __le32_to_cpu(desc->u.qcn9074.mpdu_start.info11)); 463 } 464 465 static u16 ath11k_hw_qcn9074_rx_desc_get_msdu_len(struct hal_rx_desc *desc) 466 { 467 return FIELD_GET(RX_MSDU_START_INFO1_MSDU_LENGTH, 468 __le32_to_cpu(desc->u.qcn9074.msdu_start.info1)); 469 } 470 471 static u8 ath11k_hw_qcn9074_rx_desc_get_msdu_sgi(struct hal_rx_desc *desc) 472 { 473 return FIELD_GET(RX_MSDU_START_INFO3_SGI, 474 __le32_to_cpu(desc->u.qcn9074.msdu_start.info3)); 475 } 476 477 static u8 ath11k_hw_qcn9074_rx_desc_get_msdu_rate_mcs(struct hal_rx_desc *desc) 478 { 479 return FIELD_GET(RX_MSDU_START_INFO3_RATE_MCS, 480 __le32_to_cpu(desc->u.qcn9074.msdu_start.info3)); 481 } 482 483 static u8 ath11k_hw_qcn9074_rx_desc_get_msdu_rx_bw(struct hal_rx_desc *desc) 484 { 485 return FIELD_GET(RX_MSDU_START_INFO3_RECV_BW, 486 __le32_to_cpu(desc->u.qcn9074.msdu_start.info3)); 487 } 488 489 static u32 ath11k_hw_qcn9074_rx_desc_get_msdu_freq(struct hal_rx_desc *desc) 490 { 491 return __le32_to_cpu(desc->u.qcn9074.msdu_start.phy_meta_data); 492 } 493 494 static u8 ath11k_hw_qcn9074_rx_desc_get_msdu_pkt_type(struct hal_rx_desc *desc) 495 { 496 return FIELD_GET(RX_MSDU_START_INFO3_PKT_TYPE, 497 __le32_to_cpu(desc->u.qcn9074.msdu_start.info3)); 498 } 499 500 static u8 ath11k_hw_qcn9074_rx_desc_get_msdu_nss(struct hal_rx_desc *desc) 501 { 502 return FIELD_GET(RX_MSDU_START_INFO3_MIMO_SS_BITMAP, 503 __le32_to_cpu(desc->u.qcn9074.msdu_start.info3)); 504 } 505 506 static u8 ath11k_hw_qcn9074_rx_desc_get_mpdu_tid(struct hal_rx_desc *desc) 507 { 508 return FIELD_GET(RX_MPDU_START_INFO9_TID, 509 __le32_to_cpu(desc->u.qcn9074.mpdu_start.info9)); 510 } 511 512 static u16 ath11k_hw_qcn9074_rx_desc_get_mpdu_peer_id(struct hal_rx_desc *desc) 513 { 514 return __le16_to_cpu(desc->u.qcn9074.mpdu_start.sw_peer_id); 515 } 516 517 static void ath11k_hw_qcn9074_rx_desc_copy_attn_end(struct hal_rx_desc *fdesc, 518 struct hal_rx_desc *ldesc) 519 { 520 memcpy((u8 *)&fdesc->u.qcn9074.msdu_end, (u8 *)&ldesc->u.qcn9074.msdu_end, 521 sizeof(struct rx_msdu_end_qcn9074)); 522 memcpy((u8 *)&fdesc->u.qcn9074.attention, (u8 *)&ldesc->u.qcn9074.attention, 523 sizeof(struct rx_attention)); 524 memcpy((u8 *)&fdesc->u.qcn9074.mpdu_end, (u8 *)&ldesc->u.qcn9074.mpdu_end, 525 sizeof(struct rx_mpdu_end)); 526 } 527 528 static u32 ath11k_hw_qcn9074_rx_desc_get_mpdu_start_tag(struct hal_rx_desc *desc) 529 { 530 return FIELD_GET(HAL_TLV_HDR_TAG, 531 __le32_to_cpu(desc->u.qcn9074.mpdu_start_tag)); 532 } 533 534 static u32 ath11k_hw_qcn9074_rx_desc_get_mpdu_ppdu_id(struct hal_rx_desc *desc) 535 { 536 return __le16_to_cpu(desc->u.qcn9074.mpdu_start.phy_ppdu_id); 537 } 538 539 static void ath11k_hw_qcn9074_rx_desc_set_msdu_len(struct hal_rx_desc *desc, u16 len) 540 { 541 u32 info = __le32_to_cpu(desc->u.qcn9074.msdu_start.info1); 542 543 info &= ~RX_MSDU_START_INFO1_MSDU_LENGTH; 544 info |= FIELD_PREP(RX_MSDU_START_INFO1_MSDU_LENGTH, len); 545 546 desc->u.qcn9074.msdu_start.info1 = __cpu_to_le32(info); 547 } 548 549 static 550 struct rx_attention *ath11k_hw_qcn9074_rx_desc_get_attention(struct hal_rx_desc *desc) 551 { 552 return &desc->u.qcn9074.attention; 553 } 554 555 static u8 *ath11k_hw_qcn9074_rx_desc_get_msdu_payload(struct hal_rx_desc *desc) 556 { 557 return &desc->u.qcn9074.msdu_payload[0]; 558 } 559 560 static bool ath11k_hw_ipq9074_rx_desc_mac_addr2_valid(struct hal_rx_desc *desc) 561 { 562 return __le32_to_cpu(desc->u.qcn9074.mpdu_start.info11) & 563 RX_MPDU_START_INFO11_MAC_ADDR2_VALID; 564 } 565 566 static u8 *ath11k_hw_ipq9074_rx_desc_mpdu_start_addr2(struct hal_rx_desc *desc) 567 { 568 return desc->u.qcn9074.mpdu_start.addr2; 569 } 570 571 static bool ath11k_hw_wcn6855_rx_desc_get_first_msdu(struct hal_rx_desc *desc) 572 { 573 return !!FIELD_GET(RX_MSDU_END_INFO2_FIRST_MSDU_WCN6855, 574 __le32_to_cpu(desc->u.wcn6855.msdu_end.info2)); 575 } 576 577 static bool ath11k_hw_wcn6855_rx_desc_get_last_msdu(struct hal_rx_desc *desc) 578 { 579 return !!FIELD_GET(RX_MSDU_END_INFO2_LAST_MSDU_WCN6855, 580 __le32_to_cpu(desc->u.wcn6855.msdu_end.info2)); 581 } 582 583 static u8 ath11k_hw_wcn6855_rx_desc_get_l3_pad_bytes(struct hal_rx_desc *desc) 584 { 585 return FIELD_GET(RX_MSDU_END_INFO2_L3_HDR_PADDING, 586 __le32_to_cpu(desc->u.wcn6855.msdu_end.info2)); 587 } 588 589 static u8 *ath11k_hw_wcn6855_rx_desc_get_hdr_status(struct hal_rx_desc *desc) 590 { 591 return desc->u.wcn6855.hdr_status; 592 } 593 594 static bool ath11k_hw_wcn6855_rx_desc_encrypt_valid(struct hal_rx_desc *desc) 595 { 596 return __le32_to_cpu(desc->u.wcn6855.mpdu_start.info1) & 597 RX_MPDU_START_INFO1_ENCRYPT_INFO_VALID; 598 } 599 600 static u32 ath11k_hw_wcn6855_rx_desc_get_encrypt_type(struct hal_rx_desc *desc) 601 { 602 return FIELD_GET(RX_MPDU_START_INFO2_ENC_TYPE, 603 __le32_to_cpu(desc->u.wcn6855.mpdu_start.info2)); 604 } 605 606 static u8 ath11k_hw_wcn6855_rx_desc_get_decap_type(struct hal_rx_desc *desc) 607 { 608 return FIELD_GET(RX_MSDU_START_INFO2_DECAP_FORMAT, 609 __le32_to_cpu(desc->u.wcn6855.msdu_start.info2)); 610 } 611 612 static u8 ath11k_hw_wcn6855_rx_desc_get_mesh_ctl(struct hal_rx_desc *desc) 613 { 614 return FIELD_GET(RX_MSDU_START_INFO2_MESH_CTRL_PRESENT, 615 __le32_to_cpu(desc->u.wcn6855.msdu_start.info2)); 616 } 617 618 static bool ath11k_hw_wcn6855_rx_desc_get_mpdu_seq_ctl_vld(struct hal_rx_desc *desc) 619 { 620 return !!FIELD_GET(RX_MPDU_START_INFO1_MPDU_SEQ_CTRL_VALID, 621 __le32_to_cpu(desc->u.wcn6855.mpdu_start.info1)); 622 } 623 624 static bool ath11k_hw_wcn6855_rx_desc_get_mpdu_fc_valid(struct hal_rx_desc *desc) 625 { 626 return !!FIELD_GET(RX_MPDU_START_INFO1_MPDU_FCTRL_VALID, 627 __le32_to_cpu(desc->u.wcn6855.mpdu_start.info1)); 628 } 629 630 static u16 ath11k_hw_wcn6855_rx_desc_get_mpdu_start_seq_no(struct hal_rx_desc *desc) 631 { 632 return FIELD_GET(RX_MPDU_START_INFO1_MPDU_SEQ_NUM, 633 __le32_to_cpu(desc->u.wcn6855.mpdu_start.info1)); 634 } 635 636 static u16 ath11k_hw_wcn6855_rx_desc_get_msdu_len(struct hal_rx_desc *desc) 637 { 638 return FIELD_GET(RX_MSDU_START_INFO1_MSDU_LENGTH, 639 __le32_to_cpu(desc->u.wcn6855.msdu_start.info1)); 640 } 641 642 static u8 ath11k_hw_wcn6855_rx_desc_get_msdu_sgi(struct hal_rx_desc *desc) 643 { 644 return FIELD_GET(RX_MSDU_START_INFO3_SGI, 645 __le32_to_cpu(desc->u.wcn6855.msdu_start.info3)); 646 } 647 648 static u8 ath11k_hw_wcn6855_rx_desc_get_msdu_rate_mcs(struct hal_rx_desc *desc) 649 { 650 return FIELD_GET(RX_MSDU_START_INFO3_RATE_MCS, 651 __le32_to_cpu(desc->u.wcn6855.msdu_start.info3)); 652 } 653 654 static u8 ath11k_hw_wcn6855_rx_desc_get_msdu_rx_bw(struct hal_rx_desc *desc) 655 { 656 return FIELD_GET(RX_MSDU_START_INFO3_RECV_BW, 657 __le32_to_cpu(desc->u.wcn6855.msdu_start.info3)); 658 } 659 660 static u32 ath11k_hw_wcn6855_rx_desc_get_msdu_freq(struct hal_rx_desc *desc) 661 { 662 return __le32_to_cpu(desc->u.wcn6855.msdu_start.phy_meta_data); 663 } 664 665 static u8 ath11k_hw_wcn6855_rx_desc_get_msdu_pkt_type(struct hal_rx_desc *desc) 666 { 667 return FIELD_GET(RX_MSDU_START_INFO3_PKT_TYPE, 668 __le32_to_cpu(desc->u.wcn6855.msdu_start.info3)); 669 } 670 671 static u8 ath11k_hw_wcn6855_rx_desc_get_msdu_nss(struct hal_rx_desc *desc) 672 { 673 return FIELD_GET(RX_MSDU_START_INFO3_MIMO_SS_BITMAP, 674 __le32_to_cpu(desc->u.wcn6855.msdu_start.info3)); 675 } 676 677 static u8 ath11k_hw_wcn6855_rx_desc_get_mpdu_tid(struct hal_rx_desc *desc) 678 { 679 return FIELD_GET(RX_MPDU_START_INFO2_TID_WCN6855, 680 __le32_to_cpu(desc->u.wcn6855.mpdu_start.info2)); 681 } 682 683 static u16 ath11k_hw_wcn6855_rx_desc_get_mpdu_peer_id(struct hal_rx_desc *desc) 684 { 685 return __le16_to_cpu(desc->u.wcn6855.mpdu_start.sw_peer_id); 686 } 687 688 static void ath11k_hw_wcn6855_rx_desc_copy_attn_end(struct hal_rx_desc *fdesc, 689 struct hal_rx_desc *ldesc) 690 { 691 memcpy((u8 *)&fdesc->u.wcn6855.msdu_end, (u8 *)&ldesc->u.wcn6855.msdu_end, 692 sizeof(struct rx_msdu_end_wcn6855)); 693 memcpy((u8 *)&fdesc->u.wcn6855.attention, (u8 *)&ldesc->u.wcn6855.attention, 694 sizeof(struct rx_attention)); 695 memcpy((u8 *)&fdesc->u.wcn6855.mpdu_end, (u8 *)&ldesc->u.wcn6855.mpdu_end, 696 sizeof(struct rx_mpdu_end)); 697 } 698 699 static u32 ath11k_hw_wcn6855_rx_desc_get_mpdu_start_tag(struct hal_rx_desc *desc) 700 { 701 return FIELD_GET(HAL_TLV_HDR_TAG, 702 __le32_to_cpu(desc->u.wcn6855.mpdu_start_tag)); 703 } 704 705 static u32 ath11k_hw_wcn6855_rx_desc_get_mpdu_ppdu_id(struct hal_rx_desc *desc) 706 { 707 return __le16_to_cpu(desc->u.wcn6855.mpdu_start.phy_ppdu_id); 708 } 709 710 static void ath11k_hw_wcn6855_rx_desc_set_msdu_len(struct hal_rx_desc *desc, u16 len) 711 { 712 u32 info = __le32_to_cpu(desc->u.wcn6855.msdu_start.info1); 713 714 info &= ~RX_MSDU_START_INFO1_MSDU_LENGTH; 715 info |= FIELD_PREP(RX_MSDU_START_INFO1_MSDU_LENGTH, len); 716 717 desc->u.wcn6855.msdu_start.info1 = __cpu_to_le32(info); 718 } 719 720 static 721 struct rx_attention *ath11k_hw_wcn6855_rx_desc_get_attention(struct hal_rx_desc *desc) 722 { 723 return &desc->u.wcn6855.attention; 724 } 725 726 static u8 *ath11k_hw_wcn6855_rx_desc_get_msdu_payload(struct hal_rx_desc *desc) 727 { 728 return &desc->u.wcn6855.msdu_payload[0]; 729 } 730 731 static bool ath11k_hw_wcn6855_rx_desc_mac_addr2_valid(struct hal_rx_desc *desc) 732 { 733 return __le32_to_cpu(desc->u.wcn6855.mpdu_start.info1) & 734 RX_MPDU_START_INFO1_MAC_ADDR2_VALID; 735 } 736 737 static u8 *ath11k_hw_wcn6855_rx_desc_mpdu_start_addr2(struct hal_rx_desc *desc) 738 { 739 return desc->u.wcn6855.mpdu_start.addr2; 740 } 741 742 static void ath11k_hw_wcn6855_reo_setup(struct ath11k_base *ab) 743 { 744 u32 reo_base = HAL_SEQ_WCSS_UMAC_REO_REG; 745 u32 val; 746 /* Each hash entry uses four bits to map to a particular ring. */ 747 u32 ring_hash_map = HAL_HASH_ROUTING_RING_SW1 << 0 | 748 HAL_HASH_ROUTING_RING_SW2 << 4 | 749 HAL_HASH_ROUTING_RING_SW3 << 8 | 750 HAL_HASH_ROUTING_RING_SW4 << 12 | 751 HAL_HASH_ROUTING_RING_SW1 << 16 | 752 HAL_HASH_ROUTING_RING_SW2 << 20 | 753 HAL_HASH_ROUTING_RING_SW3 << 24 | 754 HAL_HASH_ROUTING_RING_SW4 << 28; 755 756 val = ath11k_hif_read32(ab, reo_base + HAL_REO1_GEN_ENABLE); 757 val |= FIELD_PREP(HAL_REO1_GEN_ENABLE_AGING_LIST_ENABLE, 1) | 758 FIELD_PREP(HAL_REO1_GEN_ENABLE_AGING_FLUSH_ENABLE, 1); 759 ath11k_hif_write32(ab, reo_base + HAL_REO1_GEN_ENABLE, val); 760 761 val = ath11k_hif_read32(ab, reo_base + HAL_REO1_MISC_CTL); 762 val &= ~HAL_REO1_MISC_CTL_FRAGMENT_DST_RING; 763 val |= FIELD_PREP(HAL_REO1_MISC_CTL_FRAGMENT_DST_RING, HAL_SRNG_RING_ID_REO2SW1); 764 ath11k_hif_write32(ab, reo_base + HAL_REO1_MISC_CTL, val); 765 766 ath11k_hif_write32(ab, reo_base + HAL_REO1_AGING_THRESH_IX_0(ab), 767 HAL_DEFAULT_REO_TIMEOUT_USEC); 768 ath11k_hif_write32(ab, reo_base + HAL_REO1_AGING_THRESH_IX_1(ab), 769 HAL_DEFAULT_REO_TIMEOUT_USEC); 770 ath11k_hif_write32(ab, reo_base + HAL_REO1_AGING_THRESH_IX_2(ab), 771 HAL_DEFAULT_REO_TIMEOUT_USEC); 772 ath11k_hif_write32(ab, reo_base + HAL_REO1_AGING_THRESH_IX_3(ab), 773 HAL_DEFAULT_REO_TIMEOUT_USEC); 774 775 ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_2, 776 ring_hash_map); 777 ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_3, 778 ring_hash_map); 779 } 780 781 static u16 ath11k_hw_ipq8074_mpdu_info_get_peerid(u8 *tlv_data) 782 { 783 u16 peer_id = 0; 784 struct hal_rx_mpdu_info *mpdu_info = 785 (struct hal_rx_mpdu_info *)tlv_data; 786 787 peer_id = FIELD_GET(HAL_RX_MPDU_INFO_INFO0_PEERID, 788 __le32_to_cpu(mpdu_info->info0)); 789 790 return peer_id; 791 } 792 793 static u16 ath11k_hw_wcn6855_mpdu_info_get_peerid(u8 *tlv_data) 794 { 795 u16 peer_id = 0; 796 struct hal_rx_mpdu_info_wcn6855 *mpdu_info = 797 (struct hal_rx_mpdu_info_wcn6855 *)tlv_data; 798 799 peer_id = FIELD_GET(HAL_RX_MPDU_INFO_INFO0_PEERID_WCN6855, 800 __le32_to_cpu(mpdu_info->info0)); 801 return peer_id; 802 } 803 804 const struct ath11k_hw_ops ipq8074_ops = { 805 .get_hw_mac_from_pdev_id = ath11k_hw_ipq8074_mac_from_pdev_id, 806 .wmi_init_config = ath11k_init_wmi_config_ipq8074, 807 .mac_id_to_pdev_id = ath11k_hw_mac_id_to_pdev_id_ipq8074, 808 .mac_id_to_srng_id = ath11k_hw_mac_id_to_srng_id_ipq8074, 809 .tx_mesh_enable = ath11k_hw_ipq8074_tx_mesh_enable, 810 .rx_desc_get_first_msdu = ath11k_hw_ipq8074_rx_desc_get_first_msdu, 811 .rx_desc_get_last_msdu = ath11k_hw_ipq8074_rx_desc_get_last_msdu, 812 .rx_desc_get_l3_pad_bytes = ath11k_hw_ipq8074_rx_desc_get_l3_pad_bytes, 813 .rx_desc_get_hdr_status = ath11k_hw_ipq8074_rx_desc_get_hdr_status, 814 .rx_desc_encrypt_valid = ath11k_hw_ipq8074_rx_desc_encrypt_valid, 815 .rx_desc_get_encrypt_type = ath11k_hw_ipq8074_rx_desc_get_encrypt_type, 816 .rx_desc_get_decap_type = ath11k_hw_ipq8074_rx_desc_get_decap_type, 817 .rx_desc_get_mesh_ctl = ath11k_hw_ipq8074_rx_desc_get_mesh_ctl, 818 .rx_desc_get_mpdu_seq_ctl_vld = ath11k_hw_ipq8074_rx_desc_get_mpdu_seq_ctl_vld, 819 .rx_desc_get_mpdu_fc_valid = ath11k_hw_ipq8074_rx_desc_get_mpdu_fc_valid, 820 .rx_desc_get_mpdu_start_seq_no = ath11k_hw_ipq8074_rx_desc_get_mpdu_start_seq_no, 821 .rx_desc_get_msdu_len = ath11k_hw_ipq8074_rx_desc_get_msdu_len, 822 .rx_desc_get_msdu_sgi = ath11k_hw_ipq8074_rx_desc_get_msdu_sgi, 823 .rx_desc_get_msdu_rate_mcs = ath11k_hw_ipq8074_rx_desc_get_msdu_rate_mcs, 824 .rx_desc_get_msdu_rx_bw = ath11k_hw_ipq8074_rx_desc_get_msdu_rx_bw, 825 .rx_desc_get_msdu_freq = ath11k_hw_ipq8074_rx_desc_get_msdu_freq, 826 .rx_desc_get_msdu_pkt_type = ath11k_hw_ipq8074_rx_desc_get_msdu_pkt_type, 827 .rx_desc_get_msdu_nss = ath11k_hw_ipq8074_rx_desc_get_msdu_nss, 828 .rx_desc_get_mpdu_tid = ath11k_hw_ipq8074_rx_desc_get_mpdu_tid, 829 .rx_desc_get_mpdu_peer_id = ath11k_hw_ipq8074_rx_desc_get_mpdu_peer_id, 830 .rx_desc_copy_attn_end_tlv = ath11k_hw_ipq8074_rx_desc_copy_attn_end, 831 .rx_desc_get_mpdu_start_tag = ath11k_hw_ipq8074_rx_desc_get_mpdu_start_tag, 832 .rx_desc_get_mpdu_ppdu_id = ath11k_hw_ipq8074_rx_desc_get_mpdu_ppdu_id, 833 .rx_desc_set_msdu_len = ath11k_hw_ipq8074_rx_desc_set_msdu_len, 834 .rx_desc_get_attention = ath11k_hw_ipq8074_rx_desc_get_attention, 835 .rx_desc_get_msdu_payload = ath11k_hw_ipq8074_rx_desc_get_msdu_payload, 836 .reo_setup = ath11k_hw_ipq8074_reo_setup, 837 .mpdu_info_get_peerid = ath11k_hw_ipq8074_mpdu_info_get_peerid, 838 .rx_desc_mac_addr2_valid = ath11k_hw_ipq8074_rx_desc_mac_addr2_valid, 839 .rx_desc_mpdu_start_addr2 = ath11k_hw_ipq8074_rx_desc_mpdu_start_addr2, 840 }; 841 842 const struct ath11k_hw_ops ipq6018_ops = { 843 .get_hw_mac_from_pdev_id = ath11k_hw_ipq6018_mac_from_pdev_id, 844 .wmi_init_config = ath11k_init_wmi_config_ipq8074, 845 .mac_id_to_pdev_id = ath11k_hw_mac_id_to_pdev_id_ipq8074, 846 .mac_id_to_srng_id = ath11k_hw_mac_id_to_srng_id_ipq8074, 847 .tx_mesh_enable = ath11k_hw_ipq8074_tx_mesh_enable, 848 .rx_desc_get_first_msdu = ath11k_hw_ipq8074_rx_desc_get_first_msdu, 849 .rx_desc_get_last_msdu = ath11k_hw_ipq8074_rx_desc_get_last_msdu, 850 .rx_desc_get_l3_pad_bytes = ath11k_hw_ipq8074_rx_desc_get_l3_pad_bytes, 851 .rx_desc_get_hdr_status = ath11k_hw_ipq8074_rx_desc_get_hdr_status, 852 .rx_desc_encrypt_valid = ath11k_hw_ipq8074_rx_desc_encrypt_valid, 853 .rx_desc_get_encrypt_type = ath11k_hw_ipq8074_rx_desc_get_encrypt_type, 854 .rx_desc_get_decap_type = ath11k_hw_ipq8074_rx_desc_get_decap_type, 855 .rx_desc_get_mesh_ctl = ath11k_hw_ipq8074_rx_desc_get_mesh_ctl, 856 .rx_desc_get_mpdu_seq_ctl_vld = ath11k_hw_ipq8074_rx_desc_get_mpdu_seq_ctl_vld, 857 .rx_desc_get_mpdu_fc_valid = ath11k_hw_ipq8074_rx_desc_get_mpdu_fc_valid, 858 .rx_desc_get_mpdu_start_seq_no = ath11k_hw_ipq8074_rx_desc_get_mpdu_start_seq_no, 859 .rx_desc_get_msdu_len = ath11k_hw_ipq8074_rx_desc_get_msdu_len, 860 .rx_desc_get_msdu_sgi = ath11k_hw_ipq8074_rx_desc_get_msdu_sgi, 861 .rx_desc_get_msdu_rate_mcs = ath11k_hw_ipq8074_rx_desc_get_msdu_rate_mcs, 862 .rx_desc_get_msdu_rx_bw = ath11k_hw_ipq8074_rx_desc_get_msdu_rx_bw, 863 .rx_desc_get_msdu_freq = ath11k_hw_ipq8074_rx_desc_get_msdu_freq, 864 .rx_desc_get_msdu_pkt_type = ath11k_hw_ipq8074_rx_desc_get_msdu_pkt_type, 865 .rx_desc_get_msdu_nss = ath11k_hw_ipq8074_rx_desc_get_msdu_nss, 866 .rx_desc_get_mpdu_tid = ath11k_hw_ipq8074_rx_desc_get_mpdu_tid, 867 .rx_desc_get_mpdu_peer_id = ath11k_hw_ipq8074_rx_desc_get_mpdu_peer_id, 868 .rx_desc_copy_attn_end_tlv = ath11k_hw_ipq8074_rx_desc_copy_attn_end, 869 .rx_desc_get_mpdu_start_tag = ath11k_hw_ipq8074_rx_desc_get_mpdu_start_tag, 870 .rx_desc_get_mpdu_ppdu_id = ath11k_hw_ipq8074_rx_desc_get_mpdu_ppdu_id, 871 .rx_desc_set_msdu_len = ath11k_hw_ipq8074_rx_desc_set_msdu_len, 872 .rx_desc_get_attention = ath11k_hw_ipq8074_rx_desc_get_attention, 873 .rx_desc_get_msdu_payload = ath11k_hw_ipq8074_rx_desc_get_msdu_payload, 874 .reo_setup = ath11k_hw_ipq8074_reo_setup, 875 .mpdu_info_get_peerid = ath11k_hw_ipq8074_mpdu_info_get_peerid, 876 .rx_desc_mac_addr2_valid = ath11k_hw_ipq8074_rx_desc_mac_addr2_valid, 877 .rx_desc_mpdu_start_addr2 = ath11k_hw_ipq8074_rx_desc_mpdu_start_addr2, 878 }; 879 880 const struct ath11k_hw_ops qca6390_ops = { 881 .get_hw_mac_from_pdev_id = ath11k_hw_ipq8074_mac_from_pdev_id, 882 .wmi_init_config = ath11k_init_wmi_config_qca6390, 883 .mac_id_to_pdev_id = ath11k_hw_mac_id_to_pdev_id_qca6390, 884 .mac_id_to_srng_id = ath11k_hw_mac_id_to_srng_id_qca6390, 885 .tx_mesh_enable = ath11k_hw_ipq8074_tx_mesh_enable, 886 .rx_desc_get_first_msdu = ath11k_hw_ipq8074_rx_desc_get_first_msdu, 887 .rx_desc_get_last_msdu = ath11k_hw_ipq8074_rx_desc_get_last_msdu, 888 .rx_desc_get_l3_pad_bytes = ath11k_hw_ipq8074_rx_desc_get_l3_pad_bytes, 889 .rx_desc_get_hdr_status = ath11k_hw_ipq8074_rx_desc_get_hdr_status, 890 .rx_desc_encrypt_valid = ath11k_hw_ipq8074_rx_desc_encrypt_valid, 891 .rx_desc_get_encrypt_type = ath11k_hw_ipq8074_rx_desc_get_encrypt_type, 892 .rx_desc_get_decap_type = ath11k_hw_ipq8074_rx_desc_get_decap_type, 893 .rx_desc_get_mesh_ctl = ath11k_hw_ipq8074_rx_desc_get_mesh_ctl, 894 .rx_desc_get_mpdu_seq_ctl_vld = ath11k_hw_ipq8074_rx_desc_get_mpdu_seq_ctl_vld, 895 .rx_desc_get_mpdu_fc_valid = ath11k_hw_ipq8074_rx_desc_get_mpdu_fc_valid, 896 .rx_desc_get_mpdu_start_seq_no = ath11k_hw_ipq8074_rx_desc_get_mpdu_start_seq_no, 897 .rx_desc_get_msdu_len = ath11k_hw_ipq8074_rx_desc_get_msdu_len, 898 .rx_desc_get_msdu_sgi = ath11k_hw_ipq8074_rx_desc_get_msdu_sgi, 899 .rx_desc_get_msdu_rate_mcs = ath11k_hw_ipq8074_rx_desc_get_msdu_rate_mcs, 900 .rx_desc_get_msdu_rx_bw = ath11k_hw_ipq8074_rx_desc_get_msdu_rx_bw, 901 .rx_desc_get_msdu_freq = ath11k_hw_ipq8074_rx_desc_get_msdu_freq, 902 .rx_desc_get_msdu_pkt_type = ath11k_hw_ipq8074_rx_desc_get_msdu_pkt_type, 903 .rx_desc_get_msdu_nss = ath11k_hw_ipq8074_rx_desc_get_msdu_nss, 904 .rx_desc_get_mpdu_tid = ath11k_hw_ipq8074_rx_desc_get_mpdu_tid, 905 .rx_desc_get_mpdu_peer_id = ath11k_hw_ipq8074_rx_desc_get_mpdu_peer_id, 906 .rx_desc_copy_attn_end_tlv = ath11k_hw_ipq8074_rx_desc_copy_attn_end, 907 .rx_desc_get_mpdu_start_tag = ath11k_hw_ipq8074_rx_desc_get_mpdu_start_tag, 908 .rx_desc_get_mpdu_ppdu_id = ath11k_hw_ipq8074_rx_desc_get_mpdu_ppdu_id, 909 .rx_desc_set_msdu_len = ath11k_hw_ipq8074_rx_desc_set_msdu_len, 910 .rx_desc_get_attention = ath11k_hw_ipq8074_rx_desc_get_attention, 911 .rx_desc_get_msdu_payload = ath11k_hw_ipq8074_rx_desc_get_msdu_payload, 912 .reo_setup = ath11k_hw_ipq8074_reo_setup, 913 .mpdu_info_get_peerid = ath11k_hw_ipq8074_mpdu_info_get_peerid, 914 .rx_desc_mac_addr2_valid = ath11k_hw_ipq8074_rx_desc_mac_addr2_valid, 915 .rx_desc_mpdu_start_addr2 = ath11k_hw_ipq8074_rx_desc_mpdu_start_addr2, 916 }; 917 918 const struct ath11k_hw_ops qcn9074_ops = { 919 .get_hw_mac_from_pdev_id = ath11k_hw_ipq6018_mac_from_pdev_id, 920 .wmi_init_config = ath11k_init_wmi_config_ipq8074, 921 .mac_id_to_pdev_id = ath11k_hw_mac_id_to_pdev_id_ipq8074, 922 .mac_id_to_srng_id = ath11k_hw_mac_id_to_srng_id_ipq8074, 923 .tx_mesh_enable = ath11k_hw_qcn9074_tx_mesh_enable, 924 .rx_desc_get_first_msdu = ath11k_hw_qcn9074_rx_desc_get_first_msdu, 925 .rx_desc_get_last_msdu = ath11k_hw_qcn9074_rx_desc_get_last_msdu, 926 .rx_desc_get_l3_pad_bytes = ath11k_hw_qcn9074_rx_desc_get_l3_pad_bytes, 927 .rx_desc_get_hdr_status = ath11k_hw_qcn9074_rx_desc_get_hdr_status, 928 .rx_desc_encrypt_valid = ath11k_hw_qcn9074_rx_desc_encrypt_valid, 929 .rx_desc_get_encrypt_type = ath11k_hw_qcn9074_rx_desc_get_encrypt_type, 930 .rx_desc_get_decap_type = ath11k_hw_qcn9074_rx_desc_get_decap_type, 931 .rx_desc_get_mesh_ctl = ath11k_hw_qcn9074_rx_desc_get_mesh_ctl, 932 .rx_desc_get_mpdu_seq_ctl_vld = ath11k_hw_qcn9074_rx_desc_get_mpdu_seq_ctl_vld, 933 .rx_desc_get_mpdu_fc_valid = ath11k_hw_qcn9074_rx_desc_get_mpdu_fc_valid, 934 .rx_desc_get_mpdu_start_seq_no = ath11k_hw_qcn9074_rx_desc_get_mpdu_start_seq_no, 935 .rx_desc_get_msdu_len = ath11k_hw_qcn9074_rx_desc_get_msdu_len, 936 .rx_desc_get_msdu_sgi = ath11k_hw_qcn9074_rx_desc_get_msdu_sgi, 937 .rx_desc_get_msdu_rate_mcs = ath11k_hw_qcn9074_rx_desc_get_msdu_rate_mcs, 938 .rx_desc_get_msdu_rx_bw = ath11k_hw_qcn9074_rx_desc_get_msdu_rx_bw, 939 .rx_desc_get_msdu_freq = ath11k_hw_qcn9074_rx_desc_get_msdu_freq, 940 .rx_desc_get_msdu_pkt_type = ath11k_hw_qcn9074_rx_desc_get_msdu_pkt_type, 941 .rx_desc_get_msdu_nss = ath11k_hw_qcn9074_rx_desc_get_msdu_nss, 942 .rx_desc_get_mpdu_tid = ath11k_hw_qcn9074_rx_desc_get_mpdu_tid, 943 .rx_desc_get_mpdu_peer_id = ath11k_hw_qcn9074_rx_desc_get_mpdu_peer_id, 944 .rx_desc_copy_attn_end_tlv = ath11k_hw_qcn9074_rx_desc_copy_attn_end, 945 .rx_desc_get_mpdu_start_tag = ath11k_hw_qcn9074_rx_desc_get_mpdu_start_tag, 946 .rx_desc_get_mpdu_ppdu_id = ath11k_hw_qcn9074_rx_desc_get_mpdu_ppdu_id, 947 .rx_desc_set_msdu_len = ath11k_hw_qcn9074_rx_desc_set_msdu_len, 948 .rx_desc_get_attention = ath11k_hw_qcn9074_rx_desc_get_attention, 949 .rx_desc_get_msdu_payload = ath11k_hw_qcn9074_rx_desc_get_msdu_payload, 950 .reo_setup = ath11k_hw_ipq8074_reo_setup, 951 .mpdu_info_get_peerid = ath11k_hw_ipq8074_mpdu_info_get_peerid, 952 .rx_desc_mac_addr2_valid = ath11k_hw_ipq9074_rx_desc_mac_addr2_valid, 953 .rx_desc_mpdu_start_addr2 = ath11k_hw_ipq9074_rx_desc_mpdu_start_addr2, 954 }; 955 956 const struct ath11k_hw_ops wcn6855_ops = { 957 .get_hw_mac_from_pdev_id = ath11k_hw_ipq8074_mac_from_pdev_id, 958 .wmi_init_config = ath11k_init_wmi_config_qca6390, 959 .mac_id_to_pdev_id = ath11k_hw_mac_id_to_pdev_id_qca6390, 960 .mac_id_to_srng_id = ath11k_hw_mac_id_to_srng_id_qca6390, 961 .tx_mesh_enable = ath11k_hw_wcn6855_tx_mesh_enable, 962 .rx_desc_get_first_msdu = ath11k_hw_wcn6855_rx_desc_get_first_msdu, 963 .rx_desc_get_last_msdu = ath11k_hw_wcn6855_rx_desc_get_last_msdu, 964 .rx_desc_get_l3_pad_bytes = ath11k_hw_wcn6855_rx_desc_get_l3_pad_bytes, 965 .rx_desc_get_hdr_status = ath11k_hw_wcn6855_rx_desc_get_hdr_status, 966 .rx_desc_encrypt_valid = ath11k_hw_wcn6855_rx_desc_encrypt_valid, 967 .rx_desc_get_encrypt_type = ath11k_hw_wcn6855_rx_desc_get_encrypt_type, 968 .rx_desc_get_decap_type = ath11k_hw_wcn6855_rx_desc_get_decap_type, 969 .rx_desc_get_mesh_ctl = ath11k_hw_wcn6855_rx_desc_get_mesh_ctl, 970 .rx_desc_get_mpdu_seq_ctl_vld = ath11k_hw_wcn6855_rx_desc_get_mpdu_seq_ctl_vld, 971 .rx_desc_get_mpdu_fc_valid = ath11k_hw_wcn6855_rx_desc_get_mpdu_fc_valid, 972 .rx_desc_get_mpdu_start_seq_no = ath11k_hw_wcn6855_rx_desc_get_mpdu_start_seq_no, 973 .rx_desc_get_msdu_len = ath11k_hw_wcn6855_rx_desc_get_msdu_len, 974 .rx_desc_get_msdu_sgi = ath11k_hw_wcn6855_rx_desc_get_msdu_sgi, 975 .rx_desc_get_msdu_rate_mcs = ath11k_hw_wcn6855_rx_desc_get_msdu_rate_mcs, 976 .rx_desc_get_msdu_rx_bw = ath11k_hw_wcn6855_rx_desc_get_msdu_rx_bw, 977 .rx_desc_get_msdu_freq = ath11k_hw_wcn6855_rx_desc_get_msdu_freq, 978 .rx_desc_get_msdu_pkt_type = ath11k_hw_wcn6855_rx_desc_get_msdu_pkt_type, 979 .rx_desc_get_msdu_nss = ath11k_hw_wcn6855_rx_desc_get_msdu_nss, 980 .rx_desc_get_mpdu_tid = ath11k_hw_wcn6855_rx_desc_get_mpdu_tid, 981 .rx_desc_get_mpdu_peer_id = ath11k_hw_wcn6855_rx_desc_get_mpdu_peer_id, 982 .rx_desc_copy_attn_end_tlv = ath11k_hw_wcn6855_rx_desc_copy_attn_end, 983 .rx_desc_get_mpdu_start_tag = ath11k_hw_wcn6855_rx_desc_get_mpdu_start_tag, 984 .rx_desc_get_mpdu_ppdu_id = ath11k_hw_wcn6855_rx_desc_get_mpdu_ppdu_id, 985 .rx_desc_set_msdu_len = ath11k_hw_wcn6855_rx_desc_set_msdu_len, 986 .rx_desc_get_attention = ath11k_hw_wcn6855_rx_desc_get_attention, 987 .rx_desc_get_msdu_payload = ath11k_hw_wcn6855_rx_desc_get_msdu_payload, 988 .reo_setup = ath11k_hw_wcn6855_reo_setup, 989 .mpdu_info_get_peerid = ath11k_hw_wcn6855_mpdu_info_get_peerid, 990 .rx_desc_mac_addr2_valid = ath11k_hw_wcn6855_rx_desc_mac_addr2_valid, 991 .rx_desc_mpdu_start_addr2 = ath11k_hw_wcn6855_rx_desc_mpdu_start_addr2, 992 }; 993 994 #define ATH11K_TX_RING_MASK_0 0x1 995 #define ATH11K_TX_RING_MASK_1 0x2 996 #define ATH11K_TX_RING_MASK_2 0x4 997 998 #define ATH11K_RX_RING_MASK_0 0x1 999 #define ATH11K_RX_RING_MASK_1 0x2 1000 #define ATH11K_RX_RING_MASK_2 0x4 1001 #define ATH11K_RX_RING_MASK_3 0x8 1002 1003 #define ATH11K_RX_ERR_RING_MASK_0 0x1 1004 1005 #define ATH11K_RX_WBM_REL_RING_MASK_0 0x1 1006 1007 #define ATH11K_REO_STATUS_RING_MASK_0 0x1 1008 1009 #define ATH11K_RXDMA2HOST_RING_MASK_0 0x1 1010 #define ATH11K_RXDMA2HOST_RING_MASK_1 0x2 1011 #define ATH11K_RXDMA2HOST_RING_MASK_2 0x4 1012 1013 #define ATH11K_HOST2RXDMA_RING_MASK_0 0x1 1014 #define ATH11K_HOST2RXDMA_RING_MASK_1 0x2 1015 #define ATH11K_HOST2RXDMA_RING_MASK_2 0x4 1016 1017 #define ATH11K_RX_MON_STATUS_RING_MASK_0 0x1 1018 #define ATH11K_RX_MON_STATUS_RING_MASK_1 0x2 1019 #define ATH11K_RX_MON_STATUS_RING_MASK_2 0x4 1020 1021 const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_ipq8074 = { 1022 .tx = { 1023 ATH11K_TX_RING_MASK_0, 1024 ATH11K_TX_RING_MASK_1, 1025 ATH11K_TX_RING_MASK_2, 1026 }, 1027 .rx_mon_status = { 1028 0, 0, 0, 0, 1029 ATH11K_RX_MON_STATUS_RING_MASK_0, 1030 ATH11K_RX_MON_STATUS_RING_MASK_1, 1031 ATH11K_RX_MON_STATUS_RING_MASK_2, 1032 }, 1033 .rx = { 1034 0, 0, 0, 0, 0, 0, 0, 1035 ATH11K_RX_RING_MASK_0, 1036 ATH11K_RX_RING_MASK_1, 1037 ATH11K_RX_RING_MASK_2, 1038 ATH11K_RX_RING_MASK_3, 1039 }, 1040 .rx_err = { 1041 ATH11K_RX_ERR_RING_MASK_0, 1042 }, 1043 .rx_wbm_rel = { 1044 ATH11K_RX_WBM_REL_RING_MASK_0, 1045 }, 1046 .reo_status = { 1047 ATH11K_REO_STATUS_RING_MASK_0, 1048 }, 1049 .rxdma2host = { 1050 ATH11K_RXDMA2HOST_RING_MASK_0, 1051 ATH11K_RXDMA2HOST_RING_MASK_1, 1052 ATH11K_RXDMA2HOST_RING_MASK_2, 1053 }, 1054 .host2rxdma = { 1055 ATH11K_HOST2RXDMA_RING_MASK_0, 1056 ATH11K_HOST2RXDMA_RING_MASK_1, 1057 ATH11K_HOST2RXDMA_RING_MASK_2, 1058 }, 1059 }; 1060 1061 const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_qca6390 = { 1062 .tx = { 1063 ATH11K_TX_RING_MASK_0, 1064 }, 1065 .rx_mon_status = { 1066 0, 0, 0, 0, 1067 ATH11K_RX_MON_STATUS_RING_MASK_0, 1068 ATH11K_RX_MON_STATUS_RING_MASK_1, 1069 ATH11K_RX_MON_STATUS_RING_MASK_2, 1070 }, 1071 .rx = { 1072 0, 0, 0, 0, 0, 0, 0, 1073 ATH11K_RX_RING_MASK_0, 1074 ATH11K_RX_RING_MASK_1, 1075 ATH11K_RX_RING_MASK_2, 1076 ATH11K_RX_RING_MASK_3, 1077 }, 1078 .rx_err = { 1079 ATH11K_RX_ERR_RING_MASK_0, 1080 }, 1081 .rx_wbm_rel = { 1082 ATH11K_RX_WBM_REL_RING_MASK_0, 1083 }, 1084 .reo_status = { 1085 ATH11K_REO_STATUS_RING_MASK_0, 1086 }, 1087 .rxdma2host = { 1088 ATH11K_RXDMA2HOST_RING_MASK_0, 1089 ATH11K_RXDMA2HOST_RING_MASK_1, 1090 ATH11K_RXDMA2HOST_RING_MASK_2, 1091 }, 1092 .host2rxdma = { 1093 }, 1094 }; 1095 1096 /* Target firmware's Copy Engine configuration. */ 1097 const struct ce_pipe_config ath11k_target_ce_config_wlan_ipq8074[] = { 1098 /* CE0: host->target HTC control and raw streams */ 1099 { 1100 .pipenum = __cpu_to_le32(0), 1101 .pipedir = __cpu_to_le32(PIPEDIR_OUT), 1102 .nentries = __cpu_to_le32(32), 1103 .nbytes_max = __cpu_to_le32(2048), 1104 .flags = __cpu_to_le32(CE_ATTR_FLAGS), 1105 .reserved = __cpu_to_le32(0), 1106 }, 1107 1108 /* CE1: target->host HTT + HTC control */ 1109 { 1110 .pipenum = __cpu_to_le32(1), 1111 .pipedir = __cpu_to_le32(PIPEDIR_IN), 1112 .nentries = __cpu_to_le32(32), 1113 .nbytes_max = __cpu_to_le32(2048), 1114 .flags = __cpu_to_le32(CE_ATTR_FLAGS), 1115 .reserved = __cpu_to_le32(0), 1116 }, 1117 1118 /* CE2: target->host WMI */ 1119 { 1120 .pipenum = __cpu_to_le32(2), 1121 .pipedir = __cpu_to_le32(PIPEDIR_IN), 1122 .nentries = __cpu_to_le32(32), 1123 .nbytes_max = __cpu_to_le32(2048), 1124 .flags = __cpu_to_le32(CE_ATTR_FLAGS), 1125 .reserved = __cpu_to_le32(0), 1126 }, 1127 1128 /* CE3: host->target WMI */ 1129 { 1130 .pipenum = __cpu_to_le32(3), 1131 .pipedir = __cpu_to_le32(PIPEDIR_OUT), 1132 .nentries = __cpu_to_le32(32), 1133 .nbytes_max = __cpu_to_le32(2048), 1134 .flags = __cpu_to_le32(CE_ATTR_FLAGS), 1135 .reserved = __cpu_to_le32(0), 1136 }, 1137 1138 /* CE4: host->target HTT */ 1139 { 1140 .pipenum = __cpu_to_le32(4), 1141 .pipedir = __cpu_to_le32(PIPEDIR_OUT), 1142 .nentries = __cpu_to_le32(256), 1143 .nbytes_max = __cpu_to_le32(256), 1144 .flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR), 1145 .reserved = __cpu_to_le32(0), 1146 }, 1147 1148 /* CE5: target->host Pktlog */ 1149 { 1150 .pipenum = __cpu_to_le32(5), 1151 .pipedir = __cpu_to_le32(PIPEDIR_IN), 1152 .nentries = __cpu_to_le32(32), 1153 .nbytes_max = __cpu_to_le32(2048), 1154 .flags = __cpu_to_le32(0), 1155 .reserved = __cpu_to_le32(0), 1156 }, 1157 1158 /* CE6: Reserved for target autonomous hif_memcpy */ 1159 { 1160 .pipenum = __cpu_to_le32(6), 1161 .pipedir = __cpu_to_le32(PIPEDIR_INOUT), 1162 .nentries = __cpu_to_le32(32), 1163 .nbytes_max = __cpu_to_le32(65535), 1164 .flags = __cpu_to_le32(CE_ATTR_FLAGS), 1165 .reserved = __cpu_to_le32(0), 1166 }, 1167 1168 /* CE7 used only by Host */ 1169 { 1170 .pipenum = __cpu_to_le32(7), 1171 .pipedir = __cpu_to_le32(PIPEDIR_OUT), 1172 .nentries = __cpu_to_le32(32), 1173 .nbytes_max = __cpu_to_le32(2048), 1174 .flags = __cpu_to_le32(CE_ATTR_FLAGS), 1175 .reserved = __cpu_to_le32(0), 1176 }, 1177 1178 /* CE8 target->host used only by IPA */ 1179 { 1180 .pipenum = __cpu_to_le32(8), 1181 .pipedir = __cpu_to_le32(PIPEDIR_INOUT), 1182 .nentries = __cpu_to_le32(32), 1183 .nbytes_max = __cpu_to_le32(65535), 1184 .flags = __cpu_to_le32(CE_ATTR_FLAGS), 1185 .reserved = __cpu_to_le32(0), 1186 }, 1187 1188 /* CE9 host->target HTT */ 1189 { 1190 .pipenum = __cpu_to_le32(9), 1191 .pipedir = __cpu_to_le32(PIPEDIR_OUT), 1192 .nentries = __cpu_to_le32(32), 1193 .nbytes_max = __cpu_to_le32(2048), 1194 .flags = __cpu_to_le32(CE_ATTR_FLAGS), 1195 .reserved = __cpu_to_le32(0), 1196 }, 1197 1198 /* CE10 target->host HTT */ 1199 { 1200 .pipenum = __cpu_to_le32(10), 1201 .pipedir = __cpu_to_le32(PIPEDIR_INOUT_H2H), 1202 .nentries = __cpu_to_le32(0), 1203 .nbytes_max = __cpu_to_le32(0), 1204 .flags = __cpu_to_le32(CE_ATTR_FLAGS), 1205 .reserved = __cpu_to_le32(0), 1206 }, 1207 1208 /* CE11 Not used */ 1209 }; 1210 1211 /* Map from service/endpoint to Copy Engine. 1212 * This table is derived from the CE_PCI TABLE, above. 1213 * It is passed to the Target at startup for use by firmware. 1214 */ 1215 const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_ipq8074[] = { 1216 { 1217 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO), 1218 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1219 .pipenum = __cpu_to_le32(3), 1220 }, 1221 { 1222 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO), 1223 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1224 .pipenum = __cpu_to_le32(2), 1225 }, 1226 { 1227 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK), 1228 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1229 .pipenum = __cpu_to_le32(3), 1230 }, 1231 { 1232 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK), 1233 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1234 .pipenum = __cpu_to_le32(2), 1235 }, 1236 { 1237 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE), 1238 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1239 .pipenum = __cpu_to_le32(3), 1240 }, 1241 { 1242 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE), 1243 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1244 .pipenum = __cpu_to_le32(2), 1245 }, 1246 { 1247 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI), 1248 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1249 .pipenum = __cpu_to_le32(3), 1250 }, 1251 { 1252 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI), 1253 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1254 .pipenum = __cpu_to_le32(2), 1255 }, 1256 { 1257 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL), 1258 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1259 .pipenum = __cpu_to_le32(3), 1260 }, 1261 { 1262 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL), 1263 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1264 .pipenum = __cpu_to_le32(2), 1265 }, 1266 { 1267 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL_MAC1), 1268 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1269 .pipenum = __cpu_to_le32(7), 1270 }, 1271 { 1272 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL_MAC1), 1273 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1274 .pipenum = __cpu_to_le32(2), 1275 }, 1276 { 1277 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL_MAC2), 1278 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1279 .pipenum = __cpu_to_le32(9), 1280 }, 1281 { 1282 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL_MAC2), 1283 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1284 .pipenum = __cpu_to_le32(2), 1285 }, 1286 { 1287 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL), 1288 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1289 .pipenum = __cpu_to_le32(0), 1290 }, 1291 { 1292 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL), 1293 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1294 .pipenum = __cpu_to_le32(1), 1295 }, 1296 { /* not used */ 1297 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_TEST_RAW_STREAMS), 1298 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1299 .pipenum = __cpu_to_le32(0), 1300 }, 1301 { /* not used */ 1302 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_TEST_RAW_STREAMS), 1303 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1304 .pipenum = __cpu_to_le32(1), 1305 }, 1306 { 1307 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG), 1308 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1309 .pipenum = __cpu_to_le32(4), 1310 }, 1311 { 1312 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG), 1313 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1314 .pipenum = __cpu_to_le32(1), 1315 }, 1316 { 1317 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_PKT_LOG), 1318 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1319 .pipenum = __cpu_to_le32(5), 1320 }, 1321 1322 /* (Additions here) */ 1323 1324 { /* terminator entry */ } 1325 }; 1326 1327 const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_ipq6018[] = { 1328 { 1329 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO), 1330 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1331 .pipenum = __cpu_to_le32(3), 1332 }, 1333 { 1334 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO), 1335 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1336 .pipenum = __cpu_to_le32(2), 1337 }, 1338 { 1339 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK), 1340 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1341 .pipenum = __cpu_to_le32(3), 1342 }, 1343 { 1344 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK), 1345 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1346 .pipenum = __cpu_to_le32(2), 1347 }, 1348 { 1349 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE), 1350 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1351 .pipenum = __cpu_to_le32(3), 1352 }, 1353 { 1354 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE), 1355 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1356 .pipenum = __cpu_to_le32(2), 1357 }, 1358 { 1359 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI), 1360 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1361 .pipenum = __cpu_to_le32(3), 1362 }, 1363 { 1364 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI), 1365 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1366 .pipenum = __cpu_to_le32(2), 1367 }, 1368 { 1369 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL), 1370 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1371 .pipenum = __cpu_to_le32(3), 1372 }, 1373 { 1374 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL), 1375 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1376 .pipenum = __cpu_to_le32(2), 1377 }, 1378 { 1379 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL_MAC1), 1380 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1381 .pipenum = __cpu_to_le32(7), 1382 }, 1383 { 1384 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL_MAC1), 1385 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1386 .pipenum = __cpu_to_le32(2), 1387 }, 1388 { 1389 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL), 1390 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1391 .pipenum = __cpu_to_le32(0), 1392 }, 1393 { 1394 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL), 1395 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1396 .pipenum = __cpu_to_le32(1), 1397 }, 1398 { /* not used */ 1399 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_TEST_RAW_STREAMS), 1400 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1401 .pipenum = __cpu_to_le32(0), 1402 }, 1403 { /* not used */ 1404 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_TEST_RAW_STREAMS), 1405 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1406 .pipenum = __cpu_to_le32(1), 1407 }, 1408 { 1409 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG), 1410 .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1411 .pipenum = __cpu_to_le32(4), 1412 }, 1413 { 1414 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG), 1415 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1416 .pipenum = __cpu_to_le32(1), 1417 }, 1418 { 1419 .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_PKT_LOG), 1420 .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1421 .pipenum = __cpu_to_le32(5), 1422 }, 1423 1424 /* (Additions here) */ 1425 1426 { /* terminator entry */ } 1427 }; 1428 1429 /* Target firmware's Copy Engine configuration. */ 1430 const struct ce_pipe_config ath11k_target_ce_config_wlan_qca6390[] = { 1431 /* CE0: host->target HTC control and raw streams */ 1432 { 1433 .pipenum = __cpu_to_le32(0), 1434 .pipedir = __cpu_to_le32(PIPEDIR_OUT), 1435 .nentries = __cpu_to_le32(32), 1436 .nbytes_max = __cpu_to_le32(2048), 1437 .flags = __cpu_to_le32(CE_ATTR_FLAGS), 1438 .reserved = __cpu_to_le32(0), 1439 }, 1440 1441 /* CE1: target->host HTT + HTC control */ 1442 { 1443 .pipenum = __cpu_to_le32(1), 1444 .pipedir = __cpu_to_le32(PIPEDIR_IN), 1445 .nentries = __cpu_to_le32(32), 1446 .nbytes_max = __cpu_to_le32(2048), 1447 .flags = __cpu_to_le32(CE_ATTR_FLAGS), 1448 .reserved = __cpu_to_le32(0), 1449 }, 1450 1451 /* CE2: target->host WMI */ 1452 { 1453 .pipenum = __cpu_to_le32(2), 1454 .pipedir = __cpu_to_le32(PIPEDIR_IN), 1455 .nentries = __cpu_to_le32(32), 1456 .nbytes_max = __cpu_to_le32(2048), 1457 .flags = __cpu_to_le32(CE_ATTR_FLAGS), 1458 .reserved = __cpu_to_le32(0), 1459 }, 1460 1461 /* CE3: host->target WMI */ 1462 { 1463 .pipenum = __cpu_to_le32(3), 1464 .pipedir = __cpu_to_le32(PIPEDIR_OUT), 1465 .nentries = __cpu_to_le32(32), 1466 .nbytes_max = __cpu_to_le32(2048), 1467 .flags = __cpu_to_le32(CE_ATTR_FLAGS), 1468 .reserved = __cpu_to_le32(0), 1469 }, 1470 1471 /* CE4: host->target HTT */ 1472 { 1473 .pipenum = __cpu_to_le32(4), 1474 .pipedir = __cpu_to_le32(PIPEDIR_OUT), 1475 .nentries = __cpu_to_le32(256), 1476 .nbytes_max = __cpu_to_le32(256), 1477 .flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR), 1478 .reserved = __cpu_to_le32(0), 1479 }, 1480 1481 /* CE5: target->host Pktlog */ 1482 { 1483 .pipenum = __cpu_to_le32(5), 1484 .pipedir = __cpu_to_le32(PIPEDIR_IN), 1485 .nentries = __cpu_to_le32(32), 1486 .nbytes_max = __cpu_to_le32(2048), 1487 .flags = __cpu_to_le32(CE_ATTR_FLAGS), 1488 .reserved = __cpu_to_le32(0), 1489 }, 1490 1491 /* CE6: Reserved for target autonomous hif_memcpy */ 1492 { 1493 .pipenum = __cpu_to_le32(6), 1494 .pipedir = __cpu_to_le32(PIPEDIR_INOUT), 1495 .nentries = __cpu_to_le32(32), 1496 .nbytes_max = __cpu_to_le32(16384), 1497 .flags = __cpu_to_le32(CE_ATTR_FLAGS), 1498 .reserved = __cpu_to_le32(0), 1499 }, 1500 1501 /* CE7 used only by Host */ 1502 { 1503 .pipenum = __cpu_to_le32(7), 1504 .pipedir = __cpu_to_le32(PIPEDIR_INOUT_H2H), 1505 .nentries = __cpu_to_le32(0), 1506 .nbytes_max = __cpu_to_le32(0), 1507 .flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR), 1508 .reserved = __cpu_to_le32(0), 1509 }, 1510 1511 /* CE8 target->host used only by IPA */ 1512 { 1513 .pipenum = __cpu_to_le32(8), 1514 .pipedir = __cpu_to_le32(PIPEDIR_INOUT), 1515 .nentries = __cpu_to_le32(32), 1516 .nbytes_max = __cpu_to_le32(16384), 1517 .flags = __cpu_to_le32(CE_ATTR_FLAGS), 1518 .reserved = __cpu_to_le32(0), 1519 }, 1520 /* CE 9, 10, 11 are used by MHI driver */ 1521 }; 1522 1523 /* Map from service/endpoint to Copy Engine. 1524 * This table is derived from the CE_PCI TABLE, above. 1525 * It is passed to the Target at startup for use by firmware. 1526 */ 1527 const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_qca6390[] = { 1528 { 1529 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO), 1530 __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1531 __cpu_to_le32(3), 1532 }, 1533 { 1534 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO), 1535 __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1536 __cpu_to_le32(2), 1537 }, 1538 { 1539 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK), 1540 __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1541 __cpu_to_le32(3), 1542 }, 1543 { 1544 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK), 1545 __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1546 __cpu_to_le32(2), 1547 }, 1548 { 1549 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE), 1550 __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1551 __cpu_to_le32(3), 1552 }, 1553 { 1554 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE), 1555 __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1556 __cpu_to_le32(2), 1557 }, 1558 { 1559 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI), 1560 __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1561 __cpu_to_le32(3), 1562 }, 1563 { 1564 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI), 1565 __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1566 __cpu_to_le32(2), 1567 }, 1568 { 1569 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL), 1570 __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1571 __cpu_to_le32(3), 1572 }, 1573 { 1574 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL), 1575 __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1576 __cpu_to_le32(2), 1577 }, 1578 { 1579 __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL), 1580 __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1581 __cpu_to_le32(0), 1582 }, 1583 { 1584 __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL), 1585 __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1586 __cpu_to_le32(2), 1587 }, 1588 { 1589 __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG), 1590 __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1591 __cpu_to_le32(4), 1592 }, 1593 { 1594 __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG), 1595 __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1596 __cpu_to_le32(1), 1597 }, 1598 1599 /* (Additions here) */ 1600 1601 { /* must be last */ 1602 __cpu_to_le32(0), 1603 __cpu_to_le32(0), 1604 __cpu_to_le32(0), 1605 }, 1606 }; 1607 1608 /* Target firmware's Copy Engine configuration. */ 1609 const struct ce_pipe_config ath11k_target_ce_config_wlan_qcn9074[] = { 1610 /* CE0: host->target HTC control and raw streams */ 1611 { 1612 .pipenum = __cpu_to_le32(0), 1613 .pipedir = __cpu_to_le32(PIPEDIR_OUT), 1614 .nentries = __cpu_to_le32(32), 1615 .nbytes_max = __cpu_to_le32(2048), 1616 .flags = __cpu_to_le32(CE_ATTR_FLAGS), 1617 .reserved = __cpu_to_le32(0), 1618 }, 1619 1620 /* CE1: target->host HTT + HTC control */ 1621 { 1622 .pipenum = __cpu_to_le32(1), 1623 .pipedir = __cpu_to_le32(PIPEDIR_IN), 1624 .nentries = __cpu_to_le32(32), 1625 .nbytes_max = __cpu_to_le32(2048), 1626 .flags = __cpu_to_le32(CE_ATTR_FLAGS), 1627 .reserved = __cpu_to_le32(0), 1628 }, 1629 1630 /* CE2: target->host WMI */ 1631 { 1632 .pipenum = __cpu_to_le32(2), 1633 .pipedir = __cpu_to_le32(PIPEDIR_IN), 1634 .nentries = __cpu_to_le32(32), 1635 .nbytes_max = __cpu_to_le32(2048), 1636 .flags = __cpu_to_le32(CE_ATTR_FLAGS), 1637 .reserved = __cpu_to_le32(0), 1638 }, 1639 1640 /* CE3: host->target WMI */ 1641 { 1642 .pipenum = __cpu_to_le32(3), 1643 .pipedir = __cpu_to_le32(PIPEDIR_OUT), 1644 .nentries = __cpu_to_le32(32), 1645 .nbytes_max = __cpu_to_le32(2048), 1646 .flags = __cpu_to_le32(CE_ATTR_FLAGS), 1647 .reserved = __cpu_to_le32(0), 1648 }, 1649 1650 /* CE4: host->target HTT */ 1651 { 1652 .pipenum = __cpu_to_le32(4), 1653 .pipedir = __cpu_to_le32(PIPEDIR_OUT), 1654 .nentries = __cpu_to_le32(256), 1655 .nbytes_max = __cpu_to_le32(256), 1656 .flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR), 1657 .reserved = __cpu_to_le32(0), 1658 }, 1659 1660 /* CE5: target->host Pktlog */ 1661 { 1662 .pipenum = __cpu_to_le32(5), 1663 .pipedir = __cpu_to_le32(PIPEDIR_IN), 1664 .nentries = __cpu_to_le32(32), 1665 .nbytes_max = __cpu_to_le32(2048), 1666 .flags = __cpu_to_le32(CE_ATTR_FLAGS), 1667 .reserved = __cpu_to_le32(0), 1668 }, 1669 1670 /* CE6: Reserved for target autonomous hif_memcpy */ 1671 { 1672 .pipenum = __cpu_to_le32(6), 1673 .pipedir = __cpu_to_le32(PIPEDIR_INOUT), 1674 .nentries = __cpu_to_le32(32), 1675 .nbytes_max = __cpu_to_le32(16384), 1676 .flags = __cpu_to_le32(CE_ATTR_FLAGS), 1677 .reserved = __cpu_to_le32(0), 1678 }, 1679 1680 /* CE7 used only by Host */ 1681 { 1682 .pipenum = __cpu_to_le32(7), 1683 .pipedir = __cpu_to_le32(PIPEDIR_INOUT_H2H), 1684 .nentries = __cpu_to_le32(0), 1685 .nbytes_max = __cpu_to_le32(0), 1686 .flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR), 1687 .reserved = __cpu_to_le32(0), 1688 }, 1689 1690 /* CE8 target->host used only by IPA */ 1691 { 1692 .pipenum = __cpu_to_le32(8), 1693 .pipedir = __cpu_to_le32(PIPEDIR_INOUT), 1694 .nentries = __cpu_to_le32(32), 1695 .nbytes_max = __cpu_to_le32(16384), 1696 .flags = __cpu_to_le32(CE_ATTR_FLAGS), 1697 .reserved = __cpu_to_le32(0), 1698 }, 1699 /* CE 9, 10, 11 are used by MHI driver */ 1700 }; 1701 1702 /* Map from service/endpoint to Copy Engine. 1703 * This table is derived from the CE_PCI TABLE, above. 1704 * It is passed to the Target at startup for use by firmware. 1705 */ 1706 const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_qcn9074[] = { 1707 { 1708 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO), 1709 __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1710 __cpu_to_le32(3), 1711 }, 1712 { 1713 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO), 1714 __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1715 __cpu_to_le32(2), 1716 }, 1717 { 1718 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK), 1719 __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1720 __cpu_to_le32(3), 1721 }, 1722 { 1723 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK), 1724 __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1725 __cpu_to_le32(2), 1726 }, 1727 { 1728 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE), 1729 __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1730 __cpu_to_le32(3), 1731 }, 1732 { 1733 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE), 1734 __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1735 __cpu_to_le32(2), 1736 }, 1737 { 1738 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI), 1739 __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1740 __cpu_to_le32(3), 1741 }, 1742 { 1743 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI), 1744 __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1745 __cpu_to_le32(2), 1746 }, 1747 { 1748 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL), 1749 __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1750 __cpu_to_le32(3), 1751 }, 1752 { 1753 __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL), 1754 __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1755 __cpu_to_le32(2), 1756 }, 1757 { 1758 __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL), 1759 __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1760 __cpu_to_le32(0), 1761 }, 1762 { 1763 __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL), 1764 __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1765 __cpu_to_le32(1), 1766 }, 1767 { 1768 __cpu_to_le32(ATH11K_HTC_SVC_ID_TEST_RAW_STREAMS), 1769 __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1770 __cpu_to_le32(0), 1771 }, 1772 { 1773 __cpu_to_le32(ATH11K_HTC_SVC_ID_TEST_RAW_STREAMS), 1774 __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1775 __cpu_to_le32(1), 1776 }, 1777 { 1778 __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG), 1779 __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ 1780 __cpu_to_le32(4), 1781 }, 1782 { 1783 __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG), 1784 __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1785 __cpu_to_le32(1), 1786 }, 1787 { 1788 __cpu_to_le32(ATH11K_HTC_SVC_ID_PKT_LOG), 1789 __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */ 1790 __cpu_to_le32(5), 1791 }, 1792 1793 /* (Additions here) */ 1794 1795 { /* must be last */ 1796 __cpu_to_le32(0), 1797 __cpu_to_le32(0), 1798 __cpu_to_le32(0), 1799 }, 1800 }; 1801 1802 const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_qcn9074 = { 1803 .tx = { 1804 ATH11K_TX_RING_MASK_0, 1805 ATH11K_TX_RING_MASK_1, 1806 ATH11K_TX_RING_MASK_2, 1807 }, 1808 .rx_mon_status = { 1809 0, 0, 0, 1810 ATH11K_RX_MON_STATUS_RING_MASK_0, 1811 ATH11K_RX_MON_STATUS_RING_MASK_1, 1812 ATH11K_RX_MON_STATUS_RING_MASK_2, 1813 }, 1814 .rx = { 1815 0, 0, 0, 0, 1816 ATH11K_RX_RING_MASK_0, 1817 ATH11K_RX_RING_MASK_1, 1818 ATH11K_RX_RING_MASK_2, 1819 ATH11K_RX_RING_MASK_3, 1820 }, 1821 .rx_err = { 1822 0, 0, 0, 1823 ATH11K_RX_ERR_RING_MASK_0, 1824 }, 1825 .rx_wbm_rel = { 1826 0, 0, 0, 1827 ATH11K_RX_WBM_REL_RING_MASK_0, 1828 }, 1829 .reo_status = { 1830 0, 0, 0, 1831 ATH11K_REO_STATUS_RING_MASK_0, 1832 }, 1833 .rxdma2host = { 1834 0, 0, 0, 1835 ATH11K_RXDMA2HOST_RING_MASK_0, 1836 }, 1837 .host2rxdma = { 1838 0, 0, 0, 1839 ATH11K_HOST2RXDMA_RING_MASK_0, 1840 }, 1841 }; 1842 1843 const struct ath11k_hw_regs ipq8074_regs = { 1844 /* SW2TCL(x) R0 ring configuration address */ 1845 .hal_tcl1_ring_base_lsb = 0x00000510, 1846 .hal_tcl1_ring_base_msb = 0x00000514, 1847 .hal_tcl1_ring_id = 0x00000518, 1848 .hal_tcl1_ring_misc = 0x00000520, 1849 .hal_tcl1_ring_tp_addr_lsb = 0x0000052c, 1850 .hal_tcl1_ring_tp_addr_msb = 0x00000530, 1851 .hal_tcl1_ring_consumer_int_setup_ix0 = 0x00000540, 1852 .hal_tcl1_ring_consumer_int_setup_ix1 = 0x00000544, 1853 .hal_tcl1_ring_msi1_base_lsb = 0x00000558, 1854 .hal_tcl1_ring_msi1_base_msb = 0x0000055c, 1855 .hal_tcl1_ring_msi1_data = 0x00000560, 1856 .hal_tcl2_ring_base_lsb = 0x00000568, 1857 .hal_tcl_ring_base_lsb = 0x00000618, 1858 1859 /* TCL STATUS ring address */ 1860 .hal_tcl_status_ring_base_lsb = 0x00000720, 1861 1862 /* REO2SW(x) R0 ring configuration address */ 1863 .hal_reo1_ring_base_lsb = 0x0000029c, 1864 .hal_reo1_ring_base_msb = 0x000002a0, 1865 .hal_reo1_ring_id = 0x000002a4, 1866 .hal_reo1_ring_misc = 0x000002ac, 1867 .hal_reo1_ring_hp_addr_lsb = 0x000002b0, 1868 .hal_reo1_ring_hp_addr_msb = 0x000002b4, 1869 .hal_reo1_ring_producer_int_setup = 0x000002c0, 1870 .hal_reo1_ring_msi1_base_lsb = 0x000002e4, 1871 .hal_reo1_ring_msi1_base_msb = 0x000002e8, 1872 .hal_reo1_ring_msi1_data = 0x000002ec, 1873 .hal_reo2_ring_base_lsb = 0x000002f4, 1874 .hal_reo1_aging_thresh_ix_0 = 0x00000564, 1875 .hal_reo1_aging_thresh_ix_1 = 0x00000568, 1876 .hal_reo1_aging_thresh_ix_2 = 0x0000056c, 1877 .hal_reo1_aging_thresh_ix_3 = 0x00000570, 1878 1879 /* REO2SW(x) R2 ring pointers (head/tail) address */ 1880 .hal_reo1_ring_hp = 0x00003038, 1881 .hal_reo1_ring_tp = 0x0000303c, 1882 .hal_reo2_ring_hp = 0x00003040, 1883 1884 /* REO2TCL R0 ring configuration address */ 1885 .hal_reo_tcl_ring_base_lsb = 0x000003fc, 1886 .hal_reo_tcl_ring_hp = 0x00003058, 1887 1888 /* REO status address */ 1889 .hal_reo_status_ring_base_lsb = 0x00000504, 1890 .hal_reo_status_hp = 0x00003070, 1891 1892 /* WCSS relative address */ 1893 .hal_seq_wcss_umac_ce0_src_reg = 0x00a00000, 1894 .hal_seq_wcss_umac_ce0_dst_reg = 0x00a01000, 1895 .hal_seq_wcss_umac_ce1_src_reg = 0x00a02000, 1896 .hal_seq_wcss_umac_ce1_dst_reg = 0x00a03000, 1897 1898 /* WBM Idle address */ 1899 .hal_wbm_idle_link_ring_base_lsb = 0x00000860, 1900 .hal_wbm_idle_link_ring_misc = 0x00000870, 1901 1902 /* SW2WBM release address */ 1903 .hal_wbm_release_ring_base_lsb = 0x000001d8, 1904 1905 /* WBM2SW release address */ 1906 .hal_wbm0_release_ring_base_lsb = 0x00000910, 1907 .hal_wbm1_release_ring_base_lsb = 0x00000968, 1908 1909 /* PCIe base address */ 1910 .pcie_qserdes_sysclk_en_sel = 0x0, 1911 .pcie_pcs_osc_dtct_config_base = 0x0, 1912 }; 1913 1914 const struct ath11k_hw_regs qca6390_regs = { 1915 /* SW2TCL(x) R0 ring configuration address */ 1916 .hal_tcl1_ring_base_lsb = 0x00000684, 1917 .hal_tcl1_ring_base_msb = 0x00000688, 1918 .hal_tcl1_ring_id = 0x0000068c, 1919 .hal_tcl1_ring_misc = 0x00000694, 1920 .hal_tcl1_ring_tp_addr_lsb = 0x000006a0, 1921 .hal_tcl1_ring_tp_addr_msb = 0x000006a4, 1922 .hal_tcl1_ring_consumer_int_setup_ix0 = 0x000006b4, 1923 .hal_tcl1_ring_consumer_int_setup_ix1 = 0x000006b8, 1924 .hal_tcl1_ring_msi1_base_lsb = 0x000006cc, 1925 .hal_tcl1_ring_msi1_base_msb = 0x000006d0, 1926 .hal_tcl1_ring_msi1_data = 0x000006d4, 1927 .hal_tcl2_ring_base_lsb = 0x000006dc, 1928 .hal_tcl_ring_base_lsb = 0x0000078c, 1929 1930 /* TCL STATUS ring address */ 1931 .hal_tcl_status_ring_base_lsb = 0x00000894, 1932 1933 /* REO2SW(x) R0 ring configuration address */ 1934 .hal_reo1_ring_base_lsb = 0x00000244, 1935 .hal_reo1_ring_base_msb = 0x00000248, 1936 .hal_reo1_ring_id = 0x0000024c, 1937 .hal_reo1_ring_misc = 0x00000254, 1938 .hal_reo1_ring_hp_addr_lsb = 0x00000258, 1939 .hal_reo1_ring_hp_addr_msb = 0x0000025c, 1940 .hal_reo1_ring_producer_int_setup = 0x00000268, 1941 .hal_reo1_ring_msi1_base_lsb = 0x0000028c, 1942 .hal_reo1_ring_msi1_base_msb = 0x00000290, 1943 .hal_reo1_ring_msi1_data = 0x00000294, 1944 .hal_reo2_ring_base_lsb = 0x0000029c, 1945 .hal_reo1_aging_thresh_ix_0 = 0x0000050c, 1946 .hal_reo1_aging_thresh_ix_1 = 0x00000510, 1947 .hal_reo1_aging_thresh_ix_2 = 0x00000514, 1948 .hal_reo1_aging_thresh_ix_3 = 0x00000518, 1949 1950 /* REO2SW(x) R2 ring pointers (head/tail) address */ 1951 .hal_reo1_ring_hp = 0x00003030, 1952 .hal_reo1_ring_tp = 0x00003034, 1953 .hal_reo2_ring_hp = 0x00003038, 1954 1955 /* REO2TCL R0 ring configuration address */ 1956 .hal_reo_tcl_ring_base_lsb = 0x000003a4, 1957 .hal_reo_tcl_ring_hp = 0x00003050, 1958 1959 /* REO status address */ 1960 .hal_reo_status_ring_base_lsb = 0x000004ac, 1961 .hal_reo_status_hp = 0x00003068, 1962 1963 /* WCSS relative address */ 1964 .hal_seq_wcss_umac_ce0_src_reg = 0x00a00000, 1965 .hal_seq_wcss_umac_ce0_dst_reg = 0x00a01000, 1966 .hal_seq_wcss_umac_ce1_src_reg = 0x00a02000, 1967 .hal_seq_wcss_umac_ce1_dst_reg = 0x00a03000, 1968 1969 /* WBM Idle address */ 1970 .hal_wbm_idle_link_ring_base_lsb = 0x00000860, 1971 .hal_wbm_idle_link_ring_misc = 0x00000870, 1972 1973 /* SW2WBM release address */ 1974 .hal_wbm_release_ring_base_lsb = 0x000001d8, 1975 1976 /* WBM2SW release address */ 1977 .hal_wbm0_release_ring_base_lsb = 0x00000910, 1978 .hal_wbm1_release_ring_base_lsb = 0x00000968, 1979 1980 /* PCIe base address */ 1981 .pcie_qserdes_sysclk_en_sel = 0x01e0c0ac, 1982 .pcie_pcs_osc_dtct_config_base = 0x01e0c628, 1983 }; 1984 1985 const struct ath11k_hw_regs qcn9074_regs = { 1986 /* SW2TCL(x) R0 ring configuration address */ 1987 .hal_tcl1_ring_base_lsb = 0x000004f0, 1988 .hal_tcl1_ring_base_msb = 0x000004f4, 1989 .hal_tcl1_ring_id = 0x000004f8, 1990 .hal_tcl1_ring_misc = 0x00000500, 1991 .hal_tcl1_ring_tp_addr_lsb = 0x0000050c, 1992 .hal_tcl1_ring_tp_addr_msb = 0x00000510, 1993 .hal_tcl1_ring_consumer_int_setup_ix0 = 0x00000520, 1994 .hal_tcl1_ring_consumer_int_setup_ix1 = 0x00000524, 1995 .hal_tcl1_ring_msi1_base_lsb = 0x00000538, 1996 .hal_tcl1_ring_msi1_base_msb = 0x0000053c, 1997 .hal_tcl1_ring_msi1_data = 0x00000540, 1998 .hal_tcl2_ring_base_lsb = 0x00000548, 1999 .hal_tcl_ring_base_lsb = 0x000005f8, 2000 2001 /* TCL STATUS ring address */ 2002 .hal_tcl_status_ring_base_lsb = 0x00000700, 2003 2004 /* REO2SW(x) R0 ring configuration address */ 2005 .hal_reo1_ring_base_lsb = 0x0000029c, 2006 .hal_reo1_ring_base_msb = 0x000002a0, 2007 .hal_reo1_ring_id = 0x000002a4, 2008 .hal_reo1_ring_misc = 0x000002ac, 2009 .hal_reo1_ring_hp_addr_lsb = 0x000002b0, 2010 .hal_reo1_ring_hp_addr_msb = 0x000002b4, 2011 .hal_reo1_ring_producer_int_setup = 0x000002c0, 2012 .hal_reo1_ring_msi1_base_lsb = 0x000002e4, 2013 .hal_reo1_ring_msi1_base_msb = 0x000002e8, 2014 .hal_reo1_ring_msi1_data = 0x000002ec, 2015 .hal_reo2_ring_base_lsb = 0x000002f4, 2016 .hal_reo1_aging_thresh_ix_0 = 0x00000564, 2017 .hal_reo1_aging_thresh_ix_1 = 0x00000568, 2018 .hal_reo1_aging_thresh_ix_2 = 0x0000056c, 2019 .hal_reo1_aging_thresh_ix_3 = 0x00000570, 2020 2021 /* REO2SW(x) R2 ring pointers (head/tail) address */ 2022 .hal_reo1_ring_hp = 0x00003038, 2023 .hal_reo1_ring_tp = 0x0000303c, 2024 .hal_reo2_ring_hp = 0x00003040, 2025 2026 /* REO2TCL R0 ring configuration address */ 2027 .hal_reo_tcl_ring_base_lsb = 0x000003fc, 2028 .hal_reo_tcl_ring_hp = 0x00003058, 2029 2030 /* REO status address */ 2031 .hal_reo_status_ring_base_lsb = 0x00000504, 2032 .hal_reo_status_hp = 0x00003070, 2033 2034 /* WCSS relative address */ 2035 .hal_seq_wcss_umac_ce0_src_reg = 0x01b80000, 2036 .hal_seq_wcss_umac_ce0_dst_reg = 0x01b81000, 2037 .hal_seq_wcss_umac_ce1_src_reg = 0x01b82000, 2038 .hal_seq_wcss_umac_ce1_dst_reg = 0x01b83000, 2039 2040 /* WBM Idle address */ 2041 .hal_wbm_idle_link_ring_base_lsb = 0x00000874, 2042 .hal_wbm_idle_link_ring_misc = 0x00000884, 2043 2044 /* SW2WBM release address */ 2045 .hal_wbm_release_ring_base_lsb = 0x000001ec, 2046 2047 /* WBM2SW release address */ 2048 .hal_wbm0_release_ring_base_lsb = 0x00000924, 2049 .hal_wbm1_release_ring_base_lsb = 0x0000097c, 2050 2051 /* PCIe base address */ 2052 .pcie_qserdes_sysclk_en_sel = 0x01e0e0a8, 2053 .pcie_pcs_osc_dtct_config_base = 0x01e0f45c, 2054 }; 2055 2056 const struct ath11k_hw_regs wcn6855_regs = { 2057 /* SW2TCL(x) R0 ring configuration address */ 2058 .hal_tcl1_ring_base_lsb = 0x00000690, 2059 .hal_tcl1_ring_base_msb = 0x00000694, 2060 .hal_tcl1_ring_id = 0x00000698, 2061 .hal_tcl1_ring_misc = 0x000006a0, 2062 .hal_tcl1_ring_tp_addr_lsb = 0x000006ac, 2063 .hal_tcl1_ring_tp_addr_msb = 0x000006b0, 2064 .hal_tcl1_ring_consumer_int_setup_ix0 = 0x000006c0, 2065 .hal_tcl1_ring_consumer_int_setup_ix1 = 0x000006c4, 2066 .hal_tcl1_ring_msi1_base_lsb = 0x000006d8, 2067 .hal_tcl1_ring_msi1_base_msb = 0x000006dc, 2068 .hal_tcl1_ring_msi1_data = 0x000006e0, 2069 .hal_tcl2_ring_base_lsb = 0x000006e8, 2070 .hal_tcl_ring_base_lsb = 0x00000798, 2071 2072 /* TCL STATUS ring address */ 2073 .hal_tcl_status_ring_base_lsb = 0x000008a0, 2074 2075 /* REO2SW(x) R0 ring configuration address */ 2076 .hal_reo1_ring_base_lsb = 0x00000244, 2077 .hal_reo1_ring_base_msb = 0x00000248, 2078 .hal_reo1_ring_id = 0x0000024c, 2079 .hal_reo1_ring_misc = 0x00000254, 2080 .hal_reo1_ring_hp_addr_lsb = 0x00000258, 2081 .hal_reo1_ring_hp_addr_msb = 0x0000025c, 2082 .hal_reo1_ring_producer_int_setup = 0x00000268, 2083 .hal_reo1_ring_msi1_base_lsb = 0x0000028c, 2084 .hal_reo1_ring_msi1_base_msb = 0x00000290, 2085 .hal_reo1_ring_msi1_data = 0x00000294, 2086 .hal_reo2_ring_base_lsb = 0x0000029c, 2087 .hal_reo1_aging_thresh_ix_0 = 0x000005bc, 2088 .hal_reo1_aging_thresh_ix_1 = 0x000005c0, 2089 .hal_reo1_aging_thresh_ix_2 = 0x000005c4, 2090 .hal_reo1_aging_thresh_ix_3 = 0x000005c8, 2091 2092 /* REO2SW(x) R2 ring pointers (head/tail) address */ 2093 .hal_reo1_ring_hp = 0x00003030, 2094 .hal_reo1_ring_tp = 0x00003034, 2095 .hal_reo2_ring_hp = 0x00003038, 2096 2097 /* REO2TCL R0 ring configuration address */ 2098 .hal_reo_tcl_ring_base_lsb = 0x00000454, 2099 .hal_reo_tcl_ring_hp = 0x00003060, 2100 2101 /* REO status address */ 2102 .hal_reo_status_ring_base_lsb = 0x0000055c, 2103 .hal_reo_status_hp = 0x00003078, 2104 2105 /* WCSS relative address */ 2106 .hal_seq_wcss_umac_ce0_src_reg = 0x1b80000, 2107 .hal_seq_wcss_umac_ce0_dst_reg = 0x1b81000, 2108 .hal_seq_wcss_umac_ce1_src_reg = 0x1b82000, 2109 .hal_seq_wcss_umac_ce1_dst_reg = 0x1b83000, 2110 2111 /* WBM Idle address */ 2112 .hal_wbm_idle_link_ring_base_lsb = 0x00000870, 2113 .hal_wbm_idle_link_ring_misc = 0x00000880, 2114 2115 /* SW2WBM release address */ 2116 .hal_wbm_release_ring_base_lsb = 0x000001e8, 2117 2118 /* WBM2SW release address */ 2119 .hal_wbm0_release_ring_base_lsb = 0x00000920, 2120 .hal_wbm1_release_ring_base_lsb = 0x00000978, 2121 2122 /* PCIe base address */ 2123 .pcie_qserdes_sysclk_en_sel = 0x01e0c0ac, 2124 .pcie_pcs_osc_dtct_config_base = 0x01e0c628, 2125 }; 2126 2127 const struct ath11k_hw_hal_params ath11k_hw_hal_params_ipq8074 = { 2128 .rx_buf_rbm = HAL_RX_BUF_RBM_SW3_BM, 2129 }; 2130 2131 const struct ath11k_hw_hal_params ath11k_hw_hal_params_qca6390 = { 2132 .rx_buf_rbm = HAL_RX_BUF_RBM_SW1_BM, 2133 }; 2134