Commit 6bad146d authored by Alexander Couzens's avatar Alexander Couzens Committed by Felix Fietkau
Browse files

wifi: mt76: mt7915: add support for MT7981



Add support for the MediaTek MT7981 SoC which is similar to the MT7986
but with a newer IP cores and only 2x ARM Cortex-A53 instead of 4x.
Unlike MT7986 the MT7981 can only connect a single wireless frontend,
usually MT7976 is used for DBDC.

Signed-off-by: default avatarAlexander Couzens <lynxis@fe80.eu>
Signed-off-by: default avatarDaniel Golle <daniel@makrotopia.org>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 7a01cad9
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -197,11 +197,21 @@ static inline bool is_mt7916(struct mt76_dev *dev)
	return mt76_chip(dev) == 0x7906;
}

static inline bool is_mt7981(struct mt76_dev *dev)
{
	return mt76_chip(dev) == 0x7981;
}

static inline bool is_mt7986(struct mt76_dev *dev)
{
	return mt76_chip(dev) == 0x7986;
}

static inline bool is_mt798x(struct mt76_dev *dev)
{
	return is_mt7981(dev) || is_mt7986(dev);
}

static inline bool is_mt7996(struct mt76_dev *dev)
{
	return mt76_chip(dev) == 0x7990;
+3 −3
Original line number Diff line number Diff line
@@ -14,12 +14,12 @@ config MT7915E

	  To compile this driver as a module, choose M here.

config MT7986_WMAC
	bool "MT7986 (SoC) WMAC support"
config MT798X_WMAC
	bool "MT798x (SoC) WMAC support"
	depends on MT7915E
	depends on ARCH_MEDIATEK || COMPILE_TEST
	select REGMAP
	help
	  This adds support for the built-in WMAC on MT7986 SoC device
	  This adds support for the built-in WMAC on MT7981 and MT7986 SoC device
	  which has the same feature set as a MT7915, but enables 6E
	  support.
+1 −1
Original line number Diff line number Diff line
@@ -6,5 +6,5 @@ mt7915e-y := pci.o init.o dma.o eeprom.o main.o mcu.o mac.o \
	     debugfs.o mmio.o

mt7915e-$(CONFIG_NL80211_TESTMODE) += testmode.o
mt7915e-$(CONFIG_MT7986_WMAC) += soc.o
mt7915e-$(CONFIG_MT798X_WMAC) += soc.o
mt7915e-$(CONFIG_DEV_COREDUMP) += coredump.o
+4 −3
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ static const struct mt7915_mem_region mt7916_mem_regions[] = {
	},
};

static const struct mt7915_mem_region mt7986_mem_regions[] = {
static const struct mt7915_mem_region mt798x_mem_regions[] = {
	{
		.start = 0x00800000,
		.len = 0x0005ffff,
@@ -92,9 +92,10 @@ mt7915_coredump_get_mem_layout(struct mt7915_dev *dev, u32 *num)
	case 0x7915:
		*num = ARRAY_SIZE(mt7915_mem_regions);
		return &mt7915_mem_regions[0];
	case 0x7981:
	case 0x7986:
		*num = ARRAY_SIZE(mt7986_mem_regions);
		return &mt7986_mem_regions[0];
		*num = ARRAY_SIZE(mt798x_mem_regions);
		return &mt798x_mem_regions[0];
	case 0x7916:
		*num = ARRAY_SIZE(mt7916_mem_regions);
		return &mt7916_mem_regions[0];
+3 −3
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ mt7915_init_tx_queues(struct mt7915_phy *phy, int idx, int n_desc, int ring_base
	struct mt7915_dev *dev = phy->dev;

	if (mtk_wed_device_active(&phy->dev->mt76.mmio.wed)) {
		if (is_mt7986(&dev->mt76))
		if (is_mt798x(&dev->mt76))
			ring_base += MT_TXQ_ID(0) * MT_RING_SIZE;
		else
			ring_base = MT_WED_TX_RING_BASE;
@@ -370,7 +370,7 @@ static int mt7915_dma_enable(struct mt7915_dev *dev)
		int ret;

		wed_irq_mask |= MT_INT_TX_DONE_BAND0 | MT_INT_TX_DONE_BAND1;
		if (!is_mt7986(&dev->mt76))
		if (!is_mt798x(&dev->mt76))
			mt76_wr(dev, MT_INT_WED_MASK_CSR, wed_irq_mask);
		else
			mt76_wr(dev, MT_INT_MASK_CSR, wed_irq_mask);
@@ -404,7 +404,7 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
	mt7915_dma_disable(dev, true);

	if (mtk_wed_device_active(&mdev->mmio.wed)) {
		if (!is_mt7986(mdev)) {
		if (!is_mt798x(mdev)) {
			u8 wed_control_rx1 = is_mt7915(mdev) ? 1 : 2;

			mt76_set(dev, MT_WFDMA_HOST_CONFIG,
Loading