Commit 2bed2a3e authored by Felix Fietkau's avatar Felix Fietkau

mt76: mt7615: rework chainmask handling

Move chainmask to struct mt7615_phy and instead of needlessly making the
format similar to values for older chips, make it refer to the actual chain
bits used for the rx/tx path.
This is important for multiple wiphy support, where for a secondary phy,
antenna_mask will start at 0, and chainmask will start at the chain offset
(bit 2)
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 5dabdf71
...@@ -125,8 +125,8 @@ static void mt7615_eeprom_parse_hw_cap(struct mt7615_dev *dev) ...@@ -125,8 +125,8 @@ static void mt7615_eeprom_parse_hw_cap(struct mt7615_dev *dev)
if (!tx_mask || tx_mask > max_nss) if (!tx_mask || tx_mask > max_nss)
tx_mask = max_nss; tx_mask = max_nss;
dev->chainmask = tx_mask << 8 | rx_mask;
dev->mphy.antenna_mask = BIT(tx_mask) - 1; dev->mphy.antenna_mask = BIT(tx_mask) - 1;
dev->phy.chainmask = dev->mphy.antenna_mask;
} }
int mt7615_eeprom_get_power_index(struct mt7615_dev *dev, int mt7615_eeprom_get_power_index(struct mt7615_dev *dev,
......
...@@ -1304,6 +1304,7 @@ int mt7615_mcu_set_channel(struct mt7615_phy *phy) ...@@ -1304,6 +1304,7 @@ int mt7615_mcu_set_channel(struct mt7615_phy *phy)
struct mt7615_dev *dev = phy->dev; struct mt7615_dev *dev = phy->dev;
struct cfg80211_chan_def *chandef = &phy->mt76->chandef; struct cfg80211_chan_def *chandef = &phy->mt76->chandef;
int freq1 = chandef->center_freq1, freq2 = chandef->center_freq2; int freq1 = chandef->center_freq1, freq2 = chandef->center_freq2;
u8 n_chains = hweight8(phy->mt76->antenna_mask);
struct { struct {
u8 control_chan; u8 control_chan;
u8 center_chan; u8 center_chan;
...@@ -1325,8 +1326,8 @@ int mt7615_mcu_set_channel(struct mt7615_phy *phy) ...@@ -1325,8 +1326,8 @@ int mt7615_mcu_set_channel(struct mt7615_phy *phy)
} req = { } req = {
.control_chan = chandef->chan->hw_value, .control_chan = chandef->chan->hw_value,
.center_chan = ieee80211_frequency_to_channel(freq1), .center_chan = ieee80211_frequency_to_channel(freq1),
.tx_streams = (dev->chainmask >> 8) & 0xf, .tx_streams = n_chains,
.rx_streams_mask = dev->mphy.antenna_mask, .rx_streams_mask = n_chains,
.center_chan2 = ieee80211_frequency_to_channel(freq2), .center_chan2 = ieee80211_frequency_to_channel(freq2),
}; };
int ret; int ret;
...@@ -1373,6 +1374,8 @@ int mt7615_mcu_set_channel(struct mt7615_phy *phy) ...@@ -1373,6 +1374,8 @@ int mt7615_mcu_set_channel(struct mt7615_phy *phy)
if (ret) if (ret)
return ret; return ret;
req.rx_streams_mask = phy->chainmask;
return __mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_SET_RX_PATH, return __mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_SET_RX_PATH,
&req, sizeof(req), true); &req, sizeof(req), true);
} }
......
...@@ -90,6 +90,8 @@ struct mt7615_phy { ...@@ -90,6 +90,8 @@ struct mt7615_phy {
s8 ofdm_sensitivity; s8 ofdm_sensitivity;
s8 cck_sensitivity; s8 cck_sensitivity;
u16 chainmask;
u8 rdd_state; u8 rdd_state;
int dfs_state; int dfs_state;
}; };
...@@ -101,7 +103,6 @@ struct mt7615_dev { ...@@ -101,7 +103,6 @@ struct mt7615_dev {
}; };
struct mt7615_phy phy; struct mt7615_phy phy;
u16 chainmask;
u32 vif_mask; u32 vif_mask;
u32 omac_mask; u32 omac_mask;
......
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