mt7603: move mt7603_set_channel to mt7603_main.c

Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Felix Fietkau
2016-02-03 15:59:50 +01:00
parent 71fae84d55
commit 9ef6f3a90f
3 changed files with 34 additions and 34 deletions
-1
View File
@@ -122,7 +122,6 @@ void mt7603_mac_stop(struct mt7603_dev *dev);
int mt7603_mac_fill_rx(struct mt7603_dev *dev, struct sk_buff *skb);
void mt7603_mac_add_txs(struct mt7603_dev *dev, void *data);
int mt7603_set_channel(struct mt7603_dev *dev, struct cfg80211_chan_def *def);
int mt7603_mcu_set_channel(struct mt7603_dev *dev);
int mt7603_mcu_reg_read(struct mt7603_dev *dev, u32 reg, u32 *val, bool rf);
int mt7603_mcu_set_eeprom(struct mt7603_dev *dev);
-33
View File
@@ -12,7 +12,6 @@
*/
#include "mt7603.h"
#include "mt7603_eeprom.h"
void mt7603_set_irq_mask(struct mt7603_dev *dev, u32 clear, u32 set)
{
@@ -80,35 +79,3 @@ u32 mt7603_reg_map(struct mt7603_dev *dev, u32 addr)
return MT_PCIE_REMAP_BASE_2 + offset;
}
int mt7603_set_channel(struct mt7603_dev *dev, struct cfg80211_chan_def *def)
{
u8 *rssi_data = (u8 *) dev->mt76.eeprom.data;
int idx, ret;
u8 bw = MT_BW_20;
mt7603_mac_stop(dev);
dev->chandef = *def;
mt76_rmw_field(dev, MT_AGG_BWCR, MT_AGG_BWCR_BW, bw);
ret = mt7603_mcu_set_channel(dev);
if (ret)
return ret;
if (def->chan->band == IEEE80211_BAND_5GHZ) {
idx = 1;
rssi_data += MT_EE_RSSI_OFFSET_5G;
} else {
idx = 0;
rssi_data += MT_EE_RSSI_OFFSET_2G;
}
memcpy(dev->rssi_offset, rssi_data, sizeof(dev->rssi_offset));
idx |= (def->chan - mt76_hw(dev)->wiphy->bands[def->chan->band]->channels) << 1;
mt76_wr(dev, MT_WF_RMAC_CH_FREQ, idx);
mt7603_mac_start(dev);
return 0;
}
+34
View File
@@ -12,6 +12,7 @@
*/
#include "mt7603.h"
#include "mt7603_eeprom.h"
static int
mt7603_start(struct ieee80211_hw *hw)
@@ -90,6 +91,39 @@ mt7603_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
mutex_unlock(&dev->mutex);
}
static int
mt7603_set_channel(struct mt7603_dev *dev, struct cfg80211_chan_def *def)
{
u8 *rssi_data = (u8 *) dev->mt76.eeprom.data;
int idx, ret;
u8 bw = MT_BW_20;
mt7603_mac_stop(dev);
dev->chandef = *def;
mt76_rmw_field(dev, MT_AGG_BWCR, MT_AGG_BWCR_BW, bw);
ret = mt7603_mcu_set_channel(dev);
if (ret)
return ret;
if (def->chan->band == IEEE80211_BAND_5GHZ) {
idx = 1;
rssi_data += MT_EE_RSSI_OFFSET_5G;
} else {
idx = 0;
rssi_data += MT_EE_RSSI_OFFSET_2G;
}
memcpy(dev->rssi_offset, rssi_data, sizeof(dev->rssi_offset));
idx |= (def->chan - mt76_hw(dev)->wiphy->bands[def->chan->band]->channels) << 1;
mt76_wr(dev, MT_WF_RMAC_CH_FREQ, idx);
mt7603_mac_start(dev);
return 0;
}
static int
mt7603_config(struct ieee80211_hw *hw, u32 changed)
{