#include "mt76x2_mac.h"
#include "mt76x2_dfs.h"
-struct mt76x2_mcu {
- struct mutex mutex;
-
- wait_queue_head_t wait;
- struct sk_buff_head res_q;
-
- u32 msg_seq;
-};
-
struct mt76x2_rx_freq_cal {
s8 high_gain[MT_MAX_CHAINS];
s8 rssi_offset[MT_MAX_CHAINS];
u8 txdone_seq;
DECLARE_KFIFO_PTR(txstatus_fifo, struct mt76x02_tx_status);
- struct mt76x2_mcu mcu;
struct sk_buff *rx_head;
struct tasklet_struct tx_tasklet;
void *rxwi = skb->data;
if (q == MT_RXQ_MCU) {
- skb_queue_tail(&dev->mcu.res_q, skb);
- wake_up(&dev->mcu.wait);
+ /* this is used just by mmio code */
+ skb_queue_tail(&mdev->mmio.mcu.res_q, skb);
+ wake_up(&mdev->mmio.mcu.wait);
return;
}
mt76_dma_attach(&dev->mt76);
- init_waitqueue_head(&dev->mcu.wait);
- skb_queue_head_init(&dev->mcu.res_q);
-
tasklet_init(&dev->tx_tasklet, mt76x2_tx_tasklet, (unsigned long) dev);
mt76_wr(dev, MT_WPDMA_RST_IDX, ~0);
return NULL;
timeout = expires - jiffies;
- wait_event_timeout(dev->mcu.wait, !skb_queue_empty(&dev->mcu.res_q),
+ wait_event_timeout(dev->mt76.mmio.mcu.wait,
+ !skb_queue_empty(&dev->mt76.mmio.mcu.res_q),
timeout);
- return skb_dequeue(&dev->mcu.res_q);
+ return skb_dequeue(&dev->mt76.mmio.mcu.res_q);
}
static int
if (!skb)
return -EINVAL;
- mutex_lock(&dev->mcu.mutex);
+ mutex_lock(&dev->mt76.mmio.mcu.mutex);
- seq = ++dev->mcu.msg_seq & 0xf;
+ seq = ++dev->mt76.mmio.mcu.msg_seq & 0xf;
if (!seq)
- seq = ++dev->mcu.msg_seq & 0xf;
+ seq = ++dev->mt76.mmio.mcu.msg_seq & 0xf;
ret = mt76x2_tx_queue_mcu(&dev->mt76, MT_TXQ_MCU, skb, cmd, seq);
if (ret)
}
out:
- mutex_unlock(&dev->mcu.mutex);
+ mutex_unlock(&dev->mt76.mmio.mcu.mutex);
return ret;
}
{
int ret;
- mutex_init(&dev->mcu.mutex);
-
ret = mt76pci_load_rom_patch(dev);
if (ret)
return ret;
mt76_wr(dev, MT_MCU_INT_LEVEL, 1);
usleep_range(20000, 30000);
- while ((skb = skb_dequeue(&dev->mcu.res_q)) != NULL)
+ while ((skb = skb_dequeue(&dev->mt76.mmio.mcu.res_q)) != NULL)
dev_kfree_skb(skb);
return 0;