xref: /linux/drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2u.h (revision 1613c621e19416754beda19879d574cd149bf91e)
1*1613c621SLorenzo Bianconi /*
2*1613c621SLorenzo Bianconi  * Copyright (C) 2018 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
3*1613c621SLorenzo Bianconi  *
4*1613c621SLorenzo Bianconi  * Permission to use, copy, modify, and/or distribute this software for any
5*1613c621SLorenzo Bianconi  * purpose with or without fee is hereby granted, provided that the above
6*1613c621SLorenzo Bianconi  * copyright notice and this permission notice appear in all copies.
7*1613c621SLorenzo Bianconi  *
8*1613c621SLorenzo Bianconi  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9*1613c621SLorenzo Bianconi  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10*1613c621SLorenzo Bianconi  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11*1613c621SLorenzo Bianconi  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12*1613c621SLorenzo Bianconi  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13*1613c621SLorenzo Bianconi  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14*1613c621SLorenzo Bianconi  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*1613c621SLorenzo Bianconi  */
16*1613c621SLorenzo Bianconi 
17*1613c621SLorenzo Bianconi #ifndef __MT76x2U_H
18*1613c621SLorenzo Bianconi #define __MT76x2U_H
19*1613c621SLorenzo Bianconi 
20*1613c621SLorenzo Bianconi #include <linux/device.h>
21*1613c621SLorenzo Bianconi 
22*1613c621SLorenzo Bianconi #include "mt76x2.h"
23*1613c621SLorenzo Bianconi #include "mcu.h"
24*1613c621SLorenzo Bianconi #include "../mt76x02_dma.h"
25*1613c621SLorenzo Bianconi 
26*1613c621SLorenzo Bianconi #define MT7612U_EEPROM_SIZE		512
27*1613c621SLorenzo Bianconi 
28*1613c621SLorenzo Bianconi #define MT_USB_AGGR_SIZE_LIMIT		21 /* 1024B unit */
29*1613c621SLorenzo Bianconi #define MT_USB_AGGR_TIMEOUT		0x80 /* 33ns unit */
30*1613c621SLorenzo Bianconi 
31*1613c621SLorenzo Bianconi extern const struct ieee80211_ops mt76x2u_ops;
32*1613c621SLorenzo Bianconi 
33*1613c621SLorenzo Bianconi struct mt76x2_dev *mt76x2u_alloc_device(struct device *pdev);
34*1613c621SLorenzo Bianconi int mt76x2u_register_device(struct mt76x2_dev *dev);
35*1613c621SLorenzo Bianconi int mt76x2u_init_hardware(struct mt76x2_dev *dev);
36*1613c621SLorenzo Bianconi void mt76x2u_cleanup(struct mt76x2_dev *dev);
37*1613c621SLorenzo Bianconi void mt76x2u_stop_hw(struct mt76x2_dev *dev);
38*1613c621SLorenzo Bianconi 
39*1613c621SLorenzo Bianconi int mt76x2u_mac_reset(struct mt76x2_dev *dev);
40*1613c621SLorenzo Bianconi void mt76x2u_mac_resume(struct mt76x2_dev *dev);
41*1613c621SLorenzo Bianconi int mt76x2u_mac_start(struct mt76x2_dev *dev);
42*1613c621SLorenzo Bianconi int mt76x2u_mac_stop(struct mt76x2_dev *dev);
43*1613c621SLorenzo Bianconi 
44*1613c621SLorenzo Bianconi int mt76x2u_phy_set_channel(struct mt76x2_dev *dev,
45*1613c621SLorenzo Bianconi 			    struct cfg80211_chan_def *chandef);
46*1613c621SLorenzo Bianconi void mt76x2u_phy_calibrate(struct work_struct *work);
47*1613c621SLorenzo Bianconi void mt76x2u_phy_channel_calibrate(struct mt76x2_dev *dev);
48*1613c621SLorenzo Bianconi 
49*1613c621SLorenzo Bianconi void mt76x2u_mcu_complete_urb(struct urb *urb);
50*1613c621SLorenzo Bianconi int mt76x2u_mcu_set_dynamic_vga(struct mt76x2_dev *dev, u8 channel, bool ap,
51*1613c621SLorenzo Bianconi 				bool ext, int rssi, u32 false_cca);
52*1613c621SLorenzo Bianconi int mt76x2u_mcu_init(struct mt76x2_dev *dev);
53*1613c621SLorenzo Bianconi int mt76x2u_mcu_fw_init(struct mt76x2_dev *dev);
54*1613c621SLorenzo Bianconi 
55*1613c621SLorenzo Bianconi int mt76x2u_alloc_queues(struct mt76x2_dev *dev);
56*1613c621SLorenzo Bianconi void mt76x2u_queues_deinit(struct mt76x2_dev *dev);
57*1613c621SLorenzo Bianconi void mt76x2u_stop_queues(struct mt76x2_dev *dev);
58*1613c621SLorenzo Bianconi int mt76x2u_tx_prepare_skb(struct mt76_dev *mdev, void *data,
59*1613c621SLorenzo Bianconi 			   struct sk_buff *skb, struct mt76_queue *q,
60*1613c621SLorenzo Bianconi 			   struct mt76_wcid *wcid, struct ieee80211_sta *sta,
61*1613c621SLorenzo Bianconi 			   u32 *tx_info);
62*1613c621SLorenzo Bianconi int mt76x2u_skb_dma_info(struct sk_buff *skb, enum dma_msg_port port,
63*1613c621SLorenzo Bianconi 			 u32 flags);
64*1613c621SLorenzo Bianconi 
65*1613c621SLorenzo Bianconi #endif /* __MT76x2U_H */
66