1 /* SPDX-License-Identifier: ISC */ 2 /* Copyright (C) 2020 MediaTek Inc. */ 3 4 #ifndef __MT76_CONNAC_MCU_H 5 #define __MT76_CONNAC_MCU_H 6 7 #include "mt76_connac.h" 8 9 #define FW_FEATURE_SET_ENCRYPT BIT(0) 10 #define FW_FEATURE_SET_KEY_IDX GENMASK(2, 1) 11 #define FW_FEATURE_ENCRY_MODE BIT(4) 12 #define FW_FEATURE_OVERRIDE_ADDR BIT(5) 13 #define FW_FEATURE_NON_DL BIT(6) 14 15 #define DL_MODE_ENCRYPT BIT(0) 16 #define DL_MODE_KEY_IDX GENMASK(2, 1) 17 #define DL_MODE_RESET_SEC_IV BIT(3) 18 #define DL_MODE_WORKING_PDA_CR4 BIT(4) 19 #define DL_MODE_VALID_RAM_ENTRY BIT(5) 20 #define DL_CONFIG_ENCRY_MODE_SEL BIT(6) 21 #define DL_MODE_NEED_RSP BIT(31) 22 23 #define FW_START_OVERRIDE BIT(0) 24 #define FW_START_WORKING_PDA_CR4 BIT(2) 25 26 #define PATCH_SEC_NOT_SUPPORT GENMASK(31, 0) 27 #define PATCH_SEC_TYPE_MASK GENMASK(15, 0) 28 #define PATCH_SEC_TYPE_INFO 0x2 29 30 #define PATCH_SEC_ENC_TYPE_MASK GENMASK(31, 24) 31 #define PATCH_SEC_ENC_TYPE_PLAIN 0x00 32 #define PATCH_SEC_ENC_TYPE_AES 0x01 33 #define PATCH_SEC_ENC_TYPE_SCRAMBLE 0x02 34 #define PATCH_SEC_ENC_SCRAMBLE_INFO_MASK GENMASK(15, 0) 35 #define PATCH_SEC_ENC_AES_KEY_MASK GENMASK(7, 0) 36 37 enum { 38 FW_TYPE_DEFAULT = 0, 39 FW_TYPE_CLC = 2, 40 FW_TYPE_MAX_NUM = 255 41 }; 42 43 #define MCU_PQ_ID(p, q) (((p) << 15) | ((q) << 10)) 44 #define MCU_PKT_ID 0xa0 45 46 struct mt76_connac2_mcu_txd { 47 __le32 txd[8]; 48 49 __le16 len; 50 __le16 pq_id; 51 52 u8 cid; 53 u8 pkt_type; 54 u8 set_query; /* FW don't care */ 55 u8 seq; 56 57 u8 uc_d2b0_rev; 58 u8 ext_cid; 59 u8 s2d_index; 60 u8 ext_cid_ack; 61 62 u32 rsv[5]; 63 } __packed __aligned(4); 64 65 /** 66 * struct mt76_connac2_mcu_uni_txd - mcu command descriptor for firmware v3 67 * @txd: hardware descriptor 68 * @len: total length not including txd 69 * @cid: command identifier 70 * @pkt_type: must be 0xa0 (cmd packet by long format) 71 * @frag_n: fragment number 72 * @seq: sequence number 73 * @checksum: 0 mean there is no checksum 74 * @s2d_index: index for command source and destination 75 * Definition | value | note 76 * CMD_S2D_IDX_H2N | 0x00 | command from HOST to WM 77 * CMD_S2D_IDX_C2N | 0x01 | command from WA to WM 78 * CMD_S2D_IDX_H2C | 0x02 | command from HOST to WA 79 * CMD_S2D_IDX_H2N_AND_H2C | 0x03 | command from HOST to WA and WM 80 * 81 * @option: command option 82 * BIT[0]: UNI_CMD_OPT_BIT_ACK 83 * set to 1 to request a fw reply 84 * if UNI_CMD_OPT_BIT_0_ACK is set and UNI_CMD_OPT_BIT_2_SET_QUERY 85 * is set, mcu firmware will send response event EID = 0x01 86 * (UNI_EVENT_ID_CMD_RESULT) to the host. 87 * BIT[1]: UNI_CMD_OPT_BIT_UNI_CMD 88 * 0: original command 89 * 1: unified command 90 * BIT[2]: UNI_CMD_OPT_BIT_SET_QUERY 91 * 0: QUERY command 92 * 1: SET command 93 */ 94 struct mt76_connac2_mcu_uni_txd { 95 __le32 txd[8]; 96 97 /* DW1 */ 98 __le16 len; 99 __le16 cid; 100 101 /* DW2 */ 102 u8 rsv; 103 u8 pkt_type; 104 u8 frag_n; 105 u8 seq; 106 107 /* DW3 */ 108 __le16 checksum; 109 u8 s2d_index; 110 u8 option; 111 112 /* DW4 */ 113 u8 rsv1[4]; 114 } __packed __aligned(4); 115 116 struct mt76_connac2_mcu_rxd { 117 __le32 rxd[6]; 118 119 __le16 len; 120 __le16 pkt_type_id; 121 122 u8 eid; 123 u8 seq; 124 u8 option; 125 u8 rsv; 126 u8 ext_eid; 127 u8 rsv1[2]; 128 u8 s2d_index; 129 130 u8 tlv[0]; 131 }; 132 133 struct mt76_connac2_patch_hdr { 134 char build_date[16]; 135 char platform[4]; 136 __be32 hw_sw_ver; 137 __be32 patch_ver; 138 __be16 checksum; 139 u16 rsv; 140 struct { 141 __be32 patch_ver; 142 __be32 subsys; 143 __be32 feature; 144 __be32 n_region; 145 __be32 crc; 146 u32 rsv[11]; 147 } desc; 148 } __packed; 149 150 struct mt76_connac2_patch_sec { 151 __be32 type; 152 __be32 offs; 153 __be32 size; 154 union { 155 __be32 spec[13]; 156 struct { 157 __be32 addr; 158 __be32 len; 159 __be32 sec_key_idx; 160 __be32 align_len; 161 u32 rsv[9]; 162 } info; 163 }; 164 } __packed; 165 166 struct mt76_connac2_fw_trailer { 167 u8 chip_id; 168 u8 eco_code; 169 u8 n_region; 170 u8 format_ver; 171 u8 format_flag; 172 u8 rsv[2]; 173 char fw_ver[10]; 174 char build_date[15]; 175 __le32 crc; 176 } __packed; 177 178 struct mt76_connac2_fw_region { 179 __le32 decomp_crc; 180 __le32 decomp_len; 181 __le32 decomp_blk_sz; 182 u8 rsv[4]; 183 __le32 addr; 184 __le32 len; 185 u8 feature_set; 186 u8 type; 187 u8 rsv1[14]; 188 } __packed; 189 190 struct tlv { 191 __le16 tag; 192 __le16 len; 193 } __packed; 194 195 struct bss_info_omac { 196 __le16 tag; 197 __le16 len; 198 u8 hw_bss_idx; 199 u8 omac_idx; 200 u8 band_idx; 201 u8 rsv0; 202 __le32 conn_type; 203 u32 rsv1; 204 } __packed; 205 206 struct bss_info_basic { 207 __le16 tag; 208 __le16 len; 209 __le32 network_type; 210 u8 active; 211 u8 rsv0; 212 __le16 bcn_interval; 213 u8 bssid[ETH_ALEN]; 214 u8 wmm_idx; 215 u8 dtim_period; 216 u8 bmc_wcid_lo; 217 u8 cipher; 218 u8 phy_mode; 219 u8 max_bssid; /* max BSSID. range: 1 ~ 8, 0: MBSSID disabled */ 220 u8 non_tx_bssid;/* non-transmitted BSSID, 0: transmitted BSSID */ 221 u8 bmc_wcid_hi; /* high Byte and version */ 222 u8 rsv[2]; 223 } __packed; 224 225 struct bss_info_rf_ch { 226 __le16 tag; 227 __le16 len; 228 u8 pri_ch; 229 u8 center_ch0; 230 u8 center_ch1; 231 u8 bw; 232 u8 he_ru26_block; /* 1: don't send HETB in RU26, 0: allow */ 233 u8 he_all_disable; /* 1: disallow all HETB, 0: allow */ 234 u8 rsv[2]; 235 } __packed; 236 237 struct bss_info_ext_bss { 238 __le16 tag; 239 __le16 len; 240 __le32 mbss_tsf_offset; /* in unit of us */ 241 u8 rsv[8]; 242 } __packed; 243 244 enum { 245 BSS_INFO_OMAC, 246 BSS_INFO_BASIC, 247 BSS_INFO_RF_CH, /* optional, for BT/LTE coex */ 248 BSS_INFO_PM, /* sta only */ 249 BSS_INFO_UAPSD, /* sta only */ 250 BSS_INFO_ROAM_DETECT, /* obsoleted */ 251 BSS_INFO_LQ_RM, /* obsoleted */ 252 BSS_INFO_EXT_BSS, 253 BSS_INFO_BMC_RATE, /* for bmc rate control in CR4 */ 254 BSS_INFO_SYNC_MODE, /* obsoleted */ 255 BSS_INFO_RA, 256 BSS_INFO_HW_AMSDU, 257 BSS_INFO_BSS_COLOR, 258 BSS_INFO_HE_BASIC, 259 BSS_INFO_PROTECT_INFO, 260 BSS_INFO_OFFLOAD, 261 BSS_INFO_11V_MBSSID, 262 BSS_INFO_MAX_NUM 263 }; 264 265 /* sta_rec */ 266 267 struct sta_ntlv_hdr { 268 u8 rsv[2]; 269 __le16 tlv_num; 270 } __packed; 271 272 struct sta_req_hdr { 273 u8 bss_idx; 274 u8 wlan_idx_lo; 275 __le16 tlv_num; 276 u8 is_tlv_append; 277 u8 muar_idx; 278 u8 wlan_idx_hi; 279 u8 rsv; 280 } __packed; 281 282 struct sta_rec_basic { 283 __le16 tag; 284 __le16 len; 285 __le32 conn_type; 286 u8 conn_state; 287 u8 qos; 288 __le16 aid; 289 u8 peer_addr[ETH_ALEN]; 290 #define EXTRA_INFO_VER BIT(0) 291 #define EXTRA_INFO_NEW BIT(1) 292 __le16 extra_info; 293 } __packed; 294 295 struct sta_rec_ht { 296 __le16 tag; 297 __le16 len; 298 __le16 ht_cap; 299 u16 rsv; 300 } __packed; 301 302 struct sta_rec_vht { 303 __le16 tag; 304 __le16 len; 305 __le32 vht_cap; 306 __le16 vht_rx_mcs_map; 307 __le16 vht_tx_mcs_map; 308 /* mt7915 - mt7921 */ 309 u8 rts_bw_sig; 310 u8 rsv[3]; 311 } __packed; 312 313 struct sta_rec_uapsd { 314 __le16 tag; 315 __le16 len; 316 u8 dac_map; 317 u8 tac_map; 318 u8 max_sp; 319 u8 rsv0; 320 __le16 listen_interval; 321 u8 rsv1[2]; 322 } __packed; 323 324 struct sta_rec_ba { 325 __le16 tag; 326 __le16 len; 327 u8 tid; 328 u8 ba_type; 329 u8 amsdu; 330 u8 ba_en; 331 __le16 ssn; 332 __le16 winsize; 333 } __packed; 334 335 struct sta_rec_he { 336 __le16 tag; 337 __le16 len; 338 339 __le32 he_cap; 340 341 u8 t_frame_dur; 342 u8 max_ampdu_exp; 343 u8 bw_set; 344 u8 device_class; 345 u8 dcm_tx_mode; 346 u8 dcm_tx_max_nss; 347 u8 dcm_rx_mode; 348 u8 dcm_rx_max_nss; 349 u8 dcm_max_ru; 350 u8 punc_pream_rx; 351 u8 pkt_ext; 352 u8 rsv1; 353 354 __le16 max_nss_mcs[CMD_HE_MCS_BW_NUM]; 355 356 u8 rsv2[2]; 357 } __packed; 358 359 struct sta_rec_he_v2 { 360 __le16 tag; 361 __le16 len; 362 u8 he_mac_cap[6]; 363 u8 he_phy_cap[11]; 364 u8 pkt_ext; 365 /* 0: BW80, 1: BW160, 2: BW8080 */ 366 __le16 max_nss_mcs[CMD_HE_MCS_BW_NUM]; 367 } __packed; 368 369 struct sta_rec_amsdu { 370 __le16 tag; 371 __le16 len; 372 u8 max_amsdu_num; 373 u8 max_mpdu_size; 374 u8 amsdu_en; 375 u8 rsv; 376 } __packed; 377 378 struct sta_rec_state { 379 __le16 tag; 380 __le16 len; 381 __le32 flags; 382 u8 state; 383 u8 vht_opmode; 384 u8 action; 385 u8 rsv[1]; 386 } __packed; 387 388 #define RA_LEGACY_OFDM GENMASK(13, 6) 389 #define RA_LEGACY_CCK GENMASK(3, 0) 390 #define HT_MCS_MASK_NUM 10 391 struct sta_rec_ra_info { 392 __le16 tag; 393 __le16 len; 394 __le16 legacy; 395 u8 rx_mcs_bitmask[HT_MCS_MASK_NUM]; 396 } __packed; 397 398 struct sta_rec_phy { 399 __le16 tag; 400 __le16 len; 401 __le16 basic_rate; 402 u8 phy_type; 403 u8 ampdu; 404 u8 rts_policy; 405 u8 rcpi; 406 u8 rsv[2]; 407 } __packed; 408 409 struct sta_rec_he_6g_capa { 410 __le16 tag; 411 __le16 len; 412 __le16 capa; 413 u8 rsv[2]; 414 } __packed; 415 416 struct sec_key { 417 u8 cipher_id; 418 u8 cipher_len; 419 u8 key_id; 420 u8 key_len; 421 u8 key[32]; 422 } __packed; 423 424 struct sta_rec_sec { 425 __le16 tag; 426 __le16 len; 427 u8 add; 428 u8 n_cipher; 429 u8 rsv[2]; 430 431 struct sec_key key[2]; 432 } __packed; 433 434 struct sta_rec_bf { 435 __le16 tag; 436 __le16 len; 437 438 __le16 pfmu; /* 0xffff: no access right for PFMU */ 439 bool su_mu; /* 0: SU, 1: MU */ 440 u8 bf_cap; /* 0: iBF, 1: eBF */ 441 u8 sounding_phy; /* 0: legacy, 1: OFDM, 2: HT, 4: VHT */ 442 u8 ndpa_rate; 443 u8 ndp_rate; 444 u8 rept_poll_rate; 445 u8 tx_mode; /* 0: legacy, 1: OFDM, 2: HT, 4: VHT ... */ 446 u8 ncol; 447 u8 nrow; 448 u8 bw; /* 0: 20M, 1: 40M, 2: 80M, 3: 160M */ 449 450 u8 mem_total; 451 u8 mem_20m; 452 struct { 453 u8 row; 454 u8 col: 6, row_msb: 2; 455 } mem[4]; 456 457 __le16 smart_ant; 458 u8 se_idx; 459 u8 auto_sounding; /* b7: low traffic indicator 460 * b6: Stop sounding for this entry 461 * b5 ~ b0: postpone sounding 462 */ 463 u8 ibf_timeout; 464 u8 ibf_dbw; 465 u8 ibf_ncol; 466 u8 ibf_nrow; 467 u8 nrow_bw160; 468 u8 ncol_bw160; 469 u8 ru_start_idx; 470 u8 ru_end_idx; 471 472 bool trigger_su; 473 bool trigger_mu; 474 bool ng16_su; 475 bool ng16_mu; 476 bool codebook42_su; 477 bool codebook75_mu; 478 479 u8 he_ltf; 480 u8 rsv[3]; 481 } __packed; 482 483 struct sta_rec_bfee { 484 __le16 tag; 485 __le16 len; 486 bool fb_identity_matrix; /* 1: feedback identity matrix */ 487 bool ignore_feedback; /* 1: ignore */ 488 u8 rsv[2]; 489 } __packed; 490 491 struct sta_rec_muru { 492 __le16 tag; 493 __le16 len; 494 495 struct { 496 bool ofdma_dl_en; 497 bool ofdma_ul_en; 498 bool mimo_dl_en; 499 bool mimo_ul_en; 500 u8 rsv[4]; 501 } cfg; 502 503 struct { 504 u8 punc_pream_rx; 505 bool he_20m_in_40m_2g; 506 bool he_20m_in_160m; 507 bool he_80m_in_160m; 508 bool lt16_sigb; 509 bool rx_su_comp_sigb; 510 bool rx_su_non_comp_sigb; 511 u8 rsv; 512 } ofdma_dl; 513 514 struct { 515 u8 t_frame_dur; 516 u8 mu_cascading; 517 u8 uo_ra; 518 u8 he_2x996_tone; 519 u8 rx_t_frame_11ac; 520 u8 rsv[3]; 521 } ofdma_ul; 522 523 struct { 524 bool vht_mu_bfee; 525 bool partial_bw_dl_mimo; 526 u8 rsv[2]; 527 } mimo_dl; 528 529 struct { 530 bool full_ul_mimo; 531 bool partial_ul_mimo; 532 u8 rsv[2]; 533 } mimo_ul; 534 } __packed; 535 536 struct sta_phy { 537 u8 type; 538 u8 flag; 539 u8 stbc; 540 u8 sgi; 541 u8 bw; 542 u8 ldpc; 543 u8 mcs; 544 u8 nss; 545 u8 he_ltf; 546 }; 547 548 struct sta_rec_ra { 549 __le16 tag; 550 __le16 len; 551 552 u8 valid; 553 u8 auto_rate; 554 u8 phy_mode; 555 u8 channel; 556 u8 bw; 557 u8 disable_cck; 558 u8 ht_mcs32; 559 u8 ht_gf; 560 u8 ht_mcs[4]; 561 u8 mmps_mode; 562 u8 gband_256; 563 u8 af; 564 u8 auth_wapi_mode; 565 u8 rate_len; 566 567 u8 supp_mode; 568 u8 supp_cck_rate; 569 u8 supp_ofdm_rate; 570 __le32 supp_ht_mcs; 571 __le16 supp_vht_mcs[4]; 572 573 u8 op_mode; 574 u8 op_vht_chan_width; 575 u8 op_vht_rx_nss; 576 u8 op_vht_rx_nss_type; 577 578 __le32 sta_cap; 579 580 struct sta_phy phy; 581 } __packed; 582 583 struct sta_rec_ra_fixed { 584 __le16 tag; 585 __le16 len; 586 587 __le32 field; 588 u8 op_mode; 589 u8 op_vht_chan_width; 590 u8 op_vht_rx_nss; 591 u8 op_vht_rx_nss_type; 592 593 struct sta_phy phy; 594 595 u8 spe_idx; 596 u8 short_preamble; 597 u8 is_5g; 598 u8 mmps_mode; 599 } __packed; 600 601 /* wtbl_rec */ 602 603 struct wtbl_req_hdr { 604 u8 wlan_idx_lo; 605 u8 operation; 606 __le16 tlv_num; 607 u8 wlan_idx_hi; 608 u8 rsv[3]; 609 } __packed; 610 611 struct wtbl_generic { 612 __le16 tag; 613 __le16 len; 614 u8 peer_addr[ETH_ALEN]; 615 u8 muar_idx; 616 u8 skip_tx; 617 u8 cf_ack; 618 u8 qos; 619 u8 mesh; 620 u8 adm; 621 __le16 partial_aid; 622 u8 baf_en; 623 u8 aad_om; 624 } __packed; 625 626 struct wtbl_rx { 627 __le16 tag; 628 __le16 len; 629 u8 rcid; 630 u8 rca1; 631 u8 rca2; 632 u8 rv; 633 u8 rsv[4]; 634 } __packed; 635 636 struct wtbl_ht { 637 __le16 tag; 638 __le16 len; 639 u8 ht; 640 u8 ldpc; 641 u8 af; 642 u8 mm; 643 u8 rsv[4]; 644 } __packed; 645 646 struct wtbl_vht { 647 __le16 tag; 648 __le16 len; 649 u8 ldpc; 650 u8 dyn_bw; 651 u8 vht; 652 u8 txop_ps; 653 u8 rsv[4]; 654 } __packed; 655 656 struct wtbl_tx_ps { 657 __le16 tag; 658 __le16 len; 659 u8 txps; 660 u8 rsv[3]; 661 } __packed; 662 663 struct wtbl_hdr_trans { 664 __le16 tag; 665 __le16 len; 666 u8 to_ds; 667 u8 from_ds; 668 u8 no_rx_trans; 669 u8 rsv; 670 } __packed; 671 672 struct wtbl_ba { 673 __le16 tag; 674 __le16 len; 675 /* common */ 676 u8 tid; 677 u8 ba_type; 678 u8 rsv0[2]; 679 /* originator only */ 680 __le16 sn; 681 u8 ba_en; 682 u8 ba_winsize_idx; 683 /* originator & recipient */ 684 __le16 ba_winsize; 685 /* recipient only */ 686 u8 peer_addr[ETH_ALEN]; 687 u8 rst_ba_tid; 688 u8 rst_ba_sel; 689 u8 rst_ba_sb; 690 u8 band_idx; 691 u8 rsv1[4]; 692 } __packed; 693 694 struct wtbl_smps { 695 __le16 tag; 696 __le16 len; 697 u8 smps; 698 u8 rsv[3]; 699 } __packed; 700 701 /* mt7615 only */ 702 703 struct wtbl_bf { 704 __le16 tag; 705 __le16 len; 706 u8 ibf; 707 u8 ebf; 708 u8 ibf_vht; 709 u8 ebf_vht; 710 u8 gid; 711 u8 pfmu_idx; 712 u8 rsv[2]; 713 } __packed; 714 715 struct wtbl_pn { 716 __le16 tag; 717 __le16 len; 718 u8 pn[6]; 719 u8 rsv[2]; 720 } __packed; 721 722 struct wtbl_spe { 723 __le16 tag; 724 __le16 len; 725 u8 spe_idx; 726 u8 rsv[3]; 727 } __packed; 728 729 struct wtbl_raw { 730 __le16 tag; 731 __le16 len; 732 u8 wtbl_idx; 733 u8 dw; 734 u8 rsv[2]; 735 __le32 msk; 736 __le32 val; 737 } __packed; 738 739 #define MT76_CONNAC_WTBL_UPDATE_MAX_SIZE (sizeof(struct wtbl_req_hdr) + \ 740 sizeof(struct wtbl_generic) + \ 741 sizeof(struct wtbl_rx) + \ 742 sizeof(struct wtbl_ht) + \ 743 sizeof(struct wtbl_vht) + \ 744 sizeof(struct wtbl_tx_ps) + \ 745 sizeof(struct wtbl_hdr_trans) +\ 746 sizeof(struct wtbl_ba) + \ 747 sizeof(struct wtbl_bf) + \ 748 sizeof(struct wtbl_smps) + \ 749 sizeof(struct wtbl_pn) + \ 750 sizeof(struct wtbl_spe)) 751 752 #define MT76_CONNAC_STA_UPDATE_MAX_SIZE (sizeof(struct sta_req_hdr) + \ 753 sizeof(struct sta_rec_basic) + \ 754 sizeof(struct sta_rec_bf) + \ 755 sizeof(struct sta_rec_ht) + \ 756 sizeof(struct sta_rec_he) + \ 757 sizeof(struct sta_rec_ba) + \ 758 sizeof(struct sta_rec_vht) + \ 759 sizeof(struct sta_rec_uapsd) + \ 760 sizeof(struct sta_rec_amsdu) + \ 761 sizeof(struct sta_rec_muru) + \ 762 sizeof(struct sta_rec_bfee) + \ 763 sizeof(struct sta_rec_ra) + \ 764 sizeof(struct sta_rec_sec) + \ 765 sizeof(struct sta_rec_ra_fixed) + \ 766 sizeof(struct sta_rec_he_6g_capa) + \ 767 sizeof(struct tlv) + \ 768 MT76_CONNAC_WTBL_UPDATE_MAX_SIZE) 769 770 enum { 771 STA_REC_BASIC, 772 STA_REC_RA, 773 STA_REC_RA_CMM_INFO, 774 STA_REC_RA_UPDATE, 775 STA_REC_BF, 776 STA_REC_AMSDU, 777 STA_REC_BA, 778 STA_REC_STATE, 779 STA_REC_TX_PROC, /* for hdr trans and CSO in CR4 */ 780 STA_REC_HT, 781 STA_REC_VHT, 782 STA_REC_APPS, 783 STA_REC_KEY, 784 STA_REC_WTBL, 785 STA_REC_HE, 786 STA_REC_HW_AMSDU, 787 STA_REC_WTBL_AADOM, 788 STA_REC_KEY_V2, 789 STA_REC_MURU, 790 STA_REC_MUEDCA, 791 STA_REC_BFEE, 792 STA_REC_PHY = 0x15, 793 STA_REC_HE_6G = 0x17, 794 STA_REC_HE_V2 = 0x19, 795 STA_REC_MAX_NUM 796 }; 797 798 enum { 799 WTBL_GENERIC, 800 WTBL_RX, 801 WTBL_HT, 802 WTBL_VHT, 803 WTBL_PEER_PS, /* not used */ 804 WTBL_TX_PS, 805 WTBL_HDR_TRANS, 806 WTBL_SEC_KEY, 807 WTBL_BA, 808 WTBL_RDG, /* obsoleted */ 809 WTBL_PROTECT, /* not used */ 810 WTBL_CLEAR, /* not used */ 811 WTBL_BF, 812 WTBL_SMPS, 813 WTBL_RAW_DATA, /* debug only */ 814 WTBL_PN, 815 WTBL_SPE, 816 WTBL_MAX_NUM 817 }; 818 819 #define STA_TYPE_STA BIT(0) 820 #define STA_TYPE_AP BIT(1) 821 #define STA_TYPE_ADHOC BIT(2) 822 #define STA_TYPE_WDS BIT(4) 823 #define STA_TYPE_BC BIT(5) 824 825 #define NETWORK_INFRA BIT(16) 826 #define NETWORK_P2P BIT(17) 827 #define NETWORK_IBSS BIT(18) 828 #define NETWORK_WDS BIT(21) 829 830 #define SCAN_FUNC_RANDOM_MAC BIT(0) 831 #define SCAN_FUNC_SPLIT_SCAN BIT(5) 832 833 #define CONNECTION_INFRA_STA (STA_TYPE_STA | NETWORK_INFRA) 834 #define CONNECTION_INFRA_AP (STA_TYPE_AP | NETWORK_INFRA) 835 #define CONNECTION_P2P_GC (STA_TYPE_STA | NETWORK_P2P) 836 #define CONNECTION_P2P_GO (STA_TYPE_AP | NETWORK_P2P) 837 #define CONNECTION_IBSS_ADHOC (STA_TYPE_ADHOC | NETWORK_IBSS) 838 #define CONNECTION_WDS (STA_TYPE_WDS | NETWORK_WDS) 839 #define CONNECTION_INFRA_BC (STA_TYPE_BC | NETWORK_INFRA) 840 841 #define CONN_STATE_DISCONNECT 0 842 #define CONN_STATE_CONNECT 1 843 #define CONN_STATE_PORT_SECURE 2 844 845 /* HE MAC */ 846 #define STA_REC_HE_CAP_HTC BIT(0) 847 #define STA_REC_HE_CAP_BQR BIT(1) 848 #define STA_REC_HE_CAP_BSR BIT(2) 849 #define STA_REC_HE_CAP_OM BIT(3) 850 #define STA_REC_HE_CAP_AMSDU_IN_AMPDU BIT(4) 851 /* HE PHY */ 852 #define STA_REC_HE_CAP_DUAL_BAND BIT(5) 853 #define STA_REC_HE_CAP_LDPC BIT(6) 854 #define STA_REC_HE_CAP_TRIG_CQI_FK BIT(7) 855 #define STA_REC_HE_CAP_PARTIAL_BW_EXT_RANGE BIT(8) 856 /* STBC */ 857 #define STA_REC_HE_CAP_LE_EQ_80M_TX_STBC BIT(9) 858 #define STA_REC_HE_CAP_LE_EQ_80M_RX_STBC BIT(10) 859 #define STA_REC_HE_CAP_GT_80M_TX_STBC BIT(11) 860 #define STA_REC_HE_CAP_GT_80M_RX_STBC BIT(12) 861 /* GI */ 862 #define STA_REC_HE_CAP_SU_PPDU_1LTF_8US_GI BIT(13) 863 #define STA_REC_HE_CAP_SU_MU_PPDU_4LTF_8US_GI BIT(14) 864 #define STA_REC_HE_CAP_ER_SU_PPDU_1LTF_8US_GI BIT(15) 865 #define STA_REC_HE_CAP_ER_SU_PPDU_4LTF_8US_GI BIT(16) 866 #define STA_REC_HE_CAP_NDP_4LTF_3DOT2MS_GI BIT(17) 867 /* 242 TONE */ 868 #define STA_REC_HE_CAP_BW20_RU242_SUPPORT BIT(18) 869 #define STA_REC_HE_CAP_TX_1024QAM_UNDER_RU242 BIT(19) 870 #define STA_REC_HE_CAP_RX_1024QAM_UNDER_RU242 BIT(20) 871 872 #define PHY_MODE_A BIT(0) 873 #define PHY_MODE_B BIT(1) 874 #define PHY_MODE_G BIT(2) 875 #define PHY_MODE_GN BIT(3) 876 #define PHY_MODE_AN BIT(4) 877 #define PHY_MODE_AC BIT(5) 878 #define PHY_MODE_AX_24G BIT(6) 879 #define PHY_MODE_AX_5G BIT(7) 880 881 #define PHY_MODE_AX_6G BIT(0) /* phymode_ext */ 882 883 #define MODE_CCK BIT(0) 884 #define MODE_OFDM BIT(1) 885 #define MODE_HT BIT(2) 886 #define MODE_VHT BIT(3) 887 #define MODE_HE BIT(4) 888 889 #define STA_CAP_WMM BIT(0) 890 #define STA_CAP_SGI_20 BIT(4) 891 #define STA_CAP_SGI_40 BIT(5) 892 #define STA_CAP_TX_STBC BIT(6) 893 #define STA_CAP_RX_STBC BIT(7) 894 #define STA_CAP_VHT_SGI_80 BIT(16) 895 #define STA_CAP_VHT_SGI_160 BIT(17) 896 #define STA_CAP_VHT_TX_STBC BIT(18) 897 #define STA_CAP_VHT_RX_STBC BIT(19) 898 #define STA_CAP_VHT_LDPC BIT(23) 899 #define STA_CAP_LDPC BIT(24) 900 #define STA_CAP_HT BIT(26) 901 #define STA_CAP_VHT BIT(27) 902 #define STA_CAP_HE BIT(28) 903 904 enum { 905 PHY_TYPE_HR_DSSS_INDEX = 0, 906 PHY_TYPE_ERP_INDEX, 907 PHY_TYPE_ERP_P2P_INDEX, 908 PHY_TYPE_OFDM_INDEX, 909 PHY_TYPE_HT_INDEX, 910 PHY_TYPE_VHT_INDEX, 911 PHY_TYPE_HE_INDEX, 912 PHY_TYPE_INDEX_NUM 913 }; 914 915 #define PHY_TYPE_BIT_HR_DSSS BIT(PHY_TYPE_HR_DSSS_INDEX) 916 #define PHY_TYPE_BIT_ERP BIT(PHY_TYPE_ERP_INDEX) 917 #define PHY_TYPE_BIT_OFDM BIT(PHY_TYPE_OFDM_INDEX) 918 #define PHY_TYPE_BIT_HT BIT(PHY_TYPE_HT_INDEX) 919 #define PHY_TYPE_BIT_VHT BIT(PHY_TYPE_VHT_INDEX) 920 #define PHY_TYPE_BIT_HE BIT(PHY_TYPE_HE_INDEX) 921 922 #define MT_WTBL_RATE_TX_MODE GENMASK(9, 6) 923 #define MT_WTBL_RATE_MCS GENMASK(5, 0) 924 #define MT_WTBL_RATE_NSS GENMASK(12, 10) 925 #define MT_WTBL_RATE_HE_GI GENMASK(7, 4) 926 #define MT_WTBL_RATE_GI GENMASK(3, 0) 927 928 #define MT_WTBL_W5_CHANGE_BW_RATE GENMASK(7, 5) 929 #define MT_WTBL_W5_SHORT_GI_20 BIT(8) 930 #define MT_WTBL_W5_SHORT_GI_40 BIT(9) 931 #define MT_WTBL_W5_SHORT_GI_80 BIT(10) 932 #define MT_WTBL_W5_SHORT_GI_160 BIT(11) 933 #define MT_WTBL_W5_BW_CAP GENMASK(13, 12) 934 #define MT_WTBL_W5_MPDU_FAIL_COUNT GENMASK(25, 23) 935 #define MT_WTBL_W5_MPDU_OK_COUNT GENMASK(28, 26) 936 #define MT_WTBL_W5_RATE_IDX GENMASK(31, 29) 937 938 enum { 939 WTBL_RESET_AND_SET = 1, 940 WTBL_SET, 941 WTBL_QUERY, 942 WTBL_RESET_ALL 943 }; 944 945 enum { 946 MT_BA_TYPE_INVALID, 947 MT_BA_TYPE_ORIGINATOR, 948 MT_BA_TYPE_RECIPIENT 949 }; 950 951 enum { 952 RST_BA_MAC_TID_MATCH, 953 RST_BA_MAC_MATCH, 954 RST_BA_NO_MATCH 955 }; 956 957 enum { 958 DEV_INFO_ACTIVE, 959 DEV_INFO_MAX_NUM 960 }; 961 962 #define MCU_UNI_CMD_EVENT BIT(1) 963 #define MCU_UNI_CMD_UNSOLICITED_EVENT BIT(2) 964 965 /* event table */ 966 enum { 967 MCU_EVENT_TARGET_ADDRESS_LEN = 0x01, 968 MCU_EVENT_FW_START = 0x01, 969 MCU_EVENT_GENERIC = 0x01, 970 MCU_EVENT_ACCESS_REG = 0x02, 971 MCU_EVENT_MT_PATCH_SEM = 0x04, 972 MCU_EVENT_REG_ACCESS = 0x05, 973 MCU_EVENT_LP_INFO = 0x07, 974 MCU_EVENT_SCAN_DONE = 0x0d, 975 MCU_EVENT_TX_DONE = 0x0f, 976 MCU_EVENT_ROC = 0x10, 977 MCU_EVENT_BSS_ABSENCE = 0x11, 978 MCU_EVENT_BSS_BEACON_LOSS = 0x13, 979 MCU_EVENT_CH_PRIVILEGE = 0x18, 980 MCU_EVENT_SCHED_SCAN_DONE = 0x23, 981 MCU_EVENT_DBG_MSG = 0x27, 982 MCU_EVENT_TXPWR = 0xd0, 983 MCU_EVENT_EXT = 0xed, 984 MCU_EVENT_RESTART_DL = 0xef, 985 MCU_EVENT_COREDUMP = 0xf0, 986 }; 987 988 /* ext event table */ 989 enum { 990 MCU_EXT_EVENT_PS_SYNC = 0x5, 991 MCU_EXT_EVENT_FW_LOG_2_HOST = 0x13, 992 MCU_EXT_EVENT_THERMAL_PROTECT = 0x22, 993 MCU_EXT_EVENT_ASSERT_DUMP = 0x23, 994 MCU_EXT_EVENT_RDD_REPORT = 0x3a, 995 MCU_EXT_EVENT_CSA_NOTIFY = 0x4f, 996 MCU_EXT_EVENT_BCC_NOTIFY = 0x75, 997 MCU_EXT_EVENT_MURU_CTRL = 0x9f, 998 }; 999 1000 enum { 1001 MCU_Q_QUERY, 1002 MCU_Q_SET, 1003 MCU_Q_RESERVED, 1004 MCU_Q_NA 1005 }; 1006 1007 enum { 1008 MCU_S2D_H2N, 1009 MCU_S2D_C2N, 1010 MCU_S2D_H2C, 1011 MCU_S2D_H2CN 1012 }; 1013 1014 enum { 1015 PATCH_NOT_DL_SEM_FAIL, 1016 PATCH_IS_DL, 1017 PATCH_NOT_DL_SEM_SUCCESS, 1018 PATCH_REL_SEM_SUCCESS 1019 }; 1020 1021 enum { 1022 FW_STATE_INITIAL, 1023 FW_STATE_FW_DOWNLOAD, 1024 FW_STATE_NORMAL_OPERATION, 1025 FW_STATE_NORMAL_TRX, 1026 FW_STATE_RDY = 7 1027 }; 1028 1029 enum { 1030 CH_SWITCH_NORMAL = 0, 1031 CH_SWITCH_SCAN = 3, 1032 CH_SWITCH_MCC = 4, 1033 CH_SWITCH_DFS = 5, 1034 CH_SWITCH_BACKGROUND_SCAN_START = 6, 1035 CH_SWITCH_BACKGROUND_SCAN_RUNNING = 7, 1036 CH_SWITCH_BACKGROUND_SCAN_STOP = 8, 1037 CH_SWITCH_SCAN_BYPASS_DPD = 9 1038 }; 1039 1040 enum { 1041 THERMAL_SENSOR_TEMP_QUERY, 1042 THERMAL_SENSOR_MANUAL_CTRL, 1043 THERMAL_SENSOR_INFO_QUERY, 1044 THERMAL_SENSOR_TASK_CTRL, 1045 }; 1046 1047 enum mcu_cipher_type { 1048 MCU_CIPHER_NONE = 0, 1049 MCU_CIPHER_WEP40, 1050 MCU_CIPHER_WEP104, 1051 MCU_CIPHER_WEP128, 1052 MCU_CIPHER_TKIP, 1053 MCU_CIPHER_AES_CCMP, 1054 MCU_CIPHER_CCMP_256, 1055 MCU_CIPHER_GCMP, 1056 MCU_CIPHER_GCMP_256, 1057 MCU_CIPHER_WAPI, 1058 MCU_CIPHER_BIP_CMAC_128, 1059 }; 1060 1061 enum { 1062 EE_MODE_EFUSE, 1063 EE_MODE_BUFFER, 1064 }; 1065 1066 enum { 1067 EE_FORMAT_BIN, 1068 EE_FORMAT_WHOLE, 1069 EE_FORMAT_MULTIPLE, 1070 }; 1071 1072 enum { 1073 MCU_PHY_STATE_TX_RATE, 1074 MCU_PHY_STATE_RX_RATE, 1075 MCU_PHY_STATE_RSSI, 1076 MCU_PHY_STATE_CONTENTION_RX_RATE, 1077 MCU_PHY_STATE_OFDMLQ_CNINFO, 1078 }; 1079 1080 #define MCU_CMD_ACK BIT(0) 1081 #define MCU_CMD_UNI BIT(1) 1082 #define MCU_CMD_QUERY BIT(2) 1083 1084 #define MCU_CMD_UNI_EXT_ACK (MCU_CMD_ACK | MCU_CMD_UNI | \ 1085 MCU_CMD_QUERY) 1086 1087 #define __MCU_CMD_FIELD_ID GENMASK(7, 0) 1088 #define __MCU_CMD_FIELD_EXT_ID GENMASK(15, 8) 1089 #define __MCU_CMD_FIELD_QUERY BIT(16) 1090 #define __MCU_CMD_FIELD_UNI BIT(17) 1091 #define __MCU_CMD_FIELD_CE BIT(18) 1092 #define __MCU_CMD_FIELD_WA BIT(19) 1093 1094 #define MCU_CMD(_t) FIELD_PREP(__MCU_CMD_FIELD_ID, \ 1095 MCU_CMD_##_t) 1096 #define MCU_EXT_CMD(_t) (MCU_CMD(EXT_CID) | \ 1097 FIELD_PREP(__MCU_CMD_FIELD_EXT_ID, \ 1098 MCU_EXT_CMD_##_t)) 1099 #define MCU_EXT_QUERY(_t) (MCU_EXT_CMD(_t) | __MCU_CMD_FIELD_QUERY) 1100 #define MCU_UNI_CMD(_t) (__MCU_CMD_FIELD_UNI | \ 1101 FIELD_PREP(__MCU_CMD_FIELD_ID, \ 1102 MCU_UNI_CMD_##_t)) 1103 #define MCU_CE_CMD(_t) (__MCU_CMD_FIELD_CE | \ 1104 FIELD_PREP(__MCU_CMD_FIELD_ID, \ 1105 MCU_CE_CMD_##_t)) 1106 #define MCU_CE_QUERY(_t) (MCU_CE_CMD(_t) | __MCU_CMD_FIELD_QUERY) 1107 1108 #define MCU_WA_CMD(_t) (MCU_CMD(_t) | __MCU_CMD_FIELD_WA) 1109 #define MCU_WA_EXT_CMD(_t) (MCU_EXT_CMD(_t) | __MCU_CMD_FIELD_WA) 1110 #define MCU_WA_PARAM_CMD(_t) (MCU_WA_CMD(WA_PARAM) | \ 1111 FIELD_PREP(__MCU_CMD_FIELD_EXT_ID, \ 1112 MCU_WA_PARAM_CMD_##_t)) 1113 1114 enum { 1115 MCU_EXT_CMD_EFUSE_ACCESS = 0x01, 1116 MCU_EXT_CMD_RF_REG_ACCESS = 0x02, 1117 MCU_EXT_CMD_RF_TEST = 0x04, 1118 MCU_EXT_CMD_PM_STATE_CTRL = 0x07, 1119 MCU_EXT_CMD_CHANNEL_SWITCH = 0x08, 1120 MCU_EXT_CMD_SET_TX_POWER_CTRL = 0x11, 1121 MCU_EXT_CMD_FW_LOG_2_HOST = 0x13, 1122 MCU_EXT_CMD_TXBF_ACTION = 0x1e, 1123 MCU_EXT_CMD_EFUSE_BUFFER_MODE = 0x21, 1124 MCU_EXT_CMD_THERMAL_PROT = 0x23, 1125 MCU_EXT_CMD_STA_REC_UPDATE = 0x25, 1126 MCU_EXT_CMD_BSS_INFO_UPDATE = 0x26, 1127 MCU_EXT_CMD_EDCA_UPDATE = 0x27, 1128 MCU_EXT_CMD_DEV_INFO_UPDATE = 0x2A, 1129 MCU_EXT_CMD_THERMAL_CTRL = 0x2c, 1130 MCU_EXT_CMD_WTBL_UPDATE = 0x32, 1131 MCU_EXT_CMD_SET_DRR_CTRL = 0x36, 1132 MCU_EXT_CMD_SET_RDD_CTRL = 0x3a, 1133 MCU_EXT_CMD_ATE_CTRL = 0x3d, 1134 MCU_EXT_CMD_PROTECT_CTRL = 0x3e, 1135 MCU_EXT_CMD_DBDC_CTRL = 0x45, 1136 MCU_EXT_CMD_MAC_INIT_CTRL = 0x46, 1137 MCU_EXT_CMD_RX_HDR_TRANS = 0x47, 1138 MCU_EXT_CMD_MUAR_UPDATE = 0x48, 1139 MCU_EXT_CMD_BCN_OFFLOAD = 0x49, 1140 MCU_EXT_CMD_RX_AIRTIME_CTRL = 0x4a, 1141 MCU_EXT_CMD_SET_RX_PATH = 0x4e, 1142 MCU_EXT_CMD_EFUSE_FREE_BLOCK = 0x4f, 1143 MCU_EXT_CMD_TX_POWER_FEATURE_CTRL = 0x58, 1144 MCU_EXT_CMD_RXDCOC_CAL = 0x59, 1145 MCU_EXT_CMD_GET_MIB_INFO = 0x5a, 1146 MCU_EXT_CMD_TXDPD_CAL = 0x60, 1147 MCU_EXT_CMD_CAL_CACHE = 0x67, 1148 MCU_EXT_CMD_SET_RADAR_TH = 0x7c, 1149 MCU_EXT_CMD_SET_RDD_PATTERN = 0x7d, 1150 MCU_EXT_CMD_MWDS_SUPPORT = 0x80, 1151 MCU_EXT_CMD_SET_SER_TRIGGER = 0x81, 1152 MCU_EXT_CMD_TWT_AGRT_UPDATE = 0x94, 1153 MCU_EXT_CMD_FW_DBG_CTRL = 0x95, 1154 MCU_EXT_CMD_OFFCH_SCAN_CTRL = 0x9a, 1155 MCU_EXT_CMD_SET_RDD_TH = 0x9d, 1156 MCU_EXT_CMD_MURU_CTRL = 0x9f, 1157 MCU_EXT_CMD_SET_SPR = 0xa8, 1158 MCU_EXT_CMD_GROUP_PRE_CAL_INFO = 0xab, 1159 MCU_EXT_CMD_DPD_PRE_CAL_INFO = 0xac, 1160 MCU_EXT_CMD_PHY_STAT_INFO = 0xad, 1161 }; 1162 1163 enum { 1164 MCU_UNI_CMD_DEV_INFO_UPDATE = 0x01, 1165 MCU_UNI_CMD_BSS_INFO_UPDATE = 0x02, 1166 MCU_UNI_CMD_STA_REC_UPDATE = 0x03, 1167 MCU_UNI_CMD_SUSPEND = 0x05, 1168 MCU_UNI_CMD_OFFLOAD = 0x06, 1169 MCU_UNI_CMD_HIF_CTRL = 0x07, 1170 MCU_UNI_CMD_SNIFFER = 0x24, 1171 MCU_UNI_CMD_ROC = 0x27, 1172 }; 1173 1174 enum { 1175 MCU_CMD_TARGET_ADDRESS_LEN_REQ = 0x01, 1176 MCU_CMD_FW_START_REQ = 0x02, 1177 MCU_CMD_INIT_ACCESS_REG = 0x3, 1178 MCU_CMD_NIC_POWER_CTRL = 0x4, 1179 MCU_CMD_PATCH_START_REQ = 0x05, 1180 MCU_CMD_PATCH_FINISH_REQ = 0x07, 1181 MCU_CMD_PATCH_SEM_CONTROL = 0x10, 1182 MCU_CMD_WA_PARAM = 0xc4, 1183 MCU_CMD_EXT_CID = 0xed, 1184 MCU_CMD_FW_SCATTER = 0xee, 1185 MCU_CMD_RESTART_DL_REQ = 0xef, 1186 }; 1187 1188 /* offload mcu commands */ 1189 enum { 1190 MCU_CE_CMD_TEST_CTRL = 0x01, 1191 MCU_CE_CMD_START_HW_SCAN = 0x03, 1192 MCU_CE_CMD_SET_PS_PROFILE = 0x05, 1193 MCU_CE_CMD_SET_CHAN_DOMAIN = 0x0f, 1194 MCU_CE_CMD_SET_BSS_CONNECTED = 0x16, 1195 MCU_CE_CMD_SET_BSS_ABORT = 0x17, 1196 MCU_CE_CMD_CANCEL_HW_SCAN = 0x1b, 1197 MCU_CE_CMD_SET_ROC = 0x1c, 1198 MCU_CE_CMD_SET_EDCA_PARMS = 0x1d, 1199 MCU_CE_CMD_SET_P2P_OPPPS = 0x33, 1200 MCU_CE_CMD_SET_CLC = 0x5c, 1201 MCU_CE_CMD_SET_RATE_TX_POWER = 0x5d, 1202 MCU_CE_CMD_SCHED_SCAN_ENABLE = 0x61, 1203 MCU_CE_CMD_SCHED_SCAN_REQ = 0x62, 1204 MCU_CE_CMD_GET_NIC_CAPAB = 0x8a, 1205 MCU_CE_CMD_SET_MU_EDCA_PARMS = 0xb0, 1206 MCU_CE_CMD_REG_WRITE = 0xc0, 1207 MCU_CE_CMD_REG_READ = 0xc0, 1208 MCU_CE_CMD_CHIP_CONFIG = 0xca, 1209 MCU_CE_CMD_FWLOG_2_HOST = 0xc5, 1210 MCU_CE_CMD_GET_WTBL = 0xcd, 1211 MCU_CE_CMD_GET_TXPWR = 0xd0, 1212 }; 1213 1214 enum { 1215 PATCH_SEM_RELEASE, 1216 PATCH_SEM_GET 1217 }; 1218 1219 enum { 1220 UNI_BSS_INFO_BASIC = 0, 1221 UNI_BSS_INFO_RLM = 2, 1222 UNI_BSS_INFO_BSS_COLOR = 4, 1223 UNI_BSS_INFO_HE_BASIC = 5, 1224 UNI_BSS_INFO_BCN_CONTENT = 7, 1225 UNI_BSS_INFO_QBSS = 15, 1226 UNI_BSS_INFO_UAPSD = 19, 1227 UNI_BSS_INFO_PS = 21, 1228 UNI_BSS_INFO_BCNFT = 22, 1229 }; 1230 1231 enum { 1232 UNI_OFFLOAD_OFFLOAD_ARP, 1233 UNI_OFFLOAD_OFFLOAD_ND, 1234 UNI_OFFLOAD_OFFLOAD_GTK_REKEY, 1235 UNI_OFFLOAD_OFFLOAD_BMC_RPY_DETECT, 1236 }; 1237 1238 enum { 1239 MT_NIC_CAP_TX_RESOURCE, 1240 MT_NIC_CAP_TX_EFUSE_ADDR, 1241 MT_NIC_CAP_COEX, 1242 MT_NIC_CAP_SINGLE_SKU, 1243 MT_NIC_CAP_CSUM_OFFLOAD, 1244 MT_NIC_CAP_HW_VER, 1245 MT_NIC_CAP_SW_VER, 1246 MT_NIC_CAP_MAC_ADDR, 1247 MT_NIC_CAP_PHY, 1248 MT_NIC_CAP_MAC, 1249 MT_NIC_CAP_FRAME_BUF, 1250 MT_NIC_CAP_BEAM_FORM, 1251 MT_NIC_CAP_LOCATION, 1252 MT_NIC_CAP_MUMIMO, 1253 MT_NIC_CAP_BUFFER_MODE_INFO, 1254 MT_NIC_CAP_HW_ADIE_VERSION = 0x14, 1255 MT_NIC_CAP_ANTSWP = 0x16, 1256 MT_NIC_CAP_WFDMA_REALLOC, 1257 MT_NIC_CAP_6G, 1258 }; 1259 1260 #define UNI_WOW_DETECT_TYPE_MAGIC BIT(0) 1261 #define UNI_WOW_DETECT_TYPE_ANY BIT(1) 1262 #define UNI_WOW_DETECT_TYPE_DISCONNECT BIT(2) 1263 #define UNI_WOW_DETECT_TYPE_GTK_REKEY_FAIL BIT(3) 1264 #define UNI_WOW_DETECT_TYPE_BCN_LOST BIT(4) 1265 #define UNI_WOW_DETECT_TYPE_SCH_SCAN_HIT BIT(5) 1266 #define UNI_WOW_DETECT_TYPE_BITMAP BIT(6) 1267 1268 enum { 1269 UNI_SUSPEND_MODE_SETTING, 1270 UNI_SUSPEND_WOW_CTRL, 1271 UNI_SUSPEND_WOW_GPIO_PARAM, 1272 UNI_SUSPEND_WOW_WAKEUP_PORT, 1273 UNI_SUSPEND_WOW_PATTERN, 1274 }; 1275 1276 enum { 1277 WOW_USB = 1, 1278 WOW_PCIE = 2, 1279 WOW_GPIO = 3, 1280 }; 1281 1282 struct mt76_connac_bss_basic_tlv { 1283 __le16 tag; 1284 __le16 len; 1285 u8 active; 1286 u8 omac_idx; 1287 u8 hw_bss_idx; 1288 u8 band_idx; 1289 __le32 conn_type; 1290 u8 conn_state; 1291 u8 wmm_idx; 1292 u8 bssid[ETH_ALEN]; 1293 __le16 bmc_tx_wlan_idx; 1294 __le16 bcn_interval; 1295 u8 dtim_period; 1296 u8 phymode; /* bit(0): A 1297 * bit(1): B 1298 * bit(2): G 1299 * bit(3): GN 1300 * bit(4): AN 1301 * bit(5): AC 1302 * bit(6): AX2 1303 * bit(7): AX5 1304 * bit(8): AX6 1305 */ 1306 __le16 sta_idx; 1307 __le16 nonht_basic_phy; 1308 u8 phymode_ext; /* bit(0) AX_6G */ 1309 u8 pad[1]; 1310 } __packed; 1311 1312 struct mt76_connac_bss_qos_tlv { 1313 __le16 tag; 1314 __le16 len; 1315 u8 qos; 1316 u8 pad[3]; 1317 } __packed; 1318 1319 struct mt76_connac_beacon_loss_event { 1320 u8 bss_idx; 1321 u8 reason; 1322 u8 pad[2]; 1323 } __packed; 1324 1325 struct mt76_connac_mcu_bss_event { 1326 u8 bss_idx; 1327 u8 is_absent; 1328 u8 free_quota; 1329 u8 pad; 1330 } __packed; 1331 1332 struct mt76_connac_mcu_scan_ssid { 1333 __le32 ssid_len; 1334 u8 ssid[IEEE80211_MAX_SSID_LEN]; 1335 } __packed; 1336 1337 struct mt76_connac_mcu_scan_channel { 1338 u8 band; /* 1: 2.4GHz 1339 * 2: 5.0GHz 1340 * Others: Reserved 1341 */ 1342 u8 channel_num; 1343 } __packed; 1344 1345 struct mt76_connac_mcu_scan_match { 1346 __le32 rssi_th; 1347 u8 ssid[IEEE80211_MAX_SSID_LEN]; 1348 u8 ssid_len; 1349 u8 rsv[3]; 1350 } __packed; 1351 1352 struct mt76_connac_hw_scan_req { 1353 u8 seq_num; 1354 u8 bss_idx; 1355 u8 scan_type; /* 0: PASSIVE SCAN 1356 * 1: ACTIVE SCAN 1357 */ 1358 u8 ssid_type; /* BIT(0) wildcard SSID 1359 * BIT(1) P2P wildcard SSID 1360 * BIT(2) specified SSID + wildcard SSID 1361 * BIT(2) + ssid_type_ext BIT(0) specified SSID only 1362 */ 1363 u8 ssids_num; 1364 u8 probe_req_num; /* Number of probe request for each SSID */ 1365 u8 scan_func; /* BIT(0) Enable random MAC scan 1366 * BIT(1) Disable DBDC scan type 1~3. 1367 * BIT(2) Use DBDC scan type 3 (dedicated one RF to scan). 1368 */ 1369 u8 version; /* 0: Not support fields after ies. 1370 * 1: Support fields after ies. 1371 */ 1372 struct mt76_connac_mcu_scan_ssid ssids[4]; 1373 __le16 probe_delay_time; 1374 __le16 channel_dwell_time; /* channel Dwell interval */ 1375 __le16 timeout_value; 1376 u8 channel_type; /* 0: Full channels 1377 * 1: Only 2.4GHz channels 1378 * 2: Only 5GHz channels 1379 * 3: P2P social channel only (channel #1, #6 and #11) 1380 * 4: Specified channels 1381 * Others: Reserved 1382 */ 1383 u8 channels_num; /* valid when channel_type is 4 */ 1384 /* valid when channels_num is set */ 1385 struct mt76_connac_mcu_scan_channel channels[32]; 1386 __le16 ies_len; 1387 u8 ies[MT76_CONNAC_SCAN_IE_LEN]; 1388 /* following fields are valid if version > 0 */ 1389 u8 ext_channels_num; 1390 u8 ext_ssids_num; 1391 __le16 channel_min_dwell_time; 1392 struct mt76_connac_mcu_scan_channel ext_channels[32]; 1393 struct mt76_connac_mcu_scan_ssid ext_ssids[6]; 1394 u8 bssid[ETH_ALEN]; 1395 u8 random_mac[ETH_ALEN]; /* valid when BIT(1) in scan_func is set. */ 1396 u8 pad[63]; 1397 u8 ssid_type_ext; 1398 } __packed; 1399 1400 #define MT76_CONNAC_SCAN_DONE_EVENT_MAX_CHANNEL_NUM 64 1401 1402 struct mt76_connac_hw_scan_done { 1403 u8 seq_num; 1404 u8 sparse_channel_num; 1405 struct mt76_connac_mcu_scan_channel sparse_channel; 1406 u8 complete_channel_num; 1407 u8 current_state; 1408 u8 version; 1409 u8 pad; 1410 __le32 beacon_scan_num; 1411 u8 pno_enabled; 1412 u8 pad2[3]; 1413 u8 sparse_channel_valid_num; 1414 u8 pad3[3]; 1415 u8 channel_num[MT76_CONNAC_SCAN_DONE_EVENT_MAX_CHANNEL_NUM]; 1416 /* idle format for channel_idle_time 1417 * 0: first bytes: idle time(ms) 2nd byte: dwell time(ms) 1418 * 1: first bytes: idle time(8ms) 2nd byte: dwell time(8ms) 1419 * 2: dwell time (16us) 1420 */ 1421 __le16 channel_idle_time[MT76_CONNAC_SCAN_DONE_EVENT_MAX_CHANNEL_NUM]; 1422 /* beacon and probe response count */ 1423 u8 beacon_probe_num[MT76_CONNAC_SCAN_DONE_EVENT_MAX_CHANNEL_NUM]; 1424 u8 mdrdy_count[MT76_CONNAC_SCAN_DONE_EVENT_MAX_CHANNEL_NUM]; 1425 __le32 beacon_2g_num; 1426 __le32 beacon_5g_num; 1427 } __packed; 1428 1429 struct mt76_connac_sched_scan_req { 1430 u8 version; 1431 u8 seq_num; 1432 u8 stop_on_match; 1433 u8 ssids_num; 1434 u8 match_num; 1435 u8 pad; 1436 __le16 ie_len; 1437 struct mt76_connac_mcu_scan_ssid ssids[MT76_CONNAC_MAX_SCHED_SCAN_SSID]; 1438 struct mt76_connac_mcu_scan_match match[MT76_CONNAC_MAX_SCAN_MATCH]; 1439 u8 channel_type; 1440 u8 channels_num; 1441 u8 intervals_num; 1442 u8 scan_func; /* MT7663: BIT(0) eable random mac address */ 1443 struct mt76_connac_mcu_scan_channel channels[64]; 1444 __le16 intervals[MT76_CONNAC_MAX_NUM_SCHED_SCAN_INTERVAL]; 1445 union { 1446 struct { 1447 u8 random_mac[ETH_ALEN]; 1448 u8 pad2[58]; 1449 } mt7663; 1450 struct { 1451 u8 bss_idx; 1452 u8 pad1[3]; 1453 __le32 delay; 1454 u8 pad2[12]; 1455 u8 random_mac[ETH_ALEN]; 1456 u8 pad3[38]; 1457 } mt7921; 1458 }; 1459 } __packed; 1460 1461 struct mt76_connac_sched_scan_done { 1462 u8 seq_num; 1463 u8 status; /* 0: ssid found */ 1464 __le16 pad; 1465 } __packed; 1466 1467 struct bss_info_uni_bss_color { 1468 __le16 tag; 1469 __le16 len; 1470 u8 enable; 1471 u8 bss_color; 1472 u8 rsv[2]; 1473 } __packed; 1474 1475 struct bss_info_uni_he { 1476 __le16 tag; 1477 __le16 len; 1478 __le16 he_rts_thres; 1479 u8 he_pe_duration; 1480 u8 su_disable; 1481 __le16 max_nss_mcs[CMD_HE_MCS_BW_NUM]; 1482 u8 rsv[2]; 1483 } __packed; 1484 1485 struct mt76_connac_gtk_rekey_tlv { 1486 __le16 tag; 1487 __le16 len; 1488 u8 kek[NL80211_KEK_LEN]; 1489 u8 kck[NL80211_KCK_LEN]; 1490 u8 replay_ctr[NL80211_REPLAY_CTR_LEN]; 1491 u8 rekey_mode; /* 0: rekey offload enable 1492 * 1: rekey offload disable 1493 * 2: rekey update 1494 */ 1495 u8 keyid; 1496 u8 option; /* 1: rekey data update without enabling offload */ 1497 u8 pad[1]; 1498 __le32 proto; /* WPA-RSN-WAPI-OPSN */ 1499 __le32 pairwise_cipher; 1500 __le32 group_cipher; 1501 __le32 key_mgmt; /* NONE-PSK-IEEE802.1X */ 1502 __le32 mgmt_group_cipher; 1503 u8 reserverd[4]; 1504 } __packed; 1505 1506 #define MT76_CONNAC_WOW_MASK_MAX_LEN 16 1507 #define MT76_CONNAC_WOW_PATTEN_MAX_LEN 128 1508 1509 struct mt76_connac_wow_pattern_tlv { 1510 __le16 tag; 1511 __le16 len; 1512 u8 index; /* pattern index */ 1513 u8 enable; /* 0: disable 1514 * 1: enable 1515 */ 1516 u8 data_len; /* pattern length */ 1517 u8 pad; 1518 u8 mask[MT76_CONNAC_WOW_MASK_MAX_LEN]; 1519 u8 pattern[MT76_CONNAC_WOW_PATTEN_MAX_LEN]; 1520 u8 rsv[4]; 1521 } __packed; 1522 1523 struct mt76_connac_wow_ctrl_tlv { 1524 __le16 tag; 1525 __le16 len; 1526 u8 cmd; /* 0x1: PM_WOWLAN_REQ_START 1527 * 0x2: PM_WOWLAN_REQ_STOP 1528 * 0x3: PM_WOWLAN_PARAM_CLEAR 1529 */ 1530 u8 trigger; /* 0: NONE 1531 * BIT(0): NL80211_WOWLAN_TRIG_MAGIC_PKT 1532 * BIT(1): NL80211_WOWLAN_TRIG_ANY 1533 * BIT(2): NL80211_WOWLAN_TRIG_DISCONNECT 1534 * BIT(3): NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE 1535 * BIT(4): BEACON_LOST 1536 * BIT(5): NL80211_WOWLAN_TRIG_NET_DETECT 1537 */ 1538 u8 wakeup_hif; /* 0x0: HIF_SDIO 1539 * 0x1: HIF_USB 1540 * 0x2: HIF_PCIE 1541 * 0x3: HIF_GPIO 1542 */ 1543 u8 pad; 1544 u8 rsv[4]; 1545 } __packed; 1546 1547 struct mt76_connac_wow_gpio_param_tlv { 1548 __le16 tag; 1549 __le16 len; 1550 u8 gpio_pin; 1551 u8 trigger_lvl; 1552 u8 pad[2]; 1553 __le32 gpio_interval; 1554 u8 rsv[4]; 1555 } __packed; 1556 1557 struct mt76_connac_arpns_tlv { 1558 __le16 tag; 1559 __le16 len; 1560 u8 mode; 1561 u8 ips_num; 1562 u8 option; 1563 u8 pad[1]; 1564 } __packed; 1565 1566 struct mt76_connac_suspend_tlv { 1567 __le16 tag; 1568 __le16 len; 1569 u8 enable; /* 0: suspend mode disabled 1570 * 1: suspend mode enabled 1571 */ 1572 u8 mdtim; /* LP parameter */ 1573 u8 wow_suspend; /* 0: update by origin policy 1574 * 1: update by wow dtim 1575 */ 1576 u8 pad[5]; 1577 } __packed; 1578 1579 enum mt76_sta_info_state { 1580 MT76_STA_INFO_STATE_NONE, 1581 MT76_STA_INFO_STATE_AUTH, 1582 MT76_STA_INFO_STATE_ASSOC 1583 }; 1584 1585 struct mt76_sta_cmd_info { 1586 struct ieee80211_sta *sta; 1587 struct mt76_wcid *wcid; 1588 1589 struct ieee80211_vif *vif; 1590 1591 bool offload_fw; 1592 bool enable; 1593 bool newly; 1594 int cmd; 1595 u8 rcpi; 1596 u8 state; 1597 }; 1598 1599 #define MT_SKU_POWER_LIMIT 161 1600 1601 struct mt76_connac_sku_tlv { 1602 u8 channel; 1603 s8 pwr_limit[MT_SKU_POWER_LIMIT]; 1604 } __packed; 1605 1606 struct mt76_connac_tx_power_limit_tlv { 1607 /* DW0 - common info*/ 1608 u8 ver; 1609 u8 pad0; 1610 __le16 len; 1611 /* DW1 - cmd hint */ 1612 u8 n_chan; /* # channel */ 1613 u8 band; /* 2.4GHz - 5GHz - 6GHz */ 1614 u8 last_msg; 1615 u8 pad1; 1616 /* DW3 */ 1617 u8 alpha2[4]; /* regulatory_request.alpha2 */ 1618 u8 pad2[32]; 1619 } __packed; 1620 1621 struct mt76_connac_config { 1622 __le16 id; 1623 u8 type; 1624 u8 resp_type; 1625 __le16 data_size; 1626 __le16 resv; 1627 u8 data[320]; 1628 } __packed; 1629 1630 static inline enum mcu_cipher_type 1631 mt76_connac_mcu_get_cipher(int cipher) 1632 { 1633 switch (cipher) { 1634 case WLAN_CIPHER_SUITE_WEP40: 1635 return MCU_CIPHER_WEP40; 1636 case WLAN_CIPHER_SUITE_WEP104: 1637 return MCU_CIPHER_WEP104; 1638 case WLAN_CIPHER_SUITE_TKIP: 1639 return MCU_CIPHER_TKIP; 1640 case WLAN_CIPHER_SUITE_AES_CMAC: 1641 return MCU_CIPHER_BIP_CMAC_128; 1642 case WLAN_CIPHER_SUITE_CCMP: 1643 return MCU_CIPHER_AES_CCMP; 1644 case WLAN_CIPHER_SUITE_CCMP_256: 1645 return MCU_CIPHER_CCMP_256; 1646 case WLAN_CIPHER_SUITE_GCMP: 1647 return MCU_CIPHER_GCMP; 1648 case WLAN_CIPHER_SUITE_GCMP_256: 1649 return MCU_CIPHER_GCMP_256; 1650 case WLAN_CIPHER_SUITE_SMS4: 1651 return MCU_CIPHER_WAPI; 1652 default: 1653 return MCU_CIPHER_NONE; 1654 } 1655 } 1656 1657 static inline u32 1658 mt76_connac_mcu_gen_dl_mode(struct mt76_dev *dev, u8 feature_set, bool is_wa) 1659 { 1660 u32 ret = 0; 1661 1662 ret |= feature_set & FW_FEATURE_SET_ENCRYPT ? 1663 DL_MODE_ENCRYPT | DL_MODE_RESET_SEC_IV : 0; 1664 if (is_mt7921(dev)) 1665 ret |= feature_set & FW_FEATURE_ENCRY_MODE ? 1666 DL_CONFIG_ENCRY_MODE_SEL : 0; 1667 ret |= FIELD_PREP(DL_MODE_KEY_IDX, 1668 FIELD_GET(FW_FEATURE_SET_KEY_IDX, feature_set)); 1669 ret |= DL_MODE_NEED_RSP; 1670 ret |= is_wa ? DL_MODE_WORKING_PDA_CR4 : 0; 1671 1672 return ret; 1673 } 1674 1675 #define to_wcid_lo(id) FIELD_GET(GENMASK(7, 0), (u16)id) 1676 #define to_wcid_hi(id) FIELD_GET(GENMASK(9, 8), (u16)id) 1677 1678 static inline void 1679 mt76_connac_mcu_get_wlan_idx(struct mt76_dev *dev, struct mt76_wcid *wcid, 1680 u8 *wlan_idx_lo, u8 *wlan_idx_hi) 1681 { 1682 *wlan_idx_hi = 0; 1683 1684 if (!is_connac_v1(dev)) { 1685 *wlan_idx_lo = wcid ? to_wcid_lo(wcid->idx) : 0; 1686 *wlan_idx_hi = wcid ? to_wcid_hi(wcid->idx) : 0; 1687 } else { 1688 *wlan_idx_lo = wcid ? wcid->idx : 0; 1689 } 1690 } 1691 1692 struct sk_buff * 1693 __mt76_connac_mcu_alloc_sta_req(struct mt76_dev *dev, struct mt76_vif *mvif, 1694 struct mt76_wcid *wcid, int len); 1695 static inline struct sk_buff * 1696 mt76_connac_mcu_alloc_sta_req(struct mt76_dev *dev, struct mt76_vif *mvif, 1697 struct mt76_wcid *wcid) 1698 { 1699 return __mt76_connac_mcu_alloc_sta_req(dev, mvif, wcid, 1700 MT76_CONNAC_STA_UPDATE_MAX_SIZE); 1701 } 1702 1703 struct wtbl_req_hdr * 1704 mt76_connac_mcu_alloc_wtbl_req(struct mt76_dev *dev, struct mt76_wcid *wcid, 1705 int cmd, void *sta_wtbl, struct sk_buff **skb); 1706 struct tlv *mt76_connac_mcu_add_nested_tlv(struct sk_buff *skb, int tag, 1707 int len, void *sta_ntlv, 1708 void *sta_wtbl); 1709 static inline struct tlv * 1710 mt76_connac_mcu_add_tlv(struct sk_buff *skb, int tag, int len) 1711 { 1712 return mt76_connac_mcu_add_nested_tlv(skb, tag, len, skb->data, NULL); 1713 } 1714 1715 int mt76_connac_mcu_set_channel_domain(struct mt76_phy *phy); 1716 int mt76_connac_mcu_set_vif_ps(struct mt76_dev *dev, struct ieee80211_vif *vif); 1717 void mt76_connac_mcu_sta_basic_tlv(struct sk_buff *skb, 1718 struct ieee80211_vif *vif, 1719 struct ieee80211_sta *sta, bool enable, 1720 bool newly); 1721 void mt76_connac_mcu_wtbl_generic_tlv(struct mt76_dev *dev, struct sk_buff *skb, 1722 struct ieee80211_vif *vif, 1723 struct ieee80211_sta *sta, void *sta_wtbl, 1724 void *wtbl_tlv); 1725 void mt76_connac_mcu_wtbl_hdr_trans_tlv(struct sk_buff *skb, 1726 struct ieee80211_vif *vif, 1727 struct mt76_wcid *wcid, 1728 void *sta_wtbl, void *wtbl_tlv); 1729 int mt76_connac_mcu_sta_update_hdr_trans(struct mt76_dev *dev, 1730 struct ieee80211_vif *vif, 1731 struct mt76_wcid *wcid, int cmd); 1732 int mt76_connac_mcu_wtbl_update_hdr_trans(struct mt76_dev *dev, 1733 struct ieee80211_vif *vif, 1734 struct ieee80211_sta *sta); 1735 void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb, 1736 struct ieee80211_sta *sta, 1737 struct ieee80211_vif *vif, 1738 u8 rcpi, u8 state); 1739 void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb, 1740 struct ieee80211_sta *sta, void *sta_wtbl, 1741 void *wtbl_tlv, bool ht_ldpc, bool vht_ldpc); 1742 void mt76_connac_mcu_wtbl_ba_tlv(struct mt76_dev *dev, struct sk_buff *skb, 1743 struct ieee80211_ampdu_params *params, 1744 bool enable, bool tx, void *sta_wtbl, 1745 void *wtbl_tlv); 1746 void mt76_connac_mcu_sta_ba_tlv(struct sk_buff *skb, 1747 struct ieee80211_ampdu_params *params, 1748 bool enable, bool tx); 1749 int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy, 1750 struct ieee80211_vif *vif, 1751 struct mt76_wcid *wcid, 1752 bool enable); 1753 int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif, 1754 struct ieee80211_ampdu_params *params, 1755 int cmd, bool enable, bool tx); 1756 int mt76_connac_mcu_uni_set_chctx(struct mt76_phy *phy, 1757 struct mt76_vif *vif, 1758 struct ieee80211_chanctx_conf *ctx); 1759 int mt76_connac_mcu_uni_add_bss(struct mt76_phy *phy, 1760 struct ieee80211_vif *vif, 1761 struct mt76_wcid *wcid, 1762 bool enable, 1763 struct ieee80211_chanctx_conf *ctx); 1764 int mt76_connac_mcu_sta_cmd(struct mt76_phy *phy, 1765 struct mt76_sta_cmd_info *info); 1766 void mt76_connac_mcu_beacon_loss_iter(void *priv, u8 *mac, 1767 struct ieee80211_vif *vif); 1768 int mt76_connac_mcu_set_rts_thresh(struct mt76_dev *dev, u32 val, u8 band); 1769 int mt76_connac_mcu_set_mac_enable(struct mt76_dev *dev, int band, bool enable, 1770 bool hdr_trans); 1771 int mt76_connac_mcu_init_download(struct mt76_dev *dev, u32 addr, u32 len, 1772 u32 mode); 1773 int mt76_connac_mcu_start_patch(struct mt76_dev *dev); 1774 int mt76_connac_mcu_patch_sem_ctrl(struct mt76_dev *dev, bool get); 1775 int mt76_connac_mcu_start_firmware(struct mt76_dev *dev, u32 addr, u32 option); 1776 int mt76_connac_mcu_get_nic_capability(struct mt76_phy *phy); 1777 1778 int mt76_connac_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif, 1779 struct ieee80211_scan_request *scan_req); 1780 int mt76_connac_mcu_cancel_hw_scan(struct mt76_phy *phy, 1781 struct ieee80211_vif *vif); 1782 int mt76_connac_mcu_sched_scan_req(struct mt76_phy *phy, 1783 struct ieee80211_vif *vif, 1784 struct cfg80211_sched_scan_request *sreq); 1785 int mt76_connac_mcu_sched_scan_enable(struct mt76_phy *phy, 1786 struct ieee80211_vif *vif, 1787 bool enable); 1788 int mt76_connac_mcu_update_arp_filter(struct mt76_dev *dev, 1789 struct mt76_vif *vif, 1790 struct ieee80211_bss_conf *info); 1791 int mt76_connac_mcu_update_gtk_rekey(struct ieee80211_hw *hw, 1792 struct ieee80211_vif *vif, 1793 struct cfg80211_gtk_rekey_data *key); 1794 int mt76_connac_mcu_set_hif_suspend(struct mt76_dev *dev, bool suspend); 1795 void mt76_connac_mcu_set_suspend_iter(void *priv, u8 *mac, 1796 struct ieee80211_vif *vif); 1797 int mt76_connac_sta_state_dp(struct mt76_dev *dev, 1798 enum ieee80211_sta_state old_state, 1799 enum ieee80211_sta_state new_state); 1800 int mt76_connac_mcu_chip_config(struct mt76_dev *dev); 1801 int mt76_connac_mcu_set_deep_sleep(struct mt76_dev *dev, bool enable); 1802 void mt76_connac_mcu_coredump_event(struct mt76_dev *dev, struct sk_buff *skb, 1803 struct mt76_connac_coredump *coredump); 1804 int mt76_connac_mcu_set_rate_txpower(struct mt76_phy *phy); 1805 int mt76_connac_mcu_set_p2p_oppps(struct ieee80211_hw *hw, 1806 struct ieee80211_vif *vif); 1807 u32 mt76_connac_mcu_reg_rr(struct mt76_dev *dev, u32 offset); 1808 void mt76_connac_mcu_reg_wr(struct mt76_dev *dev, u32 offset, u32 val); 1809 1810 const struct ieee80211_sta_he_cap * 1811 mt76_connac_get_he_phy_cap(struct mt76_phy *phy, struct ieee80211_vif *vif); 1812 u8 mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif, 1813 enum nl80211_band band, struct ieee80211_sta *sta); 1814 1815 int mt76_connac_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif, 1816 struct mt76_connac_sta_key_conf *sta_key_conf, 1817 struct ieee80211_key_conf *key, int mcu_cmd, 1818 struct mt76_wcid *wcid, enum set_key_cmd cmd); 1819 1820 void mt76_connac_mcu_bss_ext_tlv(struct sk_buff *skb, struct mt76_vif *mvif); 1821 void mt76_connac_mcu_bss_omac_tlv(struct sk_buff *skb, 1822 struct ieee80211_vif *vif); 1823 int mt76_connac_mcu_bss_basic_tlv(struct sk_buff *skb, 1824 struct ieee80211_vif *vif, 1825 struct ieee80211_sta *sta, 1826 struct mt76_phy *phy, u16 wlan_idx, 1827 bool enable); 1828 void mt76_connac_mcu_sta_uapsd(struct sk_buff *skb, struct ieee80211_vif *vif, 1829 struct ieee80211_sta *sta); 1830 void mt76_connac_mcu_wtbl_smps_tlv(struct sk_buff *skb, 1831 struct ieee80211_sta *sta, 1832 void *sta_wtbl, void *wtbl_tlv); 1833 int mt76_connac_mcu_set_pm(struct mt76_dev *dev, int band, int enter); 1834 int mt76_connac_mcu_restart(struct mt76_dev *dev); 1835 int mt76_connac_mcu_rdd_cmd(struct mt76_dev *dev, int cmd, u8 index, 1836 u8 rx_sel, u8 val); 1837 int mt76_connac2_load_ram(struct mt76_dev *dev, const char *fw_wm, 1838 const char *fw_wa); 1839 int mt76_connac2_load_patch(struct mt76_dev *dev, const char *fw_name); 1840 int mt76_connac2_mcu_fill_message(struct mt76_dev *mdev, struct sk_buff *skb, 1841 int cmd, int *wait_seq); 1842 #endif /* __MT76_CONNAC_MCU_H */ 1843