104b8e659SRyder Lee /* SPDX-License-Identifier: ISC */
204b8e659SRyder Lee /* Copyright (C) 2019 MediaTek Inc. */
304b8e659SRyder Lee 
404b8e659SRyder Lee #ifndef __MT7615_H
504b8e659SRyder Lee #define __MT7615_H
604b8e659SRyder Lee 
708523a2aSLorenzo Bianconi #include <linux/completion.h>
804b8e659SRyder Lee #include <linux/interrupt.h>
904b8e659SRyder Lee #include <linux/ktime.h>
1035da599fSFelix Fietkau #include <linux/regmap.h>
1104b8e659SRyder Lee #include "../mt76.h"
1204b8e659SRyder Lee #include "regs.h"
1304b8e659SRyder Lee 
14d8d59f66SRyder Lee #define MT7615_MAX_INTERFACES		16
1549f1132cSRyder Lee #define MT7615_MAX_WMM_SETS		4
168f997dddSLorenzo Bianconi #define MT7663_WTBL_SIZE		32
1704b8e659SRyder Lee #define MT7615_WTBL_SIZE		128
188f997dddSLorenzo Bianconi #define MT7615_WTBL_RESERVED		(mt7615_wtbl_size(dev) - 1)
1904b8e659SRyder Lee #define MT7615_WTBL_STA			(MT7615_WTBL_RESERVED - \
2004b8e659SRyder Lee 					 MT7615_MAX_INTERFACES)
2104b8e659SRyder Lee 
22de5ff3c9SLorenzo Bianconi #define MT7615_PM_TIMEOUT		(HZ / 12)
23457d19c7SLorenzo Bianconi #define MT7615_WATCHDOG_TIME		(HZ / 10)
24fcdfc29eSLorenzo Bianconi #define MT7615_HW_SCAN_TIMEOUT		(HZ / 10)
2561c4fa72SFelix Fietkau #define MT7615_RESET_TIMEOUT		(30 * HZ)
2604b8e659SRyder Lee #define MT7615_RATE_RETRY		2
2704b8e659SRyder Lee 
2804b8e659SRyder Lee #define MT7615_TX_RING_SIZE		1024
29cdad4874SFelix Fietkau #define MT7615_TX_MGMT_RING_SIZE	128
3004b8e659SRyder Lee #define MT7615_TX_MCU_RING_SIZE		128
3104b8e659SRyder Lee #define MT7615_TX_FWDL_RING_SIZE	128
3204b8e659SRyder Lee 
3304b8e659SRyder Lee #define MT7615_RX_RING_SIZE		1024
3404b8e659SRyder Lee #define MT7615_RX_MCU_RING_SIZE		512
3504b8e659SRyder Lee 
36894b7767SLorenzo Bianconi #define MT7615_DRV_OWN_RETRY_COUNT	10
37894b7767SLorenzo Bianconi 
389d4d0d06SLorenzo Bianconi #define MT7615_FIRMWARE_CR4		"mediatek/mt7615_cr4.bin"
399d4d0d06SLorenzo Bianconi #define MT7615_FIRMWARE_N9		"mediatek/mt7615_n9.bin"
409d4d0d06SLorenzo Bianconi #define MT7615_ROM_PATCH		"mediatek/mt7615_rom_patch.bin"
4104b8e659SRyder Lee 
4235da599fSFelix Fietkau #define MT7622_FIRMWARE_N9		"mediatek/mt7622_n9.bin"
4335da599fSFelix Fietkau #define MT7622_ROM_PATCH		"mediatek/mt7622_rom_patch.bin"
4435da599fSFelix Fietkau 
456849e29eSRyder Lee #define MT7615_FIRMWARE_V1		1
466849e29eSRyder Lee #define MT7615_FIRMWARE_V2		2
47f40ac0f3SLorenzo Bianconi #define MT7615_FIRMWARE_V3		3
48f40ac0f3SLorenzo Bianconi 
49f2dc8ea1SLorenzo Bianconi #define MT7663_OFFLOAD_ROM_PATCH	"mediatek/mt7663pr2h.bin"
50f2dc8ea1SLorenzo Bianconi #define MT7663_OFFLOAD_FIRMWARE_N9	"mediatek/mt7663_n9_v3.bin"
51f2dc8ea1SLorenzo Bianconi #define MT7663_ROM_PATCH		"mediatek/mt7663pr2h_rebb.bin"
52f2dc8ea1SLorenzo Bianconi #define MT7663_FIRMWARE_N9		"mediatek/mt7663_n9_rebb.bin"
536849e29eSRyder Lee 
5404b8e659SRyder Lee #define MT7615_EEPROM_SIZE		1024
5504b8e659SRyder Lee #define MT7615_TOKEN_SIZE		4096
5604b8e659SRyder Lee 
5749de79adSLorenzo Bianconi #define MT_FRAC_SCALE		12
5849de79adSLorenzo Bianconi #define MT_FRAC(val, div)	(((val) << MT_FRAC_SCALE) / (div))
5949de79adSLorenzo Bianconi 
6027ae7219SFelix Fietkau #define MT_CHFREQ_VALID		BIT(7)
6127ae7219SFelix Fietkau #define MT_CHFREQ_DBDC_IDX	BIT(6)
6227ae7219SFelix Fietkau #define MT_CHFREQ_SEQ		GENMASK(5, 0)
6327ae7219SFelix Fietkau 
64a25c888fSRyder Lee #define MT7615_BAR_RATE_DEFAULT		0x4b /* OFDM 6M */
65a25c888fSRyder Lee #define MT7615_CFEND_RATE_DEFAULT	0x49 /* OFDM 24M */
66183d1fcfSLorenzo Bianconi #define MT7615_CFEND_RATE_11B		0x03 /* 11B LP, 11M */
67183d1fcfSLorenzo Bianconi 
68fcdfc29eSLorenzo Bianconi #define MT7615_SCAN_IE_LEN		600
6920305f98SLorenzo Bianconi #define MT7615_MAX_SCHED_SCAN_INTERVAL	10
7020305f98SLorenzo Bianconi #define MT7615_MAX_SCHED_SCAN_SSID	10
7120305f98SLorenzo Bianconi #define MT7615_MAX_SCAN_MATCH		16
72fcdfc29eSLorenzo Bianconi 
7304b8e659SRyder Lee struct mt7615_vif;
7404b8e659SRyder Lee struct mt7615_sta;
752ce73efeSLorenzo Bianconi struct mt7615_dfs_pulse;
762ce73efeSLorenzo Bianconi struct mt7615_dfs_pattern;
77294f17aeSLorenzo Bianconi enum mt7615_cipher_type;
7804b8e659SRyder Lee 
7904b8e659SRyder Lee enum mt7615_hw_txq_id {
8004b8e659SRyder Lee 	MT7615_TXQ_MAIN,
8104b8e659SRyder Lee 	MT7615_TXQ_EXT,
8204b8e659SRyder Lee 	MT7615_TXQ_MCU,
8304b8e659SRyder Lee 	MT7615_TXQ_FWDL,
8404b8e659SRyder Lee };
8504b8e659SRyder Lee 
86cdad4874SFelix Fietkau enum mt7622_hw_txq_id {
87cdad4874SFelix Fietkau 	MT7622_TXQ_AC0,
88cdad4874SFelix Fietkau 	MT7622_TXQ_AC1,
89cdad4874SFelix Fietkau 	MT7622_TXQ_AC2,
90cdad4874SFelix Fietkau 	MT7622_TXQ_FWDL = MT7615_TXQ_FWDL,
91cdad4874SFelix Fietkau 	MT7622_TXQ_AC3,
92cdad4874SFelix Fietkau 	MT7622_TXQ_MGMT,
93cdad4874SFelix Fietkau 	MT7622_TXQ_MCU = 15,
94cdad4874SFelix Fietkau };
95cdad4874SFelix Fietkau 
964af81f02SFelix Fietkau struct mt7615_rate_set {
974af81f02SFelix Fietkau 	struct ieee80211_tx_rate probe_rate;
984af81f02SFelix Fietkau 	struct ieee80211_tx_rate rates[4];
994af81f02SFelix Fietkau };
1004af81f02SFelix Fietkau 
1018f93af9cSLorenzo Bianconi struct mt7615_rate_desc {
1028f93af9cSLorenzo Bianconi 	bool rateset;
1038f93af9cSLorenzo Bianconi 	u16 probe_val;
1048f93af9cSLorenzo Bianconi 	u16 val[4];
1058f93af9cSLorenzo Bianconi 	u8 bw_idx;
1068f93af9cSLorenzo Bianconi 	u8 bw;
1078f93af9cSLorenzo Bianconi };
1088f93af9cSLorenzo Bianconi 
109d927ebb9SLorenzo Bianconi struct mt7615_wtbl_rate_desc {
1107d9f1d10SLorenzo Bianconi 	struct list_head node;
1117d9f1d10SLorenzo Bianconi 
1127d9f1d10SLorenzo Bianconi 	struct mt7615_rate_desc rate;
113d927ebb9SLorenzo Bianconi 	struct mt7615_sta *sta;
1147d9f1d10SLorenzo Bianconi };
1157d9f1d10SLorenzo Bianconi 
11604b8e659SRyder Lee struct mt7615_sta {
11704b8e659SRyder Lee 	struct mt76_wcid wcid; /* must be first */
11804b8e659SRyder Lee 
11904b8e659SRyder Lee 	struct mt7615_vif *vif;
12004b8e659SRyder Lee 
121b2c2f029SLorenzo Bianconi 	struct list_head poll_list;
122b2c2f029SLorenzo Bianconi 	u32 airtime_ac[8];
123b2c2f029SLorenzo Bianconi 
1244af81f02SFelix Fietkau 	struct ieee80211_tx_rate rates[4];
1254af81f02SFelix Fietkau 
1264af81f02SFelix Fietkau 	struct mt7615_rate_set rateset[2];
1274af81f02SFelix Fietkau 	u32 rate_set_tsf;
1284af81f02SFelix Fietkau 
12904b8e659SRyder Lee 	u8 rate_count;
13004b8e659SRyder Lee 	u8 n_rates;
13104b8e659SRyder Lee 
13204b8e659SRyder Lee 	u8 rate_probe;
13304b8e659SRyder Lee };
13404b8e659SRyder Lee 
13504b8e659SRyder Lee struct mt7615_vif {
13604b8e659SRyder Lee 	u8 idx;
13704b8e659SRyder Lee 	u8 omac_idx;
13804b8e659SRyder Lee 	u8 band_idx;
13904b8e659SRyder Lee 	u8 wmm_idx;
140fcdfc29eSLorenzo Bianconi 	u8 scan_seq_num;
14104b8e659SRyder Lee 
14204b8e659SRyder Lee 	struct mt7615_sta sta;
14304b8e659SRyder Lee };
14404b8e659SRyder Lee 
145679b23feSRyder Lee struct mib_stats {
146b7825ca0SRyder Lee 	u16 ack_fail_cnt;
147b7825ca0SRyder Lee 	u16 fcs_err_cnt;
148b7825ca0SRyder Lee 	u16 rts_cnt;
149b7825ca0SRyder Lee 	u16 rts_retries_cnt;
150aef16345SRyder Lee 	u16 ba_miss_cnt;
151aef16345SRyder Lee 	unsigned long aggr_per;
152679b23feSRyder Lee };
153679b23feSRyder Lee 
154fdd2e570SFelix Fietkau struct mt7615_phy {
155fdd2e570SFelix Fietkau 	struct mt76_phy *mt76;
156fdd2e570SFelix Fietkau 	struct mt7615_dev *dev;
157fdd2e570SFelix Fietkau 
1584f0bce1cSFelix Fietkau 	struct ieee80211_vif *monitor_vif;
1594f0bce1cSFelix Fietkau 
1607124198aSLorenzo Bianconi 	u8 n_beacon_vif;
1617124198aSLorenzo Bianconi 
162fdd2e570SFelix Fietkau 	u32 rxfilter;
163d8d59f66SRyder Lee 	u64 omac_mask;
164d446a20fSFelix Fietkau 
165e5051965SFelix Fietkau 	u16 noise;
166e5051965SFelix Fietkau 
167594034b7SLorenzo Bianconi 	bool scs_en;
168594034b7SLorenzo Bianconi 
169d446a20fSFelix Fietkau 	unsigned long last_cca_adj;
170d446a20fSFelix Fietkau 	int false_cca_ofdm, false_cca_cck;
171d446a20fSFelix Fietkau 	s8 ofdm_sensitivity;
172d446a20fSFelix Fietkau 	s8 cck_sensitivity;
1735dabdf71SFelix Fietkau 
1742bed2a3eSFelix Fietkau 	u16 chainmask;
1752bed2a3eSFelix Fietkau 
176183d1fcfSLorenzo Bianconi 	s16 coverage_class;
177183d1fcfSLorenzo Bianconi 	u8 slottime;
178183d1fcfSLorenzo Bianconi 
1790e544cb5SFelix Fietkau 	u8 chfreq;
1805dabdf71SFelix Fietkau 	u8 rdd_state;
1815dabdf71SFelix Fietkau 	int dfs_state;
18227ae7219SFelix Fietkau 
18327ae7219SFelix Fietkau 	__le32 rx_ampdu_ts;
18427ae7219SFelix Fietkau 	u32 ampdu_ref;
185679b23feSRyder Lee 
186679b23feSRyder Lee 	struct mib_stats mib;
187fcdfc29eSLorenzo Bianconi 
1884fcf6e77SLorenzo Bianconi 	struct delayed_work mac_work;
1894fcf6e77SLorenzo Bianconi 	u8 mac_work_count;
1904fcf6e77SLorenzo Bianconi 
19120305f98SLorenzo Bianconi 	struct sk_buff_head scan_event_list;
192fcdfc29eSLorenzo Bianconi 	struct delayed_work scan_work;
1937f8ebafeSLorenzo Bianconi 
1947307f296SLorenzo Bianconi 	struct work_struct roc_work;
1957307f296SLorenzo Bianconi 	struct timer_list roc_timer;
1967307f296SLorenzo Bianconi 	wait_queue_head_t roc_wait;
1977307f296SLorenzo Bianconi 	bool roc_grant;
198*7517ea01SShayne Chen 
199*7517ea01SShayne Chen #ifdef CONFIG_NL80211_TESTMODE
200*7517ea01SShayne Chen 	struct {
201*7517ea01SShayne Chen 		u32 *reg_backup;
202*7517ea01SShayne Chen 
203*7517ea01SShayne Chen 		s16 last_freq_offset;
204*7517ea01SShayne Chen 		u8 last_rcpi[4];
205*7517ea01SShayne Chen 		s8 last_ib_rssi[4];
206*7517ea01SShayne Chen 		s8 last_wb_rssi[4];
207*7517ea01SShayne Chen 	} test;
208*7517ea01SShayne Chen #endif
209fdd2e570SFelix Fietkau };
210fdd2e570SFelix Fietkau 
2116f4d7cc8SLorenzo Bianconi #define mt7615_mcu_add_tx_ba(dev, ...)	(dev)->mcu_ops->add_tx_ba((dev), __VA_ARGS__)
2126f4d7cc8SLorenzo Bianconi #define mt7615_mcu_add_rx_ba(dev, ...)	(dev)->mcu_ops->add_rx_ba((dev), __VA_ARGS__)
21399c457d9SLorenzo Bianconi #define mt7615_mcu_sta_add(dev, ...)	(dev)->mcu_ops->sta_add((dev),  __VA_ARGS__)
214062c3699SLorenzo Bianconi #define mt7615_mcu_add_dev_info(dev, ...) (dev)->mcu_ops->add_dev_info((dev),  __VA_ARGS__)
2155d3a4a4bSLorenzo Bianconi #define mt7615_mcu_add_bss_info(phy, ...) (phy->dev)->mcu_ops->add_bss_info((phy),  __VA_ARGS__)
216062c3699SLorenzo Bianconi #define mt7615_mcu_add_beacon(dev, ...)	(dev)->mcu_ops->add_beacon_offload((dev),  __VA_ARGS__)
217062c3699SLorenzo Bianconi #define mt7615_mcu_set_pm(dev, ...)	(dev)->mcu_ops->set_pm_state((dev),  __VA_ARGS__)
218186b659cSLorenzo Bianconi #define mt7615_mcu_set_drv_ctrl(dev)	(dev)->mcu_ops->set_drv_ctrl((dev))
219186b659cSLorenzo Bianconi #define mt7615_mcu_set_fw_ctrl(dev)	(dev)->mcu_ops->set_fw_ctrl((dev))
2206f4d7cc8SLorenzo Bianconi struct mt7615_mcu_ops {
2216f4d7cc8SLorenzo Bianconi 	int (*add_tx_ba)(struct mt7615_dev *dev,
2226f4d7cc8SLorenzo Bianconi 			 struct ieee80211_ampdu_params *params,
2236f4d7cc8SLorenzo Bianconi 			 bool enable);
2246f4d7cc8SLorenzo Bianconi 	int (*add_rx_ba)(struct mt7615_dev *dev,
2256f4d7cc8SLorenzo Bianconi 			 struct ieee80211_ampdu_params *params,
2266f4d7cc8SLorenzo Bianconi 			 bool enable);
22799c457d9SLorenzo Bianconi 	int (*sta_add)(struct mt7615_dev *dev,
22899c457d9SLorenzo Bianconi 		       struct ieee80211_vif *vif,
22999c457d9SLorenzo Bianconi 		       struct ieee80211_sta *sta, bool enable);
230062c3699SLorenzo Bianconi 	int (*add_dev_info)(struct mt7615_dev *dev,
231062c3699SLorenzo Bianconi 			    struct ieee80211_vif *vif, bool enable);
2325d3a4a4bSLorenzo Bianconi 	int (*add_bss_info)(struct mt7615_phy *phy, struct ieee80211_vif *vif,
233f5596850SLorenzo Bianconi 			    struct ieee80211_sta *sta, bool enable);
234062c3699SLorenzo Bianconi 	int (*add_beacon_offload)(struct mt7615_dev *dev,
235062c3699SLorenzo Bianconi 				  struct ieee80211_hw *hw,
236062c3699SLorenzo Bianconi 				  struct ieee80211_vif *vif, bool enable);
237062c3699SLorenzo Bianconi 	int (*set_pm_state)(struct mt7615_dev *dev, int band, int state);
238186b659cSLorenzo Bianconi 	int (*set_drv_ctrl)(struct mt7615_dev *dev);
239186b659cSLorenzo Bianconi 	int (*set_fw_ctrl)(struct mt7615_dev *dev);
2406f4d7cc8SLorenzo Bianconi };
2416f4d7cc8SLorenzo Bianconi 
24204b8e659SRyder Lee struct mt7615_dev {
243ac24dd35SFelix Fietkau 	union { /* must be first */
244ac24dd35SFelix Fietkau 		struct mt76_dev mt76;
245ac24dd35SFelix Fietkau 		struct mt76_phy mphy;
246ac24dd35SFelix Fietkau 	};
247ac24dd35SFelix Fietkau 
248557b5a17SFelix Fietkau 	const struct mt76_bus_ops *bus_ops;
2499b90ab32SFelix Fietkau 	struct tasklet_struct irq_tasklet;
2509b90ab32SFelix Fietkau 
251fdd2e570SFelix Fietkau 	struct mt7615_phy phy;
252d8d59f66SRyder Lee 	u64 omac_mask;
25304b8e659SRyder Lee 
2540f2173f0SFelix Fietkau 	u16 chainmask;
2550f2173f0SFelix Fietkau 
256635cb010SFelix Fietkau 	struct ieee80211_ops *ops;
2576f4d7cc8SLorenzo Bianconi 	const struct mt7615_mcu_ops *mcu_ops;
25835da599fSFelix Fietkau 	struct regmap *infracfg;
25994f83b66SLorenzo Bianconi 	const u32 *reg_map;
26035da599fSFelix Fietkau 
261c3c25d09SFelix Fietkau 	struct work_struct mcu_work;
262c3c25d09SFelix Fietkau 
26361c4fa72SFelix Fietkau 	struct work_struct reset_work;
26461c4fa72SFelix Fietkau 	wait_queue_head_t reset_wait;
26561c4fa72SFelix Fietkau 	u32 reset_state;
26661c4fa72SFelix Fietkau 
267b2c2f029SLorenzo Bianconi 	struct list_head sta_poll_list;
268b2c2f029SLorenzo Bianconi 	spinlock_t sta_poll_lock;
269b2c2f029SLorenzo Bianconi 
27070911d96SLorenzo Bianconi 	struct {
27170911d96SLorenzo Bianconi 		u8 n_pulses;
27270911d96SLorenzo Bianconi 		u32 period;
27370911d96SLorenzo Bianconi 		u16 width;
27470911d96SLorenzo Bianconi 		s16 power;
27570911d96SLorenzo Bianconi 	} radar_pattern;
276d67a6646SLorenzo Bianconi 	u32 hw_pattern;
277d67a6646SLorenzo Bianconi 
278f347f81aSFelix Fietkau 	bool fw_debug;
279ad380ad1SFelix Fietkau 	bool flash_eeprom;
2807660a1bdSShayne Chen 	bool dbdc_support;
28149de79adSLorenzo Bianconi 
28204b8e659SRyder Lee 	spinlock_t token_lock;
28304b8e659SRyder Lee 	struct idr token;
2846849e29eSRyder Lee 
2856849e29eSRyder Lee 	u8 fw_ver;
286eb99cc95SLorenzo Bianconi 
287d927ebb9SLorenzo Bianconi 	struct work_struct rate_work;
288d927ebb9SLorenzo Bianconi 	struct list_head wrd_head;
289dc804058SFelix Fietkau 
290dc804058SFelix Fietkau 	u32 debugfs_rf_wf;
291dc804058SFelix Fietkau 	u32 debugfs_rf_reg;
2924f0bce1cSFelix Fietkau 
293d22da028SFelix Fietkau 	u32 muar_mask;
294d22da028SFelix Fietkau 
29508523a2aSLorenzo Bianconi 	struct {
296de5ff3c9SLorenzo Bianconi 		bool enable;
297de5ff3c9SLorenzo Bianconi 
2982b8cdfb2SLorenzo Bianconi 		spinlock_t txq_lock;
2992b8cdfb2SLorenzo Bianconi 		struct {
3002b8cdfb2SLorenzo Bianconi 			struct mt7615_sta *msta;
3012b8cdfb2SLorenzo Bianconi 			struct sk_buff *skb;
3022b8cdfb2SLorenzo Bianconi 		} tx_q[IEEE80211_NUM_ACS];
3032b8cdfb2SLorenzo Bianconi 
30408523a2aSLorenzo Bianconi 		struct work_struct wake_work;
30508523a2aSLorenzo Bianconi 		struct completion wake_cmpl;
306adfd5112SLorenzo Bianconi 
307de5ff3c9SLorenzo Bianconi 		struct delayed_work ps_work;
308adfd5112SLorenzo Bianconi 		unsigned long last_activity;
309ec4b9f38SLorenzo Bianconi 		unsigned long idle_timeout;
31008523a2aSLorenzo Bianconi 	} pm;
31104b8e659SRyder Lee };
31204b8e659SRyder Lee 
3131fec635bSLorenzo Bianconi enum tx_pkt_queue_idx {
3141fec635bSLorenzo Bianconi 	MT_LMAC_AC00,
3151fec635bSLorenzo Bianconi 	MT_LMAC_AC01,
3161fec635bSLorenzo Bianconi 	MT_LMAC_AC02,
3171fec635bSLorenzo Bianconi 	MT_LMAC_AC03,
3181fec635bSLorenzo Bianconi 	MT_LMAC_ALTX0 = 0x10,
3191fec635bSLorenzo Bianconi 	MT_LMAC_BMC0,
3201fec635bSLorenzo Bianconi 	MT_LMAC_BCN0,
3211fec635bSLorenzo Bianconi 	MT_LMAC_PSMP0,
3221fec635bSLorenzo Bianconi 	MT_LMAC_ALTX1,
3231fec635bSLorenzo Bianconi 	MT_LMAC_BMC1,
3241fec635bSLorenzo Bianconi 	MT_LMAC_BCN1,
3251fec635bSLorenzo Bianconi 	MT_LMAC_PSMP1,
3261fec635bSLorenzo Bianconi };
3271fec635bSLorenzo Bianconi 
32804b8e659SRyder Lee enum {
32904b8e659SRyder Lee 	HW_BSSID_0 = 0x0,
33004b8e659SRyder Lee 	HW_BSSID_1,
33104b8e659SRyder Lee 	HW_BSSID_2,
33204b8e659SRyder Lee 	HW_BSSID_3,
333d8d59f66SRyder Lee 	HW_BSSID_MAX = HW_BSSID_3,
33404b8e659SRyder Lee 	EXT_BSSID_START = 0x10,
33504b8e659SRyder Lee 	EXT_BSSID_1,
336d8d59f66SRyder Lee 	EXT_BSSID_15 = 0x1f,
337d8d59f66SRyder Lee 	EXT_BSSID_MAX = EXT_BSSID_15,
338d8d59f66SRyder Lee 	REPEATER_BSSID_START = 0x20,
339d8d59f66SRyder Lee 	REPEATER_BSSID_MAX = 0x3f,
34004b8e659SRyder Lee };
34104b8e659SRyder Lee 
342d67a6646SLorenzo Bianconi enum {
343d67a6646SLorenzo Bianconi 	MT_RX_SEL0,
344d67a6646SLorenzo Bianconi 	MT_RX_SEL1,
345d67a6646SLorenzo Bianconi };
346d67a6646SLorenzo Bianconi 
347d67a6646SLorenzo Bianconi enum mt7615_rdd_cmd {
348d67a6646SLorenzo Bianconi 	RDD_STOP,
349d67a6646SLorenzo Bianconi 	RDD_START,
350d67a6646SLorenzo Bianconi 	RDD_DET_MODE,
351d67a6646SLorenzo Bianconi 	RDD_DET_STOP,
352d67a6646SLorenzo Bianconi 	RDD_CAC_START,
353d67a6646SLorenzo Bianconi 	RDD_CAC_END,
354d67a6646SLorenzo Bianconi 	RDD_NORMAL_START,
355d67a6646SLorenzo Bianconi 	RDD_DISABLE_DFS_CAL,
356d67a6646SLorenzo Bianconi 	RDD_PULSE_DBG,
357d67a6646SLorenzo Bianconi 	RDD_READ_PULSE,
358d67a6646SLorenzo Bianconi 	RDD_RESUME_BF,
359d67a6646SLorenzo Bianconi };
360d67a6646SLorenzo Bianconi 
361fdd2e570SFelix Fietkau static inline struct mt7615_phy *
362fdd2e570SFelix Fietkau mt7615_hw_phy(struct ieee80211_hw *hw)
363fdd2e570SFelix Fietkau {
364fdd2e570SFelix Fietkau 	struct mt76_phy *phy = hw->priv;
365fdd2e570SFelix Fietkau 
366fdd2e570SFelix Fietkau 	return phy->priv;
367fdd2e570SFelix Fietkau }
368fdd2e570SFelix Fietkau 
369fdd2e570SFelix Fietkau static inline struct mt7615_dev *
370fdd2e570SFelix Fietkau mt7615_hw_dev(struct ieee80211_hw *hw)
371fdd2e570SFelix Fietkau {
372fdd2e570SFelix Fietkau 	struct mt76_phy *phy = hw->priv;
373fdd2e570SFelix Fietkau 
374fdd2e570SFelix Fietkau 	return container_of(phy->dev, struct mt7615_dev, mt76);
375fdd2e570SFelix Fietkau }
376fdd2e570SFelix Fietkau 
377fdd2e570SFelix Fietkau static inline struct mt7615_phy *
378fdd2e570SFelix Fietkau mt7615_ext_phy(struct mt7615_dev *dev)
379fdd2e570SFelix Fietkau {
380fdd2e570SFelix Fietkau 	struct mt76_phy *phy = dev->mt76.phy2;
381fdd2e570SFelix Fietkau 
382fdd2e570SFelix Fietkau 	if (!phy)
383fdd2e570SFelix Fietkau 		return NULL;
384fdd2e570SFelix Fietkau 
385fdd2e570SFelix Fietkau 	return phy->priv;
386fdd2e570SFelix Fietkau }
387fdd2e570SFelix Fietkau 
388e90354e0SLorenzo Bianconi extern struct ieee80211_rate mt7615_rates[12];
38904b8e659SRyder Lee extern const struct ieee80211_ops mt7615_ops;
39094f83b66SLorenzo Bianconi extern const u32 mt7615e_reg_map[__MT_BASE_MAX];
391f40ac0f3SLorenzo Bianconi extern const u32 mt7663e_reg_map[__MT_BASE_MAX];
39290520afbSLorenzo Bianconi extern const u32 mt7663_usb_sdio_reg_map[__MT_BASE_MAX];
39304b8e659SRyder Lee extern struct pci_driver mt7615_pci_driver;
39435da599fSFelix Fietkau extern struct platform_driver mt7622_wmac_driver;
3954f0bce1cSFelix Fietkau extern const struct mt76_testmode_ops mt7615_testmode_ops;
39635da599fSFelix Fietkau 
39735da599fSFelix Fietkau #ifdef CONFIG_MT7622_WMAC
39835da599fSFelix Fietkau int mt7622_wmac_init(struct mt7615_dev *dev);
39935da599fSFelix Fietkau #else
40035da599fSFelix Fietkau static inline int mt7622_wmac_init(struct mt7615_dev *dev)
40135da599fSFelix Fietkau {
40235da599fSFelix Fietkau 	return 0;
40335da599fSFelix Fietkau }
40435da599fSFelix Fietkau #endif
40504b8e659SRyder Lee 
40694f83b66SLorenzo Bianconi int mt7615_mmio_probe(struct device *pdev, void __iomem *mem_base,
40794f83b66SLorenzo Bianconi 		      int irq, const u32 *map);
40804b8e659SRyder Lee u32 mt7615_reg_map(struct mt7615_dev *dev, u32 addr);
40904b8e659SRyder Lee 
41053b42ae2SLorenzo Bianconi void mt7615_check_offload_capability(struct mt7615_dev *dev);
4112ee920c2SLorenzo Bianconi void mt7615_init_device(struct mt7615_dev *dev);
41204b8e659SRyder Lee int mt7615_register_device(struct mt7615_dev *dev);
41304b8e659SRyder Lee void mt7615_unregister_device(struct mt7615_dev *dev);
4140f2173f0SFelix Fietkau int mt7615_register_ext_phy(struct mt7615_dev *dev);
4150f2173f0SFelix Fietkau void mt7615_unregister_ext_phy(struct mt7615_dev *dev);
4166e5d2099SLorenzo Bianconi int mt7615_eeprom_init(struct mt7615_dev *dev, u32 addr);
417e0ec633dSLorenzo Bianconi int mt7615_eeprom_get_target_power_index(struct mt7615_dev *dev,
41816a2f8e2SLorenzo Bianconi 					 struct ieee80211_channel *chan,
41961d36824SLorenzo Bianconi 					 u8 chain_idx);
420c88bf52bSLorenzo Bianconi int mt7615_eeprom_get_power_delta_index(struct mt7615_dev *dev,
421c88bf52bSLorenzo Bianconi 					enum nl80211_band band);
4226dd4072cSLorenzo Bianconi int mt7615_wait_pdma_busy(struct mt7615_dev *dev);
42304b8e659SRyder Lee int mt7615_dma_init(struct mt7615_dev *dev);
42404b8e659SRyder Lee void mt7615_dma_cleanup(struct mt7615_dev *dev);
42504b8e659SRyder Lee int mt7615_mcu_init(struct mt7615_dev *dev);
426c3c25d09SFelix Fietkau bool mt7615_wait_for_mcu_init(struct mt7615_dev *dev);
427fdd2e570SFelix Fietkau void mt7615_mac_set_rates(struct mt7615_phy *phy, struct mt7615_sta *sta,
42804b8e659SRyder Lee 			  struct ieee80211_tx_rate *probe_rate,
42904b8e659SRyder Lee 			  struct ieee80211_tx_rate *rates);
43008523a2aSLorenzo Bianconi void mt7615_pm_wake_work(struct work_struct *work);
43108523a2aSLorenzo Bianconi int mt7615_pm_wake(struct mt7615_dev *dev);
432de5ff3c9SLorenzo Bianconi void mt7615_pm_power_save_sched(struct mt7615_dev *dev);
433de5ff3c9SLorenzo Bianconi void mt7615_pm_power_save_work(struct work_struct *work);
43404b8e659SRyder Lee int mt7615_mcu_del_wtbl_all(struct mt7615_dev *dev);
4354fe9218cSRyder Lee int mt7615_mcu_set_chan_info(struct mt7615_phy *phy, int cmd);
43604b8e659SRyder Lee int mt7615_mcu_set_wmm(struct mt7615_dev *dev, u8 queue,
43704b8e659SRyder Lee 		       const struct ieee80211_tx_queue_params *params);
438d67a6646SLorenzo Bianconi void mt7615_mcu_rx_event(struct mt7615_dev *dev, struct sk_buff *skb);
439d67a6646SLorenzo Bianconi int mt7615_mcu_rdd_cmd(struct mt7615_dev *dev,
440d67a6646SLorenzo Bianconi 		       enum mt7615_rdd_cmd cmd, u8 index,
441d67a6646SLorenzo Bianconi 		       u8 rx_sel, u8 val);
44270911d96SLorenzo Bianconi int mt7615_mcu_rdd_send_pattern(struct mt7615_dev *dev);
443f347f81aSFelix Fietkau int mt7615_mcu_fw_log_2_host(struct mt7615_dev *dev, u8 ctrl);
444d67a6646SLorenzo Bianconi 
44549de79adSLorenzo Bianconi static inline bool is_mt7622(struct mt76_dev *dev)
44649de79adSLorenzo Bianconi {
44735da599fSFelix Fietkau 	if (!IS_ENABLED(CONFIG_MT7622_WMAC))
44835da599fSFelix Fietkau 		return false;
44935da599fSFelix Fietkau 
45049de79adSLorenzo Bianconi 	return mt76_chip(dev) == 0x7622;
45149de79adSLorenzo Bianconi }
45249de79adSLorenzo Bianconi 
453cdad4874SFelix Fietkau static inline bool is_mt7615(struct mt76_dev *dev)
454cdad4874SFelix Fietkau {
455e47f2245SDENG Qingfang 	return mt76_chip(dev) == 0x7615 || mt76_chip(dev) == 0x7611;
456cdad4874SFelix Fietkau }
457cdad4874SFelix Fietkau 
458f82282efSLorenzo Bianconi static inline bool is_mt7663(struct mt76_dev *dev)
459f82282efSLorenzo Bianconi {
460f82282efSLorenzo Bianconi 	return mt76_chip(dev) == 0x7663;
461f82282efSLorenzo Bianconi }
462f82282efSLorenzo Bianconi 
463e47f2245SDENG Qingfang static inline bool is_mt7611(struct mt76_dev *dev)
464e47f2245SDENG Qingfang {
465e47f2245SDENG Qingfang 	return mt76_chip(dev) == 0x7611;
466e47f2245SDENG Qingfang }
467e47f2245SDENG Qingfang 
46804b8e659SRyder Lee static inline void mt7615_irq_enable(struct mt7615_dev *dev, u32 mask)
46904b8e659SRyder Lee {
4709b90ab32SFelix Fietkau 	mt76_set_irq_mask(&dev->mt76, 0, 0, mask);
47104b8e659SRyder Lee 
4729b90ab32SFelix Fietkau 	tasklet_schedule(&dev->irq_tasklet);
47304b8e659SRyder Lee }
47404b8e659SRyder Lee 
475bf18fcdcSLorenzo Bianconi static inline bool mt7615_firmware_offload(struct mt7615_dev *dev)
476bf18fcdcSLorenzo Bianconi {
477bf18fcdcSLorenzo Bianconi 	return dev->fw_ver > MT7615_FIRMWARE_V2;
478bf18fcdcSLorenzo Bianconi }
479bf18fcdcSLorenzo Bianconi 
4808f997dddSLorenzo Bianconi static inline u16 mt7615_wtbl_size(struct mt7615_dev *dev)
4818f997dddSLorenzo Bianconi {
4828f997dddSLorenzo Bianconi 	if (is_mt7663(&dev->mt76) && mt7615_firmware_offload(dev))
4838f997dddSLorenzo Bianconi 		return MT7663_WTBL_SIZE;
4848f997dddSLorenzo Bianconi 	else
4858f997dddSLorenzo Bianconi 		return MT7615_WTBL_SIZE;
4868f997dddSLorenzo Bianconi }
4878f997dddSLorenzo Bianconi 
488adfd5112SLorenzo Bianconi static inline void mt7615_mutex_acquire(struct mt7615_dev *dev)
489adfd5112SLorenzo Bianconi 	 __acquires(&dev->mt76.mutex)
490adfd5112SLorenzo Bianconi {
491adfd5112SLorenzo Bianconi 	mutex_lock(&dev->mt76.mutex);
492adfd5112SLorenzo Bianconi 	mt7615_pm_wake(dev);
493adfd5112SLorenzo Bianconi }
494adfd5112SLorenzo Bianconi 
495adfd5112SLorenzo Bianconi static inline void mt7615_mutex_release(struct mt7615_dev *dev)
496adfd5112SLorenzo Bianconi 	__releases(&dev->mt76.mutex)
497adfd5112SLorenzo Bianconi {
498de5ff3c9SLorenzo Bianconi 	mt7615_pm_power_save_sched(dev);
499adfd5112SLorenzo Bianconi 	mutex_unlock(&dev->mt76.mutex);
500adfd5112SLorenzo Bianconi }
501adfd5112SLorenzo Bianconi 
5021fec635bSLorenzo Bianconi static inline u8 mt7615_lmac_mapping(struct mt7615_dev *dev, u8 ac)
5031fec635bSLorenzo Bianconi {
5041fec635bSLorenzo Bianconi 	static const u8 lmac_queue_map[] = {
5051fec635bSLorenzo Bianconi 		[IEEE80211_AC_BK] = MT_LMAC_AC00,
5061fec635bSLorenzo Bianconi 		[IEEE80211_AC_BE] = MT_LMAC_AC01,
5071fec635bSLorenzo Bianconi 		[IEEE80211_AC_VI] = MT_LMAC_AC02,
5081fec635bSLorenzo Bianconi 		[IEEE80211_AC_VO] = MT_LMAC_AC03,
5091fec635bSLorenzo Bianconi 	};
5101fec635bSLorenzo Bianconi 
5111fec635bSLorenzo Bianconi 	if (WARN_ON_ONCE(ac >= ARRAY_SIZE(lmac_queue_map)))
5121fec635bSLorenzo Bianconi 		return MT_LMAC_AC01; /* BE */
5131fec635bSLorenzo Bianconi 
5141fec635bSLorenzo Bianconi 	return lmac_queue_map[ac];
5151fec635bSLorenzo Bianconi }
5161fec635bSLorenzo Bianconi 
517e17d7945SFelix Fietkau static inline u32 mt7615_tx_mcu_int_mask(struct mt7615_dev *dev)
518e17d7945SFelix Fietkau {
519e637763bSLorenzo Bianconi 	return MT_INT_TX_DONE(dev->mt76.q_mcu[MT_MCUQ_WM]->hw_idx);
520e17d7945SFelix Fietkau }
521e17d7945SFelix Fietkau 
5226dd4072cSLorenzo Bianconi void mt7615_dma_reset(struct mt7615_dev *dev);
523fcdfc29eSLorenzo Bianconi void mt7615_scan_work(struct work_struct *work);
5247307f296SLorenzo Bianconi void mt7615_roc_work(struct work_struct *work);
5257307f296SLorenzo Bianconi void mt7615_roc_timer(struct timer_list *timer);
526e90354e0SLorenzo Bianconi void mt7615_init_txpower(struct mt7615_dev *dev,
527e90354e0SLorenzo Bianconi 			 struct ieee80211_supported_band *sband);
528e90354e0SLorenzo Bianconi void mt7615_phy_init(struct mt7615_dev *dev);
529e90354e0SLorenzo Bianconi void mt7615_mac_init(struct mt7615_dev *dev);
5304f0bce1cSFelix Fietkau int mt7615_set_channel(struct mt7615_phy *phy);
531e90354e0SLorenzo Bianconi 
532e90354e0SLorenzo Bianconi int mt7615_mcu_restart(struct mt76_dev *dev);
533863c15a1SLorenzo Bianconi void mt7615_update_channel(struct mt76_dev *mdev);
53487d3cdebSLorenzo Bianconi bool mt7615_mac_wtbl_update(struct mt7615_dev *dev, int idx, u32 mask);
53575601194SLorenzo Bianconi void mt7615_mac_reset_counters(struct mt7615_dev *dev);
536d446a20fSFelix Fietkau void mt7615_mac_cca_stats_reset(struct mt7615_phy *phy);
537594034b7SLorenzo Bianconi void mt7615_mac_set_scs(struct mt7615_phy *phy, bool enable);
538e5051965SFelix Fietkau void mt7615_mac_enable_nf(struct mt7615_dev *dev, bool ext_phy);
539b2c2f029SLorenzo Bianconi void mt7615_mac_sta_poll(struct mt7615_dev *dev);
54004b8e659SRyder Lee int mt7615_mac_write_txwi(struct mt7615_dev *dev, __le32 *txwi,
54104b8e659SRyder Lee 			  struct sk_buff *skb, struct mt76_wcid *wcid,
54204b8e659SRyder Lee 			  struct ieee80211_sta *sta, int pid,
543c984457bSFelix Fietkau 			  struct ieee80211_key_conf *key, bool beacon);
544183d1fcfSLorenzo Bianconi void mt7615_mac_set_timing(struct mt7615_phy *phy);
545faa72684SLorenzo Bianconi int __mt7615_mac_wtbl_set_key(struct mt7615_dev *dev,
546faa72684SLorenzo Bianconi 			      struct mt76_wcid *wcid,
54727b8a900SLorenzo Bianconi 			      struct ieee80211_key_conf *key,
54827b8a900SLorenzo Bianconi 			      enum set_key_cmd cmd);
549faa72684SLorenzo Bianconi int mt7615_mac_wtbl_set_key(struct mt7615_dev *dev, struct mt76_wcid *wcid,
550faa72684SLorenzo Bianconi 			    struct ieee80211_key_conf *key,
551294f17aeSLorenzo Bianconi 			    enum set_key_cmd cmd);
55261c4fa72SFelix Fietkau void mt7615_mac_reset_work(struct work_struct *work);
553a28bef56SFelix Fietkau u32 mt7615_mac_get_sta_tid_sn(struct mt7615_dev *dev, int wcid, u8 tid);
55404b8e659SRyder Lee 
555f320d812SFelix Fietkau int mt7615_mcu_parse_response(struct mt76_dev *mdev, int cmd,
556f320d812SFelix Fietkau 			      struct sk_buff *skb, int seq);
557dc804058SFelix Fietkau u32 mt7615_rf_rr(struct mt7615_dev *dev, u32 wf, u32 reg);
558dc804058SFelix Fietkau int mt7615_rf_wr(struct mt7615_dev *dev, u32 wf, u32 reg, u32 val);
559ac3ef85cSFelix Fietkau int mt7615_mcu_set_dbdc(struct mt7615_dev *dev);
56004b8e659SRyder Lee int mt7615_mcu_set_eeprom(struct mt7615_dev *dev);
561b0b5426eSFelix Fietkau int mt7615_mcu_set_mac_enable(struct mt7615_dev *dev, int band, bool enable);
562fdd2e570SFelix Fietkau int mt7615_mcu_set_rts_thresh(struct mt7615_phy *phy, u32 val);
5630e6a29e4SLorenzo Bianconi int mt7615_mcu_get_temperature(struct mt7615_dev *dev, int index);
5644f0bce1cSFelix Fietkau int mt7615_mcu_set_tx_power(struct mt7615_phy *phy);
56504b8e659SRyder Lee void mt7615_mcu_exit(struct mt7615_dev *dev);
56663f09b6bSLorenzo Bianconi void mt7615_mcu_fill_msg(struct mt7615_dev *dev, struct sk_buff *skb,
56763f09b6bSLorenzo Bianconi 			 int cmd, int *wait_seq);
568bf18fcdcSLorenzo Bianconi int mt7615_mcu_set_channel_domain(struct mt7615_phy *phy);
569fcdfc29eSLorenzo Bianconi int mt7615_mcu_hw_scan(struct mt7615_phy *phy, struct ieee80211_vif *vif,
570fcdfc29eSLorenzo Bianconi 		       struct ieee80211_scan_request *scan_req);
571fcdfc29eSLorenzo Bianconi int mt7615_mcu_cancel_hw_scan(struct mt7615_phy *phy,
572fcdfc29eSLorenzo Bianconi 			      struct ieee80211_vif *vif);
57320305f98SLorenzo Bianconi int mt7615_mcu_sched_scan_req(struct mt7615_phy *phy,
57420305f98SLorenzo Bianconi 			      struct ieee80211_vif *vif,
57520305f98SLorenzo Bianconi 			      struct cfg80211_sched_scan_request *sreq);
57620305f98SLorenzo Bianconi int mt7615_mcu_sched_scan_enable(struct mt7615_phy *phy,
57720305f98SLorenzo Bianconi 				 struct ieee80211_vif *vif,
57820305f98SLorenzo Bianconi 				 bool enable);
57904b8e659SRyder Lee 
58004b8e659SRyder Lee int mt7615_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
58104b8e659SRyder Lee 			  enum mt76_txq_id qid, struct mt76_wcid *wcid,
58204b8e659SRyder Lee 			  struct ieee80211_sta *sta,
58304b8e659SRyder Lee 			  struct mt76_tx_info *tx_info);
58404b8e659SRyder Lee 
585d80e52c7SFelix Fietkau void mt7615_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue_entry *e);
586a6275e93SRyder Lee void mt7615_tx_token_put(struct mt7615_dev *dev);
58704b8e659SRyder Lee void mt7615_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
58804b8e659SRyder Lee 			 struct sk_buff *skb);
58904b8e659SRyder Lee void mt7615_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps);
5903e384828SFelix Fietkau int mt7615_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
59104b8e659SRyder Lee 		       struct ieee80211_sta *sta);
5923e384828SFelix Fietkau void mt7615_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
59304b8e659SRyder Lee 			   struct ieee80211_sta *sta);
59404b8e659SRyder Lee void mt7615_mac_work(struct work_struct *work);
59504b8e659SRyder Lee void mt7615_txp_skb_unmap(struct mt76_dev *dev,
59604b8e659SRyder Lee 			  struct mt76_txwi_cache *txwi);
5972ce73efeSLorenzo Bianconi int mt7615_mcu_set_fcc5_lpn(struct mt7615_dev *dev, int val);
5982ce73efeSLorenzo Bianconi int mt7615_mcu_set_pulse_th(struct mt7615_dev *dev,
5992ce73efeSLorenzo Bianconi 			    const struct mt7615_dfs_pulse *pulse);
6002ce73efeSLorenzo Bianconi int mt7615_mcu_set_radar_th(struct mt7615_dev *dev, int index,
6012ce73efeSLorenzo Bianconi 			    const struct mt7615_dfs_pattern *pattern);
6024f0bce1cSFelix Fietkau int mt7615_mcu_set_test_param(struct mt7615_dev *dev, u8 param, bool test_mode,
6034f0bce1cSFelix Fietkau 			      u32 val);
60415d9a5d7SFelix Fietkau int mt7615_mcu_set_sku_en(struct mt7615_phy *phy, bool enable);
605ad380ad1SFelix Fietkau int mt7615_mcu_apply_rx_dcoc(struct mt7615_phy *phy);
606371a59d1SFelix Fietkau int mt7615_mcu_apply_tx_dpd(struct mt7615_phy *phy);
607a5e0aa78SLorenzo Bianconi int mt7615_mcu_set_vif_ps(struct mt7615_dev *dev, struct ieee80211_vif *vif);
6085dabdf71SFelix Fietkau int mt7615_dfs_init_radar_detector(struct mt7615_phy *phy);
60904b8e659SRyder Lee 
61050eb0a88SLorenzo Bianconi int mt7615_mcu_set_p2p_oppps(struct ieee80211_hw *hw,
61150eb0a88SLorenzo Bianconi 			     struct ieee80211_vif *vif);
6127307f296SLorenzo Bianconi int mt7615_mcu_set_roc(struct mt7615_phy *phy, struct ieee80211_vif *vif,
6137307f296SLorenzo Bianconi 		       struct ieee80211_channel *chan, int duration);
6146dd4072cSLorenzo Bianconi 
61570911d96SLorenzo Bianconi int mt7615_init_debugfs(struct mt7615_dev *dev);
616eb99cc95SLorenzo Bianconi int mt7615_mcu_wait_response(struct mt7615_dev *dev, int cmd, int seq);
617eb99cc95SLorenzo Bianconi 
6187124198aSLorenzo Bianconi int mt7615_mac_set_beacon_filter(struct mt7615_phy *phy,
6197124198aSLorenzo Bianconi 				 struct ieee80211_vif *vif,
6207124198aSLorenzo Bianconi 				 bool enable);
62183b9f42aSLorenzo Bianconi int mt7615_mcu_set_bss_pm(struct mt7615_dev *dev, struct ieee80211_vif *vif,
62283b9f42aSLorenzo Bianconi 			  bool enable);
6236f117852SSean Wang int mt7615_mcu_set_hif_suspend(struct mt7615_dev *dev, bool suspend);
624c6bf2010SLorenzo Bianconi void mt7615_mcu_set_suspend_iter(void *priv, u8 *mac,
625c6bf2010SLorenzo Bianconi 				 struct ieee80211_vif *vif);
626b47e21e7SLorenzo Bianconi int mt7615_mcu_update_gtk_rekey(struct ieee80211_hw *hw,
627b47e21e7SLorenzo Bianconi 				struct ieee80211_vif *vif,
628b47e21e7SLorenzo Bianconi 				struct cfg80211_gtk_rekey_data *key);
62973741b9bSSean Wang int mt7615_mcu_update_arp_filter(struct ieee80211_hw *hw,
63073741b9bSSean Wang 				 struct ieee80211_vif *vif,
63173741b9bSSean Wang 				 struct ieee80211_bss_conf *info);
6328915c3ceSLorenzo Bianconi int __mt7663_load_firmware(struct mt7615_dev *dev);
633a66cbdd6SSean Wang u32 mt7615_mcu_reg_rr(struct mt76_dev *dev, u32 offset);
634a66cbdd6SSean Wang void mt7615_mcu_reg_wr(struct mt76_dev *dev, u32 offset, u32 val);
63570911d96SLorenzo Bianconi 
636eb99cc95SLorenzo Bianconi /* usb */
63790520afbSLorenzo Bianconi int mt7663_usb_sdio_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
63890520afbSLorenzo Bianconi 				   enum mt76_txq_id qid, struct mt76_wcid *wcid,
63990520afbSLorenzo Bianconi 				   struct ieee80211_sta *sta,
64090520afbSLorenzo Bianconi 				   struct mt76_tx_info *tx_info);
64190520afbSLorenzo Bianconi bool mt7663_usb_sdio_tx_status_data(struct mt76_dev *mdev, u8 *update);
64290520afbSLorenzo Bianconi void mt7663_usb_sdio_tx_complete_skb(struct mt76_dev *mdev,
64390520afbSLorenzo Bianconi 				     struct mt76_queue_entry *e);
64490520afbSLorenzo Bianconi int mt7663_usb_sdio_register_device(struct mt7615_dev *dev);
645eb99cc95SLorenzo Bianconi int mt7663u_mcu_init(struct mt7615_dev *dev);
646eb99cc95SLorenzo Bianconi 
647a66cbdd6SSean Wang /* sdio */
648a66cbdd6SSean Wang u32 mt7663s_read_pcr(struct mt7615_dev *dev);
649a66cbdd6SSean Wang int mt7663s_mcu_init(struct mt7615_dev *dev);
650fefb584dSLorenzo Bianconi void mt7663s_txrx_worker(struct mt76_worker *w);
6513e5f374dSLorenzo Bianconi void mt7663s_rx_work(struct work_struct *work);
652a66cbdd6SSean Wang void mt7663s_sdio_irq(struct sdio_func *func);
653a66cbdd6SSean Wang 
65404b8e659SRyder Lee #endif
655