1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */ 2 /* 3 * Copyright (C) 2022 MediaTek Inc. 4 */ 5 6 #ifndef __MT7996_MCU_H 7 #define __MT7996_MCU_H 8 9 #include "../mt76_connac_mcu.h" 10 11 struct mt7996_mcu_rxd { 12 __le32 rxd[8]; 13 14 __le16 len; 15 __le16 pkt_type_id; 16 17 u8 eid; 18 u8 seq; 19 u8 option; 20 u8 __rsv; 21 22 u8 ext_eid; 23 u8 __rsv1[2]; 24 u8 s2d_index; 25 }; 26 27 struct mt7996_mcu_uni_event { 28 __le16 cid; 29 u8 __rsv[2]; 30 __le32 status; /* 0: success, others: fail */ 31 } __packed; 32 33 struct mt7996_mcu_thermal_ctrl { 34 u8 ctrl_id; 35 u8 band_idx; 36 union { 37 struct { 38 u8 protect_type; /* 1: duty admit, 2: radio off */ 39 u8 trigger_type; /* 0: low, 1: high */ 40 } __packed type; 41 struct { 42 u8 duty_level; /* level 0~3 */ 43 u8 duty_cycle; 44 } __packed duty; 45 }; 46 } __packed; 47 48 struct mt7996_mcu_thermal_enable { 49 __le32 trigger_temp; 50 __le32 restore_temp; 51 __le16 sustain_time; 52 u8 rsv[2]; 53 } __packed; 54 55 struct mt7996_mcu_countdown_notify { 56 u8 omac_idx; 57 u8 count; 58 u8 csa_failure_reason; /* 0: success, 1: beacon disabled */ 59 u8 rsv; 60 } __packed; 61 62 struct mt7996_mcu_rdd_report { 63 struct mt7996_mcu_rxd rxd; 64 65 u8 __rsv1[4]; 66 67 __le16 tag; 68 __le16 len; 69 70 u8 rdd_idx; 71 u8 long_detected; 72 u8 constant_prf_detected; 73 u8 staggered_prf_detected; 74 u8 radar_type_idx; 75 u8 periodic_pulse_num; 76 u8 long_pulse_num; 77 u8 hw_pulse_num; 78 79 u8 out_lpn; 80 u8 out_spn; 81 u8 out_crpn; 82 u8 out_crpw; 83 u8 out_crbn; 84 u8 out_stgpn; 85 u8 out_stgpw; 86 87 u8 __rsv2; 88 89 __le32 out_pri_const; 90 __le32 out_pri_stg[3]; 91 __le32 out_pri_stg_dmin; 92 93 struct { 94 __le32 start; 95 __le16 pulse_width; 96 __le16 pulse_power; 97 u8 mdrdy_flag; 98 u8 rsv[3]; 99 } long_pulse[32]; 100 101 struct { 102 __le32 start; 103 __le16 pulse_width; 104 __le16 pulse_power; 105 u8 mdrdy_flag; 106 u8 rsv[3]; 107 } periodic_pulse[32]; 108 109 struct { 110 __le32 start; 111 __le16 pulse_width; 112 __le16 pulse_power; 113 u8 sc_pass; 114 u8 sw_reset; 115 u8 mdrdy_flag; 116 u8 tx_active; 117 } hw_pulse[32]; 118 } __packed; 119 120 struct mt7996_mcu_background_chain_ctrl { 121 u8 _rsv[4]; 122 123 __le16 tag; 124 __le16 len; 125 126 u8 chan; /* primary channel */ 127 u8 central_chan; /* central channel */ 128 u8 bw; 129 u8 tx_stream; 130 u8 rx_stream; 131 132 u8 monitor_chan; /* monitor channel */ 133 u8 monitor_central_chan;/* monitor central channel */ 134 u8 monitor_bw; 135 u8 monitor_tx_stream; 136 u8 monitor_rx_stream; 137 138 u8 scan_mode; /* 0: ScanStop 139 * 1: ScanStart 140 * 2: ScanRunning 141 */ 142 u8 band_idx; /* DBDC */ 143 u8 monitor_scan_type; 144 u8 band; /* 0: 2.4GHz, 1: 5GHz */ 145 u8 rsv[2]; 146 } __packed; 147 148 struct mt7996_mcu_eeprom_update { 149 u8 _rsv[4]; 150 151 __le16 tag; 152 __le16 len; 153 u8 buffer_mode; 154 u8 format; 155 __le16 buf_len; 156 } __packed; 157 158 union eeprom_data { 159 struct { 160 __le32 data_len; 161 DECLARE_FLEX_ARRAY(u8, data); 162 } ext_eeprom; 163 DECLARE_FLEX_ARRAY(u8, efuse); 164 } __packed; 165 166 struct mt7996_mcu_eeprom_info { 167 u8 _rsv[4]; 168 169 __le16 tag; 170 __le16 len; 171 __le32 addr; 172 __le32 valid; 173 } __packed; 174 175 struct mt7996_mcu_eeprom_access { 176 struct mt7996_mcu_eeprom_info info; 177 union eeprom_data eeprom; 178 } __packed; 179 180 struct mt7996_mcu_eeprom_access_event { 181 u8 _rsv[4]; 182 183 __le16 tag; 184 __le16 len; 185 __le32 version; 186 __le32 addr; 187 __le32 valid; 188 __le32 size; 189 __le32 magic_no; 190 __le32 type; 191 __le32 rsv[4]; 192 union eeprom_data eeprom; 193 } __packed; 194 195 struct mt7996_mcu_phy_rx_info { 196 u8 category; 197 u8 rate; 198 u8 mode; 199 u8 nsts; 200 u8 gi; 201 u8 coding; 202 u8 stbc; 203 u8 bw; 204 }; 205 206 struct mt7996_mcu_mib { 207 __le16 tag; 208 __le16 len; 209 __le32 offs; 210 __le64 data; 211 } __packed; 212 213 struct all_sta_trx_rate { 214 __le16 wlan_idx; 215 u8 __rsv1[2]; 216 u8 tx_mode; 217 u8 flags; 218 u8 tx_stbc; 219 u8 tx_gi; 220 u8 tx_bw; 221 u8 tx_ldpc; 222 u8 tx_mcs; 223 u8 tx_nss; 224 u8 rx_rate; 225 u8 rx_mode; 226 u8 rx_nsts; 227 u8 rx_gi; 228 u8 rx_coding; 229 u8 rx_stbc; 230 u8 rx_bw; 231 u8 __rsv2; 232 } __packed; 233 234 struct mt7996_mcu_all_sta_info_event { 235 u8 rsv[4]; 236 __le16 tag; 237 __le16 len; 238 u8 more; 239 u8 rsv2; 240 __le16 sta_num; 241 u8 rsv3[4]; 242 243 union { 244 DECLARE_FLEX_ARRAY(struct all_sta_trx_rate, rate); 245 DECLARE_FLEX_ARRAY(struct { 246 __le16 wlan_idx; 247 u8 rsv[2]; 248 __le32 tx_bytes[IEEE80211_NUM_ACS]; 249 __le32 rx_bytes[IEEE80211_NUM_ACS]; 250 } __packed, adm_stat); 251 252 DECLARE_FLEX_ARRAY(struct { 253 __le16 wlan_idx; 254 u8 rsv[2]; 255 __le32 tx_msdu_cnt; 256 __le32 rx_msdu_cnt; 257 } __packed, msdu_cnt); 258 } __packed; 259 } __packed; 260 261 struct mt7996_mcu_wed_rro_event { 262 struct mt7996_mcu_rxd rxd; 263 264 u8 __rsv1[4]; 265 266 __le16 tag; 267 __le16 len; 268 } __packed; 269 270 struct mt7996_mcu_wed_rro_ba_event { 271 __le16 tag; 272 __le16 len; 273 274 __le16 wlan_id; 275 u8 tid; 276 u8 __rsv1; 277 __le32 status; 278 __le16 id; 279 u8 __rsv2[2]; 280 } __packed; 281 282 struct mt7996_mcu_wed_rro_ba_delete_event { 283 __le16 tag; 284 __le16 len; 285 286 __le16 session_id; 287 __le16 wlan_id; 288 u8 tid; 289 u8 __rsv1; 290 u8 __rsv2[2]; 291 } __packed; 292 293 enum { 294 UNI_WED_RRO_BA_SESSION_STATUS, 295 UNI_WED_RRO_BA_SESSION_TBL, 296 UNI_WED_RRO_BA_SESSION_DELETE, 297 }; 298 299 struct mt7996_mcu_ps_sync_event { 300 struct mt7996_mcu_rxd rxd; 301 302 u8 bss_idx; 303 u8 __rsv[3]; 304 } __packed; 305 306 struct mt7996_mcu_ps_client_info { 307 __le16 tag; 308 __le16 len; 309 u8 ps_bit; 310 u8 __rsv; 311 __le16 wlan_idx; 312 u8 buffer_size; 313 u8 __rsv2[3]; 314 } __packed; 315 316 struct mt7996_mcu_ps_multi_client_info { 317 __le16 tag; 318 __le16 len; 319 __le16 sta_cnt; 320 __le16 sta_ps_info[]; 321 } __packed; 322 323 #define MT7996_PS_MULTI_WCID GENMASK(10, 0) 324 #define MT7996_PS_MULTI_PS_BIT BIT(15) 325 326 enum { 327 UNI_PS_CLIENT_INFO = 0, 328 UNI_PS_MULTI_CLIENT_INFO = 1, 329 UNI_PS_MULTI_CLIENT_INFO_BITMAP = 2, 330 }; 331 332 struct mt7996_mcu_thermal_notify { 333 struct mt7996_mcu_rxd rxd; 334 335 u8 __rsv1[4]; 336 337 __le16 tag; 338 __le16 len; 339 340 u8 event_id; 341 u8 band_idx; 342 u8 level_idx; 343 u8 duty_percent; 344 __le32 restore_temp; 345 u8 __rsv2[4]; 346 } __packed; 347 348 enum mt7996_chan_mib_offs { 349 UNI_MIB_OBSS_AIRTIME = 26, 350 UNI_MIB_NON_WIFI_TIME = 27, 351 UNI_MIB_TX_TIME = 28, 352 UNI_MIB_RX_TIME = 29 353 }; 354 355 struct edca { 356 __le16 tag; 357 __le16 len; 358 359 u8 queue; 360 u8 set; 361 u8 cw_min; 362 u8 cw_max; 363 __le16 txop; 364 u8 aifs; 365 u8 __rsv; 366 }; 367 368 #define MCU_PQ_ID(p, q) (((p) << 15) | ((q) << 10)) 369 #define MCU_PKT_ID 0xa0 370 371 enum { 372 MCU_FW_LOG_WM, 373 MCU_FW_LOG_WA, 374 MCU_FW_LOG_TO_HOST, 375 MCU_FW_LOG_RELAY = 16 376 }; 377 378 enum { 379 MCU_TWT_AGRT_ADD, 380 MCU_TWT_AGRT_MODIFY, 381 MCU_TWT_AGRT_DELETE, 382 MCU_TWT_AGRT_TEARDOWN, 383 MCU_TWT_AGRT_GET_TSF, 384 }; 385 386 enum { 387 MCU_WA_PARAM_CMD_QUERY, 388 MCU_WA_PARAM_CMD_SET, 389 MCU_WA_PARAM_CMD_CAPABILITY, 390 MCU_WA_PARAM_CMD_DEBUG, 391 }; 392 393 enum { 394 MCU_WA_PARAM_PDMA_RX = 0x04, 395 MCU_WA_PARAM_CPU_UTIL = 0x0b, 396 MCU_WA_PARAM_RED = 0x0e, 397 MCU_WA_PARAM_HW_PATH_HIF_VER = 0x2f, 398 }; 399 400 enum mcu_mmps_mode { 401 MCU_MMPS_STATIC, 402 MCU_MMPS_DYNAMIC, 403 MCU_MMPS_RSV, 404 MCU_MMPS_DISABLE, 405 }; 406 407 struct bss_rate_tlv { 408 __le16 tag; 409 __le16 len; 410 u8 __rsv1[4]; 411 __le16 bc_trans; 412 __le16 mc_trans; 413 u8 short_preamble; 414 u8 bc_fixed_rate; 415 u8 mc_fixed_rate; 416 u8 __rsv2[9]; 417 } __packed; 418 419 enum { 420 BP_DISABLE, 421 BP_SW_MODE, 422 BP_HW_MODE, 423 }; 424 425 struct bss_ra_tlv { 426 __le16 tag; 427 __le16 len; 428 u8 short_preamble; 429 u8 force_sgi; 430 u8 force_gf; 431 u8 ht_mode; 432 u8 se_off; 433 u8 antenna_idx; 434 __le16 max_phyrate; 435 u8 force_tx_streams; 436 u8 __rsv[3]; 437 } __packed; 438 439 struct bss_rlm_tlv { 440 __le16 tag; 441 __le16 len; 442 u8 control_channel; 443 u8 center_chan; 444 u8 center_chan2; 445 u8 bw; 446 u8 tx_streams; 447 u8 rx_streams; 448 u8 ht_op_info; 449 u8 sco; 450 u8 band; 451 u8 __rsv[3]; 452 } __packed; 453 454 struct bss_color_tlv { 455 __le16 tag; 456 __le16 len; 457 u8 enable; 458 u8 color; 459 u8 rsv[2]; 460 } __packed; 461 462 struct bss_inband_discovery_tlv { 463 __le16 tag; 464 __le16 len; 465 u8 tx_type; 466 u8 tx_mode; 467 u8 tx_interval; 468 u8 enable; 469 __le16 wcid; 470 __le16 prob_rsp_len; 471 } __packed; 472 473 struct bss_bcn_content_tlv { 474 __le16 tag; 475 __le16 len; 476 __le16 tim_ie_pos; 477 __le16 csa_ie_pos; 478 __le16 bcc_ie_pos; 479 u8 enable; 480 u8 type; 481 __le16 pkt_len; 482 } __packed; 483 484 struct bss_bcn_cntdwn_tlv { 485 __le16 tag; 486 __le16 len; 487 u8 cnt; 488 union { 489 struct { 490 bool static_pp; 491 bool abort; 492 } csa; 493 struct { 494 bool abort; 495 } cca; 496 }; 497 u8 rsv; 498 } __packed; 499 500 struct bss_bcn_mbss_tlv { 501 __le16 tag; 502 __le16 len; 503 __le32 bitmap; 504 #define MAX_BEACON_NUM 32 505 __le16 offset[MAX_BEACON_NUM]; 506 } __packed __aligned(4); 507 508 struct bss_txcmd_tlv { 509 __le16 tag; 510 __le16 len; 511 u8 txcmd_mode; 512 u8 __rsv[3]; 513 } __packed; 514 515 struct bss_sec_tlv { 516 __le16 tag; 517 __le16 len; 518 u8 __rsv1[2]; 519 u8 cipher; 520 u8 __rsv2[1]; 521 } __packed; 522 523 struct bss_ifs_time_tlv { 524 __le16 tag; 525 __le16 len; 526 u8 slot_valid; 527 u8 sifs_valid; 528 u8 rifs_valid; 529 u8 eifs_valid; 530 __le16 slot_time; 531 __le16 sifs_time; 532 __le16 rifs_time; 533 __le16 eifs_time; 534 u8 eifs_cck_valid; 535 u8 rsv; 536 __le16 eifs_cck_time; 537 } __packed; 538 539 struct bss_power_save { 540 __le16 tag; 541 __le16 len; 542 u8 profile; 543 u8 _rsv[3]; 544 } __packed; 545 546 struct bss_mld_tlv { 547 __le16 tag; 548 __le16 len; 549 u8 group_mld_id; 550 u8 own_mld_id; 551 u8 mac_addr[ETH_ALEN]; 552 u8 remap_idx; 553 u8 link_id; 554 u8 __rsv[2]; 555 } __packed; 556 557 struct bss_prot_tlv { 558 __le16 tag; 559 __le16 len; 560 __le32 prot_mode; 561 } __packed; 562 563 struct bss_mld_link_op_tlv { 564 __le16 tag; 565 __le16 len; 566 u8 group_mld_id; 567 u8 own_mld_id; 568 u8 mac_addr[ETH_ALEN]; 569 u8 remap_idx; 570 u8 link_operation; 571 u8 link_id; 572 u8 rsv[2]; 573 } __packed; 574 575 struct sta_rec_ht_uni { 576 __le16 tag; 577 __le16 len; 578 __le16 ht_cap; 579 __le16 ht_cap_ext; 580 u8 ampdu_param; 581 u8 _rsv[3]; 582 } __packed; 583 584 struct sta_rec_ba_uni { 585 __le16 tag; 586 __le16 len; 587 u8 tid; 588 u8 ba_type; 589 u8 amsdu; 590 u8 ba_en; 591 __le16 ssn; 592 __le16 winsize; 593 u8 ba_rdd_rro; 594 u8 __rsv[3]; 595 } __packed; 596 597 struct sta_rec_eht { 598 __le16 tag; 599 __le16 len; 600 u8 tid_bitmap; 601 u8 _rsv; 602 __le16 mac_cap; 603 __le64 phy_cap; 604 __le64 phy_cap_ext; 605 u8 mcs_map_bw20[4]; 606 u8 mcs_map_bw80[3]; 607 u8 mcs_map_bw160[3]; 608 u8 mcs_map_bw320[3]; 609 u8 _rsv2[3]; 610 } __packed; 611 612 struct sec_key_uni { 613 __le16 wlan_idx; 614 u8 mgmt_prot; 615 u8 cipher_id; 616 u8 cipher_len; 617 u8 key_id; 618 u8 key_len; 619 u8 need_resp; 620 u8 key[32]; 621 u8 pn[6]; 622 u8 bcn_mode; 623 u8 _rsv; 624 } __packed; 625 626 struct sta_rec_sec_uni { 627 __le16 tag; 628 __le16 len; 629 u8 add; 630 u8 n_cipher; 631 u8 rsv[2]; 632 633 struct sec_key_uni key[2]; 634 } __packed; 635 636 struct sta_phy_uni { 637 u8 type; 638 u8 flag; 639 u8 stbc; 640 u8 sgi; 641 u8 bw; 642 u8 ldpc; 643 u8 mcs; 644 u8 nss; 645 u8 he_ltf; 646 u8 rsv[3]; 647 }; 648 649 struct sta_rec_ra_uni { 650 __le16 tag; 651 __le16 len; 652 653 u8 valid; 654 u8 auto_rate; 655 u8 phy_mode; 656 u8 channel; 657 u8 bw; 658 u8 disable_cck; 659 u8 ht_mcs32; 660 u8 ht_gf; 661 u8 ht_mcs[4]; 662 u8 mmps_mode; 663 u8 gband_256; 664 u8 af; 665 u8 auth_wapi_mode; 666 u8 rate_len; 667 668 u8 supp_mode; 669 u8 supp_cck_rate; 670 u8 supp_ofdm_rate; 671 __le32 supp_ht_mcs; 672 __le16 supp_vht_mcs[4]; 673 674 u8 op_mode; 675 u8 op_vht_chan_width; 676 u8 op_vht_rx_nss; 677 u8 op_vht_rx_nss_type; 678 679 __le32 sta_cap; 680 681 struct sta_phy_uni phy; 682 u8 rx_rcpi[4]; 683 } __packed; 684 685 struct sta_rec_ra_fixed_uni { 686 __le16 tag; 687 __le16 len; 688 689 __le32 field; 690 u8 op_mode; 691 u8 op_vht_chan_width; 692 u8 op_vht_rx_nss; 693 u8 op_vht_rx_nss_type; 694 695 struct sta_phy_uni phy; 696 697 u8 spe_idx; 698 u8 short_preamble; 699 u8 is_5g; 700 u8 mmps_mode; 701 } __packed; 702 703 struct sta_rec_hdrt { 704 __le16 tag; 705 __le16 len; 706 u8 hdrt_mode; 707 u8 rsv[3]; 708 } __packed; 709 710 struct sta_rec_hdr_trans { 711 __le16 tag; 712 __le16 len; 713 u8 from_ds; 714 u8 to_ds; 715 u8 dis_rx_hdr_tran; 716 u8 mesh; 717 } __packed; 718 719 struct sta_rec_ps_leave { 720 __le16 tag; 721 __le16 len; 722 u8 __rsv[4]; 723 } __packed; 724 725 struct sta_rec_mld_setup { 726 __le16 tag; 727 __le16 len; 728 u8 mld_addr[ETH_ALEN]; 729 __le16 primary_id; 730 __le16 seconed_id; 731 __le16 setup_wcid; 732 u8 link_num; 733 u8 info; 734 u8 __rsv[2]; 735 u8 link_info[]; 736 } __packed; 737 738 struct sta_rec_eht_mld { 739 __le16 tag; 740 __le16 len; 741 u8 nsep; 742 u8 __rsv1[2]; 743 u8 str_cap[__MT_MAX_BAND]; 744 __le16 eml_cap; 745 u8 __rsv2[4]; 746 } __packed; 747 748 struct mld_setup_link { 749 __le16 wcid; 750 u8 bss_idx; 751 u8 __rsv; 752 } __packed; 753 754 struct mld_req_hdr { 755 u8 ver; 756 u8 mld_addr[ETH_ALEN]; 757 u8 mld_idx; 758 u8 flag; 759 u8 rsv[3]; 760 u8 buf[]; 761 } __packed; 762 763 struct mld_reconf_stop_link { 764 __le16 tag; 765 __le16 len; 766 __le16 link_bitmap; 767 u8 rsv[2]; 768 u8 bss_idx[16]; 769 } __packed; 770 771 enum { 772 UNI_CMD_MLD_RECONF_AP_REM_TIMER = 0x03, 773 UNI_CMD_MLD_RECONF_STOP_LINK = 0x04, 774 }; 775 776 struct hdr_trans_en { 777 __le16 tag; 778 __le16 len; 779 u8 enable; 780 u8 check_bssid; 781 u8 mode; 782 u8 __rsv; 783 } __packed; 784 785 struct hdr_trans_vlan { 786 __le16 tag; 787 __le16 len; 788 u8 insert_vlan; 789 u8 remove_vlan; 790 u8 tid; 791 u8 __rsv; 792 } __packed; 793 794 struct hdr_trans_blacklist { 795 __le16 tag; 796 __le16 len; 797 u8 idx; 798 u8 enable; 799 __le16 type; 800 } __packed; 801 802 struct uni_header { 803 u8 __rsv[4]; 804 } __packed; 805 806 struct vow_rx_airtime { 807 __le16 tag; 808 __le16 len; 809 810 u8 enable; 811 u8 band; 812 u8 __rsv[2]; 813 } __packed; 814 815 struct bf_sounding_on { 816 __le16 tag; 817 __le16 len; 818 819 u8 snd_mode; 820 u8 sta_num; 821 u8 __rsv[2]; 822 __le16 wlan_id[4]; 823 __le32 snd_period; 824 } __packed; 825 826 struct bf_hw_en_status_update { 827 __le16 tag; 828 __le16 len; 829 830 bool ebf; 831 bool ibf; 832 u8 __rsv[2]; 833 } __packed; 834 835 struct bf_mod_en_ctrl { 836 __le16 tag; 837 __le16 len; 838 839 u8 bf_num; 840 u8 bf_bitmap; 841 u8 bf_sel[8]; 842 u8 __rsv[2]; 843 } __packed; 844 845 union bf_tag_tlv { 846 struct bf_sounding_on bf_snd; 847 struct bf_hw_en_status_update bf_hw_en; 848 struct bf_mod_en_ctrl bf_mod_en; 849 }; 850 851 struct ra_rate { 852 __le16 wlan_idx; 853 u8 mode; 854 u8 stbc; 855 __le16 gi; 856 u8 bw; 857 u8 ldpc; 858 u8 mcs; 859 u8 nss; 860 __le16 ltf; 861 u8 spe; 862 u8 preamble; 863 u8 __rsv[2]; 864 } __packed; 865 866 struct ra_fixed_rate { 867 __le16 tag; 868 __le16 len; 869 870 __le16 version; 871 struct ra_rate rate; 872 } __packed; 873 874 enum { 875 UNI_RA_FIXED_RATE = 0xf, 876 }; 877 878 #define MT7996_HDR_TRANS_MAX_SIZE (sizeof(struct hdr_trans_en) + \ 879 sizeof(struct hdr_trans_vlan) + \ 880 sizeof(struct hdr_trans_blacklist)) 881 882 enum { 883 UNI_HDR_TRANS_EN, 884 UNI_HDR_TRANS_VLAN, 885 UNI_HDR_TRANS_BLACKLIST, 886 }; 887 888 enum { 889 RATE_PARAM_FIXED = 3, 890 RATE_PARAM_MMPS_UPDATE = 5, 891 RATE_PARAM_FIXED_HE_LTF = 7, 892 RATE_PARAM_FIXED_MCS, 893 RATE_PARAM_FIXED_GI = 11, 894 RATE_PARAM_AUTO = 20, 895 }; 896 897 enum { 898 BF_SOUNDING_ON = 1, 899 BF_HW_EN_UPDATE = 17, 900 BF_MOD_EN_CTRL = 20, 901 }; 902 903 enum { 904 CMD_BAND_NONE, 905 CMD_BAND_24G, 906 CMD_BAND_5G, 907 CMD_BAND_6G, 908 }; 909 910 struct bss_req_hdr { 911 u8 bss_idx; 912 u8 __rsv[3]; 913 } __packed; 914 915 enum { 916 UNI_CHANNEL_SWITCH, 917 UNI_CHANNEL_RX_PATH, 918 }; 919 920 enum { 921 UNI_CHIP_CONFIG_NIC_CAPA = 3, 922 UNI_CHIP_CONFIG_DUP_WTBL = 4, 923 }; 924 925 #define MT7996_BSS_UPDATE_MAX_SIZE (sizeof(struct bss_req_hdr) + \ 926 sizeof(struct mt76_connac_bss_basic_tlv) + \ 927 sizeof(struct bss_rlm_tlv) + \ 928 sizeof(struct bss_ra_tlv) + \ 929 sizeof(struct bss_info_uni_he) + \ 930 sizeof(struct bss_rate_tlv) + \ 931 sizeof(struct bss_txcmd_tlv) + \ 932 sizeof(struct bss_power_save) + \ 933 sizeof(struct bss_sec_tlv) + \ 934 sizeof(struct bss_ifs_time_tlv) + \ 935 sizeof(struct bss_mld_tlv)) 936 937 #define MT7996_STA_UPDATE_MAX_SIZE (sizeof(struct sta_req_hdr) + \ 938 sizeof(struct sta_rec_basic) + \ 939 sizeof(struct sta_rec_bf) + \ 940 sizeof(struct sta_rec_ht_uni) + \ 941 sizeof(struct sta_rec_he_v2) + \ 942 sizeof(struct sta_rec_ba_uni) + \ 943 sizeof(struct sta_rec_vht) + \ 944 sizeof(struct sta_rec_uapsd) + \ 945 sizeof(struct sta_rec_amsdu) + \ 946 sizeof(struct sta_rec_bfee) + \ 947 sizeof(struct sta_rec_ra_uni) + \ 948 sizeof(struct sta_rec_sec) + \ 949 sizeof(struct sta_rec_ra_fixed_uni) + \ 950 sizeof(struct sta_rec_he_6g_capa) + \ 951 sizeof(struct sta_rec_eht) + \ 952 sizeof(struct sta_rec_hdrt) + \ 953 sizeof(struct sta_rec_hdr_trans) + \ 954 sizeof(struct sta_rec_mld_setup) + \ 955 sizeof(struct mld_setup_link) * 3 + \ 956 sizeof(struct sta_rec_eht_mld) + \ 957 sizeof(struct tlv)) 958 959 #define MT7996_BEACON_UPDATE_SIZE (sizeof(struct bss_req_hdr) + \ 960 sizeof(struct bss_bcn_content_tlv) + \ 961 4 + MT_TXD_SIZE + \ 962 sizeof(struct bss_bcn_cntdwn_tlv) * 2 + \ 963 sizeof(struct bss_bcn_mbss_tlv)) 964 #define MT7996_MAX_BSS_OFFLOAD_SIZE 2048 965 #define MT7996_MAX_BEACON_SIZE (MT7996_MAX_BSS_OFFLOAD_SIZE - \ 966 MT7996_BEACON_UPDATE_SIZE) 967 968 enum { 969 UNI_BAND_CONFIG_RADIO_ENABLE, 970 UNI_BAND_CONFIG_RTS_THRESHOLD = 0x08, 971 UNI_BAND_CONFIG_MAC_ENABLE_CTRL = 0x0c, 972 UNI_BAND_CONFIG_BSSID_MAPPING_ADDR = 0x12, 973 }; 974 975 enum { 976 UNI_WSYS_CONFIG_FW_LOG_CTRL, 977 UNI_WSYS_CONFIG_FW_DBG_CTRL, 978 }; 979 980 enum { 981 UNI_RDD_CTRL_PARM, 982 UNI_RDD_CTRL_SET_TH = 0x3, 983 }; 984 985 enum { 986 UNI_EFUSE_ACCESS = 1, 987 UNI_EFUSE_BUFFER_MODE, 988 UNI_EFUSE_FREE_BLOCK, 989 UNI_EFUSE_BUFFER_RD, 990 }; 991 992 enum { 993 UNI_EXT_EEPROM_ACCESS = 1, 994 }; 995 996 enum { 997 UNI_VOW_DRR_CTRL, 998 UNI_VOW_RX_AT_AIRTIME_EN = 0x0b, 999 UNI_VOW_RX_AT_AIRTIME_CLR_EN = 0x0e, 1000 }; 1001 1002 enum { 1003 UNI_CMD_MIB_DATA, 1004 }; 1005 1006 enum { 1007 UNI_POWER_OFF, 1008 }; 1009 1010 enum { 1011 UNI_CMD_TWT_ARGT_UPDATE = 0x0, 1012 UNI_CMD_TWT_MGMT_OFFLOAD, 1013 }; 1014 1015 enum { 1016 UNI_RRO_DEL_ENTRY = 0x1, 1017 UNI_RRO_SET_PLATFORM_TYPE, 1018 UNI_RRO_GET_BA_SESSION_TABLE, 1019 UNI_RRO_SET_BYPASS_MODE, 1020 UNI_RRO_SET_TXFREE_PATH, 1021 UNI_RRO_DEL_BA_SESSION, 1022 UNI_RRO_SET_FLUSH_TIMEOUT 1023 }; 1024 1025 enum{ 1026 UNI_CMD_SR_ENABLE = 0x1, 1027 UNI_CMD_SR_ENABLE_SD, 1028 UNI_CMD_SR_ENABLE_MODE, 1029 UNI_CMD_SR_ENABLE_DPD = 0x12, 1030 UNI_CMD_SR_ENABLE_TX, 1031 UNI_CMD_SR_SET_SRG_BITMAP = 0x80, 1032 UNI_CMD_SR_SET_PARAM = 0xc1, 1033 UNI_CMD_SR_SET_SIGA = 0xd0, 1034 }; 1035 1036 enum { 1037 UNI_CMD_THERMAL_PROTECT_ENABLE = 0x6, 1038 UNI_CMD_THERMAL_PROTECT_DISABLE, 1039 UNI_CMD_THERMAL_PROTECT_DUTY_CONFIG, 1040 }; 1041 1042 enum { 1043 UNI_TXPOWER_POWER_LIMIT_TABLE_CTRL = 4, 1044 }; 1045 1046 enum { 1047 UNI_CMD_ACCESS_REG_BASIC = 0x0, 1048 UNI_CMD_ACCESS_RF_REG_BASIC, 1049 }; 1050 1051 enum { 1052 UNI_CMD_SER_QUERY, 1053 /* recovery */ 1054 UNI_CMD_SER_SET_RECOVER_L1, 1055 UNI_CMD_SER_SET_RECOVER_L2, 1056 UNI_CMD_SER_SET_RECOVER_L3_RX_ABORT, 1057 UNI_CMD_SER_SET_RECOVER_L3_TX_ABORT, 1058 UNI_CMD_SER_SET_RECOVER_L3_TX_DISABLE, 1059 UNI_CMD_SER_SET_RECOVER_L3_BF, 1060 UNI_CMD_SER_SET_RECOVER_L4_MDP, 1061 UNI_CMD_SER_SET_RECOVER_FROM_ETH, 1062 UNI_CMD_SER_SET_RECOVER_FULL = 8, 1063 UNI_CMD_SER_SET_SYSTEM_ASSERT, 1064 /* action */ 1065 UNI_CMD_SER_ENABLE = 1, 1066 UNI_CMD_SER_SET, 1067 UNI_CMD_SER_TRIGGER 1068 }; 1069 1070 enum { 1071 UNI_CMD_SDO_SET = 1, 1072 UNI_CMD_SDO_QUERY, 1073 UNI_CMD_SDO_CP_MODE = 6, 1074 }; 1075 1076 enum { 1077 MT7996_SEC_MODE_PLAIN, 1078 MT7996_SEC_MODE_AES, 1079 MT7996_SEC_MODE_SCRAMBLE, 1080 MT7996_SEC_MODE_MAX, 1081 }; 1082 1083 #define MT7996_PATCH_SEC GENMASK(31, 24) 1084 #define MT7996_PATCH_SCRAMBLE_KEY GENMASK(15, 8) 1085 #define MT7996_PATCH_AES_KEY GENMASK(7, 0) 1086 1087 #define MT7996_SEC_ENCRYPT BIT(0) 1088 #define MT7996_SEC_KEY_IDX GENMASK(2, 1) 1089 #define MT7996_SEC_IV BIT(3) 1090 1091 struct fixed_rate_table_ctrl { 1092 u8 _rsv[4]; 1093 1094 __le16 tag; 1095 __le16 len; 1096 1097 u8 table_idx; 1098 u8 antenna_idx; 1099 __le16 rate_idx; 1100 u8 spe_idx_sel; 1101 u8 spe_idx; 1102 u8 gi; 1103 u8 he_ltf; 1104 bool ldpc; 1105 bool txbf; 1106 bool dynamic_bw; 1107 1108 u8 _rsv2; 1109 } __packed; 1110 1111 #endif 1112