Commit b9027e08 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau
Browse files

mt76: move chainmask in mt76_phy



Move chainmask from driver phy to mt76_phy since it is used by all
drivers. This is a preliminary patch to create a common mcu library used
by mt7615 and mt7921 drivers

Co-developed-by: default avatarSean Wang <sean.wang@mediatek.com>
Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent a782f8bf
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -579,6 +579,7 @@ struct mt76_phy {


	int txpower_cur;
	int txpower_cur;
	u8 antenna_mask;
	u8 antenna_mask;
	u16 chainmask;


#ifdef CONFIG_NL80211_TESTMODE
#ifdef CONFIG_NL80211_TESTMODE
	struct mt76_testmode_data test;
	struct mt76_testmode_data test;
+1 −1
Original line number Original line Diff line number Diff line
@@ -161,7 +161,7 @@ static void mt7615_eeprom_parse_hw_cap(struct mt7615_dev *dev)


	dev->chainmask = BIT(tx_mask) - 1;
	dev->chainmask = BIT(tx_mask) - 1;
	dev->mphy.antenna_mask = dev->chainmask;
	dev->mphy.antenna_mask = dev->chainmask;
	dev->phy.chainmask = dev->chainmask;
	dev->mphy.chainmask = dev->chainmask;
}
}


static int mt7663_eeprom_get_target_power_index(struct mt7615_dev *dev,
static int mt7663_eeprom_get_target_power_index(struct mt7615_dev *dev,
+6 −6
Original line number Original line Diff line number Diff line
@@ -362,9 +362,9 @@ mt7615_cap_dbdc_enable(struct mt7615_dev *dev)
		dev->mphy.antenna_mask = dev->chainmask >> 2;
		dev->mphy.antenna_mask = dev->chainmask >> 2;
	else
	else
		dev->mphy.antenna_mask = dev->chainmask >> 1;
		dev->mphy.antenna_mask = dev->chainmask >> 1;
	dev->phy.chainmask = dev->mphy.antenna_mask;
	dev->mphy.chainmask = dev->mphy.antenna_mask;
	dev->mphy.hw->wiphy->available_antennas_rx = dev->phy.chainmask;
	dev->mphy.hw->wiphy->available_antennas_rx = dev->mphy.chainmask;
	dev->mphy.hw->wiphy->available_antennas_tx = dev->phy.chainmask;
	dev->mphy.hw->wiphy->available_antennas_tx = dev->mphy.chainmask;
	mt76_set_stream_caps(&dev->mphy, true);
	mt76_set_stream_caps(&dev->mphy, true);
}
}


@@ -375,7 +375,7 @@ mt7615_cap_dbdc_disable(struct mt7615_dev *dev)
			IEEE80211_VHT_CAP_SHORT_GI_160 |
			IEEE80211_VHT_CAP_SHORT_GI_160 |
			IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ;
			IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ;
	dev->mphy.antenna_mask = dev->chainmask;
	dev->mphy.antenna_mask = dev->chainmask;
	dev->phy.chainmask = dev->chainmask;
	dev->mphy.chainmask = dev->chainmask;
	dev->mphy.hw->wiphy->available_antennas_rx = dev->chainmask;
	dev->mphy.hw->wiphy->available_antennas_rx = dev->chainmask;
	dev->mphy.hw->wiphy->available_antennas_tx = dev->chainmask;
	dev->mphy.hw->wiphy->available_antennas_tx = dev->chainmask;
	mt76_set_stream_caps(&dev->mphy, true);
	mt76_set_stream_caps(&dev->mphy, true);
@@ -404,8 +404,8 @@ int mt7615_register_ext_phy(struct mt7615_dev *dev)
	phy = mphy->priv;
	phy = mphy->priv;
	phy->dev = dev;
	phy->dev = dev;
	phy->mt76 = mphy;
	phy->mt76 = mphy;
	phy->chainmask = dev->chainmask & ~dev->phy.chainmask;
	mphy->chainmask = dev->chainmask & ~dev->mphy.chainmask;
	mphy->antenna_mask = BIT(hweight8(phy->chainmask)) - 1;
	mphy->antenna_mask = BIT(hweight8(mphy->chainmask)) - 1;
	mt7615_init_wiphy(mphy->hw);
	mt7615_init_wiphy(mphy->hw);


	INIT_DELAYED_WORK(&mphy->mac_work, mt7615_mac_work);
	INIT_DELAYED_WORK(&mphy->mac_work, mt7615_mac_work);
+1 −1
Original line number Original line Diff line number Diff line
@@ -326,7 +326,7 @@ static int mt7615_mac_fill_rx(struct mt7615_dev *dev, struct sk_buff *skb)
		 * that PHY.
		 * that PHY.
		 */
		 */
		if (phy_idx < 0) {
		if (phy_idx < 0) {
			int first_chain = ffs(phy2->chainmask) - 1;
			int first_chain = ffs(phy2->mt76->chainmask) - 1;


			phy_idx = ((rxdg5 >> (first_chain * 8)) & 0xff) == 0;
			phy_idx = ((rxdg5 >> (first_chain * 8)) & 0xff) == 0;
		}
		}
+1 −1
Original line number Original line Diff line number Diff line
@@ -911,7 +911,7 @@ mt7615_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
		else
		else
			tx_ant <<= 1;
			tx_ant <<= 1;
	}
	}
	phy->chainmask = tx_ant;
	phy->mt76->chainmask = tx_ant;


	mt76_set_stream_caps(phy->mt76, true);
	mt76_set_stream_caps(phy->mt76, true);


Loading