1 /* SPDX-License-Identifier: ISC */
2 /* Copyright (C) 2020 MediaTek Inc. */
7 #include "../mt76_connac_mcu.h"
9 struct mt7915_mcu_txd {
17 u8 set_query; /* FW don't care */
26 } __packed __aligned(4);
29 MCU_ATE_SET_TRX = 0x1,
30 MCU_ATE_SET_FREQ_OFFSET = 0xa,
31 MCU_ATE_SET_SLOT_TIME = 0x13,
32 MCU_ATE_CLEAN_TXQUEUE = 0x1c,
35 struct mt7915_mcu_rxd {
50 struct mt7915_mcu_thermal_ctrl {
55 u8 protect_type; /* 1: duty admit, 2: radio off */
56 u8 trigger_type; /* 0: low, 1: high */
59 u8 duty_level; /* level 0~3 */
65 struct mt7915_mcu_thermal_notify {
66 struct mt7915_mcu_rxd rxd;
68 struct mt7915_mcu_thermal_ctrl ctrl;
73 struct mt7915_mcu_csa_notify {
74 struct mt7915_mcu_rxd rxd;
82 struct mt7915_mcu_bcc_notify {
83 struct mt7915_mcu_rxd rxd;
91 struct mt7915_mcu_rdd_report {
92 struct mt7915_mcu_rxd rxd;
96 u8 constant_prf_detected;
97 u8 staggered_prf_detected;
99 u8 periodic_pulse_num;
113 __le32 out_pri_const;
114 __le32 out_pri_stg[3];
130 } periodic_pulse[32];
143 struct mt7915_mcu_background_chain_ctrl {
144 u8 chan; /* primary channel */
145 u8 central_chan; /* central channel */
150 u8 monitor_chan; /* monitor channel */
151 u8 monitor_central_chan;/* monitor central channel */
153 u8 monitor_tx_stream;
154 u8 monitor_rx_stream;
156 u8 scan_mode; /* 0: ScanStop
160 u8 band_idx; /* DBDC */
161 u8 monitor_scan_type;
162 u8 band; /* 0: 2.4GHz, 1: 5GHz */
166 struct mt7915_mcu_eeprom {
172 struct mt7915_mcu_eeprom_info {
178 struct mt7915_mcu_phy_rx_info {
189 struct mt7915_mcu_mib {
195 enum mt7915_chan_mib_offs {
200 MIB_OBSS_AIRTIME = 86,
202 MIB_BUSY_TIME_V2 = 0,
205 MIB_OBSS_AIRTIME_V2 = 490
217 struct mt7915_mcu_tx {
223 struct edca edca[IEEE80211_NUM_ACS];
226 struct mt7915_mcu_muru_stats {
238 __le32 he_ext_su_cnt;
245 __le32 he_5to8ru_cnt;
246 __le32 he_9to16ru_cnt;
247 __le32 he_gtr16ru_cnt;
251 __le32 hetrig_su_cnt;
252 __le32 hetrig_2ru_cnt;
253 __le32 hetrig_3ru_cnt;
254 __le32 hetrig_4ru_cnt;
255 __le32 hetrig_5to8ru_cnt;
256 __le32 hetrig_9to16ru_cnt;
257 __le32 hetrig_gtr16ru_cnt;
258 __le32 hetrig_2mu_cnt;
259 __le32 hetrig_3mu_cnt;
260 __le32 hetrig_4mu_cnt;
264 #define WMM_AIFS_SET BIT(0)
265 #define WMM_CW_MIN_SET BIT(1)
266 #define WMM_CW_MAX_SET BIT(2)
267 #define WMM_TXOP_SET BIT(3)
268 #define WMM_PARAM_SET GENMASK(3, 0)
270 #define MCU_PQ_ID(p, q) (((p) << 15) | ((q) << 10))
271 #define MCU_PKT_ID 0xa0
283 MCU_TWT_AGRT_TEARDOWN,
284 MCU_TWT_AGRT_GET_TSF,
288 MCU_WA_PARAM_CMD_QUERY,
289 MCU_WA_PARAM_CMD_SET,
290 MCU_WA_PARAM_CMD_CAPABILITY,
291 MCU_WA_PARAM_CMD_DEBUG,
295 MCU_WA_PARAM_PDMA_RX = 0x04,
296 MCU_WA_PARAM_CPU_UTIL = 0x0b,
297 MCU_WA_PARAM_RED = 0x0e,
307 struct bss_info_bmc_rate {
328 u8 has_20_sta; /* Check if any sta support GF. */
329 u8 bss_width_trigger_events;
331 u8 vht_bw_signal; /* not use */
332 u8 vht_force_sgi; /* not use */
337 unsigned short train_up_high_thres;
338 short train_up_rule_rssi;
339 unsigned short low_traffic_thres;
343 __le32 fast_interval;
346 struct bss_info_hw_amsdu {
356 struct bss_info_color {
368 u8 vht_op_info_present;
370 __le16 max_nss_mcs[CMD_HE_MCS_BW_NUM];
374 struct bss_info_bcn {
380 } __packed __aligned(4);
382 struct bss_info_bcn_cntdwn {
387 } __packed __aligned(4);
389 struct bss_info_bcn_mbss {
390 #define MAX_BEACON_NUM 32
394 __le16 offset[MAX_BEACON_NUM];
396 } __packed __aligned(4);
398 struct bss_info_bcn_cont {
405 } __packed __aligned(4);
407 struct bss_info_inband_discovery {
416 } __packed __aligned(4);
422 BSS_INFO_BCN_CONTENT,
428 RATE_PARAM_FIXED = 3,
429 RATE_PARAM_MMPS_UPDATE = 5,
430 RATE_PARAM_FIXED_HE_LTF = 7,
431 RATE_PARAM_FIXED_MCS,
432 RATE_PARAM_FIXED_GI = 11,
433 RATE_PARAM_AUTO = 20,
436 #define RATE_CFG_MCS GENMASK(3, 0)
437 #define RATE_CFG_NSS GENMASK(7, 4)
438 #define RATE_CFG_GI GENMASK(11, 8)
439 #define RATE_CFG_BW GENMASK(15, 12)
440 #define RATE_CFG_STBC GENMASK(19, 16)
441 #define RATE_CFG_LDPC GENMASK(23, 20)
442 #define RATE_CFG_PHY_TYPE GENMASK(27, 24)
443 #define RATE_CFG_HE_LTF GENMASK(31, 28)
446 THERMAL_PROTECT_PARAMETER_CTRL,
447 THERMAL_PROTECT_BASIC_INFO,
448 THERMAL_PROTECT_ENABLE,
449 THERMAL_PROTECT_DISABLE,
450 THERMAL_PROTECT_DUTY_CONFIG,
451 THERMAL_PROTECT_MECH_INFO,
452 THERMAL_PROTECT_DUTY_INFO,
453 THERMAL_PROTECT_STATE_ACT,
457 MT_BF_SOUNDING_ON = 1,
458 MT_BF_TYPE_UPDATE = 20,
459 MT_BF_MODULE_UPDATE = 25
463 MURU_SET_ARB_OP_MODE = 14,
464 MURU_SET_PLATFORM_TYPE = 25,
468 MURU_PLATFORM_TYPE_PERF_LEVEL_1 = 1,
469 MURU_PLATFORM_TYPE_PERF_LEVEL_2,
472 /* tx cmd tx statistics */
474 MURU_SET_TXC_TX_STATS_EN = 150,
475 MURU_GET_TXC_TX_STATS = 151,
483 SER_SET_RECOVER_L3_RX_ABORT,
484 SER_SET_RECOVER_L3_TX_ABORT,
485 SER_SET_RECOVER_L3_TX_DISABLE,
486 SER_SET_RECOVER_L3_BF,
492 #define MT7915_BSS_UPDATE_MAX_SIZE (sizeof(struct sta_req_hdr) + \
493 sizeof(struct bss_info_omac) + \
494 sizeof(struct bss_info_basic) +\
495 sizeof(struct bss_info_rf_ch) +\
496 sizeof(struct bss_info_ra) + \
497 sizeof(struct bss_info_hw_amsdu) +\
498 sizeof(struct bss_info_he) + \
499 sizeof(struct bss_info_bmc_rate) +\
500 sizeof(struct bss_info_ext_bss))
502 #define MT7915_BEACON_UPDATE_SIZE (sizeof(struct sta_req_hdr) + \
503 sizeof(struct bss_info_bcn_cntdwn) + \
504 sizeof(struct bss_info_bcn_mbss) + \
505 sizeof(struct bss_info_bcn_cont) + \
506 sizeof(struct bss_info_inband_discovery))