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

source code of linux/drivers/net/wireless/mediatek/mt76/mt7996/mcu.h