Commit f7bbb80f authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau
Browse files

mt76: introduce mmio data structure in mt76_dev



Introduce mt76_mmio data structure in mt76_dev and
move mt76x2_mcu in mt76_mmio. This is a preliminary
patch to unify mcu code between mt76x02{e,u} drivers

Signed-off-by: default avatarLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 8db5ec77
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -57,5 +57,9 @@ void mt76_mmio_init(struct mt76_dev *dev, void __iomem *regs)

	dev->bus = &mt76_mmio_ops;
	dev->regs = regs;

	skb_queue_head_init(&dev->mmio.mcu.res_q);
	init_waitqueue_head(&dev->mmio.mcu.wait);
	mutex_init(&dev->mmio.mcu.mutex);
}
EXPORT_SYMBOL_GPL(mt76_mmio_init);
+15 −1
Original line number Diff line number Diff line
@@ -338,6 +338,17 @@ struct mt76_usb {
	} mcu;
};

struct mt76_mmio {
	struct mt76e_mcu {
		struct mutex mutex;

		wait_queue_head_t wait;
		struct sk_buff_head res_q;

		u32 msg_seq;
	} mcu;
};

struct mt76_dev {
	struct ieee80211_hw *hw;
	struct cfg80211_chan_def chandef;
@@ -392,8 +403,11 @@ struct mt76_dev {

	u32 rxfilter;

	union {
		struct mt76_mmio mmio;
		struct mt76_usb usb;
	};
};

enum mt76_phy_type {
	MT_PHY_TYPE_CCK,
+0 −10
Original line number Diff line number Diff line
@@ -47,15 +47,6 @@
#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];
@@ -97,7 +88,6 @@ struct mt76x2_dev {
	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;
+3 −2
Original line number Diff line number Diff line
@@ -25,8 +25,9 @@ void mt76x2_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
	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;
	}

+0 −3
Original line number Diff line number Diff line
@@ -112,9 +112,6 @@ int mt76x2_dma_init(struct mt76x2_dev *dev)

	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);
Loading