Path: blob/main/sys/contrib/dev/mediatek/mt76/mt7915/mcu.h
48525 views
/* SPDX-License-Identifier: ISC */1/* Copyright (C) 2020 MediaTek Inc. */23#ifndef __MT7915_MCU_H4#define __MT7915_MCU_H56#include "../mt76_connac_mcu.h"78enum {9MCU_ATE_SET_TRX = 0x1,10MCU_ATE_SET_FREQ_OFFSET = 0xa,11MCU_ATE_SET_SLOT_TIME = 0x13,12MCU_ATE_CLEAN_TXQUEUE = 0x1c,13};1415struct mt7915_mcu_thermal_ctrl {16u8 ctrl_id;17u8 band_idx;18union {19struct {20u8 protect_type; /* 1: duty admit, 2: radio off */21u8 trigger_type; /* 0: low, 1: high */22} __packed type;23struct {24u8 duty_level; /* level 0~3 */25u8 duty_cycle;26} __packed duty;27};28} __packed;2930struct mt7915_mcu_thermal_notify {31struct mt76_connac2_mcu_rxd_hdr rxd;3233struct mt7915_mcu_thermal_ctrl ctrl;34__le32 temperature;35u8 rsv[8];36} __packed;3738struct mt7915_mcu_csa_notify {39struct mt76_connac2_mcu_rxd_hdr rxd;4041u8 omac_idx;42u8 csa_count;43u8 band_idx;44u8 rsv;45} __packed;4647struct mt7915_mcu_bcc_notify {48struct mt76_connac2_mcu_rxd_hdr rxd;4950u8 band_idx;51u8 omac_idx;52u8 cca_count;53u8 rsv;54} __packed;5556struct mt7915_mcu_rdd_report {57struct mt76_connac2_mcu_rxd_hdr rxd;5859u8 rdd_idx;60u8 long_detected;61u8 constant_prf_detected;62u8 staggered_prf_detected;63u8 radar_type_idx;64u8 periodic_pulse_num;65u8 long_pulse_num;66u8 hw_pulse_num;6768u8 out_lpn;69u8 out_spn;70u8 out_crpn;71u8 out_crpw;72u8 out_crbn;73u8 out_stgpn;74u8 out_stgpw;7576u8 rsv;7778__le32 out_pri_const;79__le32 out_pri_stg[3];8081struct {82__le32 start;83__le16 pulse_width;84__le16 pulse_power;85u8 mdrdy_flag;86u8 rsv[3];87} long_pulse[32];8889struct {90__le32 start;91__le16 pulse_width;92__le16 pulse_power;93u8 mdrdy_flag;94u8 rsv[3];95} periodic_pulse[32];9697struct {98__le32 start;99__le16 pulse_width;100__le16 pulse_power;101u8 sc_pass;102u8 sw_reset;103u8 mdrdy_flag;104u8 tx_active;105} hw_pulse[32];106} __packed;107108struct mt7915_mcu_background_chain_ctrl {109u8 chan; /* primary channel */110u8 central_chan; /* central channel */111u8 bw;112u8 tx_stream;113u8 rx_stream;114115u8 monitor_chan; /* monitor channel */116u8 monitor_central_chan;/* monitor central channel */117u8 monitor_bw;118u8 monitor_tx_stream;119u8 monitor_rx_stream;120121u8 scan_mode; /* 0: ScanStop122* 1: ScanStart123* 2: ScanRunning124*/125u8 band_idx; /* DBDC */126u8 monitor_scan_type;127u8 band; /* 0: 2.4GHz, 1: 5GHz */128u8 rsv[2];129} __packed;130131struct mt7915_mcu_sr_ctrl {132u8 action;133u8 argnum;134u8 band_idx;135u8 status;136u8 drop_ta_idx;137u8 sta_idx; /* 256 sta */138u8 rsv[2];139__le32 val;140} __packed;141142struct mt7915_mcu_eeprom {143u8 buffer_mode;144u8 format;145__le16 len;146} __packed;147148struct mt7915_mcu_eeprom_info {149__le32 addr;150__le32 valid;151u8 data[16];152} __packed;153154struct mt7915_mcu_phy_rx_info {155u8 category;156u8 rate;157u8 mode;158u8 nsts;159u8 gi;160u8 coding;161u8 stbc;162u8 bw;163};164165struct mt7915_mcu_mib {166__le32 band;167__le32 offs;168__le64 data;169} __packed;170171enum mt7915_chan_mib_offs {172/* mt7915 */173MIB_TX_TIME = 81,174MIB_RX_TIME,175MIB_OBSS_AIRTIME = 86,176MIB_NON_WIFI_TIME,177MIB_TXOP_INIT_COUNT,178179/* mt7916 */180MIB_TX_TIME_V2 = 6,181MIB_RX_TIME_V2 = 8,182MIB_OBSS_AIRTIME_V2 = 490,183MIB_NON_WIFI_TIME_V2184};185186struct mt7915_mcu_txpower_sku {187u8 format_id;188u8 limit_type;189u8 band_idx;190s8 txpower_sku[MT7915_SKU_RATE_NUM];191} __packed;192193struct edca {194u8 queue;195u8 set;196u8 aifs;197u8 cw_min;198__le16 cw_max;199__le16 txop;200};201202struct mt7915_mcu_tx {203u8 total;204u8 action;205u8 valid;206u8 mode;207208struct edca edca[IEEE80211_NUM_ACS];209} __packed;210211struct mt7915_mcu_muru_stats {212__le32 event_id;213struct {214__le32 cck_cnt;215__le32 ofdm_cnt;216__le32 htmix_cnt;217__le32 htgf_cnt;218__le32 vht_su_cnt;219__le32 vht_2mu_cnt;220__le32 vht_3mu_cnt;221__le32 vht_4mu_cnt;222__le32 he_su_cnt;223__le32 he_ext_su_cnt;224__le32 he_2ru_cnt;225__le32 he_2mu_cnt;226__le32 he_3ru_cnt;227__le32 he_3mu_cnt;228__le32 he_4ru_cnt;229__le32 he_4mu_cnt;230__le32 he_5to8ru_cnt;231__le32 he_9to16ru_cnt;232__le32 he_gtr16ru_cnt;233} dl;234235struct {236__le32 hetrig_su_cnt;237__le32 hetrig_2ru_cnt;238__le32 hetrig_3ru_cnt;239__le32 hetrig_4ru_cnt;240__le32 hetrig_5to8ru_cnt;241__le32 hetrig_9to16ru_cnt;242__le32 hetrig_gtr16ru_cnt;243__le32 hetrig_2mu_cnt;244__le32 hetrig_3mu_cnt;245__le32 hetrig_4mu_cnt;246} ul;247};248249#define WMM_AIFS_SET BIT(0)250#define WMM_CW_MIN_SET BIT(1)251#define WMM_CW_MAX_SET BIT(2)252#define WMM_TXOP_SET BIT(3)253#define WMM_PARAM_SET GENMASK(3, 0)254255enum {256MCU_FW_LOG_WM,257MCU_FW_LOG_WA,258MCU_FW_LOG_TO_HOST,259};260261enum {262MCU_TWT_AGRT_ADD,263MCU_TWT_AGRT_MODIFY,264MCU_TWT_AGRT_DELETE,265MCU_TWT_AGRT_TEARDOWN,266MCU_TWT_AGRT_GET_TSF,267};268269enum {270MCU_WA_PARAM_CMD_QUERY,271MCU_WA_PARAM_CMD_SET,272MCU_WA_PARAM_CMD_CAPABILITY,273MCU_WA_PARAM_CMD_DEBUG,274};275276enum {277MCU_WA_PARAM_PDMA_RX = 0x04,278MCU_WA_PARAM_CPU_UTIL = 0x0b,279MCU_WA_PARAM_RED = 0x0e,280MCU_WA_PARAM_RED_SETTING = 0x40,281};282283enum mcu_mmps_mode {284MCU_MMPS_STATIC,285MCU_MMPS_DYNAMIC,286MCU_MMPS_RSV,287MCU_MMPS_DISABLE,288};289290struct bss_info_bmc_rate {291__le16 tag;292__le16 len;293__le16 bc_trans;294__le16 mc_trans;295u8 short_preamble;296u8 rsv[7];297} __packed;298299struct bss_info_ra {300__le16 tag;301__le16 len;302u8 op_mode;303u8 adhoc_en;304u8 short_preamble;305u8 tx_streams;306u8 rx_streams;307u8 algo;308u8 force_sgi;309u8 force_gf;310u8 ht_mode;311u8 has_20_sta; /* Check if any sta support GF. */312u8 bss_width_trigger_events;313u8 vht_nss_cap;314u8 vht_bw_signal; /* not use */315u8 vht_force_sgi; /* not use */316u8 se_off;317u8 antenna_idx;318u8 train_up_rule;319u8 rsv[3];320unsigned short train_up_high_thres;321short train_up_rule_rssi;322unsigned short low_traffic_thres;323__le16 max_phyrate;324__le32 phy_cap;325__le32 interval;326__le32 fast_interval;327} __packed;328329struct bss_info_hw_amsdu {330__le16 tag;331__le16 len;332__le32 cmp_bitmap_0;333__le32 cmp_bitmap_1;334__le16 trig_thres;335u8 enable;336u8 rsv;337} __packed;338339struct bss_info_color {340__le16 tag;341__le16 len;342u8 disable;343u8 color;344u8 rsv[2];345} __packed;346347struct bss_info_he {348__le16 tag;349__le16 len;350u8 he_pe_duration;351u8 vht_op_info_present;352__le16 he_rts_thres;353__le16 max_nss_mcs[CMD_HE_MCS_BW_NUM];354u8 rsv[6];355} __packed;356357struct bss_info_bcn {358__le16 tag;359__le16 len;360u8 ver;361u8 enable;362__le16 sub_ntlv;363} __packed __aligned(4);364365struct bss_info_bcn_cntdwn {366__le16 tag;367__le16 len;368u8 cnt;369u8 rsv[3];370} __packed __aligned(4);371372struct bss_info_bcn_mbss {373#define MAX_BEACON_NUM 32374__le16 tag;375__le16 len;376__le32 bitmap;377__le16 offset[MAX_BEACON_NUM];378u8 rsv[8];379} __packed __aligned(4);380381struct bss_info_bcn_cont {382__le16 tag;383__le16 len;384__le16 tim_ofs;385__le16 csa_ofs;386__le16 bcc_ofs;387__le16 pkt_len;388} __packed __aligned(4);389390struct bss_info_inband_discovery {391__le16 tag;392__le16 len;393u8 tx_type;394u8 tx_mode;395u8 tx_interval;396u8 enable;397__le16 rsv;398__le16 prob_rsp_len;399} __packed __aligned(4);400401enum {402BSS_INFO_BCN_CSA,403BSS_INFO_BCN_BCC,404BSS_INFO_BCN_MBSSID,405BSS_INFO_BCN_CONTENT,406BSS_INFO_BCN_DISCOV,407BSS_INFO_BCN_MAX408};409410enum {411RATE_PARAM_FIXED = 3,412RATE_PARAM_MMPS_UPDATE = 5,413RATE_PARAM_FIXED_HE_LTF = 7,414RATE_PARAM_FIXED_MCS,415RATE_PARAM_FIXED_GI = 11,416RATE_PARAM_AUTO = 20,417RATE_PARAM_SPE_UPDATE = 22,418};419420#define RATE_CFG_MCS GENMASK(3, 0)421#define RATE_CFG_NSS GENMASK(7, 4)422#define RATE_CFG_GI GENMASK(11, 8)423#define RATE_CFG_BW GENMASK(15, 12)424#define RATE_CFG_STBC GENMASK(19, 16)425#define RATE_CFG_LDPC GENMASK(23, 20)426#define RATE_CFG_PHY_TYPE GENMASK(27, 24)427#define RATE_CFG_HE_LTF GENMASK(31, 28)428429enum {430TX_POWER_LIMIT_ENABLE,431TX_POWER_LIMIT_TABLE = 0x4,432TX_POWER_LIMIT_INFO = 0x7,433TX_POWER_LIMIT_FRAME = 0x11,434TX_POWER_LIMIT_FRAME_MIN = 0x12,435};436437enum {438SPR_ENABLE = 0x1,439SPR_ENABLE_SD = 0x3,440SPR_ENABLE_MODE = 0x5,441SPR_ENABLE_DPD = 0x23,442SPR_ENABLE_TX = 0x25,443SPR_SET_SRG_BITMAP = 0x80,444SPR_SET_PARAM = 0xc2,445SPR_SET_SIGA = 0xdc,446};447448enum {449THERMAL_PROTECT_PARAMETER_CTRL,450THERMAL_PROTECT_BASIC_INFO,451THERMAL_PROTECT_ENABLE,452THERMAL_PROTECT_DISABLE,453THERMAL_PROTECT_DUTY_CONFIG,454THERMAL_PROTECT_MECH_INFO,455THERMAL_PROTECT_DUTY_INFO,456THERMAL_PROTECT_STATE_ACT,457};458459enum {460MT_BF_SOUNDING_ON = 1,461MT_BF_TYPE_UPDATE = 20,462MT_BF_MODULE_UPDATE = 25463};464465enum {466MURU_SET_ARB_OP_MODE = 14,467MURU_SET_PLATFORM_TYPE = 25,468};469470enum {471MURU_PLATFORM_TYPE_PERF_LEVEL_1 = 1,472MURU_PLATFORM_TYPE_PERF_LEVEL_2,473};474475/* tx cmd tx statistics */476enum {477MURU_SET_TXC_TX_STATS_EN = 150,478MURU_GET_TXC_TX_STATS = 151,479};480481enum {482SER_QUERY,483/* recovery */484SER_SET_RECOVER_L1,485SER_SET_RECOVER_L2,486SER_SET_RECOVER_L3_RX_ABORT,487SER_SET_RECOVER_L3_TX_ABORT,488SER_SET_RECOVER_L3_TX_DISABLE,489SER_SET_RECOVER_L3_BF,490SER_SET_RECOVER_FULL,491SER_SET_SYSTEM_ASSERT,492/* action */493SER_ENABLE = 2,494SER_RECOVER495};496497#define MT7915_MAX_BEACON_SIZE 1308498#define MT7915_BEACON_UPDATE_SIZE (sizeof(struct sta_req_hdr) + \499sizeof(struct bss_info_bcn) + \500sizeof(struct bss_info_bcn_cntdwn) + \501sizeof(struct bss_info_bcn_mbss) + \502MT_TXD_SIZE + \503sizeof(struct bss_info_bcn_cont))504#define MT7915_MAX_BSS_OFFLOAD_SIZE (MT7915_MAX_BEACON_SIZE + \505MT7915_BEACON_UPDATE_SIZE)506507#define MT7915_BSS_UPDATE_MAX_SIZE (sizeof(struct sta_req_hdr) + \508sizeof(struct bss_info_omac) + \509sizeof(struct bss_info_basic) +\510sizeof(struct bss_info_rf_ch) +\511sizeof(struct bss_info_ra) + \512sizeof(struct bss_info_hw_amsdu) +\513sizeof(struct bss_info_he) + \514sizeof(struct bss_info_bmc_rate) +\515sizeof(struct bss_info_ext_bss))516517#endif518519520