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

mt76: mt7615: move core shared code in mt7615-common module



Create mt7615-common module in order to collect shared code between usb
and mmio code. Move the following source files in mt7615-common module:
- main.c
- init.c
- mcu.c
- mac.c
- debugfs.c
- eeprom.c
- trace.c

Create the following source files for mmio only source code and move them
in mt7615e module:
- pci_init.c
- dma.c
- pci_mac.c

Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 4fcf6e77
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -26,4 +26,4 @@ mt76x02-usb-y := mt76x02_usb_mcu.o mt76x02_usb_core.o
obj-$(CONFIG_MT76x0_COMMON) += mt76x0/
obj-$(CONFIG_MT76x2_COMMON) += mt76x2/
obj-$(CONFIG_MT7603E) += mt7603/
obj-$(CONFIG_MT7615E) += mt7615/
obj-$(CONFIG_MT7615_COMMON) += mt7615/
+6 −1
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only

config MT7615_COMMON
	tristate
	select MT76_CORE

config MT7615E
	tristate "MediaTek MT7615E (PCIe) support"
	select MT76_CORE
	select MT7615_COMMON
	depends on MAC80211
	depends on PCI
	help
+5 −2
Original line number Diff line number Diff line
#SPDX-License-Identifier: ISC

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

CFLAGS_trace.o := -I$(src)

mt7615e-y := pci.o init.o dma.o eeprom.o main.o mcu.o mac.o mmio.o \
mt7615-common-y := main.o init.o mcu.o eeprom.o mac.o \
		   debugfs.o trace.o

mt7615e-y := pci.o pci_init.o dma.o pci_mac.o mmio.o
mt7615e-$(CONFIG_MT7622_WMAC) += soc.o
+1 −0
Original line number Diff line number Diff line
@@ -325,3 +325,4 @@ int mt7615_init_debugfs(struct mt7615_dev *dev)

	return 0;
}
EXPORT_SYMBOL_GPL(mt7615_init_debugfs);
+0 −39
Original line number Diff line number Diff line
@@ -94,45 +94,6 @@ mt7615_init_tx_queues(struct mt7615_dev *dev)
	return 0;
}

void mt7615_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
			 struct sk_buff *skb)
{
	struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76);
	__le32 *rxd = (__le32 *)skb->data;
	__le32 *end = (__le32 *)&skb->data[skb->len];
	enum rx_pkt_type type;
	u16 flag;

	type = FIELD_GET(MT_RXD0_PKT_TYPE, le32_to_cpu(rxd[0]));
	flag = FIELD_GET(MT_RXD0_PKT_FLAG, le32_to_cpu(rxd[0]));
	if (type == PKT_TYPE_RX_EVENT && flag == 0x1)
		type = PKT_TYPE_NORMAL_MCU;

	switch (type) {
	case PKT_TYPE_TXS:
		for (rxd++; rxd + 7 <= end; rxd += 7)
			mt7615_mac_add_txs(dev, rxd);
		dev_kfree_skb(skb);
		break;
	case PKT_TYPE_TXRX_NOTIFY:
		mt7615_mac_tx_free(dev, skb);
		break;
	case PKT_TYPE_RX_EVENT:
		mt7615_mcu_rx_event(dev, skb);
		break;
	case PKT_TYPE_NORMAL_MCU:
	case PKT_TYPE_NORMAL:
		if (!mt7615_mac_fill_rx(dev, skb)) {
			mt76_rx(&dev->mt76, q, skb);
			return;
		}
		/* fall through */
	default:
		dev_kfree_skb(skb);
		break;
	}
}

static void
mt7615_tx_cleanup(struct mt7615_dev *dev)
{
Loading