1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
4  * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
5  * Copyright (C) 2018 Stanislaw Gruszka <stf_xl@wp.pl>
6  */
7 
8 #ifndef MT76X0U_H
9 #define MT76X0U_H
10 
11 #include <linux/bitfield.h>
12 #include <linux/kernel.h>
13 #include <linux/device.h>
14 #include <linux/mutex.h>
15 #include <linux/usb.h>
16 #include <linux/completion.h>
17 #include <net/mac80211.h>
18 #include <linux/debugfs.h>
19 
20 #include "../mt76x02.h"
21 #include "eeprom.h"
22 
23 #define MT7610E_FIRMWARE		"mediatek/mt7610e.bin"
24 #define MT7650E_FIRMWARE		"mediatek/mt7650e.bin"
25 
26 #define MT7610U_FIRMWARE		"mediatek/mt7610u.bin"
27 
28 #define MT_USB_AGGR_SIZE_LIMIT		21 /* * 1024B */
29 #define MT_USB_AGGR_TIMEOUT		0x80 /* * 33ns */
30 
31 static inline bool is_mt7610e(struct mt76x02_dev *dev)
32 {
33 	if (!mt76_is_mmio(&dev->mt76))
34 		return false;
35 
36 	return mt76_chip(&dev->mt76) == 0x7610;
37 }
38 
39 static inline bool is_mt7630(struct mt76x02_dev *dev)
40 {
41 	return mt76_chip(&dev->mt76) == 0x7630;
42 }
43 
44 /* Init */
45 int mt76x0_init_hardware(struct mt76x02_dev *dev);
46 int mt76x0_register_device(struct mt76x02_dev *dev);
47 void mt76x0_chip_onoff(struct mt76x02_dev *dev, bool enable, bool reset);
48 
49 void mt76x0_mac_stop(struct mt76x02_dev *dev);
50 
51 int mt76x0_config(struct ieee80211_hw *hw, u32 changed);
52 
53 /* PHY */
54 void mt76x0_phy_init(struct mt76x02_dev *dev);
55 int mt76x0_phy_wait_bbp_ready(struct mt76x02_dev *dev);
56 void mt76x0_phy_set_channel(struct mt76x02_dev *dev,
57 			    struct cfg80211_chan_def *chandef);
58 void mt76x0_phy_set_txpower(struct mt76x02_dev *dev);
59 void mt76x0_phy_calibrate(struct mt76x02_dev *dev, bool power_on);
60 #endif
61