1 /* SPDX-License-Identifier: ISC */ 2 /* Copyright (C) 2020 MediaTek Inc. */ 3 4 #ifndef __MT7915_MCU_H 5 #define __MT7915_MCU_H 6 7 struct mt7915_mcu_txd { 8 __le32 txd[8]; 9 10 __le16 len; 11 __le16 pq_id; 12 13 u8 cid; 14 u8 pkt_type; 15 u8 set_query; /* FW don't care */ 16 u8 seq; 17 18 u8 uc_d2b0_rev; 19 u8 ext_cid; 20 u8 s2d_index; 21 u8 ext_cid_ack; 22 23 u32 reserved[5]; 24 } __packed __aligned(4); 25 26 /* event table */ 27 enum { 28 MCU_EVENT_TARGET_ADDRESS_LEN = 0x01, 29 MCU_EVENT_FW_START = 0x01, 30 MCU_EVENT_GENERIC = 0x01, 31 MCU_EVENT_ACCESS_REG = 0x02, 32 MCU_EVENT_MT_PATCH_SEM = 0x04, 33 MCU_EVENT_CH_PRIVILEGE = 0x18, 34 MCU_EVENT_EXT = 0xed, 35 MCU_EVENT_RESTART_DL = 0xef, 36 }; 37 38 /* ext event table */ 39 enum { 40 MCU_EXT_EVENT_PS_SYNC = 0x5, 41 MCU_EXT_EVENT_FW_LOG_2_HOST = 0x13, 42 MCU_EXT_EVENT_THERMAL_PROTECT = 0x22, 43 MCU_EXT_EVENT_ASSERT_DUMP = 0x23, 44 MCU_EXT_EVENT_RDD_REPORT = 0x3a, 45 MCU_EXT_EVENT_CSA_NOTIFY = 0x4f, 46 MCU_EXT_EVENT_RATE_REPORT = 0x87, 47 }; 48 49 struct mt7915_mcu_rxd { 50 __le32 rxd[6]; 51 52 __le16 len; 53 __le16 pkt_type_id; 54 55 u8 eid; 56 u8 seq; 57 __le16 __rsv; 58 59 u8 ext_eid; 60 u8 __rsv1[2]; 61 u8 s2d_index; 62 }; 63 64 struct mt7915_mcu_rdd_report { 65 struct mt7915_mcu_rxd rxd; 66 67 u8 idx; 68 u8 long_detected; 69 u8 constant_prf_detected; 70 u8 staggered_prf_detected; 71 u8 radar_type_idx; 72 u8 periodic_pulse_num; 73 u8 long_pulse_num; 74 u8 hw_pulse_num; 75 76 u8 out_lpn; 77 u8 out_spn; 78 u8 out_crpn; 79 u8 out_crpw; 80 u8 out_crbn; 81 u8 out_stgpn; 82 u8 out_stgpw; 83 84 u8 rsv; 85 86 __le32 out_pri_const; 87 __le32 out_pri_stg[3]; 88 89 struct { 90 __le32 start; 91 __le16 pulse_width; 92 __le16 pulse_power; 93 u8 mdrdy_flag; 94 u8 rsv[3]; 95 } long_pulse[32]; 96 97 struct { 98 __le32 start; 99 __le16 pulse_width; 100 __le16 pulse_power; 101 u8 mdrdy_flag; 102 u8 rsv[3]; 103 } periodic_pulse[32]; 104 105 struct { 106 __le32 start; 107 __le16 pulse_width; 108 __le16 pulse_power; 109 u8 sc_pass; 110 u8 sw_reset; 111 u8 mdrdy_flag; 112 u8 tx_active; 113 } hw_pulse[32]; 114 } __packed; 115 116 struct mt7915_mcu_eeprom_info { 117 __le32 addr; 118 __le32 valid; 119 u8 data[16]; 120 } __packed; 121 122 struct mt7915_mcu_ra_info { 123 struct mt7915_mcu_rxd rxd; 124 125 __le32 event_id; 126 __le16 wlan_idx; 127 __le16 ru_idx; 128 __le16 direction; 129 __le16 dump_group; 130 131 __le32 suggest_rate; 132 __le32 min_rate; /* for dynamic sounding */ 133 __le32 max_rate; /* for dynamic sounding */ 134 __le32 init_rate_down_rate; 135 136 __le16 curr_rate; 137 __le16 init_rate_down_total; 138 __le16 init_rate_down_succ; 139 __le16 success; 140 __le16 attempts; 141 142 __le16 prev_rate; 143 __le16 prob_up_rate; 144 u8 no_rate_up_cnt; 145 u8 ppdu_cnt; 146 u8 gi; 147 148 u8 try_up_fail; 149 u8 try_up_total; 150 u8 suggest_wf; 151 u8 try_up_check; 152 u8 prob_up_period; 153 u8 prob_down_pending; 154 } __packed; 155 156 #define MT_RA_RATE_NSS GENMASK(8, 6) 157 #define MT_RA_RATE_MCS GENMASK(3, 0) 158 #define MT_RA_RATE_TX_MODE GENMASK(12, 9) 159 #define MT_RA_RATE_DCM_EN BIT(4) 160 #define MT_RA_RATE_BW GENMASK(14, 13) 161 162 #define MCU_PQ_ID(p, q) (((p) << 15) | ((q) << 10)) 163 #define MCU_PKT_ID 0xa0 164 165 enum { 166 MCU_Q_QUERY, 167 MCU_Q_SET, 168 MCU_Q_RESERVED, 169 MCU_Q_NA 170 }; 171 172 enum { 173 MCU_S2D_H2N, 174 MCU_S2D_C2N, 175 MCU_S2D_H2C, 176 MCU_S2D_H2CN 177 }; 178 179 enum { 180 MCU_CMD_TARGET_ADDRESS_LEN_REQ = 0x01, 181 MCU_CMD_FW_START_REQ = 0x02, 182 MCU_CMD_INIT_ACCESS_REG = 0x3, 183 MCU_CMD_NIC_POWER_CTRL = 0x4, 184 MCU_CMD_PATCH_START_REQ = 0x05, 185 MCU_CMD_PATCH_FINISH_REQ = 0x07, 186 MCU_CMD_PATCH_SEM_CONTROL = 0x10, 187 MCU_CMD_EXT_CID = 0xED, 188 MCU_CMD_FW_SCATTER = 0xEE, 189 MCU_CMD_RESTART_DL_REQ = 0xEF, 190 }; 191 192 enum { 193 MCU_EXT_CMD_EFUSE_ACCESS = 0x01, 194 MCU_EXT_CMD_PM_STATE_CTRL = 0x07, 195 MCU_EXT_CMD_CHANNEL_SWITCH = 0x08, 196 MCU_EXT_CMD_FW_LOG_2_HOST = 0x13, 197 MCU_EXT_CMD_TXBF_ACTION = 0x1e, 198 MCU_EXT_CMD_EFUSE_BUFFER_MODE = 0x21, 199 MCU_EXT_CMD_STA_REC_UPDATE = 0x25, 200 MCU_EXT_CMD_BSS_INFO_UPDATE = 0x26, 201 MCU_EXT_CMD_EDCA_UPDATE = 0x27, 202 MCU_EXT_CMD_DEV_INFO_UPDATE = 0x2A, 203 MCU_EXT_CMD_THERMAL_CTRL = 0x2c, 204 MCU_EXT_CMD_SET_RDD_CTRL = 0x3a, 205 MCU_EXT_CMD_PROTECT_CTRL = 0x3e, 206 MCU_EXT_CMD_MAC_INIT_CTRL = 0x46, 207 MCU_EXT_CMD_RX_HDR_TRANS = 0x47, 208 MCU_EXT_CMD_SET_RX_PATH = 0x4e, 209 MCU_EXT_CMD_TX_POWER_FEATURE_CTRL = 0x58, 210 MCU_EXT_CMD_SET_SER_TRIGGER = 0x81, 211 MCU_EXT_CMD_SCS_CTRL = 0x82, 212 MCU_EXT_CMD_RATE_CTRL = 0x87, 213 MCU_EXT_CMD_FW_DBG_CTRL = 0x95, 214 MCU_EXT_CMD_SET_RDD_TH = 0x9d, 215 MCU_EXT_CMD_SET_SPR = 0xa8, 216 }; 217 218 enum { 219 PATCH_SEM_RELEASE, 220 PATCH_SEM_GET 221 }; 222 223 enum { 224 PATCH_NOT_DL_SEM_FAIL, 225 PATCH_IS_DL, 226 PATCH_NOT_DL_SEM_SUCCESS, 227 PATCH_REL_SEM_SUCCESS 228 }; 229 230 enum { 231 FW_STATE_INITIAL, 232 FW_STATE_FW_DOWNLOAD, 233 FW_STATE_NORMAL_OPERATION, 234 FW_STATE_NORMAL_TRX, 235 FW_STATE_WACPU_RDY = 7 236 }; 237 238 enum { 239 EE_MODE_EFUSE, 240 EE_MODE_BUFFER, 241 }; 242 243 enum { 244 EE_FORMAT_BIN, 245 EE_FORMAT_WHOLE, 246 EE_FORMAT_MULTIPLE, 247 }; 248 249 #define STA_TYPE_STA BIT(0) 250 #define STA_TYPE_AP BIT(1) 251 #define STA_TYPE_ADHOC BIT(2) 252 #define STA_TYPE_WDS BIT(4) 253 #define STA_TYPE_BC BIT(5) 254 255 #define NETWORK_INFRA BIT(16) 256 #define NETWORK_P2P BIT(17) 257 #define NETWORK_IBSS BIT(18) 258 #define NETWORK_WDS BIT(21) 259 260 #define CONNECTION_INFRA_STA (STA_TYPE_STA | NETWORK_INFRA) 261 #define CONNECTION_INFRA_AP (STA_TYPE_AP | NETWORK_INFRA) 262 #define CONNECTION_P2P_GC (STA_TYPE_STA | NETWORK_P2P) 263 #define CONNECTION_P2P_GO (STA_TYPE_AP | NETWORK_P2P) 264 #define CONNECTION_IBSS_ADHOC (STA_TYPE_ADHOC | NETWORK_IBSS) 265 #define CONNECTION_WDS (STA_TYPE_WDS | NETWORK_WDS) 266 #define CONNECTION_INFRA_BC (STA_TYPE_BC | NETWORK_INFRA) 267 268 #define CONN_STATE_DISCONNECT 0 269 #define CONN_STATE_CONNECT 1 270 #define CONN_STATE_PORT_SECURE 2 271 272 enum { 273 DEV_INFO_ACTIVE, 274 DEV_INFO_MAX_NUM 275 }; 276 277 enum { 278 SCS_SEND_DATA, 279 SCS_SET_MANUAL_PD_TH, 280 SCS_CONFIG, 281 SCS_ENABLE, 282 SCS_SHOW_INFO, 283 SCS_GET_GLO_ADDR, 284 SCS_GET_GLO_ADDR_EVENT, 285 }; 286 287 enum { 288 CMD_CBW_20MHZ = IEEE80211_STA_RX_BW_20, 289 CMD_CBW_40MHZ = IEEE80211_STA_RX_BW_40, 290 CMD_CBW_80MHZ = IEEE80211_STA_RX_BW_80, 291 CMD_CBW_160MHZ = IEEE80211_STA_RX_BW_160, 292 CMD_CBW_10MHZ, 293 CMD_CBW_5MHZ, 294 CMD_CBW_8080MHZ, 295 296 CMD_HE_MCS_BW80 = 0, 297 CMD_HE_MCS_BW160, 298 CMD_HE_MCS_BW8080, 299 CMD_HE_MCS_BW_NUM 300 }; 301 302 struct tlv { 303 __le16 tag; 304 __le16 len; 305 } __packed; 306 307 struct bss_info_omac { 308 __le16 tag; 309 __le16 len; 310 u8 hw_bss_idx; 311 u8 omac_idx; 312 u8 band_idx; 313 u8 rsv0; 314 __le32 conn_type; 315 u32 rsv1; 316 } __packed; 317 318 struct bss_info_basic { 319 __le16 tag; 320 __le16 len; 321 __le32 network_type; 322 u8 active; 323 u8 rsv0; 324 __le16 bcn_interval; 325 u8 bssid[ETH_ALEN]; 326 u8 wmm_idx; 327 u8 dtim_period; 328 u8 bmc_wcid_lo; 329 u8 cipher; 330 u8 phy_mode; 331 u8 max_bssid; /* max BSSID. range: 1 ~ 8, 0: MBSSID disabled */ 332 u8 non_tx_bssid;/* non-transmitted BSSID, 0: transmitted BSSID */ 333 u8 bmc_wcid_hi; /* high Byte and version */ 334 u8 rsv[2]; 335 } __packed; 336 337 struct bss_info_rf_ch { 338 __le16 tag; 339 __le16 len; 340 u8 pri_ch; 341 u8 center_ch0; 342 u8 center_ch1; 343 u8 bw; 344 u8 he_ru26_block; /* 1: don't send HETB in RU26, 0: allow */ 345 u8 he_all_disable; /* 1: disallow all HETB, 0: allow */ 346 u8 rsv[2]; 347 } __packed; 348 349 struct bss_info_ext_bss { 350 __le16 tag; 351 __le16 len; 352 __le32 mbss_tsf_offset; /* in unit of us */ 353 u8 rsv[8]; 354 } __packed; 355 356 struct bss_info_sync_mode { 357 __le16 tag; 358 __le16 len; 359 __le16 bcn_interval; 360 u8 enable; 361 u8 dtim_period; 362 u8 rsv[8]; 363 } __packed; 364 365 struct bss_info_bmc_rate { 366 __le16 tag; 367 __le16 len; 368 __le16 bc_trans; 369 __le16 mc_trans; 370 u8 short_preamble; 371 u8 rsv[7]; 372 } __packed; 373 374 struct bss_info_ra { 375 __le16 tag; 376 __le16 len; 377 u8 op_mode; 378 u8 adhoc_en; 379 u8 short_preamble; 380 u8 tx_streams; 381 u8 rx_streams; 382 u8 algo; 383 u8 force_sgi; 384 u8 force_gf; 385 u8 ht_mode; 386 u8 has_20_sta; /* Check if any sta support GF. */ 387 u8 bss_width_trigger_events; 388 u8 vht_nss_cap; 389 u8 vht_bw_signal; /* not use */ 390 u8 vht_force_sgi; /* not use */ 391 u8 se_off; 392 u8 antenna_idx; 393 u8 train_up_rule; 394 u8 rsv[3]; 395 unsigned short train_up_high_thres; 396 short train_up_rule_rssi; 397 unsigned short low_traffic_thres; 398 __le16 max_phyrate; 399 __le32 phy_cap; 400 __le32 interval; 401 __le32 fast_interval; 402 } __packed; 403 404 struct bss_info_he { 405 __le16 tag; 406 __le16 len; 407 u8 he_pe_duration; 408 u8 vht_op_info_present; 409 __le16 he_rts_thres; 410 __le16 max_nss_mcs[CMD_HE_MCS_BW_NUM]; 411 u8 rsv[6]; 412 } __packed; 413 414 struct bss_info_bcn { 415 __le16 tag; 416 __le16 len; 417 u8 ver; 418 u8 enable; 419 __le16 sub_ntlv; 420 } __packed __aligned(4); 421 422 struct bss_info_bcn_csa { 423 __le16 tag; 424 __le16 len; 425 u8 cnt; 426 u8 rsv[3]; 427 } __packed __aligned(4); 428 429 struct bss_info_bcn_bcc { 430 __le16 tag; 431 __le16 len; 432 u8 cnt; 433 u8 rsv[3]; 434 } __packed __aligned(4); 435 436 struct bss_info_bcn_mbss { 437 #define MAX_BEACON_NUM 32 438 __le16 tag; 439 __le16 len; 440 __le32 bitmap; 441 __le16 offset[MAX_BEACON_NUM]; 442 u8 rsv[8]; 443 } __packed __aligned(4); 444 445 struct bss_info_bcn_cont { 446 __le16 tag; 447 __le16 len; 448 __le16 tim_ofs; 449 __le16 csa_ofs; 450 __le16 bcc_ofs; 451 __le16 pkt_len; 452 } __packed __aligned(4); 453 454 enum { 455 BSS_INFO_BCN_CSA, 456 BSS_INFO_BCN_BCC, 457 BSS_INFO_BCN_MBSSID, 458 BSS_INFO_BCN_CONTENT, 459 BSS_INFO_BCN_MAX 460 }; 461 462 enum { 463 BSS_INFO_OMAC, 464 BSS_INFO_BASIC, 465 BSS_INFO_RF_CH, /* optional, for BT/LTE coex */ 466 BSS_INFO_PM, /* sta only */ 467 BSS_INFO_UAPSD, /* sta only */ 468 BSS_INFO_ROAM_DETECT, /* obsoleted */ 469 BSS_INFO_LQ_RM, /* obsoleted */ 470 BSS_INFO_EXT_BSS, 471 BSS_INFO_BMC_RATE, /* for bmc rate control in CR4 */ 472 BSS_INFO_SYNC_MODE, 473 BSS_INFO_RA, 474 BSS_INFO_HW_AMSDU, 475 BSS_INFO_BSS_COLOR, 476 BSS_INFO_HE_BASIC, 477 BSS_INFO_PROTECT_INFO, 478 BSS_INFO_OFFLOAD, 479 BSS_INFO_11V_MBSSID, 480 BSS_INFO_MAX_NUM 481 }; 482 483 enum { 484 WTBL_RESET_AND_SET = 1, 485 WTBL_SET, 486 WTBL_QUERY, 487 WTBL_RESET_ALL 488 }; 489 490 struct wtbl_req_hdr { 491 u8 wlan_idx_lo; 492 u8 operation; 493 __le16 tlv_num; 494 u8 wlan_idx_hi; 495 u8 rsv[3]; 496 } __packed; 497 498 struct wtbl_generic { 499 __le16 tag; 500 __le16 len; 501 u8 peer_addr[ETH_ALEN]; 502 u8 muar_idx; 503 u8 skip_tx; 504 u8 cf_ack; 505 u8 qos; 506 u8 mesh; 507 u8 adm; 508 __le16 partial_aid; 509 u8 baf_en; 510 u8 aad_om; 511 } __packed; 512 513 struct wtbl_rx { 514 __le16 tag; 515 __le16 len; 516 u8 rcid; 517 u8 rca1; 518 u8 rca2; 519 u8 rv; 520 u8 rsv[4]; 521 } __packed; 522 523 struct wtbl_ht { 524 __le16 tag; 525 __le16 len; 526 u8 ht; 527 u8 ldpc; 528 u8 af; 529 u8 mm; 530 u8 rsv[4]; 531 } __packed; 532 533 struct wtbl_vht { 534 __le16 tag; 535 __le16 len; 536 u8 ldpc; 537 u8 dyn_bw; 538 u8 vht; 539 u8 txop_ps; 540 u8 rsv[4]; 541 } __packed; 542 543 enum { 544 MT_BA_TYPE_INVALID, 545 MT_BA_TYPE_ORIGINATOR, 546 MT_BA_TYPE_RECIPIENT 547 }; 548 549 enum { 550 RST_BA_MAC_TID_MATCH, 551 RST_BA_MAC_MATCH, 552 RST_BA_NO_MATCH 553 }; 554 555 struct wtbl_ba { 556 __le16 tag; 557 __le16 len; 558 /* common */ 559 u8 tid; 560 u8 ba_type; 561 u8 rsv0[2]; 562 /* originator only */ 563 __le16 sn; 564 u8 ba_en; 565 u8 ba_winsize_idx; 566 __le16 ba_winsize; 567 /* recipient only */ 568 u8 peer_addr[ETH_ALEN]; 569 u8 rst_ba_tid; 570 u8 rst_ba_sel; 571 u8 rst_ba_sb; 572 u8 band_idx; 573 u8 rsv1[4]; 574 } __packed; 575 576 struct wtbl_smps { 577 __le16 tag; 578 __le16 len; 579 u8 smps; 580 u8 rsv[3]; 581 } __packed; 582 583 enum { 584 WTBL_GENERIC, 585 WTBL_RX, 586 WTBL_HT, 587 WTBL_VHT, 588 WTBL_PEER_PS, /* not used */ 589 WTBL_TX_PS, 590 WTBL_HDR_TRANS, 591 WTBL_SEC_KEY, 592 WTBL_BA, 593 WTBL_RDG, /* obsoleted */ 594 WTBL_PROTECT, /* not used */ 595 WTBL_CLEAR, /* not used */ 596 WTBL_BF, 597 WTBL_SMPS, 598 WTBL_RAW_DATA, /* debug only */ 599 WTBL_PN, 600 WTBL_SPE, 601 WTBL_MAX_NUM 602 }; 603 604 struct sta_ntlv_hdr { 605 u8 rsv[2]; 606 __le16 tlv_num; 607 } __packed; 608 609 struct sta_req_hdr { 610 u8 bss_idx; 611 u8 wlan_idx_lo; 612 __le16 tlv_num; 613 u8 is_tlv_append; 614 u8 muar_idx; 615 u8 wlan_idx_hi; 616 u8 rsv; 617 } __packed; 618 619 struct sta_rec_basic { 620 __le16 tag; 621 __le16 len; 622 __le32 conn_type; 623 u8 conn_state; 624 u8 qos; 625 __le16 aid; 626 u8 peer_addr[ETH_ALEN]; 627 __le16 extra_info; 628 } __packed; 629 630 struct sta_rec_ht { 631 __le16 tag; 632 __le16 len; 633 __le16 ht_cap; 634 u16 rsv; 635 } __packed; 636 637 struct sta_rec_vht { 638 __le16 tag; 639 __le16 len; 640 __le32 vht_cap; 641 __le16 vht_rx_mcs_map; 642 __le16 vht_tx_mcs_map; 643 u8 rts_bw_sig; 644 u8 rsv[3]; 645 } __packed; 646 647 struct sta_rec_muru { 648 __le16 tag; 649 __le16 len; 650 651 struct { 652 bool ofdma_dl_en; 653 bool ofdma_ul_en; 654 bool mimo_dl_en; 655 bool mimo_ul_en; 656 bool rsv[4]; 657 } cfg; 658 659 struct { 660 u8 punc_pream_rx; 661 bool he_20m_in_40m_2g; 662 bool he_20m_in_160m; 663 bool he_80m_in_160m; 664 bool lt16_sigb; 665 bool rx_su_comp_sigb; 666 bool rx_su_non_comp_sigb; 667 bool rsv; 668 } ofdma_dl; 669 670 struct { 671 u8 t_frame_dur; 672 u8 mu_cascading; 673 u8 uo_ra; 674 u8 he_2x996_tone; 675 u8 rx_t_frame_11ac; 676 u8 rsv[3]; 677 } ofdma_ul; 678 679 struct { 680 bool vht_mu_bfee; 681 bool partial_bw_dl_mimo; 682 u8 rsv[2]; 683 } mimo_dl; 684 685 struct { 686 bool full_ul_mimo; 687 bool partial_ul_mimo; 688 u8 rsv[2]; 689 } mimo_ul; 690 } __packed; 691 692 struct sta_rec_he { 693 __le16 tag; 694 __le16 len; 695 696 __le32 he_cap; 697 698 u8 t_frame_dur; 699 u8 max_ampdu_exp; 700 u8 bw_set; 701 u8 device_class; 702 u8 dcm_tx_mode; 703 u8 dcm_tx_max_nss; 704 u8 dcm_rx_mode; 705 u8 dcm_rx_max_nss; 706 u8 dcm_max_ru; 707 u8 punc_pream_rx; 708 u8 pkt_ext; 709 u8 rsv1; 710 711 __le16 max_nss_mcs[CMD_HE_MCS_BW_NUM]; 712 713 u8 rsv2[2]; 714 } __packed; 715 716 struct sta_rec_ba { 717 __le16 tag; 718 __le16 len; 719 u8 tid; 720 u8 ba_type; 721 u8 amsdu; 722 u8 ba_en; 723 __le16 ssn; 724 __le16 winsize; 725 } __packed; 726 727 struct sec_key { 728 u8 cipher_id; 729 u8 cipher_len; 730 u8 key_id; 731 u8 key_len; 732 u8 key[32]; 733 } __packed; 734 735 struct sta_rec_sec { 736 __le16 tag; 737 __le16 len; 738 u8 add; 739 u8 n_cipher; 740 u8 rsv[2]; 741 742 struct sec_key key[2]; 743 } __packed; 744 745 struct ra_phy { 746 u8 type; 747 u8 flag; 748 u8 stbc; 749 u8 sgi; 750 u8 bw; 751 u8 ldpc; 752 u8 mcs; 753 u8 nss; 754 u8 he_ltf; 755 }; 756 757 struct sta_rec_ra { 758 __le16 tag; 759 __le16 len; 760 761 u8 valid; 762 u8 auto_rate; 763 u8 phy_mode; 764 u8 channel; 765 u8 bw; 766 u8 disable_cck; 767 u8 ht_mcs32; 768 u8 ht_gf; 769 u8 ht_mcs[4]; 770 u8 mmps_mode; 771 u8 gband_256; 772 u8 af; 773 u8 auth_wapi_mode; 774 u8 rate_len; 775 776 u8 supp_mode; 777 u8 supp_cck_rate; 778 u8 supp_ofdm_rate; 779 __le32 supp_ht_mcs; 780 __le16 supp_vht_mcs[4]; 781 782 u8 op_mode; 783 u8 op_vht_chan_width; 784 u8 op_vht_rx_nss; 785 u8 op_vht_rx_nss_type; 786 787 __le32 sta_status; 788 789 struct ra_phy phy; 790 } __packed; 791 792 struct sta_rec_ra_fixed { 793 __le16 tag; 794 __le16 len; 795 796 __le32 field; 797 u8 op_mode; 798 u8 op_vht_chan_width; 799 u8 op_vht_rx_nss; 800 u8 op_vht_rx_nss_type; 801 802 struct ra_phy phy; 803 804 u8 spe_en; 805 u8 short_preamble; 806 u8 is_5g; 807 u8 mmps_mode; 808 } __packed; 809 810 #define RATE_PARAM_FIXED 3 811 #define RATE_PARAM_AUTO 20 812 #define RATE_CFG_MCS GENMASK(3, 0) 813 #define RATE_CFG_NSS GENMASK(7, 4) 814 #define RATE_CFG_GI GENMASK(11, 8) 815 #define RATE_CFG_BW GENMASK(15, 12) 816 #define RATE_CFG_STBC GENMASK(19, 16) 817 #define RATE_CFG_LDPC GENMASK(23, 20) 818 #define RATE_CFG_PHY_TYPE GENMASK(27, 24) 819 820 struct sta_rec_bf { 821 __le16 tag; 822 __le16 len; 823 824 __le16 pfmu; /* 0xffff: no access right for PFMU */ 825 bool su_mu; /* 0: SU, 1: MU */ 826 u8 bf_cap; /* 0: iBF, 1: eBF */ 827 u8 sounding_phy; /* 0: legacy, 1: OFDM, 2: HT, 4: VHT */ 828 u8 ndpa_rate; 829 u8 ndp_rate; 830 u8 rept_poll_rate; 831 u8 tx_mode; /* 0: legacy, 1: OFDM, 2: HT, 4: VHT ... */ 832 u8 nc; 833 u8 nr; 834 u8 bw; /* 0: 20M, 1: 40M, 2: 80M, 3: 160M */ 835 836 u8 mem_total; 837 u8 mem_20m; 838 struct { 839 u8 row; 840 u8 col: 6, row_msb: 2; 841 } mem[4]; 842 843 __le16 smart_ant; 844 u8 se_idx; 845 u8 auto_sounding; /* b7: low traffic indicator 846 * b6: Stop sounding for this entry 847 * b5 ~ b0: postpone sounding 848 */ 849 u8 ibf_timeout; 850 u8 ibf_dbw; 851 u8 ibf_ncol; 852 u8 ibf_nrow; 853 u8 nr_bw160; 854 u8 nc_bw160; 855 u8 ru_start_idx; 856 u8 ru_end_idx; 857 858 bool trigger_su; 859 bool trigger_mu; 860 bool ng16_su; 861 bool ng16_mu; 862 bool codebook42_su; 863 bool codebook75_mu; 864 865 u8 he_ltf; 866 u8 rsv[2]; 867 } __packed; 868 869 struct sta_rec_bfee { 870 __le16 tag; 871 __le16 len; 872 bool fb_identity_matrix; /* 1: feedback identity matrix */ 873 bool ignore_feedback; /* 1: ignore */ 874 u8 rsv[2]; 875 } __packed; 876 877 enum { 878 STA_REC_BASIC, 879 STA_REC_RA, 880 STA_REC_RA_CMM_INFO, 881 STA_REC_RA_UPDATE, 882 STA_REC_BF, 883 STA_REC_AMSDU, 884 STA_REC_BA, 885 STA_REC_RED, /* not used */ 886 STA_REC_TX_PROC, /* for hdr trans and CSO in CR4 */ 887 STA_REC_HT, 888 STA_REC_VHT, 889 STA_REC_APPS, 890 STA_REC_KEY, 891 STA_REC_WTBL, 892 STA_REC_HE, 893 STA_REC_HW_AMSDU, 894 STA_REC_WTBL_AADOM, 895 STA_REC_KEY_V2, 896 STA_REC_MURU, 897 STA_REC_MUEDCA, 898 STA_REC_BFEE, 899 STA_REC_MAX_NUM 900 }; 901 902 enum mt7915_cipher_type { 903 MT_CIPHER_NONE, 904 MT_CIPHER_WEP40, 905 MT_CIPHER_WEP104, 906 MT_CIPHER_WEP128, 907 MT_CIPHER_TKIP, 908 MT_CIPHER_AES_CCMP, 909 MT_CIPHER_CCMP_256, 910 MT_CIPHER_GCMP, 911 MT_CIPHER_GCMP_256, 912 MT_CIPHER_WAPI, 913 MT_CIPHER_BIP_CMAC_128, 914 }; 915 916 enum { 917 CH_SWITCH_NORMAL = 0, 918 CH_SWITCH_SCAN = 3, 919 CH_SWITCH_MCC = 4, 920 CH_SWITCH_DFS = 5, 921 CH_SWITCH_BACKGROUND_SCAN_START = 6, 922 CH_SWITCH_BACKGROUND_SCAN_RUNNING = 7, 923 CH_SWITCH_BACKGROUND_SCAN_STOP = 8, 924 CH_SWITCH_SCAN_BYPASS_DPD = 9 925 }; 926 927 enum { 928 THERMAL_SENSOR_TEMP_QUERY, 929 THERMAL_SENSOR_MANUAL_CTRL, 930 THERMAL_SENSOR_INFO_QUERY, 931 THERMAL_SENSOR_TASK_CTRL, 932 }; 933 934 enum { 935 MT_EBF = BIT(0), /* explicit beamforming */ 936 MT_IBF = BIT(1) /* implicit beamforming */ 937 }; 938 939 #define MT7915_WTBL_UPDATE_MAX_SIZE (sizeof(struct wtbl_req_hdr) + \ 940 sizeof(struct wtbl_generic) + \ 941 sizeof(struct wtbl_rx) + \ 942 sizeof(struct wtbl_ht) + \ 943 sizeof(struct wtbl_vht) + \ 944 sizeof(struct wtbl_ba) + \ 945 sizeof(struct wtbl_smps)) 946 947 #define MT7915_STA_UPDATE_MAX_SIZE (sizeof(struct sta_req_hdr) + \ 948 sizeof(struct sta_rec_basic) + \ 949 sizeof(struct sta_rec_ht) + \ 950 sizeof(struct sta_rec_he) + \ 951 sizeof(struct sta_rec_ba) + \ 952 sizeof(struct sta_rec_vht) + \ 953 sizeof(struct tlv) + \ 954 sizeof(struct sta_rec_muru) + \ 955 MT7915_WTBL_UPDATE_MAX_SIZE) 956 957 #define MT7915_WTBL_UPDATE_BA_SIZE (sizeof(struct wtbl_req_hdr) + \ 958 sizeof(struct wtbl_ba)) 959 960 #define MT7915_BSS_UPDATE_MAX_SIZE (sizeof(struct sta_req_hdr) + \ 961 sizeof(struct bss_info_omac) + \ 962 sizeof(struct bss_info_basic) +\ 963 sizeof(struct bss_info_rf_ch) +\ 964 sizeof(struct bss_info_ra) + \ 965 sizeof(struct bss_info_he) + \ 966 sizeof(struct bss_info_bmc_rate) +\ 967 sizeof(struct bss_info_ext_bss) +\ 968 sizeof(struct bss_info_sync_mode)) 969 970 #define MT7915_BEACON_UPDATE_SIZE (sizeof(struct sta_req_hdr) + \ 971 sizeof(struct bss_info_bcn_csa) + \ 972 sizeof(struct bss_info_bcn_bcc) + \ 973 sizeof(struct bss_info_bcn_mbss) + \ 974 sizeof(struct bss_info_bcn_cont)) 975 976 #define PHY_MODE_A BIT(0) 977 #define PHY_MODE_B BIT(1) 978 #define PHY_MODE_G BIT(2) 979 #define PHY_MODE_GN BIT(3) 980 #define PHY_MODE_AN BIT(4) 981 #define PHY_MODE_AC BIT(5) 982 #define PHY_MODE_AX_24G BIT(6) 983 #define PHY_MODE_AX_5G BIT(7) 984 #define PHY_MODE_AX_6G BIT(8) 985 986 #define MODE_CCK BIT(0) 987 #define MODE_OFDM BIT(1) 988 #define MODE_HT BIT(2) 989 #define MODE_VHT BIT(3) 990 #define MODE_HE BIT(4) 991 992 #define STA_CAP_WMM BIT(0) 993 #define STA_CAP_SGI_20 BIT(4) 994 #define STA_CAP_SGI_40 BIT(5) 995 #define STA_CAP_TX_STBC BIT(6) 996 #define STA_CAP_RX_STBC BIT(7) 997 #define STA_CAP_VHT_SGI_80 BIT(16) 998 #define STA_CAP_VHT_SGI_160 BIT(17) 999 #define STA_CAP_VHT_TX_STBC BIT(18) 1000 #define STA_CAP_VHT_RX_STBC BIT(19) 1001 #define STA_CAP_VHT_LDPC BIT(23) 1002 #define STA_CAP_LDPC BIT(24) 1003 #define STA_CAP_HT BIT(26) 1004 #define STA_CAP_VHT BIT(27) 1005 #define STA_CAP_HE BIT(28) 1006 1007 /* HE MAC */ 1008 #define STA_REC_HE_CAP_HTC BIT(0) 1009 #define STA_REC_HE_CAP_BQR BIT(1) 1010 #define STA_REC_HE_CAP_BSR BIT(2) 1011 #define STA_REC_HE_CAP_OM BIT(3) 1012 #define STA_REC_HE_CAP_AMSDU_IN_AMPDU BIT(4) 1013 /* HE PHY */ 1014 #define STA_REC_HE_CAP_DUAL_BAND BIT(5) 1015 #define STA_REC_HE_CAP_LDPC BIT(6) 1016 #define STA_REC_HE_CAP_TRIG_CQI_FK BIT(7) 1017 #define STA_REC_HE_CAP_PARTIAL_BW_EXT_RANGE BIT(8) 1018 /* STBC */ 1019 #define STA_REC_HE_CAP_LE_EQ_80M_TX_STBC BIT(9) 1020 #define STA_REC_HE_CAP_LE_EQ_80M_RX_STBC BIT(10) 1021 #define STA_REC_HE_CAP_GT_80M_TX_STBC BIT(11) 1022 #define STA_REC_HE_CAP_GT_80M_RX_STBC BIT(12) 1023 /* GI */ 1024 #define STA_REC_HE_CAP_SU_PPDU_1LTF_8US_GI BIT(13) 1025 #define STA_REC_HE_CAP_SU_MU_PPDU_4LTF_8US_GI BIT(14) 1026 #define STA_REC_HE_CAP_ER_SU_PPDU_1LTF_8US_GI BIT(15) 1027 #define STA_REC_HE_CAP_ER_SU_PPDU_4LTF_8US_GI BIT(16) 1028 #define STA_REC_HE_CAP_NDP_4LTF_3DOT2MS_GI BIT(17) 1029 /* 242 TONE */ 1030 #define STA_REC_HE_CAP_BW20_RU242_SUPPORT BIT(18) 1031 #define STA_REC_HE_CAP_TX_1024QAM_UNDER_RU242 BIT(19) 1032 #define STA_REC_HE_CAP_RX_1024QAM_UNDER_RU242 BIT(20) 1033 1034 #endif 1035