mt7921.h (20249e1a853c412f452aa6ee0beb752360e69f17) mt7921.h (c74df1c067f2af0a3758a5ab02806f501473797c)
1/* SPDX-License-Identifier: ISC */
2/* Copyright (C) 2020 MediaTek Inc. */
3
4#ifndef __MT7921_H
5#define __MT7921_H
6
7#include "../mt792x.h"
8#include "regs.h"
9#include "acpi_sar.h"
10
1/* SPDX-License-Identifier: ISC */
2/* Copyright (C) 2020 MediaTek Inc. */
3
4#ifndef __MT7921_H
5#define __MT7921_H
6
7#include "../mt792x.h"
8#include "regs.h"
9#include "acpi_sar.h"
10
11#define MT7921_MAX_INTERFACES 4
12#define MT7921_WTBL_SIZE 20
13#define MT7921_WTBL_RESERVED (MT7921_WTBL_SIZE - 1)
14#define MT7921_WTBL_STA (MT7921_WTBL_RESERVED - \
15 MT7921_MAX_INTERFACES)
16
17#define MT7921_PM_TIMEOUT (HZ / 12)
18#define MT7921_HW_SCAN_TIMEOUT (HZ / 10)
11#define MT7921_PM_TIMEOUT (HZ / 12)
12#define MT7921_HW_SCAN_TIMEOUT (HZ / 10)
19#define MT7921_WATCHDOG_TIME (HZ / 4)
20
21#define MT7921_TX_RING_SIZE 2048
22#define MT7921_TX_MCU_RING_SIZE 256
23#define MT7921_TX_FWDL_RING_SIZE 128
24
25#define MT7921_RX_RING_SIZE 1536
26#define MT7921_RX_MCU_RING_SIZE 512
27

--- 10 unchanged lines hidden (view full) ---

38#define MT7922_FIRMWARE_WM "mediatek/WIFI_RAM_CODE_MT7922_1.bin"
39#define MT7922_ROM_PATCH "mediatek/WIFI_MT7922_patch_mcu_1_1_hdr.bin"
40
41#define MT7921_EEPROM_SIZE 3584
42#define MT7921_TOKEN_SIZE 8192
43
44#define MT7921_EEPROM_BLOCK_SIZE 16
45
13
14#define MT7921_TX_RING_SIZE 2048
15#define MT7921_TX_MCU_RING_SIZE 256
16#define MT7921_TX_FWDL_RING_SIZE 128
17
18#define MT7921_RX_RING_SIZE 1536
19#define MT7921_RX_MCU_RING_SIZE 512
20

--- 10 unchanged lines hidden (view full) ---

31#define MT7922_FIRMWARE_WM "mediatek/WIFI_RAM_CODE_MT7922_1.bin"
32#define MT7922_ROM_PATCH "mediatek/WIFI_MT7922_patch_mcu_1_1_hdr.bin"
33
34#define MT7921_EEPROM_SIZE 3584
35#define MT7921_TOKEN_SIZE 8192
36
37#define MT7921_EEPROM_BLOCK_SIZE 16
38
46#define MT7921_CFEND_RATE_DEFAULT 0x49 /* OFDM 24M */
47#define MT7921_CFEND_RATE_11B 0x03 /* 11B LP, 11M */
48
49#define MT7921_SKU_RATE_NUM 161
50#define MT7921_SKU_MAX_DELTA_IDX MT7921_SKU_RATE_NUM
51#define MT7921_SKU_TABLE_SIZE (MT7921_SKU_RATE_NUM + 1)
52
53#define MT7921_SDIO_HDR_TX_BYTES GENMASK(15, 0)
54#define MT7921_SDIO_HDR_PKT_TYPE GENMASK(17, 16)
55
56#define MCU_UNI_EVENT_ROC 0x27

--- 146 unchanged lines hidden (view full) ---

203 u8 he106[12];
204 u8 he242[12];
205 u8 he484[12];
206 u8 he996[12];
207 u8 he996x2[12];
208 } data[TXPWR_MAX_NUM];
209};
210
39#define MT7921_SKU_RATE_NUM 161
40#define MT7921_SKU_MAX_DELTA_IDX MT7921_SKU_RATE_NUM
41#define MT7921_SKU_TABLE_SIZE (MT7921_SKU_RATE_NUM + 1)
42
43#define MT7921_SDIO_HDR_TX_BYTES GENMASK(15, 0)
44#define MT7921_SDIO_HDR_PKT_TYPE GENMASK(17, 16)
45
46#define MCU_UNI_EVENT_ROC 0x27

--- 146 unchanged lines hidden (view full) ---

193 u8 he106[12];
194 u8 he242[12];
195 u8 he484[12];
196 u8 he996[12];
197 u8 he996x2[12];
198 } data[TXPWR_MAX_NUM];
199};
200
211static inline struct mt792x_phy *
212mt7921_hw_phy(struct ieee80211_hw *hw)
213{
214 struct mt76_phy *phy = hw->priv;
215
216 return phy->priv;
217}
218
219extern const struct ieee80211_ops mt7921_ops;
220
221u32 mt7921_reg_map(struct mt792x_dev *dev, u32 addr);
222
223int __mt7921_start(struct mt792x_phy *phy);
224int mt7921_register_device(struct mt792x_dev *dev);
225void mt7921_unregister_device(struct mt792x_dev *dev);
226int mt7921_dma_init(struct mt792x_dev *dev);

--- 68 unchanged lines hidden (view full) ---

295 hdr = FIELD_PREP(MT7921_SDIO_HDR_TX_BYTES, len) |
296 FIELD_PREP(MT7921_SDIO_HDR_PKT_TYPE, type);
297
298 put_unaligned_le32(hdr, skb_push(skb, sizeof(hdr)));
299}
300
301void mt7921_stop(struct ieee80211_hw *hw);
302int mt7921_mac_init(struct mt792x_dev *dev);
201extern const struct ieee80211_ops mt7921_ops;
202
203u32 mt7921_reg_map(struct mt792x_dev *dev, u32 addr);
204
205int __mt7921_start(struct mt792x_phy *phy);
206int mt7921_register_device(struct mt792x_dev *dev);
207void mt7921_unregister_device(struct mt792x_dev *dev);
208int mt7921_dma_init(struct mt792x_dev *dev);

--- 68 unchanged lines hidden (view full) ---

