mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
mt7603: register device with mac80211
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
@@ -50,6 +50,8 @@ struct mt7603_mcu {
|
||||
struct mt7603_dev {
|
||||
struct mt76_dev mt76;
|
||||
|
||||
struct cfg80211_chan_def chandef;
|
||||
|
||||
u32 irqmask;
|
||||
spinlock_t irq_lock;
|
||||
|
||||
@@ -69,7 +71,7 @@ extern const struct ieee80211_ops mt7603_ops;
|
||||
struct mt7603_dev *mt7603_alloc_device(struct device *pdev);
|
||||
irqreturn_t mt7603_irq_handler(int irq, void *dev_instance);
|
||||
|
||||
int mt7603_init_hardware(struct mt7603_dev *dev);
|
||||
int mt7603_register_device(struct mt7603_dev *dev);
|
||||
int mt7603_dma_init(struct mt7603_dev *dev);
|
||||
void mt7603_dma_cleanup(struct mt7603_dev *dev);
|
||||
int mt7603_mcu_init(struct mt7603_dev *dev);
|
||||
|
||||
+62
-1
@@ -79,7 +79,8 @@ int mt7603_mac_start(struct mt7603_dev *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mt7603_init_hardware(struct mt7603_dev *dev)
|
||||
static int
|
||||
mt7603_init_hardware(struct mt7603_dev *dev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -108,3 +109,63 @@ int mt7603_init_hardware(struct mt7603_dev *dev)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define CCK_RATE(_idx, _rate) { \
|
||||
.bitrate = _rate, \
|
||||
.flags = IEEE80211_RATE_SHORT_PREAMBLE, \
|
||||
.hw_value = (MT_PHY_TYPE_CCK << 8) | _idx, \
|
||||
.hw_value_short = (MT_PHY_TYPE_CCK << 8) | (4 + _idx), \
|
||||
}
|
||||
|
||||
#define OFDM_RATE(_idx, _rate) { \
|
||||
.bitrate = _rate, \
|
||||
.hw_value = (MT_PHY_TYPE_OFDM << 8) | _idx, \
|
||||
.hw_value_short = (MT_PHY_TYPE_OFDM << 8) | _idx, \
|
||||
}
|
||||
|
||||
static struct ieee80211_rate mt76x2_rates[] = {
|
||||
CCK_RATE(0, 10),
|
||||
CCK_RATE(1, 20),
|
||||
CCK_RATE(2, 55),
|
||||
CCK_RATE(3, 110),
|
||||
OFDM_RATE(11, 60),
|
||||
OFDM_RATE(15, 90),
|
||||
OFDM_RATE(10, 120),
|
||||
OFDM_RATE(14, 180),
|
||||
OFDM_RATE(9, 240),
|
||||
OFDM_RATE(13, 360),
|
||||
OFDM_RATE(8, 480),
|
||||
OFDM_RATE(12, 540),
|
||||
};
|
||||
|
||||
|
||||
int mt7603_register_device(struct mt7603_dev *dev)
|
||||
{
|
||||
static u8 macaddr[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };
|
||||
struct ieee80211_hw *hw = mt76_hw(dev);
|
||||
struct ieee80211_supported_band *sband;
|
||||
struct wiphy *wiphy = hw->wiphy;
|
||||
int ret;
|
||||
|
||||
ret = mt7603_init_hardware(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
hw->queues = 4;
|
||||
hw->max_rates = 1;
|
||||
hw->max_report_rates = 7;
|
||||
hw->max_rate_tries = 1;
|
||||
hw->extra_tx_headroom = 2;
|
||||
|
||||
SET_IEEE80211_PERM_ADDR(hw, macaddr);
|
||||
|
||||
ret = mt76_register_device(&dev->mt76, BIT(IEEE80211_BAND_2GHZ), true,
|
||||
mt76x2_rates, ARRAY_SIZE(mt76x2_rates));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
sband = wiphy->bands[IEEE80211_BAND_2GHZ];
|
||||
dev->chandef.chan = &sband->channels[0];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+1
-6
@@ -59,15 +59,10 @@ mt76pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
if (ret)
|
||||
goto error;
|
||||
|
||||
ret = mt7603_init_hardware(dev);
|
||||
ret = mt7603_register_device(dev);
|
||||
if (ret)
|
||||
goto error;
|
||||
|
||||
if (1) {
|
||||
ret = -EINVAL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
return 0;
|
||||
error:
|
||||
ieee80211_free_hw(mt76_hw(dev));
|
||||
|
||||
Reference in New Issue
Block a user