Commit 108a4861 authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by Kalle Valo
Browse files

mt76: create new mt76x02-lib module for common mt76x{0,2} code



Move rxfilter and mutex to common structure. Create mt76x02-lib.ko
for mt76x0 and mt76x2 common functions and create new unified
mt76x02_configure_filter() function there.

Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 797ea240
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -5,8 +5,13 @@ config MT76_USB
	tristate
	tristate
	depends on MT76_CORE
	depends on MT76_CORE


config MT76x02_LIB
	tristate
	depends on MT76_CORE

config MT76x2_COMMON
config MT76x2_COMMON
	tristate
	tristate
	select MT76x02_LIB
	depends on MT76_CORE
	depends on MT76_CORE


config MT76x0U
config MT76x0U
@@ -14,6 +19,7 @@ config MT76x0U
	select MT76_CORE
	select MT76_CORE
	depends on MAC80211
	depends on MAC80211
	depends on USB
	depends on USB
	select MT76x02_LIB
	help
	help
	  This adds support for MT7610U-based wireless USB dongles.
	  This adds support for MT7610U-based wireless USB dongles.


+3 −0
Original line number Original line Diff line number Diff line
obj-$(CONFIG_MT76_CORE) += mt76.o
obj-$(CONFIG_MT76_CORE) += mt76.o
obj-$(CONFIG_MT76_USB) += mt76-usb.o
obj-$(CONFIG_MT76_USB) += mt76-usb.o
obj-$(CONFIG_MT76x0U) += mt76x0/
obj-$(CONFIG_MT76x0U) += mt76x0/
obj-$(CONFIG_MT76x02_LIB) += mt76x02-lib.o
obj-$(CONFIG_MT76x2_COMMON) += mt76x2-common.o
obj-$(CONFIG_MT76x2_COMMON) += mt76x2-common.o
obj-$(CONFIG_MT76x2E) += mt76x2e.o
obj-$(CONFIG_MT76x2E) += mt76x2e.o
obj-$(CONFIG_MT76x2U) += mt76x2u.o
obj-$(CONFIG_MT76x2U) += mt76x2u.o
@@ -13,6 +14,8 @@ mt76-usb-y := usb.o usb_trace.o usb_mcu.o
CFLAGS_trace.o := -I$(src)
CFLAGS_trace.o := -I$(src)
CFLAGS_usb_trace.o := -I$(src)
CFLAGS_usb_trace.o := -I$(src)


mt76x02-lib-y := mt76x02_util.o

mt76x2-common-y := \
mt76x2-common-y := \
	mt76x2_eeprom.o mt76x2_tx_common.o mt76x2_mac_common.o \
	mt76x2_eeprom.o mt76x2_tx_common.o mt76x2_mac_common.o \
	mt76x2_init_common.o mt76x2_common.o mt76x2_phy_common.o \
	mt76x2_init_common.o mt76x2_common.o mt76x2_phy_common.o \
+1 −0
Original line number Original line Diff line number Diff line
@@ -283,6 +283,7 @@ mt76_alloc_device(unsigned int size, const struct ieee80211_ops *ops)
	spin_lock_init(&dev->rx_lock);
	spin_lock_init(&dev->rx_lock);
	spin_lock_init(&dev->lock);
	spin_lock_init(&dev->lock);
	spin_lock_init(&dev->cc_lock);
	spin_lock_init(&dev->cc_lock);
	mutex_init(&dev->mutex);
	init_waitqueue_head(&dev->tx_wait);
	init_waitqueue_head(&dev->tx_wait);


	return dev;
	return dev;
+5 −0
Original line number Original line Diff line number Diff line
@@ -317,6 +317,9 @@ struct mt76_dev {


	spinlock_t lock;
	spinlock_t lock;
	spinlock_t cc_lock;
	spinlock_t cc_lock;

	struct mutex mutex;

	const struct mt76_bus_ops *bus;
	const struct mt76_bus_ops *bus;
	const struct mt76_driver_ops *drv;
	const struct mt76_driver_ops *drv;
	void __iomem *regs;
	void __iomem *regs;
@@ -353,6 +356,8 @@ struct mt76_dev {
	bool led_al;
	bool led_al;
	u8 led_pin;
	u8 led_pin;


	u32 rxfilter;

	struct mt76_usb usb;
	struct mt76_usb usb;
};
};


+3 −3
Original line number Original line Diff line number Diff line
@@ -290,14 +290,14 @@ int mt76x0_mac_start(struct mt76x0_dev *dev)
		       MT_WPDMA_GLO_CFG_RX_DMA_BUSY, 0, 200000))
		       MT_WPDMA_GLO_CFG_RX_DMA_BUSY, 0, 200000))
		return -ETIMEDOUT;
		return -ETIMEDOUT;


	dev->rxfilter = MT_RX_FILTR_CFG_CRC_ERR |
	dev->mt76.rxfilter = MT_RX_FILTR_CFG_CRC_ERR |
		MT_RX_FILTR_CFG_PHY_ERR | MT_RX_FILTR_CFG_PROMISC |
		MT_RX_FILTR_CFG_PHY_ERR | MT_RX_FILTR_CFG_PROMISC |
		MT_RX_FILTR_CFG_VER_ERR | MT_RX_FILTR_CFG_DUP |
		MT_RX_FILTR_CFG_VER_ERR | MT_RX_FILTR_CFG_DUP |
		MT_RX_FILTR_CFG_CFACK | MT_RX_FILTR_CFG_CFEND |
		MT_RX_FILTR_CFG_CFACK | MT_RX_FILTR_CFG_CFEND |
		MT_RX_FILTR_CFG_ACK | MT_RX_FILTR_CFG_CTS |
		MT_RX_FILTR_CFG_ACK | MT_RX_FILTR_CFG_CTS |
		MT_RX_FILTR_CFG_RTS | MT_RX_FILTR_CFG_PSPOLL |
		MT_RX_FILTR_CFG_RTS | MT_RX_FILTR_CFG_PSPOLL |
		MT_RX_FILTR_CFG_BA | MT_RX_FILTR_CFG_CTRL_RSV;
		MT_RX_FILTR_CFG_BA | MT_RX_FILTR_CFG_CTRL_RSV;
	mt76_wr(dev, MT_RX_FILTR_CFG, dev->rxfilter);
	mt76_wr(dev, MT_RX_FILTR_CFG, dev->mt76.rxfilter);


	mt76_wr(dev, MT_MAC_SYS_CTRL,
	mt76_wr(dev, MT_MAC_SYS_CTRL,
		   MT_MAC_SYS_CTRL_ENABLE_TX | MT_MAC_SYS_CTRL_ENABLE_RX);
		   MT_MAC_SYS_CTRL_ENABLE_TX | MT_MAC_SYS_CTRL_ENABLE_RX);
@@ -495,7 +495,7 @@ struct mt76x0_dev *mt76x0_alloc_device(struct device *pdev)
	mutex_init(&dev->usb_ctrl_mtx);
	mutex_init(&dev->usb_ctrl_mtx);
	mutex_init(&dev->reg_atomic_mutex);
	mutex_init(&dev->reg_atomic_mutex);
	mutex_init(&dev->hw_atomic_mutex);
	mutex_init(&dev->hw_atomic_mutex);
	mutex_init(&dev->mutex);
	mutex_init(&dev->mt76.mutex);
	spin_lock_init(&dev->tx_lock);
	spin_lock_init(&dev->tx_lock);
	spin_lock_init(&dev->rx_lock);
	spin_lock_init(&dev->rx_lock);
	spin_lock_init(&dev->mt76.lock);
	spin_lock_init(&dev->mt76.lock);
Loading