Commit 6f917bba authored by Ryder Lee's avatar Ryder Lee Committed by Felix Fietkau

wifi: mt76: mt7915: fix band_idx usage

The commit 006b9d4a introduced phy->band_idx to accommodate the
band definition change for mt7986 so that the band_idx of main_phy
can be 0 or 1. Accordingly, the source of band_idx 1 has switched to
"phy != &dev->phy" or "dev->phy.band_idx = 1".

We still use ext_phy to represent band 1 somewhere in driver, so fix it.
Also, band_idx sounds more reasonable than dbdc_idx, so change it.

Fixes: 006b9d4a ("mt76: mt7915: introduce band_idx in mt7915_phy")
Signed-off-by: default avatarRyder Lee <ryder.lee@mediatek.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 66b181b8
...@@ -51,7 +51,7 @@ mt7915_sys_recovery_set(struct file *file, const char __user *user_buf, ...@@ -51,7 +51,7 @@ mt7915_sys_recovery_set(struct file *file, const char __user *user_buf,
{ {
struct mt7915_phy *phy = file->private_data; struct mt7915_phy *phy = file->private_data;
struct mt7915_dev *dev = phy->dev; struct mt7915_dev *dev = phy->dev;
bool ext_phy = phy != &dev->phy; bool band = phy->band_idx;
char buf[16]; char buf[16];
int ret = 0; int ret = 0;
u16 val; u16 val;
...@@ -83,7 +83,7 @@ mt7915_sys_recovery_set(struct file *file, const char __user *user_buf, ...@@ -83,7 +83,7 @@ mt7915_sys_recovery_set(struct file *file, const char __user *user_buf,
* 8: trigger firmware crash. * 8: trigger firmware crash.
*/ */
case SER_QUERY: case SER_QUERY:
ret = mt7915_mcu_set_ser(dev, 0, 0, ext_phy); ret = mt7915_mcu_set_ser(dev, 0, 0, band);
break; break;
case SER_SET_RECOVER_L1: case SER_SET_RECOVER_L1:
case SER_SET_RECOVER_L2: case SER_SET_RECOVER_L2:
...@@ -91,17 +91,17 @@ mt7915_sys_recovery_set(struct file *file, const char __user *user_buf, ...@@ -91,17 +91,17 @@ mt7915_sys_recovery_set(struct file *file, const char __user *user_buf,
case SER_SET_RECOVER_L3_TX_ABORT: case SER_SET_RECOVER_L3_TX_ABORT:
case SER_SET_RECOVER_L3_TX_DISABLE: case SER_SET_RECOVER_L3_TX_DISABLE:
case SER_SET_RECOVER_L3_BF: case SER_SET_RECOVER_L3_BF:
ret = mt7915_mcu_set_ser(dev, SER_ENABLE, BIT(val), ext_phy); ret = mt7915_mcu_set_ser(dev, SER_ENABLE, BIT(val), band);
if (ret) if (ret)
return ret; return ret;
ret = mt7915_mcu_set_ser(dev, SER_RECOVER, val, ext_phy); ret = mt7915_mcu_set_ser(dev, SER_RECOVER, val, band);
break; break;
/* enable full chip reset */ /* enable full chip reset */
case SER_SET_RECOVER_FULL: case SER_SET_RECOVER_FULL:
mt76_set(dev, MT_WFDMA0_MCU_HOST_INT_ENA, MT_MCU_CMD_WDT_MASK); mt76_set(dev, MT_WFDMA0_MCU_HOST_INT_ENA, MT_MCU_CMD_WDT_MASK);
ret = mt7915_mcu_set_ser(dev, 1, 3, ext_phy); ret = mt7915_mcu_set_ser(dev, 1, 3, band);
if (ret) if (ret)
return ret; return ret;
......
...@@ -1259,18 +1259,18 @@ void mt7915_mac_set_timing(struct mt7915_phy *phy) ...@@ -1259,18 +1259,18 @@ void mt7915_mac_set_timing(struct mt7915_phy *phy)
MT_ARB_SCR_TX_DISABLE | MT_ARB_SCR_RX_DISABLE); MT_ARB_SCR_TX_DISABLE | MT_ARB_SCR_RX_DISABLE);
} }
void mt7915_mac_enable_nf(struct mt7915_dev *dev, bool ext_phy) void mt7915_mac_enable_nf(struct mt7915_dev *dev, bool band)
{ {
u32 reg; u32 reg;
reg = is_mt7915(&dev->mt76) ? MT_WF_PHY_RXTD12(ext_phy) : reg = is_mt7915(&dev->mt76) ? MT_WF_PHY_RXTD12(band) :
MT_WF_PHY_RXTD12_MT7916(ext_phy); MT_WF_PHY_RXTD12_MT7916(band);
mt76_set(dev, reg, mt76_set(dev, reg,
MT_WF_PHY_RXTD12_IRPI_SW_CLR_ONLY | MT_WF_PHY_RXTD12_IRPI_SW_CLR_ONLY |
MT_WF_PHY_RXTD12_IRPI_SW_CLR); MT_WF_PHY_RXTD12_IRPI_SW_CLR);
reg = is_mt7915(&dev->mt76) ? MT_WF_PHY_RX_CTRL1(ext_phy) : reg = is_mt7915(&dev->mt76) ? MT_WF_PHY_RX_CTRL1(band) :
MT_WF_PHY_RX_CTRL1_MT7916(ext_phy); MT_WF_PHY_RX_CTRL1_MT7916(band);
mt76_set(dev, reg, FIELD_PREP(MT_WF_PHY_RX_CTRL1_IPI_EN, 0x5)); mt76_set(dev, reg, FIELD_PREP(MT_WF_PHY_RX_CTRL1_IPI_EN, 0x5));
} }
...@@ -1979,7 +1979,6 @@ void mt7915_mac_update_stats(struct mt7915_phy *phy) ...@@ -1979,7 +1979,6 @@ void mt7915_mac_update_stats(struct mt7915_phy *phy)
static void mt7915_mac_severe_check(struct mt7915_phy *phy) static void mt7915_mac_severe_check(struct mt7915_phy *phy)
{ {
struct mt7915_dev *dev = phy->dev; struct mt7915_dev *dev = phy->dev;
bool ext_phy = phy != &dev->phy;
u32 trb; u32 trb;
if (!phy->omac_mask) if (!phy->omac_mask)
...@@ -1997,7 +1996,7 @@ static void mt7915_mac_severe_check(struct mt7915_phy *phy) ...@@ -1997,7 +1996,7 @@ static void mt7915_mac_severe_check(struct mt7915_phy *phy)
FIELD_GET(MT_TRB_RXPSR0_RX_WTBL_PTR, phy->trb_ts)) && FIELD_GET(MT_TRB_RXPSR0_RX_WTBL_PTR, phy->trb_ts)) &&
trb == phy->trb_ts) trb == phy->trb_ts)
mt7915_mcu_set_ser(dev, SER_RECOVER, SER_SET_RECOVER_L3_RX_ABORT, mt7915_mcu_set_ser(dev, SER_RECOVER, SER_SET_RECOVER_L3_RX_ABORT,
ext_phy); phy->band_idx);
phy->trb_ts = trb; phy->trb_ts = trb;
} }
......
...@@ -30,31 +30,31 @@ int mt7915_run(struct ieee80211_hw *hw) ...@@ -30,31 +30,31 @@ int mt7915_run(struct ieee80211_hw *hw)
running = mt7915_dev_running(dev); running = mt7915_dev_running(dev);
if (!running) { if (!running) {
ret = mt76_connac_mcu_set_pm(&dev->mt76, 0, 0); ret = mt76_connac_mcu_set_pm(&dev->mt76, dev->phy.band_idx, 0);
if (ret) if (ret)
goto out; goto out;
ret = mt7915_mcu_set_mac(dev, 0, true, true); ret = mt7915_mcu_set_mac(dev, dev->phy.band_idx, true, true);
if (ret) if (ret)
goto out; goto out;
mt7915_mac_enable_nf(dev, 0); mt7915_mac_enable_nf(dev, dev->phy.band_idx);
} }
if (phy != &dev->phy || phy->band_idx) { if (phy != &dev->phy) {
ret = mt76_connac_mcu_set_pm(&dev->mt76, 1, 0); ret = mt76_connac_mcu_set_pm(&dev->mt76, phy->band_idx, 0);
if (ret) if (ret)
goto out; goto out;
ret = mt7915_mcu_set_mac(dev, 1, true, true); ret = mt7915_mcu_set_mac(dev, phy->band_idx, true, true);
if (ret) if (ret)
goto out; goto out;
mt7915_mac_enable_nf(dev, 1); mt7915_mac_enable_nf(dev, phy->band_idx);
} }
ret = mt76_connac_mcu_set_rts_thresh(&dev->mt76, 0x92b, ret = mt76_connac_mcu_set_rts_thresh(&dev->mt76, 0x92b,
phy != &dev->phy); phy->band_idx);
if (ret) if (ret)
goto out; goto out;
...@@ -107,13 +107,13 @@ static void mt7915_stop(struct ieee80211_hw *hw) ...@@ -107,13 +107,13 @@ static void mt7915_stop(struct ieee80211_hw *hw)
clear_bit(MT76_STATE_RUNNING, &phy->mt76->state); clear_bit(MT76_STATE_RUNNING, &phy->mt76->state);
if (phy != &dev->phy) { if (phy != &dev->phy) {
mt76_connac_mcu_set_pm(&dev->mt76, 1, 1); mt76_connac_mcu_set_pm(&dev->mt76, phy->band_idx, 1);
mt7915_mcu_set_mac(dev, 1, false, false); mt7915_mcu_set_mac(dev, phy->band_idx, false, false);
} }
if (!mt7915_dev_running(dev)) { if (!mt7915_dev_running(dev)) {
mt76_connac_mcu_set_pm(&dev->mt76, 0, 1); mt76_connac_mcu_set_pm(&dev->mt76, dev->phy.band_idx, 1);
mt7915_mcu_set_mac(dev, 0, false, false); mt7915_mcu_set_mac(dev, dev->phy.band_idx, false, false);
} }
mutex_unlock(&dev->mt76.mutex); mutex_unlock(&dev->mt76.mutex);
...@@ -440,7 +440,6 @@ static int mt7915_config(struct ieee80211_hw *hw, u32 changed) ...@@ -440,7 +440,6 @@ static int mt7915_config(struct ieee80211_hw *hw, u32 changed)
{ {
struct mt7915_dev *dev = mt7915_hw_dev(hw); struct mt7915_dev *dev = mt7915_hw_dev(hw);
struct mt7915_phy *phy = mt7915_hw_phy(hw); struct mt7915_phy *phy = mt7915_hw_phy(hw);
bool band = phy != &dev->phy;
int ret; int ret;
if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
...@@ -468,6 +467,7 @@ static int mt7915_config(struct ieee80211_hw *hw, u32 changed) ...@@ -468,6 +467,7 @@ static int mt7915_config(struct ieee80211_hw *hw, u32 changed)
if (changed & IEEE80211_CONF_CHANGE_MONITOR) { if (changed & IEEE80211_CONF_CHANGE_MONITOR) {
bool enabled = !!(hw->conf.flags & IEEE80211_CONF_MONITOR); bool enabled = !!(hw->conf.flags & IEEE80211_CONF_MONITOR);
bool band = phy->band_idx;
if (!enabled) if (!enabled)
phy->rxfilter |= MT_WF_RFCR_DROP_OTHER_UC; phy->rxfilter |= MT_WF_RFCR_DROP_OTHER_UC;
...@@ -506,7 +506,7 @@ static void mt7915_configure_filter(struct ieee80211_hw *hw, ...@@ -506,7 +506,7 @@ static void mt7915_configure_filter(struct ieee80211_hw *hw,
{ {
struct mt7915_dev *dev = mt7915_hw_dev(hw); struct mt7915_dev *dev = mt7915_hw_dev(hw);
struct mt7915_phy *phy = mt7915_hw_phy(hw); struct mt7915_phy *phy = mt7915_hw_phy(hw);
bool band = phy != &dev->phy; bool band = phy->band_idx;
u32 ctl_flags = MT_WF_RFCR1_DROP_ACK | u32 ctl_flags = MT_WF_RFCR1_DROP_ACK |
MT_WF_RFCR1_DROP_BF_POLL | MT_WF_RFCR1_DROP_BF_POLL |
MT_WF_RFCR1_DROP_BA | MT_WF_RFCR1_DROP_BA |
...@@ -743,7 +743,7 @@ static int mt7915_set_rts_threshold(struct ieee80211_hw *hw, u32 val) ...@@ -743,7 +743,7 @@ static int mt7915_set_rts_threshold(struct ieee80211_hw *hw, u32 val)
int ret; int ret;
mutex_lock(&dev->mt76.mutex); mutex_lock(&dev->mt76.mutex);
ret = mt76_connac_mcu_set_rts_thresh(&dev->mt76, val, phy != &dev->phy); ret = mt76_connac_mcu_set_rts_thresh(&dev->mt76, val, phy->band_idx);
mutex_unlock(&dev->mt76.mutex); mutex_unlock(&dev->mt76.mutex);
return ret; return ret;
...@@ -846,7 +846,7 @@ u64 __mt7915_get_tsf(struct ieee80211_hw *hw, struct mt7915_vif *mvif) ...@@ -846,7 +846,7 @@ u64 __mt7915_get_tsf(struct ieee80211_hw *hw, struct mt7915_vif *mvif)
{ {
struct mt7915_dev *dev = mt7915_hw_dev(hw); struct mt7915_dev *dev = mt7915_hw_dev(hw);
struct mt7915_phy *phy = mt7915_hw_phy(hw); struct mt7915_phy *phy = mt7915_hw_phy(hw);
bool band = phy != &dev->phy; bool band = phy->band_idx;
union { union {
u64 t64; u64 t64;
u32 t32[2]; u32 t32[2];
...@@ -891,7 +891,7 @@ mt7915_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -891,7 +891,7 @@ mt7915_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
struct mt7915_dev *dev = mt7915_hw_dev(hw); struct mt7915_dev *dev = mt7915_hw_dev(hw);
struct mt7915_phy *phy = mt7915_hw_phy(hw); struct mt7915_phy *phy = mt7915_hw_phy(hw);
bool band = phy != &dev->phy; bool band = phy->band_idx;
union { union {
u64 t64; u64 t64;
u32 t32[2]; u32 t32[2];
...@@ -922,7 +922,7 @@ mt7915_offset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -922,7 +922,7 @@ mt7915_offset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
struct mt7915_dev *dev = mt7915_hw_dev(hw); struct mt7915_dev *dev = mt7915_hw_dev(hw);
struct mt7915_phy *phy = mt7915_hw_phy(hw); struct mt7915_phy *phy = mt7915_hw_phy(hw);
bool band = phy != &dev->phy; bool band = phy->band_idx;
union { union {
u64 t64; u64 t64;
u32 t32[2]; u32 t32[2];
......
...@@ -599,7 +599,7 @@ mt7915_mcu_muar_config(struct mt7915_phy *phy, struct ieee80211_vif *vif, ...@@ -599,7 +599,7 @@ mt7915_mcu_muar_config(struct mt7915_phy *phy, struct ieee80211_vif *vif,
.mode = !!mask || enable, .mode = !!mask || enable,
.entry_count = 1, .entry_count = 1,
.write = 1, .write = 1,
.band = phy != &dev->phy, .band = phy->band_idx,
.index = idx * 2 + bssid, .index = idx * 2 + bssid,
}; };
...@@ -1715,7 +1715,7 @@ int mt7915_mcu_add_dev_info(struct mt7915_phy *phy, ...@@ -1715,7 +1715,7 @@ int mt7915_mcu_add_dev_info(struct mt7915_phy *phy,
struct { struct {
struct req_hdr { struct req_hdr {
u8 omac_idx; u8 omac_idx;
u8 dbdc_idx; u8 band_idx;
__le16 tlv_num; __le16 tlv_num;
u8 is_tlv_append; u8 is_tlv_append;
u8 rsv[3]; u8 rsv[3];
...@@ -1724,13 +1724,13 @@ int mt7915_mcu_add_dev_info(struct mt7915_phy *phy, ...@@ -1724,13 +1724,13 @@ int mt7915_mcu_add_dev_info(struct mt7915_phy *phy,
__le16 tag; __le16 tag;
__le16 len; __le16 len;
u8 active; u8 active;
u8 dbdc_idx; u8 band_idx;
u8 omac_addr[ETH_ALEN]; u8 omac_addr[ETH_ALEN];
} __packed tlv; } __packed tlv;
} data = { } data = {
.hdr = { .hdr = {
.omac_idx = mvif->mt76.omac_idx, .omac_idx = mvif->mt76.omac_idx,
.dbdc_idx = mvif->mt76.band_idx, .band_idx = mvif->mt76.band_idx,
.tlv_num = cpu_to_le16(1), .tlv_num = cpu_to_le16(1),
.is_tlv_append = 1, .is_tlv_append = 1,
}, },
...@@ -1738,7 +1738,7 @@ int mt7915_mcu_add_dev_info(struct mt7915_phy *phy, ...@@ -1738,7 +1738,7 @@ int mt7915_mcu_add_dev_info(struct mt7915_phy *phy,
.tag = cpu_to_le16(DEV_INFO_ACTIVE), .tag = cpu_to_le16(DEV_INFO_ACTIVE),
.len = cpu_to_le16(sizeof(struct req_tlv)), .len = cpu_to_le16(sizeof(struct req_tlv)),
.active = enable, .active = enable,
.dbdc_idx = mvif->mt76.band_idx, .band_idx = mvif->mt76.band_idx,
}, },
}; };
...@@ -2585,7 +2585,7 @@ mt7915_mcu_background_chain_ctrl(struct mt7915_phy *phy, ...@@ -2585,7 +2585,7 @@ mt7915_mcu_background_chain_ctrl(struct mt7915_phy *phy,
req.monitor_central_chan = req.monitor_central_chan =
ieee80211_frequency_to_channel(chandef->center_freq1); ieee80211_frequency_to_channel(chandef->center_freq1);
req.monitor_bw = mt76_connac_chan_bw(chandef); req.monitor_bw = mt76_connac_chan_bw(chandef);
req.band_idx = phy != &dev->phy; req.band_idx = phy->band_idx;
req.scan_mode = 1; req.scan_mode = 1;
break; break;
} }
...@@ -2593,7 +2593,7 @@ mt7915_mcu_background_chain_ctrl(struct mt7915_phy *phy, ...@@ -2593,7 +2593,7 @@ mt7915_mcu_background_chain_ctrl(struct mt7915_phy *phy,
req.monitor_chan = chandef->chan->hw_value; req.monitor_chan = chandef->chan->hw_value;
req.monitor_central_chan = req.monitor_central_chan =
ieee80211_frequency_to_channel(chandef->center_freq1); ieee80211_frequency_to_channel(chandef->center_freq1);
req.band_idx = phy != &dev->phy; req.band_idx = phy->band_idx;
req.scan_mode = 2; req.scan_mode = 2;
break; break;
case CH_SWITCH_BACKGROUND_SCAN_STOP: case CH_SWITCH_BACKGROUND_SCAN_STOP:
...@@ -2997,7 +2997,7 @@ int mt7915_mcu_get_chan_mib_info(struct mt7915_phy *phy, bool chan_switch) ...@@ -2997,7 +2997,7 @@ int mt7915_mcu_get_chan_mib_info(struct mt7915_phy *phy, bool chan_switch)
} }
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
req[i].band = cpu_to_le32(phy != &dev->phy); req[i].band = cpu_to_le32(phy->band_idx);
req[i].offs = cpu_to_le32(offs[i + start]); req[i].offs = cpu_to_le32(offs[i + start]);
if (!is_mt7915(&dev->mt76) && i == 3) if (!is_mt7915(&dev->mt76) && i == 3)
...@@ -3042,11 +3042,11 @@ int mt7915_mcu_get_temperature(struct mt7915_phy *phy) ...@@ -3042,11 +3042,11 @@ int mt7915_mcu_get_temperature(struct mt7915_phy *phy)
struct { struct {
u8 ctrl_id; u8 ctrl_id;
u8 action; u8 action;
u8 dbdc_idx; u8 band_idx;
u8 rsv[5]; u8 rsv[5];
} req = { } req = {
.ctrl_id = THERMAL_SENSOR_TEMP_QUERY, .ctrl_id = THERMAL_SENSOR_TEMP_QUERY,
.dbdc_idx = phy != &dev->phy, .band_idx = phy->band_idx,
}; };
return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(THERMAL_CTRL), &req, return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(THERMAL_CTRL), &req,
...@@ -3195,11 +3195,11 @@ int mt7915_mcu_set_txpower_sku(struct mt7915_phy *phy) ...@@ -3195,11 +3195,11 @@ int mt7915_mcu_set_txpower_sku(struct mt7915_phy *phy)
struct mt7915_sku_val { struct mt7915_sku_val {
u8 format_id; u8 format_id;
u8 limit_type; u8 limit_type;
u8 dbdc_idx; u8 band_idx;
s8 val[MT7915_SKU_RATE_NUM]; s8 val[MT7915_SKU_RATE_NUM];
} __packed req = { } __packed req = {
.format_id = TX_POWER_LIMIT_TABLE, .format_id = TX_POWER_LIMIT_TABLE,
.dbdc_idx = phy != &dev->phy, .band_idx = phy->band_idx,
}; };
struct mt76_power_limits limits_array; struct mt76_power_limits limits_array;
s8 *la = (s8 *)&limits_array; s8 *la = (s8 *)&limits_array;
...@@ -3245,12 +3245,12 @@ int mt7915_mcu_get_txpower_sku(struct mt7915_phy *phy, s8 *txpower, int len) ...@@ -3245,12 +3245,12 @@ int mt7915_mcu_get_txpower_sku(struct mt7915_phy *phy, s8 *txpower, int len)
struct { struct {
u8 format_id; u8 format_id;
u8 category; u8 category;
u8 band; u8 band_idx;
u8 _rsv; u8 _rsv;
} __packed req = { } __packed req = {
.format_id = TX_POWER_LIMIT_INFO, .format_id = TX_POWER_LIMIT_INFO,
.category = RATE_POWER_INFO, .category = RATE_POWER_INFO,
.band = phy != &dev->phy, .band_idx = phy->band_idx,
}; };
s8 txpower_sku[MT7915_SKU_RATE_NUM][2]; s8 txpower_sku[MT7915_SKU_RATE_NUM][2];
struct sk_buff *skb; struct sk_buff *skb;
...@@ -3299,11 +3299,11 @@ int mt7915_mcu_set_sku_en(struct mt7915_phy *phy, bool enable) ...@@ -3299,11 +3299,11 @@ int mt7915_mcu_set_sku_en(struct mt7915_phy *phy, bool enable)
struct mt7915_sku { struct mt7915_sku {
u8 format_id; u8 format_id;
u8 sku_enable; u8 sku_enable;
u8 dbdc_idx; u8 band_idx;
u8 rsv; u8 rsv;
} __packed req = { } __packed req = {
.format_id = TX_POWER_LIMIT_ENABLE, .format_id = TX_POWER_LIMIT_ENABLE,
.dbdc_idx = phy != &dev->phy, .band_idx = phy->band_idx,
.sku_enable = enable, .sku_enable = enable,
}; };
...@@ -3385,7 +3385,7 @@ mt7915_mcu_enable_obss_spr(struct mt7915_phy *phy, u8 action, u8 val) ...@@ -3385,7 +3385,7 @@ mt7915_mcu_enable_obss_spr(struct mt7915_phy *phy, u8 action, u8 val)
struct mt7915_mcu_sr_ctrl req = { struct mt7915_mcu_sr_ctrl req = {
.action = action, .action = action,
.argnum = 1, .argnum = 1,
.band_idx = phy != &dev->phy, .band_idx = phy->band_idx,
.val = cpu_to_le32(val), .val = cpu_to_le32(val),
}; };
...@@ -3416,7 +3416,7 @@ mt7915_mcu_set_obss_spr_pd(struct mt7915_phy *phy, ...@@ -3416,7 +3416,7 @@ mt7915_mcu_set_obss_spr_pd(struct mt7915_phy *phy,
.ctrl = { .ctrl = {
.action = SPR_SET_PARAM, .action = SPR_SET_PARAM,
.argnum = 9, .argnum = 9,
.band_idx = phy != &dev->phy, .band_idx = phy->band_idx,
}, },
}; };
int ret; int ret;
...@@ -3465,7 +3465,7 @@ mt7915_mcu_set_obss_spr_siga(struct mt7915_phy *phy, struct ieee80211_vif *vif, ...@@ -3465,7 +3465,7 @@ mt7915_mcu_set_obss_spr_siga(struct mt7915_phy *phy, struct ieee80211_vif *vif,
.ctrl = { .ctrl = {
.action = SPR_SET_SIGA, .action = SPR_SET_SIGA,
.argnum = 1, .argnum = 1,
.band_idx = phy != &dev->phy, .band_idx = phy->band_idx,
}, },
.siga = { .siga = {
.omac = omac > HW_BSSID_MAX ? omac - 12 : omac, .omac = omac > HW_BSSID_MAX ? omac - 12 : omac,
...@@ -3504,7 +3504,7 @@ mt7915_mcu_set_obss_spr_bitmap(struct mt7915_phy *phy, ...@@ -3504,7 +3504,7 @@ mt7915_mcu_set_obss_spr_bitmap(struct mt7915_phy *phy,
.ctrl = { .ctrl = {
.action = SPR_SET_SRG_BITMAP, .action = SPR_SET_SRG_BITMAP,
.argnum = 4, .argnum = 4,
.band_idx = phy != &dev->phy, .band_idx = phy->band_idx,
}, },
}; };
u32 bitmap; u32 bitmap;
......
...@@ -44,14 +44,14 @@ mt7915_tm_set_tx_power(struct mt7915_phy *phy) ...@@ -44,14 +44,14 @@ mt7915_tm_set_tx_power(struct mt7915_phy *phy)
int ret; int ret;
struct { struct {
u8 format_id; u8 format_id;
u8 dbdc_idx; u8 band_idx;
s8 tx_power; s8 tx_power;
u8 ant_idx; /* Only 0 is valid */ u8 ant_idx; /* Only 0 is valid */
u8 center_chan; u8 center_chan;
u8 rsv[3]; u8 rsv[3];
} __packed req = { } __packed req = {
.format_id = 0xf, .format_id = 0xf,
.dbdc_idx = phy != &dev->phy, .band_idx = phy->band_idx,
.center_chan = ieee80211_frequency_to_channel(freq), .center_chan = ieee80211_frequency_to_channel(freq),
}; };
u8 *tx_power = NULL; u8 *tx_power = NULL;
...@@ -77,7 +77,7 @@ mt7915_tm_set_freq_offset(struct mt7915_phy *phy, bool en, u32 val) ...@@ -77,7 +77,7 @@ mt7915_tm_set_freq_offset(struct mt7915_phy *phy, bool en, u32 val)
struct mt7915_tm_cmd req = { struct mt7915_tm_cmd req = {
.testmode_en = en, .testmode_en = en,
.param_idx = MCU_ATE_SET_FREQ_OFFSET, .param_idx = MCU_ATE_SET_FREQ_OFFSET,
.param.freq.band = phy != &dev->phy, .param.freq.band = phy->band_idx,
.param.freq.freq_offset = cpu_to_le32(val), .param.freq.freq_offset = cpu_to_le32(val),
}; };
...@@ -111,7 +111,7 @@ mt7915_tm_set_trx(struct mt7915_phy *phy, int type, bool en) ...@@ -111,7 +111,7 @@ mt7915_tm_set_trx(struct mt7915_phy *phy, int type, bool en)
.param_idx = MCU_ATE_SET_TRX, .param_idx = MCU_ATE_SET_TRX,
.param.trx.type = type, .param.trx.type = type,
.param.trx.enable = en, .param.trx.enable = en,
.param.trx.band = phy != &dev->phy, .param.trx.band = phy->band_idx,
}; };
return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(ATE_CTRL), &req, return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(ATE_CTRL), &req,
...@@ -126,7 +126,7 @@ mt7915_tm_clean_hwq(struct mt7915_phy *phy, u8 wcid) ...@@ -126,7 +126,7 @@ mt7915_tm_clean_hwq(struct mt7915_phy *phy, u8 wcid)
.testmode_en = 1, .testmode_en = 1,
.param_idx = MCU_ATE_CLEAN_TXQUEUE, .param_idx = MCU_ATE_CLEAN_TXQUEUE,
.param.clean.wcid = wcid, .param.clean.wcid = wcid,
.param.clean.band = phy != &dev->phy, .param.clean.band = phy->band_idx,
}; };
return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(ATE_CTRL), &req, return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(ATE_CTRL), &req,
...@@ -144,7 +144,7 @@ mt7915_tm_set_slot_time(struct mt7915_phy *phy, u8 slot_time, u8 sifs) ...@@ -144,7 +144,7 @@ mt7915_tm_set_slot_time(struct mt7915_phy *phy, u8 slot_time, u8 sifs)
.param.slot.sifs = sifs, .param.slot.sifs = sifs,
.param.slot.rifs = 2, .param.slot.rifs = 2,
.param.slot.eifs = cpu_to_le16(60), .param.slot.eifs = cpu_to_le16(60),
.param.slot.band = phy != &dev->phy, .param.slot.band = phy->band_idx,
}; };
return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(ATE_CTRL), &req, return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(ATE_CTRL), &req,
...@@ -488,7 +488,7 @@ mt7915_tm_set_rx_frames(struct mt7915_phy *phy, bool en) ...@@ -488,7 +488,7 @@ mt7915_tm_set_rx_frames(struct mt7915_phy *phy, bool en)
mt7915_tm_update_channel(phy); mt7915_tm_update_channel(phy);
/* read-clear */ /* read-clear */
mt76_rr(dev, MT_MIB_SDR3(phy != &dev->phy)); mt76_rr(dev, MT_MIB_SDR3(phy->band_idx));
mt7915_tm_set_trx(phy, TM_MAC_RX_RXV, en); mt7915_tm_set_trx(phy, TM_MAC_RX_RXV, en);
} }
} }
...@@ -526,7 +526,7 @@ mt7915_tm_set_tx_cont(struct mt7915_phy *phy, bool en) ...@@ -526,7 +526,7 @@ mt7915_tm_set_tx_cont(struct mt7915_phy *phy, bool en)
tx_cont->control_ch = chandef->chan->hw_value; tx_cont->control_ch = chandef->chan->hw_value;
tx_cont->center_ch = freq1; tx_cont->center_ch = freq1;
tx_cont->tx_ant = td->tx_antenna_mask; tx_cont->tx_ant = td->tx_antenna_mask;
tx_cont->band = phy != &dev->phy; tx_cont->band = phy->band_idx;
switch (chandef->width) { switch (chandef->width) {
case NL80211_CHAN_WIDTH_40: case NL80211_CHAN_WIDTH_40:
...@@ -558,7 +558,7 @@ mt7915_tm_set_tx_cont(struct mt7915_phy *phy, bool en) ...@@ -558,7 +558,7 @@ mt7915_tm_set_tx_cont(struct mt7915_phy *phy, bool en)
} }
if (!en) { if (!en) {
req.op.rf.param.func_data = cpu_to_le32(phy != &dev->phy); req.op.rf.param.func_data = cpu_to_le32(phy->band_idx);
goto out; goto out;
} }
......
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