16c92544dSBjoern A. Zeeb /* SPDX-License-Identifier: ISC */
26c92544dSBjoern A. Zeeb /* Copyright (C) 2020 MediaTek Inc. */
36c92544dSBjoern A. Zeeb
46c92544dSBjoern A. Zeeb #ifndef __MT7915_MCU_H
56c92544dSBjoern A. Zeeb #define __MT7915_MCU_H
66c92544dSBjoern A. Zeeb
76c92544dSBjoern A. Zeeb #include "../mt76_connac_mcu.h"
86c92544dSBjoern A. Zeeb
96c92544dSBjoern A. Zeeb enum {
106c92544dSBjoern A. Zeeb MCU_ATE_SET_TRX = 0x1,
116c92544dSBjoern A. Zeeb MCU_ATE_SET_FREQ_OFFSET = 0xa,
126c92544dSBjoern A. Zeeb MCU_ATE_SET_SLOT_TIME = 0x13,
136c92544dSBjoern A. Zeeb MCU_ATE_CLEAN_TXQUEUE = 0x1c,
146c92544dSBjoern A. Zeeb };
156c92544dSBjoern A. Zeeb
166c92544dSBjoern A. Zeeb struct mt7915_mcu_thermal_ctrl {
176c92544dSBjoern A. Zeeb u8 ctrl_id;
186c92544dSBjoern A. Zeeb u8 band_idx;
196c92544dSBjoern A. Zeeb union {
206c92544dSBjoern A. Zeeb struct {
216c92544dSBjoern A. Zeeb u8 protect_type; /* 1: duty admit, 2: radio off */
226c92544dSBjoern A. Zeeb u8 trigger_type; /* 0: low, 1: high */
236c92544dSBjoern A. Zeeb } __packed type;
246c92544dSBjoern A. Zeeb struct {
256c92544dSBjoern A. Zeeb u8 duty_level; /* level 0~3 */
266c92544dSBjoern A. Zeeb u8 duty_cycle;
276c92544dSBjoern A. Zeeb } __packed duty;
286c92544dSBjoern A. Zeeb };
296c92544dSBjoern A. Zeeb } __packed;
306c92544dSBjoern A. Zeeb
316c92544dSBjoern A. Zeeb struct mt7915_mcu_thermal_notify {
326c92544dSBjoern A. Zeeb struct mt76_connac2_mcu_rxd rxd;
336c92544dSBjoern A. Zeeb
346c92544dSBjoern A. Zeeb struct mt7915_mcu_thermal_ctrl ctrl;
356c92544dSBjoern A. Zeeb __le32 temperature;
366c92544dSBjoern A. Zeeb u8 rsv[8];
376c92544dSBjoern A. Zeeb } __packed;
386c92544dSBjoern A. Zeeb
396c92544dSBjoern A. Zeeb struct mt7915_mcu_csa_notify {
406c92544dSBjoern A. Zeeb struct mt76_connac2_mcu_rxd rxd;
416c92544dSBjoern A. Zeeb
426c92544dSBjoern A. Zeeb u8 omac_idx;
436c92544dSBjoern A. Zeeb u8 csa_count;
446c92544dSBjoern A. Zeeb u8 band_idx;
456c92544dSBjoern A. Zeeb u8 rsv;
466c92544dSBjoern A. Zeeb } __packed;
476c92544dSBjoern A. Zeeb
486c92544dSBjoern A. Zeeb struct mt7915_mcu_bcc_notify {
496c92544dSBjoern A. Zeeb struct mt76_connac2_mcu_rxd rxd;
506c92544dSBjoern A. Zeeb
516c92544dSBjoern A. Zeeb u8 band_idx;
526c92544dSBjoern A. Zeeb u8 omac_idx;
536c92544dSBjoern A. Zeeb u8 cca_count;
546c92544dSBjoern A. Zeeb u8 rsv;
556c92544dSBjoern A. Zeeb } __packed;
566c92544dSBjoern A. Zeeb
576c92544dSBjoern A. Zeeb struct mt7915_mcu_rdd_report {
586c92544dSBjoern A. Zeeb struct mt76_connac2_mcu_rxd rxd;
596c92544dSBjoern A. Zeeb
606c92544dSBjoern A. Zeeb u8 band_idx;
616c92544dSBjoern A. Zeeb u8 long_detected;
626c92544dSBjoern A. Zeeb u8 constant_prf_detected;
636c92544dSBjoern A. Zeeb u8 staggered_prf_detected;
646c92544dSBjoern A. Zeeb u8 radar_type_idx;
656c92544dSBjoern A. Zeeb u8 periodic_pulse_num;
666c92544dSBjoern A. Zeeb u8 long_pulse_num;
676c92544dSBjoern A. Zeeb u8 hw_pulse_num;
686c92544dSBjoern A. Zeeb
696c92544dSBjoern A. Zeeb u8 out_lpn;
706c92544dSBjoern A. Zeeb u8 out_spn;
716c92544dSBjoern A. Zeeb u8 out_crpn;
726c92544dSBjoern A. Zeeb u8 out_crpw;
736c92544dSBjoern A. Zeeb u8 out_crbn;
746c92544dSBjoern A. Zeeb u8 out_stgpn;
756c92544dSBjoern A. Zeeb u8 out_stgpw;
766c92544dSBjoern A. Zeeb
776c92544dSBjoern A. Zeeb u8 rsv;
786c92544dSBjoern A. Zeeb
796c92544dSBjoern A. Zeeb __le32 out_pri_const;
806c92544dSBjoern A. Zeeb __le32 out_pri_stg[3];
816c92544dSBjoern A. Zeeb
826c92544dSBjoern A. Zeeb struct {
836c92544dSBjoern A. Zeeb __le32 start;
846c92544dSBjoern A. Zeeb __le16 pulse_width;
856c92544dSBjoern A. Zeeb __le16 pulse_power;
866c92544dSBjoern A. Zeeb u8 mdrdy_flag;
876c92544dSBjoern A. Zeeb u8 rsv[3];
886c92544dSBjoern A. Zeeb } long_pulse[32];
896c92544dSBjoern A. Zeeb
906c92544dSBjoern A. Zeeb struct {
916c92544dSBjoern A. Zeeb __le32 start;
926c92544dSBjoern A. Zeeb __le16 pulse_width;
936c92544dSBjoern A. Zeeb __le16 pulse_power;
946c92544dSBjoern A. Zeeb u8 mdrdy_flag;
956c92544dSBjoern A. Zeeb u8 rsv[3];
966c92544dSBjoern A. Zeeb } periodic_pulse[32];
976c92544dSBjoern A. Zeeb
986c92544dSBjoern A. Zeeb struct {
996c92544dSBjoern A. Zeeb __le32 start;
1006c92544dSBjoern A. Zeeb __le16 pulse_width;
1016c92544dSBjoern A. Zeeb __le16 pulse_power;
1026c92544dSBjoern A. Zeeb u8 sc_pass;
1036c92544dSBjoern A. Zeeb u8 sw_reset;
1046c92544dSBjoern A. Zeeb u8 mdrdy_flag;
1056c92544dSBjoern A. Zeeb u8 tx_active;
1066c92544dSBjoern A. Zeeb } hw_pulse[32];
1076c92544dSBjoern A. Zeeb } __packed;
1086c92544dSBjoern A. Zeeb
1096c92544dSBjoern A. Zeeb struct mt7915_mcu_background_chain_ctrl {
1106c92544dSBjoern A. Zeeb u8 chan; /* primary channel */
1116c92544dSBjoern A. Zeeb u8 central_chan; /* central channel */
1126c92544dSBjoern A. Zeeb u8 bw;
1136c92544dSBjoern A. Zeeb u8 tx_stream;
1146c92544dSBjoern A. Zeeb u8 rx_stream;
1156c92544dSBjoern A. Zeeb
1166c92544dSBjoern A. Zeeb u8 monitor_chan; /* monitor channel */
1176c92544dSBjoern A. Zeeb u8 monitor_central_chan;/* monitor central channel */
1186c92544dSBjoern A. Zeeb u8 monitor_bw;
1196c92544dSBjoern A. Zeeb u8 monitor_tx_stream;
1206c92544dSBjoern A. Zeeb u8 monitor_rx_stream;
1216c92544dSBjoern A. Zeeb
1226c92544dSBjoern A. Zeeb u8 scan_mode; /* 0: ScanStop
1236c92544dSBjoern A. Zeeb * 1: ScanStart
1246c92544dSBjoern A. Zeeb * 2: ScanRunning
1256c92544dSBjoern A. Zeeb */
1266c92544dSBjoern A. Zeeb u8 band_idx; /* DBDC */
1276c92544dSBjoern A. Zeeb u8 monitor_scan_type;
1286c92544dSBjoern A. Zeeb u8 band; /* 0: 2.4GHz, 1: 5GHz */
1296c92544dSBjoern A. Zeeb u8 rsv[2];
1306c92544dSBjoern A. Zeeb } __packed;
1316c92544dSBjoern A. Zeeb
132*cbb3ec25SBjoern A. Zeeb struct mt7915_mcu_sr_ctrl {
133*cbb3ec25SBjoern A. Zeeb u8 action;
134*cbb3ec25SBjoern A. Zeeb u8 argnum;
135*cbb3ec25SBjoern A. Zeeb u8 band_idx;
136*cbb3ec25SBjoern A. Zeeb u8 status;
137*cbb3ec25SBjoern A. Zeeb u8 drop_ta_idx;
138*cbb3ec25SBjoern A. Zeeb u8 sta_idx; /* 256 sta */
139*cbb3ec25SBjoern A. Zeeb u8 rsv[2];
140*cbb3ec25SBjoern A. Zeeb __le32 val;
141*cbb3ec25SBjoern A. Zeeb } __packed;
142*cbb3ec25SBjoern A. Zeeb
1436c92544dSBjoern A. Zeeb struct mt7915_mcu_eeprom {
1446c92544dSBjoern A. Zeeb u8 buffer_mode;
1456c92544dSBjoern A. Zeeb u8 format;
1466c92544dSBjoern A. Zeeb __le16 len;
1476c92544dSBjoern A. Zeeb } __packed;
1486c92544dSBjoern A. Zeeb
1496c92544dSBjoern A. Zeeb struct mt7915_mcu_eeprom_info {
1506c92544dSBjoern A. Zeeb __le32 addr;
1516c92544dSBjoern A. Zeeb __le32 valid;
1526c92544dSBjoern A. Zeeb u8 data[16];
1536c92544dSBjoern A. Zeeb } __packed;
1546c92544dSBjoern A. Zeeb
1556c92544dSBjoern A. Zeeb struct mt7915_mcu_phy_rx_info {
1566c92544dSBjoern A. Zeeb u8 category;
1576c92544dSBjoern A. Zeeb u8 rate;
1586c92544dSBjoern A. Zeeb u8 mode;
1596c92544dSBjoern A. Zeeb u8 nsts;
1606c92544dSBjoern A. Zeeb u8 gi;
1616c92544dSBjoern A. Zeeb u8 coding;
1626c92544dSBjoern A. Zeeb u8 stbc;
1636c92544dSBjoern A. Zeeb u8 bw;
1646c92544dSBjoern A. Zeeb };
1656c92544dSBjoern A. Zeeb
1666c92544dSBjoern A. Zeeb struct mt7915_mcu_mib {
1676c92544dSBjoern A. Zeeb __le32 band;
1686c92544dSBjoern A. Zeeb __le32 offs;
1696c92544dSBjoern A. Zeeb __le64 data;
1706c92544dSBjoern A. Zeeb } __packed;
1716c92544dSBjoern A. Zeeb
1726c92544dSBjoern A. Zeeb enum mt7915_chan_mib_offs {
1736c92544dSBjoern A. Zeeb /* mt7915 */
1746c92544dSBjoern A. Zeeb MIB_TX_TIME = 81,
1756c92544dSBjoern A. Zeeb MIB_RX_TIME,
1766c92544dSBjoern A. Zeeb MIB_OBSS_AIRTIME = 86,
177*cbb3ec25SBjoern A. Zeeb MIB_NON_WIFI_TIME,
178*cbb3ec25SBjoern A. Zeeb MIB_TXOP_INIT_COUNT,
179*cbb3ec25SBjoern A. Zeeb
1806c92544dSBjoern A. Zeeb /* mt7916 */
1816c92544dSBjoern A. Zeeb MIB_TX_TIME_V2 = 6,
1826c92544dSBjoern A. Zeeb MIB_RX_TIME_V2 = 8,
183*cbb3ec25SBjoern A. Zeeb MIB_OBSS_AIRTIME_V2 = 490,
184*cbb3ec25SBjoern A. Zeeb MIB_NON_WIFI_TIME_V2
1856c92544dSBjoern A. Zeeb };
1866c92544dSBjoern A. Zeeb
187*cbb3ec25SBjoern A. Zeeb struct mt7915_mcu_txpower_sku {
188*cbb3ec25SBjoern A. Zeeb u8 format_id;
189*cbb3ec25SBjoern A. Zeeb u8 limit_type;
190*cbb3ec25SBjoern A. Zeeb u8 band_idx;
191*cbb3ec25SBjoern A. Zeeb s8 txpower_sku[MT7915_SKU_RATE_NUM];
192*cbb3ec25SBjoern A. Zeeb } __packed;
193*cbb3ec25SBjoern A. Zeeb
1946c92544dSBjoern A. Zeeb struct edca {
1956c92544dSBjoern A. Zeeb u8 queue;
1966c92544dSBjoern A. Zeeb u8 set;
1976c92544dSBjoern A. Zeeb u8 aifs;
1986c92544dSBjoern A. Zeeb u8 cw_min;
1996c92544dSBjoern A. Zeeb __le16 cw_max;
2006c92544dSBjoern A. Zeeb __le16 txop;
2016c92544dSBjoern A. Zeeb };
2026c92544dSBjoern A. Zeeb
2036c92544dSBjoern A. Zeeb struct mt7915_mcu_tx {
2046c92544dSBjoern A. Zeeb u8 total;
2056c92544dSBjoern A. Zeeb u8 action;
2066c92544dSBjoern A. Zeeb u8 valid;
2076c92544dSBjoern A. Zeeb u8 mode;
2086c92544dSBjoern A. Zeeb
2096c92544dSBjoern A. Zeeb struct edca edca[IEEE80211_NUM_ACS];
2106c92544dSBjoern A. Zeeb } __packed;
2116c92544dSBjoern A. Zeeb
2126c92544dSBjoern A. Zeeb struct mt7915_mcu_muru_stats {
2136c92544dSBjoern A. Zeeb __le32 event_id;
2146c92544dSBjoern A. Zeeb struct {
2156c92544dSBjoern A. Zeeb __le32 cck_cnt;
2166c92544dSBjoern A. Zeeb __le32 ofdm_cnt;
2176c92544dSBjoern A. Zeeb __le32 htmix_cnt;
2186c92544dSBjoern A. Zeeb __le32 htgf_cnt;
2196c92544dSBjoern A. Zeeb __le32 vht_su_cnt;
2206c92544dSBjoern A. Zeeb __le32 vht_2mu_cnt;
2216c92544dSBjoern A. Zeeb __le32 vht_3mu_cnt;
2226c92544dSBjoern A. Zeeb __le32 vht_4mu_cnt;
2236c92544dSBjoern A. Zeeb __le32 he_su_cnt;
2246c92544dSBjoern A. Zeeb __le32 he_ext_su_cnt;
2256c92544dSBjoern A. Zeeb __le32 he_2ru_cnt;
2266c92544dSBjoern A. Zeeb __le32 he_2mu_cnt;
2276c92544dSBjoern A. Zeeb __le32 he_3ru_cnt;
2286c92544dSBjoern A. Zeeb __le32 he_3mu_cnt;
2296c92544dSBjoern A. Zeeb __le32 he_4ru_cnt;
2306c92544dSBjoern A. Zeeb __le32 he_4mu_cnt;
2316c92544dSBjoern A. Zeeb __le32 he_5to8ru_cnt;
2326c92544dSBjoern A. Zeeb __le32 he_9to16ru_cnt;
2336c92544dSBjoern A. Zeeb __le32 he_gtr16ru_cnt;
2346c92544dSBjoern A. Zeeb } dl;
2356c92544dSBjoern A. Zeeb
2366c92544dSBjoern A. Zeeb struct {
2376c92544dSBjoern A. Zeeb __le32 hetrig_su_cnt;
2386c92544dSBjoern A. Zeeb __le32 hetrig_2ru_cnt;
2396c92544dSBjoern A. Zeeb __le32 hetrig_3ru_cnt;
2406c92544dSBjoern A. Zeeb __le32 hetrig_4ru_cnt;
2416c92544dSBjoern A. Zeeb __le32 hetrig_5to8ru_cnt;
2426c92544dSBjoern A. Zeeb __le32 hetrig_9to16ru_cnt;
2436c92544dSBjoern A. Zeeb __le32 hetrig_gtr16ru_cnt;
2446c92544dSBjoern A. Zeeb __le32 hetrig_2mu_cnt;
2456c92544dSBjoern A. Zeeb __le32 hetrig_3mu_cnt;
2466c92544dSBjoern A. Zeeb __le32 hetrig_4mu_cnt;
2476c92544dSBjoern A. Zeeb } ul;
2486c92544dSBjoern A. Zeeb };
2496c92544dSBjoern A. Zeeb
2506c92544dSBjoern A. Zeeb #define WMM_AIFS_SET BIT(0)
2516c92544dSBjoern A. Zeeb #define WMM_CW_MIN_SET BIT(1)
2526c92544dSBjoern A. Zeeb #define WMM_CW_MAX_SET BIT(2)
2536c92544dSBjoern A. Zeeb #define WMM_TXOP_SET BIT(3)
2546c92544dSBjoern A. Zeeb #define WMM_PARAM_SET GENMASK(3, 0)
2556c92544dSBjoern A. Zeeb
2566c92544dSBjoern A. Zeeb enum {
2576c92544dSBjoern A. Zeeb MCU_FW_LOG_WM,
2586c92544dSBjoern A. Zeeb MCU_FW_LOG_WA,
2596c92544dSBjoern A. Zeeb MCU_FW_LOG_TO_HOST,
2606c92544dSBjoern A. Zeeb };
2616c92544dSBjoern A. Zeeb
2626c92544dSBjoern A. Zeeb enum {
2636c92544dSBjoern A. Zeeb MCU_TWT_AGRT_ADD,
2646c92544dSBjoern A. Zeeb MCU_TWT_AGRT_MODIFY,
2656c92544dSBjoern A. Zeeb MCU_TWT_AGRT_DELETE,
2666c92544dSBjoern A. Zeeb MCU_TWT_AGRT_TEARDOWN,
2676c92544dSBjoern A. Zeeb MCU_TWT_AGRT_GET_TSF,
2686c92544dSBjoern A. Zeeb };
2696c92544dSBjoern A. Zeeb
2706c92544dSBjoern A. Zeeb enum {
2716c92544dSBjoern A. Zeeb MCU_WA_PARAM_CMD_QUERY,
2726c92544dSBjoern A. Zeeb MCU_WA_PARAM_CMD_SET,
2736c92544dSBjoern A. Zeeb MCU_WA_PARAM_CMD_CAPABILITY,
2746c92544dSBjoern A. Zeeb MCU_WA_PARAM_CMD_DEBUG,
2756c92544dSBjoern A. Zeeb };
2766c92544dSBjoern A. Zeeb
2776c92544dSBjoern A. Zeeb enum {
2786c92544dSBjoern A. Zeeb MCU_WA_PARAM_PDMA_RX = 0x04,
2796c92544dSBjoern A. Zeeb MCU_WA_PARAM_CPU_UTIL = 0x0b,
2806c92544dSBjoern A. Zeeb MCU_WA_PARAM_RED = 0x0e,
281*cbb3ec25SBjoern A. Zeeb MCU_WA_PARAM_RED_SETTING = 0x40,
2826c92544dSBjoern A. Zeeb };
2836c92544dSBjoern A. Zeeb
2846c92544dSBjoern A. Zeeb enum mcu_mmps_mode {
2856c92544dSBjoern A. Zeeb MCU_MMPS_STATIC,
2866c92544dSBjoern A. Zeeb MCU_MMPS_DYNAMIC,
2876c92544dSBjoern A. Zeeb MCU_MMPS_RSV,
2886c92544dSBjoern A. Zeeb MCU_MMPS_DISABLE,
2896c92544dSBjoern A. Zeeb };
2906c92544dSBjoern A. Zeeb
2916c92544dSBjoern A. Zeeb struct bss_info_bmc_rate {
2926c92544dSBjoern A. Zeeb __le16 tag;
2936c92544dSBjoern A. Zeeb __le16 len;
2946c92544dSBjoern A. Zeeb __le16 bc_trans;
2956c92544dSBjoern A. Zeeb __le16 mc_trans;
2966c92544dSBjoern A. Zeeb u8 short_preamble;
2976c92544dSBjoern A. Zeeb u8 rsv[7];
2986c92544dSBjoern A. Zeeb } __packed;
2996c92544dSBjoern A. Zeeb
3006c92544dSBjoern A. Zeeb struct bss_info_ra {
3016c92544dSBjoern A. Zeeb __le16 tag;
3026c92544dSBjoern A. Zeeb __le16 len;
3036c92544dSBjoern A. Zeeb u8 op_mode;
3046c92544dSBjoern A. Zeeb u8 adhoc_en;
3056c92544dSBjoern A. Zeeb u8 short_preamble;
3066c92544dSBjoern A. Zeeb u8 tx_streams;
3076c92544dSBjoern A. Zeeb u8 rx_streams;
3086c92544dSBjoern A. Zeeb u8 algo;
3096c92544dSBjoern A. Zeeb u8 force_sgi;
3106c92544dSBjoern A. Zeeb u8 force_gf;
3116c92544dSBjoern A. Zeeb u8 ht_mode;
3126c92544dSBjoern A. Zeeb u8 has_20_sta; /* Check if any sta support GF. */
3136c92544dSBjoern A. Zeeb u8 bss_width_trigger_events;
3146c92544dSBjoern A. Zeeb u8 vht_nss_cap;
3156c92544dSBjoern A. Zeeb u8 vht_bw_signal; /* not use */
3166c92544dSBjoern A. Zeeb u8 vht_force_sgi; /* not use */
3176c92544dSBjoern A. Zeeb u8 se_off;
3186c92544dSBjoern A. Zeeb u8 antenna_idx;
3196c92544dSBjoern A. Zeeb u8 train_up_rule;
3206c92544dSBjoern A. Zeeb u8 rsv[3];
3216c92544dSBjoern A. Zeeb unsigned short train_up_high_thres;
3226c92544dSBjoern A. Zeeb short train_up_rule_rssi;
3236c92544dSBjoern A. Zeeb unsigned short low_traffic_thres;
3246c92544dSBjoern A. Zeeb __le16 max_phyrate;
3256c92544dSBjoern A. Zeeb __le32 phy_cap;
3266c92544dSBjoern A. Zeeb __le32 interval;
3276c92544dSBjoern A. Zeeb __le32 fast_interval;
3286c92544dSBjoern A. Zeeb } __packed;
3296c92544dSBjoern A. Zeeb
3306c92544dSBjoern A. Zeeb struct bss_info_hw_amsdu {
3316c92544dSBjoern A. Zeeb __le16 tag;
3326c92544dSBjoern A. Zeeb __le16 len;
3336c92544dSBjoern A. Zeeb __le32 cmp_bitmap_0;
3346c92544dSBjoern A. Zeeb __le32 cmp_bitmap_1;
3356c92544dSBjoern A. Zeeb __le16 trig_thres;
3366c92544dSBjoern A. Zeeb u8 enable;
3376c92544dSBjoern A. Zeeb u8 rsv;
3386c92544dSBjoern A. Zeeb } __packed;
3396c92544dSBjoern A. Zeeb
3406c92544dSBjoern A. Zeeb struct bss_info_color {
3416c92544dSBjoern A. Zeeb __le16 tag;
3426c92544dSBjoern A. Zeeb __le16 len;
3436c92544dSBjoern A. Zeeb u8 disable;
3446c92544dSBjoern A. Zeeb u8 color;
3456c92544dSBjoern A. Zeeb u8 rsv[2];
3466c92544dSBjoern A. Zeeb } __packed;
3476c92544dSBjoern A. Zeeb
3486c92544dSBjoern A. Zeeb struct bss_info_he {
3496c92544dSBjoern A. Zeeb __le16 tag;
3506c92544dSBjoern A. Zeeb __le16 len;
3516c92544dSBjoern A. Zeeb u8 he_pe_duration;
3526c92544dSBjoern A. Zeeb u8 vht_op_info_present;
3536c92544dSBjoern A. Zeeb __le16 he_rts_thres;
3546c92544dSBjoern A. Zeeb __le16 max_nss_mcs[CMD_HE_MCS_BW_NUM];
3556c92544dSBjoern A. Zeeb u8 rsv[6];
3566c92544dSBjoern A. Zeeb } __packed;
3576c92544dSBjoern A. Zeeb
3586c92544dSBjoern A. Zeeb struct bss_info_bcn {
3596c92544dSBjoern A. Zeeb __le16 tag;
3606c92544dSBjoern A. Zeeb __le16 len;
3616c92544dSBjoern A. Zeeb u8 ver;
3626c92544dSBjoern A. Zeeb u8 enable;
3636c92544dSBjoern A. Zeeb __le16 sub_ntlv;
3646c92544dSBjoern A. Zeeb } __packed __aligned(4);
3656c92544dSBjoern A. Zeeb
3666c92544dSBjoern A. Zeeb struct bss_info_bcn_cntdwn {
3676c92544dSBjoern A. Zeeb __le16 tag;
3686c92544dSBjoern A. Zeeb __le16 len;
3696c92544dSBjoern A. Zeeb u8 cnt;
3706c92544dSBjoern A. Zeeb u8 rsv[3];
3716c92544dSBjoern A. Zeeb } __packed __aligned(4);
3726c92544dSBjoern A. Zeeb
3736c92544dSBjoern A. Zeeb struct bss_info_bcn_mbss {
3746c92544dSBjoern A. Zeeb #define MAX_BEACON_NUM 32
3756c92544dSBjoern A. Zeeb __le16 tag;
3766c92544dSBjoern A. Zeeb __le16 len;
3776c92544dSBjoern A. Zeeb __le32 bitmap;
3786c92544dSBjoern A. Zeeb __le16 offset[MAX_BEACON_NUM];
3796c92544dSBjoern A. Zeeb u8 rsv[8];
3806c92544dSBjoern A. Zeeb } __packed __aligned(4);
3816c92544dSBjoern A. Zeeb
3826c92544dSBjoern A. Zeeb struct bss_info_bcn_cont {
3836c92544dSBjoern A. Zeeb __le16 tag;
3846c92544dSBjoern A. Zeeb __le16 len;
3856c92544dSBjoern A. Zeeb __le16 tim_ofs;
3866c92544dSBjoern A. Zeeb __le16 csa_ofs;
3876c92544dSBjoern A. Zeeb __le16 bcc_ofs;
3886c92544dSBjoern A. Zeeb __le16 pkt_len;
3896c92544dSBjoern A. Zeeb } __packed __aligned(4);
3906c92544dSBjoern A. Zeeb
3916c92544dSBjoern A. Zeeb struct bss_info_inband_discovery {
3926c92544dSBjoern A. Zeeb __le16 tag;
3936c92544dSBjoern A. Zeeb __le16 len;
3946c92544dSBjoern A. Zeeb u8 tx_type;
3956c92544dSBjoern A. Zeeb u8 tx_mode;
3966c92544dSBjoern A. Zeeb u8 tx_interval;
3976c92544dSBjoern A. Zeeb u8 enable;
3986c92544dSBjoern A. Zeeb __le16 rsv;
3996c92544dSBjoern A. Zeeb __le16 prob_rsp_len;
4006c92544dSBjoern A. Zeeb } __packed __aligned(4);
4016c92544dSBjoern A. Zeeb
4026c92544dSBjoern A. Zeeb enum {
4036c92544dSBjoern A. Zeeb BSS_INFO_BCN_CSA,
4046c92544dSBjoern A. Zeeb BSS_INFO_BCN_BCC,
4056c92544dSBjoern A. Zeeb BSS_INFO_BCN_MBSSID,
4066c92544dSBjoern A. Zeeb BSS_INFO_BCN_CONTENT,
4076c92544dSBjoern A. Zeeb BSS_INFO_BCN_DISCOV,
4086c92544dSBjoern A. Zeeb BSS_INFO_BCN_MAX
4096c92544dSBjoern A. Zeeb };
4106c92544dSBjoern A. Zeeb
4116c92544dSBjoern A. Zeeb enum {
4126c92544dSBjoern A. Zeeb RATE_PARAM_FIXED = 3,
4136c92544dSBjoern A. Zeeb RATE_PARAM_MMPS_UPDATE = 5,
4146c92544dSBjoern A. Zeeb RATE_PARAM_FIXED_HE_LTF = 7,
4156c92544dSBjoern A. Zeeb RATE_PARAM_FIXED_MCS,
4166c92544dSBjoern A. Zeeb RATE_PARAM_FIXED_GI = 11,
4176c92544dSBjoern A. Zeeb RATE_PARAM_AUTO = 20,
418*cbb3ec25SBjoern A. Zeeb RATE_PARAM_SPE_UPDATE = 22,
4196c92544dSBjoern A. Zeeb };
4206c92544dSBjoern A. Zeeb
4216c92544dSBjoern A. Zeeb #define RATE_CFG_MCS GENMASK(3, 0)
4226c92544dSBjoern A. Zeeb #define RATE_CFG_NSS GENMASK(7, 4)
4236c92544dSBjoern A. Zeeb #define RATE_CFG_GI GENMASK(11, 8)
4246c92544dSBjoern A. Zeeb #define RATE_CFG_BW GENMASK(15, 12)
4256c92544dSBjoern A. Zeeb #define RATE_CFG_STBC GENMASK(19, 16)
4266c92544dSBjoern A. Zeeb #define RATE_CFG_LDPC GENMASK(23, 20)
4276c92544dSBjoern A. Zeeb #define RATE_CFG_PHY_TYPE GENMASK(27, 24)
4286c92544dSBjoern A. Zeeb #define RATE_CFG_HE_LTF GENMASK(31, 28)
4296c92544dSBjoern A. Zeeb
4306c92544dSBjoern A. Zeeb enum {
431*cbb3ec25SBjoern A. Zeeb TX_POWER_LIMIT_ENABLE,
432*cbb3ec25SBjoern A. Zeeb TX_POWER_LIMIT_TABLE = 0x4,
433*cbb3ec25SBjoern A. Zeeb TX_POWER_LIMIT_INFO = 0x7,
434*cbb3ec25SBjoern A. Zeeb TX_POWER_LIMIT_FRAME = 0x11,
435*cbb3ec25SBjoern A. Zeeb TX_POWER_LIMIT_FRAME_MIN = 0x12,
436*cbb3ec25SBjoern A. Zeeb };
437*cbb3ec25SBjoern A. Zeeb
438*cbb3ec25SBjoern A. Zeeb enum {
439*cbb3ec25SBjoern A. Zeeb SPR_ENABLE = 0x1,
440*cbb3ec25SBjoern A. Zeeb SPR_ENABLE_SD = 0x3,
441*cbb3ec25SBjoern A. Zeeb SPR_ENABLE_MODE = 0x5,
442*cbb3ec25SBjoern A. Zeeb SPR_ENABLE_DPD = 0x23,
443*cbb3ec25SBjoern A. Zeeb SPR_ENABLE_TX = 0x25,
444*cbb3ec25SBjoern A. Zeeb SPR_SET_SRG_BITMAP = 0x80,
445*cbb3ec25SBjoern A. Zeeb SPR_SET_PARAM = 0xc2,
446*cbb3ec25SBjoern A. Zeeb SPR_SET_SIGA = 0xdc,
447*cbb3ec25SBjoern A. Zeeb };
448*cbb3ec25SBjoern A. Zeeb
449*cbb3ec25SBjoern A. Zeeb enum {
4506c92544dSBjoern A. Zeeb THERMAL_PROTECT_PARAMETER_CTRL,
4516c92544dSBjoern A. Zeeb THERMAL_PROTECT_BASIC_INFO,
4526c92544dSBjoern A. Zeeb THERMAL_PROTECT_ENABLE,
4536c92544dSBjoern A. Zeeb THERMAL_PROTECT_DISABLE,
4546c92544dSBjoern A. Zeeb THERMAL_PROTECT_DUTY_CONFIG,
4556c92544dSBjoern A. Zeeb THERMAL_PROTECT_MECH_INFO,
4566c92544dSBjoern A. Zeeb THERMAL_PROTECT_DUTY_INFO,
4576c92544dSBjoern A. Zeeb THERMAL_PROTECT_STATE_ACT,
4586c92544dSBjoern A. Zeeb };
4596c92544dSBjoern A. Zeeb
4606c92544dSBjoern A. Zeeb enum {
4616c92544dSBjoern A. Zeeb MT_BF_SOUNDING_ON = 1,
4626c92544dSBjoern A. Zeeb MT_BF_TYPE_UPDATE = 20,
4636c92544dSBjoern A. Zeeb MT_BF_MODULE_UPDATE = 25
4646c92544dSBjoern A. Zeeb };
4656c92544dSBjoern A. Zeeb
4666c92544dSBjoern A. Zeeb enum {
4676c92544dSBjoern A. Zeeb MURU_SET_ARB_OP_MODE = 14,
4686c92544dSBjoern A. Zeeb MURU_SET_PLATFORM_TYPE = 25,
4696c92544dSBjoern A. Zeeb };
4706c92544dSBjoern A. Zeeb
4716c92544dSBjoern A. Zeeb enum {
4726c92544dSBjoern A. Zeeb MURU_PLATFORM_TYPE_PERF_LEVEL_1 = 1,
4736c92544dSBjoern A. Zeeb MURU_PLATFORM_TYPE_PERF_LEVEL_2,
4746c92544dSBjoern A. Zeeb };
4756c92544dSBjoern A. Zeeb
4766c92544dSBjoern A. Zeeb /* tx cmd tx statistics */
4776c92544dSBjoern A. Zeeb enum {
4786c92544dSBjoern A. Zeeb MURU_SET_TXC_TX_STATS_EN = 150,
4796c92544dSBjoern A. Zeeb MURU_GET_TXC_TX_STATS = 151,
4806c92544dSBjoern A. Zeeb };
4816c92544dSBjoern A. Zeeb
4826c92544dSBjoern A. Zeeb enum {
4836c92544dSBjoern A. Zeeb SER_QUERY,
4846c92544dSBjoern A. Zeeb /* recovery */
4856c92544dSBjoern A. Zeeb SER_SET_RECOVER_L1,
4866c92544dSBjoern A. Zeeb SER_SET_RECOVER_L2,
4876c92544dSBjoern A. Zeeb SER_SET_RECOVER_L3_RX_ABORT,
4886c92544dSBjoern A. Zeeb SER_SET_RECOVER_L3_TX_ABORT,
4896c92544dSBjoern A. Zeeb SER_SET_RECOVER_L3_TX_DISABLE,
4906c92544dSBjoern A. Zeeb SER_SET_RECOVER_L3_BF,
491*cbb3ec25SBjoern A. Zeeb SER_SET_RECOVER_FULL,
492*cbb3ec25SBjoern A. Zeeb SER_SET_SYSTEM_ASSERT,
4936c92544dSBjoern A. Zeeb /* action */
4946c92544dSBjoern A. Zeeb SER_ENABLE = 2,
4956c92544dSBjoern A. Zeeb SER_RECOVER
4966c92544dSBjoern A. Zeeb };
4976c92544dSBjoern A. Zeeb
4986c92544dSBjoern A. Zeeb #define MT7915_MAX_BEACON_SIZE 512
4996c92544dSBjoern A. Zeeb #define MT7915_MAX_INBAND_FRAME_SIZE 256
5006c92544dSBjoern A. Zeeb #define MT7915_MAX_BSS_OFFLOAD_SIZE (MT7915_MAX_BEACON_SIZE + \
5016c92544dSBjoern A. Zeeb MT7915_MAX_INBAND_FRAME_SIZE + \
5026c92544dSBjoern A. Zeeb MT7915_BEACON_UPDATE_SIZE)
5036c92544dSBjoern A. Zeeb
5046c92544dSBjoern A. Zeeb #define MT7915_BSS_UPDATE_MAX_SIZE (sizeof(struct sta_req_hdr) + \
5056c92544dSBjoern A. Zeeb sizeof(struct bss_info_omac) + \
5066c92544dSBjoern A. Zeeb sizeof(struct bss_info_basic) +\
5076c92544dSBjoern A. Zeeb sizeof(struct bss_info_rf_ch) +\
5086c92544dSBjoern A. Zeeb sizeof(struct bss_info_ra) + \
5096c92544dSBjoern A. Zeeb sizeof(struct bss_info_hw_amsdu) +\
5106c92544dSBjoern A. Zeeb sizeof(struct bss_info_he) + \
5116c92544dSBjoern A. Zeeb sizeof(struct bss_info_bmc_rate) +\
5126c92544dSBjoern A. Zeeb sizeof(struct bss_info_ext_bss))
5136c92544dSBjoern A. Zeeb
5146c92544dSBjoern A. Zeeb #define MT7915_BEACON_UPDATE_SIZE (sizeof(struct sta_req_hdr) + \
5156c92544dSBjoern A. Zeeb sizeof(struct bss_info_bcn_cntdwn) + \
5166c92544dSBjoern A. Zeeb sizeof(struct bss_info_bcn_mbss) + \
5176c92544dSBjoern A. Zeeb sizeof(struct bss_info_bcn_cont) + \
5186c92544dSBjoern A. Zeeb sizeof(struct bss_info_inband_discovery))
5196c92544dSBjoern A. Zeeb
520*cbb3ec25SBjoern A. Zeeb static inline s8
mt7915_get_power_bound(struct mt7915_phy * phy,s8 txpower)521*cbb3ec25SBjoern A. Zeeb mt7915_get_power_bound(struct mt7915_phy *phy, s8 txpower)
522*cbb3ec25SBjoern A. Zeeb {
523*cbb3ec25SBjoern A. Zeeb struct mt76_phy *mphy = phy->mt76;
524*cbb3ec25SBjoern A. Zeeb int n_chains = hweight8(mphy->antenna_mask);
525*cbb3ec25SBjoern A. Zeeb
526*cbb3ec25SBjoern A. Zeeb txpower = mt76_get_sar_power(mphy, mphy->chandef.chan, txpower * 2);
527*cbb3ec25SBjoern A. Zeeb txpower -= mt76_tx_power_nss_delta(n_chains);
528*cbb3ec25SBjoern A. Zeeb
529*cbb3ec25SBjoern A. Zeeb return txpower;
530*cbb3ec25SBjoern A. Zeeb }
531*cbb3ec25SBjoern A. Zeeb
5326c92544dSBjoern A. Zeeb #endif
533