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

mt76: mt7615: introduce mt7663u support



Introduce support for mt7663u 802.11ac 2x2:2 chipset to mt7615 driver.
Main difference respect to pcie code base is the usb code needs to
configure wtbl from non-atomic context

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 e90354e0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -285,6 +285,7 @@ enum {
	MT76_MCU_RESET,
	MT76_REMOVED,
	MT76_READING_STATS,
	MT76_STATE_POWER_OFF,
};

struct mt76_hw_cap {
+11 −0
Original line number Diff line number Diff line
@@ -27,3 +27,14 @@ config MT7622_WMAC
	  This adds support for the built-in WMAC on MT7622 SoC devices
	  which has the same feature set as a MT7615, but limited to
	  2.4 GHz only.

config MT7663U
	tristate "MediaTek MT7663U (USB) support"
	select MT76_USB
	select MT7615_COMMON
	depends on MAC80211
	depends on USB
	help
	  This adds support for MT7663U 802.11ax 2x2:2 wireless devices.

	  To compile this driver as a module, choose M here.
+3 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

obj-$(CONFIG_MT7615_COMMON) += mt7615-common.o
obj-$(CONFIG_MT7615E) += mt7615e.o
obj-$(CONFIG_MT7663U) += mt7663u.o

CFLAGS_trace.o := -I$(src)

@@ -10,3 +11,5 @@ mt7615-common-y := main.o init.o mcu.o eeprom.o mac.o \

mt7615e-y := pci.o pci_init.o dma.o pci_mac.o mmio.o
mt7615e-$(CONFIG_MT7622_WMAC) += soc.o

mt7663u-y := usb.o usb_mcu.o usb_init.o
+28 −0
Original line number Diff line number Diff line
@@ -871,6 +871,29 @@ mt7615_mac_update_rate_desc(struct mt7615_phy *phy, struct mt7615_sta *sta,
	rd->bw = bw;
}

static int
mt7615_mac_queue_rate_update(struct mt7615_phy *phy, struct mt7615_sta *sta,
			     struct ieee80211_tx_rate *probe_rate,
			     struct ieee80211_tx_rate *rates)
{
	struct mt7615_dev *dev = phy->dev;
	struct mt7615_wtbl_desc *wd;

	wd = kzalloc(sizeof(*wd), GFP_ATOMIC);
	if (!wd)
		return -ENOMEM;

	wd->type = MT7615_WTBL_RATE_DESC;
	wd->sta = sta;

	mt7615_mac_update_rate_desc(phy, sta, probe_rate, rates,
				    &wd->rate);
	list_add_tail(&wd->node, &dev->wd_head);
	queue_work(dev->mt76.usb.wq, &dev->wtbl_work);

	return 0;
}

void mt7615_mac_set_rates(struct mt7615_phy *phy, struct mt7615_sta *sta,
			  struct ieee80211_tx_rate *probe_rate,
			  struct ieee80211_tx_rate *rates)
@@ -880,6 +903,11 @@ void mt7615_mac_set_rates(struct mt7615_phy *phy, struct mt7615_sta *sta,
	struct mt7615_rate_desc rd;
	u32 w5, w27, addr;

	if (mt76_is_usb(&dev->mt76)) {
		mt7615_mac_queue_rate_update(phy, sta, probe_rate, rates);
		return;
	}

	if (!mt76_poll(dev, MT_WTBL_UPDATE, MT_WTBL_UPDATE_BUSY, 0, 5000))
		return;

+4 −1
Original line number Diff line number Diff line
@@ -165,9 +165,12 @@ enum tx_phy_bandwidth {
#define MT_CT_INFO_NONE_CIPHER_FRAME	BIT(3)
#define MT_CT_INFO_HSR2_TX		BIT(4)

#define MT_USB_TXD_SIZE			(MT_TXD_SIZE + 8 * 4)
#define MT_TXD_SIZE			(8 * 4)

#define MT_USB_TXD_SIZE			(MT_TXD_SIZE + 8 * 4)
#define MT_USB_HDR_SIZE			4
#define MT_USB_TAIL_SIZE		4

#define MT_TXD0_P_IDX			BIT(31)
#define MT_TXD0_Q_IDX			GENMASK(30, 26)
#define MT_TXD0_UDP_TCP_SUM		BIT(24)
Loading