mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 08:33:17 +02:00
wifi: mt76: connac: use is_connac2() to replace is_mt7921() checks
Unify all per-chip conditionals under the new is_connac2() helper. This avoids confusion caused by the previous is_mt7921() check, which implicitly covered multiple connac2 chipsets and no longer reflected its actual scope. This is a clean-up only change with no functional impact. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Link: https://patch.msgid.link/20260219004007.19733-1-sean.wang@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
fa1063fc64
commit
5c81a4f182
|
|
@ -187,7 +187,7 @@ static inline bool is_mt7922(struct mt76_dev *dev)
|
|||
return mt76_chip(dev) == 0x7922;
|
||||
}
|
||||
|
||||
static inline bool is_mt7921(struct mt76_dev *dev)
|
||||
static inline bool is_connac2(struct mt76_dev *dev)
|
||||
{
|
||||
return mt76_chip(dev) == 0x7961 || is_mt7922(dev) || is_mt7920(dev);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ void mt76_connac_write_hw_txp(struct mt76_dev *dev,
|
|||
|
||||
txp->msdu_id[0] = cpu_to_le16(id | MT_MSDU_ID_VALID);
|
||||
|
||||
if (is_mt7663(dev) || is_mt7921(dev) || is_mt7925(dev))
|
||||
if (is_mt7663(dev) || is_connac2(dev) || is_mt7925(dev))
|
||||
last_mask = MT_TXD_LEN_LAST;
|
||||
else
|
||||
last_mask = MT_TXD_LEN_AMSDU_LAST |
|
||||
|
|
@ -217,7 +217,7 @@ mt76_connac_txp_skb_unmap_hw(struct mt76_dev *dev,
|
|||
u32 last_mask;
|
||||
int i;
|
||||
|
||||
if (is_mt7663(dev) || is_mt7921(dev) || is_mt7925(dev))
|
||||
if (is_mt7663(dev) || is_connac2(dev) || is_mt7925(dev))
|
||||
last_mask = MT_TXD_LEN_LAST;
|
||||
else
|
||||
last_mask = MT_TXD_LEN_MSDU_LAST;
|
||||
|
|
@ -309,7 +309,7 @@ u16 mt76_connac2_mac_tx_rate_val(struct mt76_phy *mphy,
|
|||
chandef = mvif->ctx ? &mvif->ctx->def : &mphy->chandef;
|
||||
band = chandef->chan->band;
|
||||
|
||||
if (is_mt7921(mphy->dev)) {
|
||||
if (is_connac2(mphy->dev)) {
|
||||
rateidx = ffs(conf->basic_rates) - 1;
|
||||
goto legacy;
|
||||
}
|
||||
|
|
@ -548,7 +548,7 @@ void mt76_connac2_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
|
|||
val = MT_TXD1_LONG_FORMAT |
|
||||
FIELD_PREP(MT_TXD1_WLAN_IDX, wcid->idx) |
|
||||
FIELD_PREP(MT_TXD1_OWN_MAC, omac_idx);
|
||||
if (!is_mt7921(dev))
|
||||
if (!is_connac2(dev))
|
||||
val |= MT_TXD1_VTA;
|
||||
if (phy_idx || band_idx)
|
||||
val |= MT_TXD1_TGID;
|
||||
|
|
@ -557,7 +557,7 @@ void mt76_connac2_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
|
|||
txwi[2] = 0;
|
||||
|
||||
val = FIELD_PREP(MT_TXD3_REM_TX_COUNT, 15);
|
||||
if (!is_mt7921(dev))
|
||||
if (!is_connac2(dev))
|
||||
val |= MT_TXD3_SW_POWER_MGMT;
|
||||
if (key)
|
||||
val |= MT_TXD3_PROTECT_FRAME;
|
||||
|
|
@ -599,7 +599,7 @@ void mt76_connac2_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
|
|||
txwi[6] |= cpu_to_le32(val);
|
||||
txwi[3] |= cpu_to_le32(MT_TXD3_BA_DISABLE);
|
||||
|
||||
if (!is_mt7921(dev)) {
|
||||
if (!is_connac2(dev)) {
|
||||
u8 spe_idx = mt76_connac_spe_idx(mphy->antenna_mask);
|
||||
|
||||
if (!spe_idx)
|
||||
|
|
@ -831,7 +831,7 @@ mt76_connac2_mac_decode_he_mu_radiotap(struct mt76_dev *dev, struct sk_buff *skb
|
|||
};
|
||||
struct ieee80211_radiotap_he_mu *he_mu;
|
||||
|
||||
if (is_mt7921(dev)) {
|
||||
if (is_connac2(dev)) {
|
||||
mu_known.flags1 |= HE_BITS(MU_FLAGS1_SIG_B_COMP_KNOWN);
|
||||
mu_known.flags2 |= HE_BITS(MU_FLAGS2_PUNC_FROM_SIG_A_BW_KNOWN);
|
||||
}
|
||||
|
|
@ -1047,7 +1047,7 @@ int mt76_connac2_mac_fill_rx_rate(struct mt76_dev *dev,
|
|||
stbc = FIELD_GET(MT_PRXV_HT_STBC, v0);
|
||||
gi = FIELD_GET(MT_PRXV_HT_SGI, v0);
|
||||
*mode = FIELD_GET(MT_PRXV_TX_MODE, v0);
|
||||
if (is_mt7921(dev))
|
||||
if (is_connac2(dev))
|
||||
dcm = !!(idx & MT_PRXV_TX_DCM);
|
||||
else
|
||||
dcm = FIELD_GET(MT_PRXV_DCM, v0);
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ int mt76_connac_mcu_init_download(struct mt76_dev *dev, u32 addr, u32 len,
|
|||
int cmd;
|
||||
|
||||
if ((!is_connac_v1(dev) && addr == MCU_PATCH_ADDRESS) ||
|
||||
(is_mt7921(dev) && addr == 0x900000) ||
|
||||
(is_connac2(dev) && addr == 0x900000) ||
|
||||
(is_mt7925(dev) && (addr == 0x900000 || addr == 0xe0002800)) ||
|
||||
(is_mt799x(dev) && addr == 0x900000))
|
||||
cmd = MCU_CMD(PATCH_START_REQ);
|
||||
|
|
@ -402,7 +402,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
|
|||
switch (vif->type) {
|
||||
case NL80211_IFTYPE_MESH_POINT:
|
||||
case NL80211_IFTYPE_AP:
|
||||
if (vif->p2p && !is_mt7921(dev))
|
||||
if (vif->p2p && !is_connac2(dev))
|
||||
conn_type = CONNECTION_P2P_GC;
|
||||
else
|
||||
conn_type = CONNECTION_INFRA_STA;
|
||||
|
|
@ -410,7 +410,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
|
|||
basic->aid = cpu_to_le16(link_sta->sta->aid);
|
||||
break;
|
||||
case NL80211_IFTYPE_STATION:
|
||||
if (vif->p2p && !is_mt7921(dev))
|
||||
if (vif->p2p && !is_connac2(dev))
|
||||
conn_type = CONNECTION_P2P_GO;
|
||||
else
|
||||
conn_type = CONNECTION_INFRA_AP;
|
||||
|
|
@ -874,7 +874,7 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
|
|||
struct sta_rec_vht *vht;
|
||||
int len;
|
||||
|
||||
len = is_mt7921(dev) ? sizeof(*vht) : sizeof(*vht) - 4;
|
||||
len = is_connac2(dev) ? sizeof(*vht) : sizeof(*vht) - 4;
|
||||
tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_VHT, len);
|
||||
vht = (struct sta_rec_vht *)tlv;
|
||||
vht->vht_cap = cpu_to_le32(sta->deflink.vht_cap.cap);
|
||||
|
|
@ -885,7 +885,7 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
|
|||
/* starec uapsd */
|
||||
mt76_connac_mcu_sta_uapsd(skb, vif, sta);
|
||||
|
||||
if (!is_mt7921(dev))
|
||||
if (!is_connac2(dev))
|
||||
return;
|
||||
|
||||
if (sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he)
|
||||
|
|
@ -1778,7 +1778,7 @@ int mt76_connac_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
|
|||
req->ssid_type_ext = n_ssids ? BIT(0) : 0;
|
||||
req->ssids_num = n_ssids;
|
||||
|
||||
duration = is_mt7921(phy->dev) ? 0 : MT76_CONNAC_SCAN_CHANNEL_TIME;
|
||||
duration = is_connac2(phy->dev) ? 0 : MT76_CONNAC_SCAN_CHANNEL_TIME;
|
||||
/* increase channel time for passive scan */
|
||||
if (!sreq->n_ssids)
|
||||
duration *= 2;
|
||||
|
|
@ -1821,7 +1821,7 @@ int mt76_connac_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
|
|||
req->ies_len = cpu_to_le16(sreq->ie_len);
|
||||
}
|
||||
|
||||
if (is_mt7921(phy->dev))
|
||||
if (is_connac2(phy->dev))
|
||||
req->scan_func |= SCAN_FUNC_SPLIT_SCAN;
|
||||
|
||||
memcpy(req->bssid, sreq->bssid, ETH_ALEN);
|
||||
|
|
@ -1897,7 +1897,7 @@ int mt76_connac_mcu_sched_scan_req(struct mt76_phy *phy,
|
|||
get_random_mask_addr(addr, sreq->mac_addr,
|
||||
sreq->mac_addr_mask);
|
||||
}
|
||||
if (is_mt7921(phy->dev)) {
|
||||
if (is_connac2(phy->dev)) {
|
||||
req->mt7921.bss_idx = mvif->idx;
|
||||
req->mt7921.delay = cpu_to_le32(sreq->delay);
|
||||
}
|
||||
|
|
@ -2037,7 +2037,7 @@ mt76_connac_mcu_build_sku(struct mt76_dev *dev, s8 *sku,
|
|||
struct mt76_power_limits *limits,
|
||||
enum nl80211_band band)
|
||||
{
|
||||
int max_power = is_mt7921(dev) ? 127 : 63;
|
||||
int max_power = is_connac2(dev) ? 127 : 63;
|
||||
int i, offset = sizeof(limits->cck);
|
||||
|
||||
memset(sku, max_power, MT_SKU_POWER_LIMIT);
|
||||
|
|
@ -2065,7 +2065,7 @@ mt76_connac_mcu_build_sku(struct mt76_dev *dev, s8 *sku,
|
|||
offset += 12;
|
||||
}
|
||||
|
||||
if (!is_mt7921(dev))
|
||||
if (!is_connac2(dev))
|
||||
return;
|
||||
|
||||
/* he */
|
||||
|
|
@ -2121,7 +2121,7 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
|
|||
enum nl80211_band band)
|
||||
{
|
||||
struct mt76_dev *dev = phy->dev;
|
||||
int sku_len, batch_len = is_mt7921(dev) ? 8 : 16;
|
||||
int sku_len, batch_len = is_connac2(dev) ? 8 : 16;
|
||||
static const u8 chan_list_2ghz[] = {
|
||||
1, 2, 3, 4, 5, 6, 7,
|
||||
8, 9, 10, 11, 12, 13, 14
|
||||
|
|
@ -2162,7 +2162,7 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
|
|||
if (!limits)
|
||||
return -ENOMEM;
|
||||
|
||||
sku_len = is_mt7921(dev) ? sizeof(sku_tlbv) : sizeof(sku_tlbv) - 92;
|
||||
sku_len = is_connac2(dev) ? sizeof(sku_tlbv) : sizeof(sku_tlbv) - 92;
|
||||
tx_power = 2 * phy->hw->conf.power_level;
|
||||
if (!tx_power)
|
||||
tx_power = 127;
|
||||
|
|
@ -3080,7 +3080,7 @@ static u32 mt76_connac2_get_data_mode(struct mt76_dev *dev, u32 info)
|
|||
{
|
||||
u32 mode = DL_MODE_NEED_RSP;
|
||||
|
||||
if ((!is_mt7921(dev) && !is_mt7925(dev)) || info == PATCH_SEC_NOT_SUPPORT)
|
||||
if ((!is_connac2(dev) && !is_mt7925(dev)) || info == PATCH_SEC_NOT_SUPPORT)
|
||||
return mode;
|
||||
|
||||
switch (FIELD_GET(PATCH_SEC_ENC_TYPE_MASK, info)) {
|
||||
|
|
|
|||
|
|
@ -1867,7 +1867,7 @@ mt76_connac_mcu_gen_dl_mode(struct mt76_dev *dev, u8 feature_set, bool is_wa)
|
|||
|
||||
ret |= feature_set & FW_FEATURE_SET_ENCRYPT ?
|
||||
DL_MODE_ENCRYPT | DL_MODE_RESET_SEC_IV : 0;
|
||||
if (is_mt7921(dev) || is_mt7925(dev))
|
||||
if (is_connac2(dev) || is_mt7925(dev))
|
||||
ret |= feature_set & FW_FEATURE_ENCRY_MODE ?
|
||||
DL_CONFIG_ENCRY_MODE_SEL : 0;
|
||||
ret |= FIELD_PREP(DL_MODE_KEY_IDX,
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ void mt792x_stop(struct ieee80211_hw *hw, bool suspend)
|
|||
cancel_work_sync(&dev->reset_work);
|
||||
mt76_connac_free_pending_tx_skbs(&dev->pm, NULL);
|
||||
|
||||
if (is_mt7921(&dev->mt76)) {
|
||||
if (is_connac2(&dev->mt76)) {
|
||||
mt792x_mutex_acquire(dev);
|
||||
mt76_connac_mcu_set_mac_enable(&dev->mt76, 0, false, false);
|
||||
mt792x_mutex_release(dev);
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ EXPORT_SYMBOL_GPL(mt792x_poll_rx);
|
|||
|
||||
int mt792x_wfsys_reset(struct mt792x_dev *dev)
|
||||
{
|
||||
u32 addr = is_mt7921(&dev->mt76) ? 0x18000140 : 0x7c000140;
|
||||
u32 addr = is_connac2(&dev->mt76) ? 0x18000140 : 0x7c000140;
|
||||
|
||||
mt76_clear(dev, addr, WFSYS_SW_RST_B);
|
||||
msleep(50);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user