277 hdr = FIELD_PREP(MT7921_SDIO_HDR_TX_BYTES, len) |
278 FIELD_PREP(MT7921_SDIO_HDR_PKT_TYPE, type);
279
280 put_unaligned_le32(hdr, skb_push(skb, sizeof(hdr)));
281}
282
283void mt7921_stop(struct ieee80211_hw *hw);
284int mt7921_mac_init(struct mt792x_dev *dev);
303bool mt7921_mac_wtbl_update(struct mt792x_dev *dev, int idx, u32 mask);
304void mt7921_mac_reset_counters(struct mt792x_phy *phy);
285void mt7921_mac_reset_counters(struct mt792x_phy *phy);
305void mt7921_mac_set_timing(struct mt792x_phy *phy);
286bool mt7921_mac_wtbl_update(struct mt792x_dev *dev, int idx, u32 mask);
306int mt7921_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
307 struct ieee80211_sta *sta);
308void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
309 struct ieee80211_sta *sta);
310void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
311 struct ieee80211_sta *sta);
287int mt7921_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
288 struct ieee80211_sta *sta);
289void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
290 struct ieee80211_sta *sta);
291void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
292 struct ieee80211_sta *sta);
312void mt7921_mac_work(struct work_struct *work);
313void mt7921_mac_reset_work(struct work_struct *work);
293void mt7921_mac_reset_work(struct work_struct *work);
314void mt7921_mac_update_mib_stats(struct mt792x_phy *phy);
315void mt7921_reset(struct mt76_dev *mdev);
316int mt7921e_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
317 enum mt76_txq_id qid, struct mt76_wcid *wcid,
318 struct ieee80211_sta *sta,
319 struct mt76_tx_info *tx_info);
320
294void mt7921_reset(struct mt76_dev *mdev);
295int mt7921e_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
296 enum mt76_txq_id qid, struct mt76_wcid *wcid,
297 struct ieee80211_sta *sta,
298 struct mt76_tx_info *tx_info);
299
321void mt7921_tx_worker(struct mt76_worker *w);
322bool mt7921_rx_check(struct mt76_dev *mdev, void *data, int len);
323void mt7921_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
324 struct sk_buff *skb, u32 *info);
325void mt7921_stats_work(struct work_struct *work);
326void mt7921_set_stream_he_caps(struct mt792x_phy *phy);
327void mt7921_update_channel(struct mt76_phy *mphy);
328int mt7921_init_debugfs(struct mt792x_dev *dev);
329
330int mt7921_mcu_set_beacon_filter(struct mt792x_dev *dev,
331 struct ieee80211_vif *vif,
332 bool enable);
333int mt7921_mcu_uni_tx_ba(struct mt792x_dev *dev,
334 struct ieee80211_ampdu_params *params,
335 bool enable);
336int mt7921_mcu_uni_rx_ba(struct mt792x_dev *dev,
337 struct ieee80211_ampdu_params *params,
338 bool enable);
339void mt7921_scan_work(struct work_struct *work);
340void mt7921_roc_work(struct work_struct *work);
300bool mt7921_rx_check(struct mt76_dev *mdev, void *data, int len);
301void mt7921_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
302 struct sk_buff *skb, u32 *info);
303void mt7921_stats_work(struct work_struct *work);
304void mt7921_set_stream_he_caps(struct mt792x_phy *phy);
305void mt7921_update_channel(struct mt76_phy *mphy);
306int mt7921_init_debugfs(struct mt792x_dev *dev);
307
308int mt7921_mcu_set_beacon_filter(struct mt792x_dev *dev,
309 struct ieee80211_vif *vif,
310 bool enable);
311int mt7921_mcu_uni_tx_ba(struct mt792x_dev *dev,
312 struct ieee80211_ampdu_params *params,
313 bool enable);
314int mt7921_mcu_uni_rx_ba(struct mt792x_dev *dev,
315 struct ieee80211_ampdu_params *params,
316 bool enable);
317void mt7921_scan_work(struct work_struct *work);
318void mt7921_roc_work(struct work_struct *work);
341void mt7921_roc_timer(struct timer_list *timer);
342int mt7921_mcu_uni_bss_ps(struct mt792x_dev *dev, struct ieee80211_vif *vif);
343int mt7921_mcu_drv_pmctrl(struct mt792x_dev *dev);
344int mt7921_mcu_fw_pmctrl(struct mt792x_dev *dev);
345void mt7921_pm_wake_work(struct work_struct *work);
346void mt7921_pm_power_save_work(struct work_struct *work);
347void mt7921_coredump_work(struct work_struct *work);
348int mt7921_wfsys_reset(struct mt792x_dev *dev);
349int mt7921_get_txpwr_info(struct mt792x_dev *dev, struct mt7921_txpwr *txpwr);

--- 89 unchanged lines hidden ---
319int mt7921_mcu_uni_bss_ps(struct mt792x_dev *dev, struct ieee80211_vif *vif);
320int mt7921_mcu_drv_pmctrl(struct mt792x_dev *dev);
321int mt7921_mcu_fw_pmctrl(struct mt792x_dev *dev);
322void mt7921_pm_wake_work(struct work_struct *work);
323void mt7921_pm_power_save_work(struct work_struct *work);
324void mt7921_coredump_work(struct work_struct *work);
325int mt7921_wfsys_reset(struct mt792x_dev *dev);
326int mt7921_get_txpwr_info(struct mt792x_dev *dev, struct mt7921_txpwr *txpwr);

--- 89 unchanged lines hidden ---