Commit 8910a4e5 authored by Sean Wang's avatar Sean Wang Committed by Felix Fietkau

mt76: mt7921: add MT7921_COMMON module

This is a preliminary patch to introduce mt7921s support.

MT7921_COMMON module grouping bus independent objects the both mt7921e and
mt7921s can share with and have to rely on.
Tested-by: default avatarDeren Wu <deren.wu@mediatek.com>
Acked-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 033ae79b
# SPDX-License-Identifier: ISC # SPDX-License-Identifier: ISC
config MT7921E config MT7921_COMMON
tristate "MediaTek MT7921E (PCIe) support" tristate
select MT76_CONNAC_LIB select MT76_CONNAC_LIB
select WANT_DEV_COREDUMP select WANT_DEV_COREDUMP
config MT7921E
tristate "MediaTek MT7921E (PCIe) support"
select MT7921_COMMON
depends on MAC80211 depends on MAC80211
depends on PCI depends on PCI
help help
......
# SPDX-License-Identifier: ISC # SPDX-License-Identifier: ISC
obj-$(CONFIG_MT7921_COMMON) += mt7921-common.o
obj-$(CONFIG_MT7921E) += mt7921e.o obj-$(CONFIG_MT7921E) += mt7921e.o
CFLAGS_trace.o := -I$(src) CFLAGS_trace.o := -I$(src)
mt7921e-y := pci.o pci_mac.o pci_mcu.o mac.o mcu.o dma.o eeprom.o main.o \ mt7921-common-y := mac.o mcu.o eeprom.o main.o init.o debugfs.o trace.o
init.o debugfs.o trace.o mt7921-common-$(CONFIG_NL80211_TESTMODE) += testmode.o
mt7921e-$(CONFIG_NL80211_TESTMODE) += testmode.o mt7921e-y := pci.o pci_mac.o pci_mcu.o dma.o
...@@ -145,6 +145,7 @@ int mt7921_mac_init(struct mt7921_dev *dev) ...@@ -145,6 +145,7 @@ int mt7921_mac_init(struct mt7921_dev *dev)
return mt76_connac_mcu_set_rts_thresh(&dev->mt76, 0x92b, 0); return mt76_connac_mcu_set_rts_thresh(&dev->mt76, 0x92b, 0);
} }
EXPORT_SYMBOL_GPL(mt7921_mac_init);
static int __mt7921_init_hardware(struct mt7921_dev *dev) static int __mt7921_init_hardware(struct mt7921_dev *dev)
{ {
...@@ -285,3 +286,4 @@ int mt7921_register_device(struct mt7921_dev *dev) ...@@ -285,3 +286,4 @@ int mt7921_register_device(struct mt7921_dev *dev)
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(mt7921_register_device);
...@@ -39,6 +39,7 @@ static struct mt76_wcid *mt7921_rx_get_wcid(struct mt7921_dev *dev, ...@@ -39,6 +39,7 @@ static struct mt76_wcid *mt7921_rx_get_wcid(struct mt7921_dev *dev,
void mt7921_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps) void mt7921_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps)
{ {
} }
EXPORT_SYMBOL_GPL(mt7921_sta_ps);
bool mt7921_mac_wtbl_update(struct mt7921_dev *dev, int idx, u32 mask) bool mt7921_mac_wtbl_update(struct mt7921_dev *dev, int idx, u32 mask)
{ {
...@@ -165,6 +166,7 @@ void mt7921_mac_sta_poll(struct mt7921_dev *dev) ...@@ -165,6 +166,7 @@ void mt7921_mac_sta_poll(struct mt7921_dev *dev)
} }
} }
} }
EXPORT_SYMBOL_GPL(mt7921_mac_sta_poll);
static void static void
mt7921_mac_decode_he_radiotap_ru(struct mt76_rx_status *status, mt7921_mac_decode_he_radiotap_ru(struct mt76_rx_status *status,
...@@ -916,6 +918,7 @@ void mt7921_mac_write_txwi(struct mt7921_dev *dev, __le32 *txwi, ...@@ -916,6 +918,7 @@ void mt7921_mac_write_txwi(struct mt7921_dev *dev, __le32 *txwi,
txwi[3] |= cpu_to_le32(MT_TXD3_BA_DISABLE); txwi[3] |= cpu_to_le32(MT_TXD3_BA_DISABLE);
} }
} }
EXPORT_SYMBOL_GPL(mt7921_mac_write_txwi);
void mt7921_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi) void mt7921_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi)
{ {
...@@ -940,6 +943,7 @@ void mt7921_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi) ...@@ -940,6 +943,7 @@ void mt7921_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi)
if (!test_and_set_bit(tid, &msta->ampdu_state)) if (!test_and_set_bit(tid, &msta->ampdu_state))
ieee80211_start_tx_ba_session(sta, tid, 0); ieee80211_start_tx_ba_session(sta, tid, 0);
} }
EXPORT_SYMBOL_GPL(mt7921_tx_check_aggr);
static bool static bool
mt7921_mac_add_txs_skb(struct mt7921_dev *dev, struct mt76_wcid *wcid, int pid, mt7921_mac_add_txs_skb(struct mt7921_dev *dev, struct mt76_wcid *wcid, int pid,
...@@ -1128,6 +1132,7 @@ void mt7921_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q, ...@@ -1128,6 +1132,7 @@ void mt7921_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
break; break;
} }
} }
EXPORT_SYMBOL_GPL(mt7921_queue_rx_skb);
void mt7921_mac_reset_counters(struct mt7921_phy *phy) void mt7921_mac_reset_counters(struct mt7921_phy *phy)
{ {
...@@ -1243,6 +1248,7 @@ void mt7921_update_channel(struct mt76_phy *mphy) ...@@ -1243,6 +1248,7 @@ void mt7921_update_channel(struct mt76_phy *mphy)
mt76_connac_power_save_sched(mphy, &dev->pm); mt76_connac_power_save_sched(mphy, &dev->pm);
} }
EXPORT_SYMBOL_GPL(mt7921_update_channel);
static void static void
mt7921_vif_connect_iter(void *priv, u8 *mac, mt7921_vif_connect_iter(void *priv, u8 *mac,
......
...@@ -237,6 +237,7 @@ int __mt7921_start(struct mt7921_phy *phy) ...@@ -237,6 +237,7 @@ int __mt7921_start(struct mt7921_phy *phy)
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(__mt7921_start);
static int mt7921_start(struct ieee80211_hw *hw) static int mt7921_start(struct ieee80211_hw *hw)
{ {
...@@ -646,6 +647,7 @@ int mt7921_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, ...@@ -646,6 +647,7 @@ int mt7921_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(mt7921_mac_sta_add);
void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif, void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta) struct ieee80211_sta *sta)
...@@ -667,6 +669,7 @@ void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif, ...@@ -667,6 +669,7 @@ void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
mt7921_mutex_release(dev); mt7921_mutex_release(dev);
} }
EXPORT_SYMBOL_GPL(mt7921_mac_sta_assoc);
void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta) struct ieee80211_sta *sta)
...@@ -698,6 +701,7 @@ void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, ...@@ -698,6 +701,7 @@ void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
mt76_connac_power_save_sched(&dev->mphy, &dev->pm); mt76_connac_power_save_sched(&dev->mphy, &dev->pm);
} }
EXPORT_SYMBOL_GPL(mt7921_mac_sta_remove);
void mt7921_tx_worker(struct mt76_worker *w) void mt7921_tx_worker(struct mt76_worker *w)
{ {
...@@ -1250,3 +1254,7 @@ const struct ieee80211_ops mt7921_ops = { ...@@ -1250,3 +1254,7 @@ const struct ieee80211_ops mt7921_ops = {
.flush = mt7921_flush, .flush = mt7921_flush,
.set_sar_specs = mt7921_set_sar_specs, .set_sar_specs = mt7921_set_sar_specs,
}; };
EXPORT_SYMBOL_GPL(mt7921_ops);
MODULE_LICENSE("Dual BSD/GPL");
MODULE_AUTHOR("Sean Wang <sean.wang@mediatek.com>");
...@@ -222,6 +222,7 @@ int mt7921_mcu_parse_response(struct mt76_dev *mdev, int cmd, ...@@ -222,6 +222,7 @@ int mt7921_mcu_parse_response(struct mt76_dev *mdev, int cmd,
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(mt7921_mcu_parse_response);
int mt7921_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb, int mt7921_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
int cmd, int *wait_seq) int cmd, int *wait_seq)
...@@ -319,6 +320,7 @@ int mt7921_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb, ...@@ -319,6 +320,7 @@ int mt7921_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
return mt76_tx_queue_skb_raw(dev, mdev->q_mcu[txq], skb, 0); return mt76_tx_queue_skb_raw(dev, mdev->q_mcu[txq], skb, 0);
} }
EXPORT_SYMBOL_GPL(mt7921_mcu_send_message);
static void static void
mt7921_mcu_scan_event(struct mt7921_dev *dev, struct sk_buff *skb) mt7921_mcu_scan_event(struct mt7921_dev *dev, struct sk_buff *skb)
...@@ -600,6 +602,7 @@ int mt7921_mcu_restart(struct mt76_dev *dev) ...@@ -600,6 +602,7 @@ int mt7921_mcu_restart(struct mt76_dev *dev)
return mt76_mcu_send_msg(dev, MCU_CMD_NIC_POWER_CTRL, &req, return mt76_mcu_send_msg(dev, MCU_CMD_NIC_POWER_CTRL, &req,
sizeof(req), false); sizeof(req), false);
} }
EXPORT_SYMBOL_GPL(mt7921_mcu_restart);
static u32 mt7921_get_data_mode(struct mt7921_dev *dev, u32 info) static u32 mt7921_get_data_mode(struct mt7921_dev *dev, u32 info)
{ {
...@@ -903,11 +906,13 @@ int mt7921_run_firmware(struct mt7921_dev *dev) ...@@ -903,11 +906,13 @@ int mt7921_run_firmware(struct mt7921_dev *dev)
return mt76_connac_mcu_get_nic_capability(&dev->mphy); return mt76_connac_mcu_get_nic_capability(&dev->mphy);
} }
EXPORT_SYMBOL_GPL(mt7921_run_firmware);
void mt7921_mcu_exit(struct mt7921_dev *dev) void mt7921_mcu_exit(struct mt7921_dev *dev)
{ {
skb_queue_purge(&dev->mt76.mcu.res_q); skb_queue_purge(&dev->mt76.mcu.res_q);
} }
EXPORT_SYMBOL_GPL(mt7921_mcu_exit);
int mt7921_mcu_set_tx(struct mt7921_dev *dev, struct ieee80211_vif *vif) int mt7921_mcu_set_tx(struct mt7921_dev *dev, struct ieee80211_vif *vif)
{ {
...@@ -1082,6 +1087,7 @@ int mt7921_mcu_set_eeprom(struct mt7921_dev *dev) ...@@ -1082,6 +1087,7 @@ int mt7921_mcu_set_eeprom(struct mt7921_dev *dev)
return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_EFUSE_BUFFER_MODE, return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_EFUSE_BUFFER_MODE,
&req, sizeof(req), true); &req, sizeof(req), true);
} }
EXPORT_SYMBOL_GPL(mt7921_mcu_set_eeprom);
int mt7921_mcu_get_eeprom(struct mt7921_dev *dev, u32 offset) int mt7921_mcu_get_eeprom(struct mt7921_dev *dev, u32 offset)
{ {
...@@ -1264,6 +1270,7 @@ int mt7921_mcu_drv_pmctrl(struct mt7921_dev *dev) ...@@ -1264,6 +1270,7 @@ int mt7921_mcu_drv_pmctrl(struct mt7921_dev *dev)
return err; return err;
} }
EXPORT_SYMBOL_GPL(mt7921_mcu_drv_pmctrl);
int mt7921_mcu_fw_pmctrl(struct mt7921_dev *dev) int mt7921_mcu_fw_pmctrl(struct mt7921_dev *dev)
{ {
...@@ -1285,6 +1292,7 @@ int mt7921_mcu_fw_pmctrl(struct mt7921_dev *dev) ...@@ -1285,6 +1292,7 @@ int mt7921_mcu_fw_pmctrl(struct mt7921_dev *dev)
return err; return err;
} }
EXPORT_SYMBOL_GPL(mt7921_mcu_fw_pmctrl);
int mt7921_mcu_set_beacon_filter(struct mt7921_dev *dev, int mt7921_mcu_set_beacon_filter(struct mt7921_dev *dev,
struct ieee80211_vif *vif, struct ieee80211_vif *vif,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment