162306a36Sopenharmony_ci/* SPDX-License-Identifier: ISC */
262306a36Sopenharmony_ci/* Copyright (C) 2020 MediaTek Inc. */
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci#ifndef __MT7915_MAC_H
562306a36Sopenharmony_ci#define __MT7915_MAC_H
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#include "../mt76_connac2_mac.h"
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#define MT_TX_FREE_VER			GENMASK(18, 16)
1062306a36Sopenharmony_ci#define MT_TX_FREE_MSDU_CNT_V0		GENMASK(6, 0)
1162306a36Sopenharmony_ci/* 0: success, others: dropped */
1262306a36Sopenharmony_ci#define MT_TX_FREE_COUNT		GENMASK(12, 0)
1362306a36Sopenharmony_ci#define MT_TX_FREE_COUNT_V3		GENMASK(27, 24)
1462306a36Sopenharmony_ci#define MT_TX_FREE_STAT			GENMASK(14, 13)
1562306a36Sopenharmony_ci#define MT_TX_FREE_STAT_V3		GENMASK(29, 28)
1662306a36Sopenharmony_ci#define MT_TX_FREE_MPDU_HEADER		BIT(15)
1762306a36Sopenharmony_ci#define MT_TX_FREE_MPDU_HEADER_V3	BIT(30)
1862306a36Sopenharmony_ci#define MT_TX_FREE_MSDU_ID_V3		GENMASK(14, 0)
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#define MT_TXS5_F0_FINAL_MPDU		BIT(31)
2162306a36Sopenharmony_ci#define MT_TXS5_F0_QOS			BIT(30)
2262306a36Sopenharmony_ci#define MT_TXS5_F0_TX_COUNT		GENMASK(29, 25)
2362306a36Sopenharmony_ci#define MT_TXS5_F0_FRONT_TIME		GENMASK(24, 0)
2462306a36Sopenharmony_ci#define MT_TXS5_F1_MPDU_TX_COUNT	GENMASK(31, 24)
2562306a36Sopenharmony_ci#define MT_TXS5_F1_MPDU_TX_BYTES	GENMASK(23, 0)
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#define MT_TXS6_F0_NOISE_3		GENMASK(31, 24)
2862306a36Sopenharmony_ci#define MT_TXS6_F0_NOISE_2		GENMASK(23, 16)
2962306a36Sopenharmony_ci#define MT_TXS6_F0_NOISE_1		GENMASK(15, 8)
3062306a36Sopenharmony_ci#define MT_TXS6_F0_NOISE_0		GENMASK(7, 0)
3162306a36Sopenharmony_ci#define MT_TXS6_F1_MPDU_FAIL_COUNT	GENMASK(31, 24)
3262306a36Sopenharmony_ci#define MT_TXS6_F1_MPDU_FAIL_BYTES	GENMASK(23, 0)
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#define MT_TXS7_F0_RCPI_3		GENMASK(31, 24)
3562306a36Sopenharmony_ci#define MT_TXS7_F0_RCPI_2		GENMASK(23, 16)
3662306a36Sopenharmony_ci#define MT_TXS7_F0_RCPI_1		GENMASK(15, 8)
3762306a36Sopenharmony_ci#define MT_TXS7_F0_RCPI_0		GENMASK(7, 0)
3862306a36Sopenharmony_ci#define MT_TXS7_F1_MPDU_RETRY_COUNT	GENMASK(31, 24)
3962306a36Sopenharmony_ci#define MT_TXS7_F1_MPDU_RETRY_BYTES	GENMASK(23, 0)
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_cistruct mt7915_dfs_pulse {
4262306a36Sopenharmony_ci	u32 max_width;		/* us */
4362306a36Sopenharmony_ci	int max_pwr;		/* dbm */
4462306a36Sopenharmony_ci	int min_pwr;		/* dbm */
4562306a36Sopenharmony_ci	u32 min_stgr_pri;	/* us */
4662306a36Sopenharmony_ci	u32 max_stgr_pri;	/* us */
4762306a36Sopenharmony_ci	u32 min_cr_pri;		/* us */
4862306a36Sopenharmony_ci	u32 max_cr_pri;		/* us */
4962306a36Sopenharmony_ci};
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_cistruct mt7915_dfs_pattern {
5262306a36Sopenharmony_ci	u8 enb;
5362306a36Sopenharmony_ci	u8 stgr;
5462306a36Sopenharmony_ci	u8 min_crpn;
5562306a36Sopenharmony_ci	u8 max_crpn;
5662306a36Sopenharmony_ci	u8 min_crpr;
5762306a36Sopenharmony_ci	u8 min_pw;
5862306a36Sopenharmony_ci	u32 min_pri;
5962306a36Sopenharmony_ci	u32 max_pri;
6062306a36Sopenharmony_ci	u8 max_pw;
6162306a36Sopenharmony_ci	u8 min_crbn;
6262306a36Sopenharmony_ci	u8 max_crbn;
6362306a36Sopenharmony_ci	u8 min_stgpn;
6462306a36Sopenharmony_ci	u8 max_stgpn;
6562306a36Sopenharmony_ci	u8 min_stgpr;
6662306a36Sopenharmony_ci	u8 rsv[2];
6762306a36Sopenharmony_ci	u32 min_stgpr_diff;
6862306a36Sopenharmony_ci} __packed;
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_cistruct mt7915_dfs_radar_spec {
7162306a36Sopenharmony_ci	struct mt7915_dfs_pulse pulse_th;
7262306a36Sopenharmony_ci	struct mt7915_dfs_pattern radar_pattern[16];
7362306a36Sopenharmony_ci};
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci#endif
76