mt7921.h (fe0195f7563314a88cf08a1e7e528d3c0266fbbe) mt7921.h (48fab5bbef4092d925ab3214773ad12e68807223)
1/* SPDX-License-Identifier: ISC */
2/* Copyright (C) 2020 MediaTek Inc. */
3
4#ifndef __MT7921_H
5#define __MT7921_H
6
7#include <linux/interrupt.h>
8#include <linux/ktime.h>

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

42
43#define MT7921_CFEND_RATE_DEFAULT 0x49 /* OFDM 24M */
44#define MT7921_CFEND_RATE_11B 0x03 /* 11B LP, 11M */
45
46#define MT7921_SKU_RATE_NUM 161
47#define MT7921_SKU_MAX_DELTA_IDX MT7921_SKU_RATE_NUM
48#define MT7921_SKU_TABLE_SIZE (MT7921_SKU_RATE_NUM + 1)
49
1/* SPDX-License-Identifier: ISC */
2/* Copyright (C) 2020 MediaTek Inc. */
3
4#ifndef __MT7921_H
5#define __MT7921_H
6
7#include <linux/interrupt.h>
8#include <linux/ktime.h>

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

42
43#define MT7921_CFEND_RATE_DEFAULT 0x49 /* OFDM 24M */
44#define MT7921_CFEND_RATE_11B 0x03 /* 11B LP, 11M */
45
46#define MT7921_SKU_RATE_NUM 161
47#define MT7921_SKU_MAX_DELTA_IDX MT7921_SKU_RATE_NUM
48#define MT7921_SKU_TABLE_SIZE (MT7921_SKU_RATE_NUM + 1)
49
50#define MT7921_SDIO_HDR_TX_BYTES GENMASK(15, 0)
51#define MT7921_SDIO_HDR_PKT_TYPE GENMASK(17, 16)
52
53enum mt7921_sdio_pkt_type {
54 MT7921_SDIO_TXD,
55 MT7921_SDIO_DATA,
56 MT7921_SDIO_CMD,
57 MT7921_SDIO_FWDL,
58};
59
60struct mt7921_sdio_intr {
61 u32 isr;
62 struct {
63 u32 wtqcr[16];
64 } tx;
65 struct {
66 u16 num[2];
67 u16 len0[16];
68 u16 len1[128];
69 } rx;
70 u32 rec_mb[2];
71} __packed;
72
50#define to_rssi(field, rxv) ((FIELD_GET(field, rxv) - 220) / 2)
51#define to_rcpi(rssi) (2 * (rssi) + 220)
52
53struct mt7921_vif;
54struct mt7921_sta;
55
56enum mt7921_txq_id {
57 MT7921_TXQ_BAND0,

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

316}
317
318static inline void mt7921_mcu_tx_cleanup(struct mt7921_dev *dev)
319{
320 mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[MT_MCUQ_WM], false);
321 mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[MT_MCUQ_WA], false);
322}
323
73#define to_rssi(field, rxv) ((FIELD_GET(field, rxv) - 220) / 2)
74#define to_rcpi(rssi) (2 * (rssi) + 220)
75
76struct mt7921_vif;
77struct mt7921_sta;
78
79enum mt7921_txq_id {
80 MT7921_TXQ_BAND0,

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

339}
340
341static inline void mt7921_mcu_tx_cleanup(struct mt7921_dev *dev)
342{
343 mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[MT_MCUQ_WM], false);
344 mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[MT_MCUQ_WA], false);
345}
346
347static inline void mt7921_skb_add_sdio_hdr(struct sk_buff *skb,
348 enum mt7921_sdio_pkt_type type)
349{
350 u32 hdr;
351
352 hdr = FIELD_PREP(MT7921_SDIO_HDR_TX_BYTES, skb->len + sizeof(hdr)) |
353 FIELD_PREP(MT7921_SDIO_HDR_PKT_TYPE, type);
354
355 put_unaligned_le32(hdr, skb_push(skb, sizeof(hdr)));
356}
357
324int mt7921_mac_init(struct mt7921_dev *dev);
325bool mt7921_mac_wtbl_update(struct mt7921_dev *dev, int idx, u32 mask);
326void mt7921_mac_reset_counters(struct mt7921_phy *phy);
327void mt7921_mac_set_timing(struct mt7921_phy *phy);
328int mt7921_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
329 struct ieee80211_sta *sta);
330void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
331 struct ieee80211_sta *sta);

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

389
390void mt7921e_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
391 struct sk_buff *skb);
392int mt7921e_mac_reset(struct mt7921_dev *dev);
393int mt7921e_mcu_init(struct mt7921_dev *dev);
394int mt7921e_mcu_drv_pmctrl(struct mt7921_dev *dev);
395int mt7921e_mcu_fw_pmctrl(struct mt7921_dev *dev);
396
358int mt7921_mac_init(struct mt7921_dev *dev);
359bool mt7921_mac_wtbl_update(struct mt7921_dev *dev, int idx, u32 mask);
360void mt7921_mac_reset_counters(struct mt7921_phy *phy);
361void mt7921_mac_set_timing(struct mt7921_phy *phy);
362int mt7921_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
363 struct ieee80211_sta *sta);
364void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
365 struct ieee80211_sta *sta);

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

423
424void mt7921e_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
425 struct sk_buff *skb);
426int mt7921e_mac_reset(struct mt7921_dev *dev);
427int mt7921e_mcu_init(struct mt7921_dev *dev);
428int mt7921e_mcu_drv_pmctrl(struct mt7921_dev *dev);
429int mt7921e_mcu_fw_pmctrl(struct mt7921_dev *dev);
430
431int mt7921s_mcu_init(struct mt7921_dev *dev);
432int mt7921s_mcu_drv_pmctrl(struct mt7921_dev *dev);
433int mt7921s_mcu_fw_pmctrl(struct mt7921_dev *dev);
434int mt7921s_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
435 enum mt76_txq_id qid, struct mt76_wcid *wcid,
436 struct ieee80211_sta *sta,
437 struct mt76_tx_info *tx_info);
438void mt7921s_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue_entry *e);
439bool mt7921s_tx_status_data(struct mt76_dev *mdev, u8 *update);
397#endif
440#endif