Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 07 Feb 2026 00:58:21 +0000
From:      Bjoern A. Zeeb <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 201fc8a55a48 - main - mt76: sort bus attachments in module Makefiles for pci and usb
Message-ID:  <69868e2d.323e5.1406dd34@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=201fc8a55a4832174b5943e17ac90800aebe5772

commit 201fc8a55a4832174b5943e17ac90800aebe5772
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-02-02 01:23:10 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-02-07 00:57:50 +0000

    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
---
 sys/modules/mt76/Makefile.inc    |  6 ++++++
 sys/modules/mt76/core/Makefile   |  7 +++++++
 sys/modules/mt76/mt7921/Makefile | 18 +++++++++++++-----
 sys/modules/mt76/mt7925/Makefile | 12 +++++++++---
 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


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69868e2d.323e5.1406dd34>