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 <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Sean Wang
2026-02-21 09:29:41 +00:00
committed by Felix Fietkau
parent 36c59c31bf
commit f1c3200333
6 changed files with 25 additions and 25 deletions
+1 -1
View File
@@ -187,7 +187,7 @@ static inline bool is_mt7922(struct mt76_dev *dev)
return mt76_chip(dev) == 0x7922; 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); return mt76_chip(dev) == 0x7961 || is_mt7922(dev) || is_mt7920(dev);
} }
+8 -8
View File
@@ -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); 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; last_mask = MT_TXD_LEN_LAST;
else else
last_mask = MT_TXD_LEN_AMSDU_LAST | last_mask = MT_TXD_LEN_AMSDU_LAST |
@@ -217,7 +217,7 @@ mt76_connac_txp_skb_unmap_hw(struct mt76_dev *dev,
u32 last_mask; u32 last_mask;
int i; 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; last_mask = MT_TXD_LEN_LAST;
else else
last_mask = MT_TXD_LEN_MSDU_LAST; 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; chandef = mvif->ctx ? &mvif->ctx->def : &mphy->chandef;
band = chandef->chan->band; band = chandef->chan->band;
if (is_mt7921(mphy->dev)) { if (is_connac2(mphy->dev)) {
rateidx = ffs(conf->basic_rates) - 1; rateidx = ffs(conf->basic_rates) - 1;
goto legacy; goto legacy;
} }
@@ -547,7 +547,7 @@ void mt76_connac2_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
val = MT_TXD1_LONG_FORMAT | val = MT_TXD1_LONG_FORMAT |
FIELD_PREP(MT_TXD1_WLAN_IDX, wcid->idx) | FIELD_PREP(MT_TXD1_WLAN_IDX, wcid->idx) |
FIELD_PREP(MT_TXD1_OWN_MAC, omac_idx); FIELD_PREP(MT_TXD1_OWN_MAC, omac_idx);
if (!is_mt7921(dev)) if (!is_connac2(dev))
val |= MT_TXD1_VTA; val |= MT_TXD1_VTA;
if (phy_idx || band_idx) if (phy_idx || band_idx)
val |= MT_TXD1_TGID; val |= MT_TXD1_TGID;
@@ -556,7 +556,7 @@ void mt76_connac2_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
txwi[2] = 0; txwi[2] = 0;
val = FIELD_PREP(MT_TXD3_REM_TX_COUNT, 15); val = FIELD_PREP(MT_TXD3_REM_TX_COUNT, 15);
if (!is_mt7921(dev)) if (!is_connac2(dev))
val |= MT_TXD3_SW_POWER_MGMT; val |= MT_TXD3_SW_POWER_MGMT;
if (key) if (key)
val |= MT_TXD3_PROTECT_FRAME; val |= MT_TXD3_PROTECT_FRAME;
@@ -598,7 +598,7 @@ void mt76_connac2_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
txwi[6] |= cpu_to_le32(val); txwi[6] |= cpu_to_le32(val);
txwi[3] |= cpu_to_le32(MT_TXD3_BA_DISABLE); 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); u8 spe_idx = mt76_connac_spe_idx(mphy->antenna_mask);
if (!spe_idx) if (!spe_idx)
@@ -830,7 +830,7 @@ mt76_connac2_mac_decode_he_mu_radiotap(struct mt76_dev *dev, struct sk_buff *skb
}; };
struct ieee80211_radiotap_he_mu *he_mu; 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.flags1 |= HE_BITS(MU_FLAGS1_SIG_B_COMP_KNOWN);
mu_known.flags2 |= HE_BITS(MU_FLAGS2_PUNC_FROM_SIG_A_BW_KNOWN); mu_known.flags2 |= HE_BITS(MU_FLAGS2_PUNC_FROM_SIG_A_BW_KNOWN);
} }
@@ -1046,7 +1046,7 @@ int mt76_connac2_mac_fill_rx_rate(struct mt76_dev *dev,
stbc = FIELD_GET(MT_PRXV_HT_STBC, v0); stbc = FIELD_GET(MT_PRXV_HT_STBC, v0);
gi = FIELD_GET(MT_PRXV_HT_SGI, v0); gi = FIELD_GET(MT_PRXV_HT_SGI, v0);
*mode = FIELD_GET(MT_PRXV_TX_MODE, v0); *mode = FIELD_GET(MT_PRXV_TX_MODE, v0);
if (is_mt7921(dev)) if (is_connac2(dev))
dcm = !!(idx & MT_PRXV_TX_DCM); dcm = !!(idx & MT_PRXV_TX_DCM);
else else
dcm = FIELD_GET(MT_PRXV_DCM, v0); dcm = FIELD_GET(MT_PRXV_DCM, v0);
+13 -13
View File
@@ -65,7 +65,7 @@ int mt76_connac_mcu_init_download(struct mt76_dev *dev, u32 addr, u32 len,
int cmd; int cmd;
if ((!is_connac_v1(dev) && addr == MCU_PATCH_ADDRESS) || 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_mt7925(dev) && (addr == 0x900000 || addr == 0xe0002800)) ||
(is_mt799x(dev) && addr == 0x900000)) (is_mt799x(dev) && addr == 0x900000))
cmd = MCU_CMD(PATCH_START_REQ); 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) { switch (vif->type) {
case NL80211_IFTYPE_MESH_POINT: case NL80211_IFTYPE_MESH_POINT:
case NL80211_IFTYPE_AP: case NL80211_IFTYPE_AP:
if (vif->p2p && !is_mt7921(dev)) if (vif->p2p && !is_connac2(dev))
conn_type = CONNECTION_P2P_GC; conn_type = CONNECTION_P2P_GC;
else else
conn_type = CONNECTION_INFRA_STA; 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); basic->aid = cpu_to_le16(link_sta->sta->aid);
break; break;
case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_STATION:
if (vif->p2p && !is_mt7921(dev)) if (vif->p2p && !is_connac2(dev))
conn_type = CONNECTION_P2P_GO; conn_type = CONNECTION_P2P_GO;
else else
conn_type = CONNECTION_INFRA_AP; 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; struct sta_rec_vht *vht;
int len; 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); tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_VHT, len);
vht = (struct sta_rec_vht *)tlv; vht = (struct sta_rec_vht *)tlv;
vht->vht_cap = cpu_to_le32(sta->deflink.vht_cap.cap); 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 */ /* starec uapsd */
mt76_connac_mcu_sta_uapsd(skb, vif, sta); mt76_connac_mcu_sta_uapsd(skb, vif, sta);
if (!is_mt7921(dev)) if (!is_connac2(dev))
return; return;
if (sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he) 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->ssid_type_ext = n_ssids ? BIT(0) : 0;
req->ssids_num = n_ssids; 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 */ /* increase channel time for passive scan */
if (!sreq->n_ssids) if (!sreq->n_ssids)
duration *= 2; 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); 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; req->scan_func |= SCAN_FUNC_SPLIT_SCAN;
memcpy(req->bssid, sreq->bssid, ETH_ALEN); 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, get_random_mask_addr(addr, sreq->mac_addr,
sreq->mac_addr_mask); sreq->mac_addr_mask);
} }
if (is_mt7921(phy->dev)) { if (is_connac2(phy->dev)) {
req->mt7921.bss_idx = mvif->idx; req->mt7921.bss_idx = mvif->idx;
req->mt7921.delay = cpu_to_le32(sreq->delay); 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, struct mt76_power_limits *limits,
enum nl80211_band band) 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); int i, offset = sizeof(limits->cck);
memset(sku, max_power, MT_SKU_POWER_LIMIT); 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; offset += 12;
} }
if (!is_mt7921(dev)) if (!is_connac2(dev))
return; return;
/* he */ /* he */
@@ -2121,7 +2121,7 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
enum nl80211_band band) enum nl80211_band band)
{ {
struct mt76_dev *dev = phy->dev; 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[] = { static const u8 chan_list_2ghz[] = {
1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14 8, 9, 10, 11, 12, 13, 14
@@ -2162,7 +2162,7 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
if (!limits) if (!limits)
return -ENOMEM; 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; tx_power = 2 * phy->hw->conf.power_level;
if (!tx_power) if (!tx_power)
tx_power = 127; 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; 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; return mode;
switch (FIELD_GET(PATCH_SEC_ENC_TYPE_MASK, info)) { switch (FIELD_GET(PATCH_SEC_ENC_TYPE_MASK, info)) {
+1 -1
View File
@@ -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 ? ret |= feature_set & FW_FEATURE_SET_ENCRYPT ?
DL_MODE_ENCRYPT | DL_MODE_RESET_SEC_IV : 0; 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 ? ret |= feature_set & FW_FEATURE_ENCRY_MODE ?
DL_CONFIG_ENCRY_MODE_SEL : 0; DL_CONFIG_ENCRY_MODE_SEL : 0;
ret |= FIELD_PREP(DL_MODE_KEY_IDX, ret |= FIELD_PREP(DL_MODE_KEY_IDX,
+1 -1
View File
@@ -151,7 +151,7 @@ void mt792x_stop(struct ieee80211_hw *hw, bool suspend)
cancel_work_sync(&dev->reset_work); cancel_work_sync(&dev->reset_work);
mt76_connac_free_pending_tx_skbs(&dev->pm, NULL); mt76_connac_free_pending_tx_skbs(&dev->pm, NULL);
if (is_mt7921(&dev->mt76)) { if (is_connac2(&dev->mt76)) {
mt792x_mutex_acquire(dev); mt792x_mutex_acquire(dev);
mt76_connac_mcu_set_mac_enable(&dev->mt76, 0, false, false); mt76_connac_mcu_set_mac_enable(&dev->mt76, 0, false, false);
mt792x_mutex_release(dev); mt792x_mutex_release(dev);
+1 -1
View File
@@ -356,7 +356,7 @@ EXPORT_SYMBOL_GPL(mt792x_poll_rx);
int mt792x_wfsys_reset(struct mt792x_dev *dev) 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); mt76_clear(dev, addr, WFSYS_SW_RST_B);
msleep(50); msleep(50);