aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2026-02-02 01:23:10 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2026-02-07 00:57:50 +0000
commit201fc8a55a4832174b5943e17ac90800aebe5772 (patch)
tree0788e0f13bbaa558665e3535d8828a99bc72ba95
parent18721be356043f6749a6e2470bc9f7351c450c6e (diff)
mt76: sort bus attachments in module Makefiles for pci and usb
With PCI enabled and USB still disabled add knobs to (i) enabled them manually in the common Makefile.inc and (ii) add bus attachment depend knobs where needed to enable them in individual drivers. For now the focus is in 7921 and 7925. Sponsored by: The FreeBSD Foundation MFC atfer: 3 days
-rw-r--r--sys/modules/mt76/Makefile.inc6
-rw-r--r--sys/modules/mt76/core/Makefile7
-rw-r--r--sys/modules/mt76/mt7921/Makefile18
-rw-r--r--sys/modules/mt76/mt7925/Makefile12
4 files changed, 35 insertions, 8 deletions
diff --git a/sys/modules/mt76/Makefile.inc b/sys/modules/mt76/Makefile.inc
index e4369564237e..739c85c60dac 100644
--- a/sys/modules/mt76/Makefile.inc
+++ b/sys/modules/mt76/Makefile.inc
@@ -4,6 +4,12 @@ COMMONDIR= ${SRCTOP}/sys/contrib/dev/mediatek/mt76
.PATH: ${COMMONDIR}
+# Bus attachments.
+WITH_PCI= 1
+WITH_USB= 0
+WITH_SDIO= 0
+
+# Options.
WITH_CONFIG_PM= 0
WITH_DEBUGFS= 0
WITH_SOC_WED= 0
diff --git a/sys/modules/mt76/core/Makefile b/sys/modules/mt76/core/Makefile
index c782bf218d93..589063a23229 100644
--- a/sys/modules/mt76/core/Makefile
+++ b/sys/modules/mt76/core/Makefile
@@ -1,3 +1,5 @@
+.include <kmod.opts.mk>
+
KMOD= mt76_core
# Basic stuff.
@@ -6,10 +8,15 @@ SRCS+= channel.c scan.c wed.c
#SRCS+= trace.c
# Bus stuff.
+# PCI parts; PCI needs to be compiled into the kernel and cannot be loaded.
+.if defined(WITH_PCI) && ${WITH_PCI} > 0 && ${KERN_OPTS:MDEV_PCI}
SRCS+= pci.c
+.endif
+
.if defined(WITH_USB) && ${WITH_USB} > 0
SRCS+= usb.c # usb_trace.c
.endif
+
#SRCS+= sdio.c sdio_txrx.c
# Connac-Lib stuff.
diff --git a/sys/modules/mt76/mt7921/Makefile b/sys/modules/mt76/mt7921/Makefile
index d3f201997a2d..1b53df04357c 100644
--- a/sys/modules/mt76/mt7921/Makefile
+++ b/sys/modules/mt76/mt7921/Makefile
@@ -1,3 +1,5 @@
+.include <kmod.opts.mk>
+
DEVDIR= ${SRCTOP}/sys/contrib/dev/mediatek/mt76/mt7921
.PATH: ${DEVDIR}
@@ -7,14 +9,20 @@ KMOD= if_mt7921
# Common stuff.
SRCS= init.c main.c mac.c mcu.c
-# PCI stuff.
+# PCI parts; PCI needs to be compiled into the kernel and cannot be loaded.
+.if defined(WITH_PCI) && ${WITH_PCI} > 0 && ${KERN_OPTS:MDEV_PCI}
SRCS+= pci.c pci_mac.c pci_mcu.c
+.endif
-# USB stuff.
-#SRCS+= usb.c
+# USB parts; USB can be loaded and is unconditional on any kernel config.
+.if defined(WITH_USB) && ${WITH_USB} > 0
+SRCS+= usb.c
+.endif
-# SDIO stuff.
-#SRCS+= sdio.c sdio_mac.c sdio_mcu.c
+# SDIO parts; SDIO depends on an MMCCAM kernel.
+.if defined(WITH_SDIO) && ${WITH_SDIO} > 0 && ${KERN_OPTS:MMMCCAM}
+SRCS+= sdio.c sdio_mac.c sdio_mcu.c
+.endif
.if defined(WITH_DEBUGFS) && ${WITH_DEBUGFS} > 0
SRCS+= debugfs.c
diff --git a/sys/modules/mt76/mt7925/Makefile b/sys/modules/mt76/mt7925/Makefile
index dc6de5085d77..ee79f09dba1c 100644
--- a/sys/modules/mt76/mt7925/Makefile
+++ b/sys/modules/mt76/mt7925/Makefile
@@ -1,3 +1,5 @@
+.include <kmod.opts.mk>
+
DEVDIR= ${SRCTOP}/sys/contrib/dev/mediatek/mt76/mt7925
.PATH: ${DEVDIR}
@@ -7,11 +9,15 @@ KMOD= if_mt7925
# Common stuff.
SRCS= init.c main.c mac.c mcu.c regd.c
-# PCI stuff.
+# PCI parts; PCI needs to be compiled into the kernel and cannot be loaded.
+.if defined(WITH_PCI) && ${WITH_PCI} > 0 && ${KERN_OPTS:MDEV_PCI}
SRCS+= pci.c pci_mac.c pci_mcu.c
+.endif
-# USB stuff.
-#SRCS+= usb.c
+# USB parts; USB can be loaded and is unconditional on any kernel config.
+.if defined(WITH_USB) && ${WITH_USB} > 0
+SRCS+= usb.c
+.endif
.if defined(WITH_DEBUGFS) && ${WITH_DEBUGFS} > 0
SRCS+= debugfs.c