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