Commit 9aeb0d11 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

mt76: mt76u: move mcu buffer allocation in mt76x02u drivers

Move mcu buffer allocation in mt76x2u/mt76x0u drivers since newer
chipsets (e.g. mt7663u) does not rely on synchronous mcu communication
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 37ec6a03
...@@ -172,8 +172,14 @@ static int mt76x0u_init_hardware(struct mt76x02_dev *dev, bool reset) ...@@ -172,8 +172,14 @@ static int mt76x0u_init_hardware(struct mt76x02_dev *dev, bool reset)
static int mt76x0u_register_device(struct mt76x02_dev *dev) static int mt76x0u_register_device(struct mt76x02_dev *dev)
{ {
struct ieee80211_hw *hw = dev->mt76.hw; struct ieee80211_hw *hw = dev->mt76.hw;
struct mt76_usb *usb = &dev->mt76.usb;
int err; int err;
usb->mcu.data = devm_kmalloc(dev->mt76.dev, MCU_RESP_URB_SIZE,
GFP_KERNEL);
if (!usb->mcu.data)
return -ENOMEM;
err = mt76u_alloc_queues(&dev->mt76); err = mt76u_alloc_queues(&dev->mt76);
if (err < 0) if (err < 0)
goto out_err; goto out_err;
......
...@@ -190,6 +190,7 @@ int mt76x2u_init_hardware(struct mt76x02_dev *dev) ...@@ -190,6 +190,7 @@ int mt76x2u_init_hardware(struct mt76x02_dev *dev)
int mt76x2u_register_device(struct mt76x02_dev *dev) int mt76x2u_register_device(struct mt76x02_dev *dev)
{ {
struct ieee80211_hw *hw = mt76_hw(dev); struct ieee80211_hw *hw = mt76_hw(dev);
struct mt76_usb *usb = &dev->mt76.usb;
int err; int err;
INIT_DELAYED_WORK(&dev->cal_work, mt76x2u_phy_calibrate); INIT_DELAYED_WORK(&dev->cal_work, mt76x2u_phy_calibrate);
...@@ -199,6 +200,11 @@ int mt76x2u_register_device(struct mt76x02_dev *dev) ...@@ -199,6 +200,11 @@ int mt76x2u_register_device(struct mt76x02_dev *dev)
if (err < 0) if (err < 0)
return err; return err;
usb->mcu.data = devm_kmalloc(dev->mt76.dev, MCU_RESP_URB_SIZE,
GFP_KERNEL);
if (!usb->mcu.data)
return -ENOMEM;
err = mt76u_alloc_queues(&dev->mt76); err = mt76u_alloc_queues(&dev->mt76);
if (err < 0) if (err < 0)
goto fail; goto fail;
......
...@@ -605,14 +605,9 @@ mt76u_submit_rx_buffers(struct mt76_dev *dev, enum mt76_rxq_id qid) ...@@ -605,14 +605,9 @@ mt76u_submit_rx_buffers(struct mt76_dev *dev, enum mt76_rxq_id qid)
static int mt76u_alloc_rx(struct mt76_dev *dev) static int mt76u_alloc_rx(struct mt76_dev *dev)
{ {
struct mt76_usb *usb = &dev->usb;
struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN]; struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
int i, err; int i, err;
usb->mcu.data = devm_kmalloc(dev->dev, MCU_RESP_URB_SIZE, GFP_KERNEL);
if (!usb->mcu.data)
return -ENOMEM;
spin_lock_init(&q->lock); spin_lock_init(&q->lock);
q->entry = devm_kcalloc(dev->dev, q->entry = devm_kcalloc(dev->dev,
MT_NUM_RX_ENTRIES, sizeof(*q->entry), MT_NUM_RX_ENTRIES, sizeof(*q->entry),
......
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