git: 846ec9bcc9c7 - main - arm64: Add MediaTek SoC support skeleton

From: Hayzam Sherif <hayzam_at_FreeBSD.org>
Date: Fri, 20 Nov 2026 01:13:42 UTC
The branch main has been updated by hayzam:

URL: https://cgit.FreeBSD.org/src/commit/?id=846ec9bcc9c7b4d8bb4467fd759bac62f18fa29f

commit 846ec9bcc9c7b4d8bb4467fd759bac62f18fa29f
Author:     Hayzam Sherif <hayzam@FreeBSD.org>
AuthorDate: 2026-11-04 10:26:49 +0000
Commit:     Hayzam Sherif <hayzam@FreeBSD.org>
CommitDate: 2026-11-20 01:10:53 +0000

    arm64: Add MediaTek SoC support skeleton
    
    Add the SOC_MEDIATEK and SOC_MEDIATEK_MT7986 options, list them in
    NOTES, add std.mediatek, include it in GENERIC and in a MEDIATEK kernel
    configuration, and add a DTB module that builds the Banana Pi BPI-R3
    (MT7986A) DTB.
    
    Reviewed by:    mmel
    Approved by:    markj (mentor)
    Sponsored by:   Alchemilla Ventures Private Limited
    Differential Revision:  https://reviews.freebsd.org/D61186
---
 sys/arm64/conf/GENERIC            |  1 +
 sys/arm64/conf/MEDIATEK           | 27 +++++++++++++++++++++++++++
 sys/arm64/conf/NOTES              |  2 ++
 sys/arm64/conf/std.mediatek       | 12 ++++++++++++
 sys/conf/options.arm64            |  2 ++
 sys/modules/dtb/mediatek/Makefile |  5 +++++
 6 files changed, 49 insertions(+)

diff --git a/sys/arm64/conf/GENERIC b/sys/arm64/conf/GENERIC
index 51d830c5e5d6..c250e4b8a14b 100644
--- a/sys/arm64/conf/GENERIC
+++ b/sys/arm64/conf/GENERIC
@@ -38,6 +38,7 @@ include		"std.hyperv"
 include		"std.hisilicon"
 include		"std.imx"
 include		"std.marvell"
+include		"std.mediatek"
 include		"std.nvidia"
 include		"std.nxp"
 include		"std.qcom"
diff --git a/sys/arm64/conf/MEDIATEK b/sys/arm64/conf/MEDIATEK
new file mode 100644
index 000000000000..0e68657b341b
--- /dev/null
+++ b/sys/arm64/conf/MEDIATEK
@@ -0,0 +1,27 @@
+#
+# MEDIATEK -- MediaTek kernel configuration file for FreeBSD/arm64
+#
+# For more information on this file, please read the config(5) manual page,
+# and/or the handbook section on Kernel Configuration Files:
+#
+#    https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config
+#
+# The handbook is also available locally in /usr/share/doc/handbook
+# if you've installed the doc distribution, otherwise always see the
+# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the
+# latest information.
+#
+# An exhaustive list of options and more detailed explanations of the
+# device lines is also present in the ../../conf/NOTES and NOTES files.
+# If you are in doubt as to the purpose or necessity of a line, check first
+# in NOTES.
+#
+
+#NO_UNIVERSE
+
+cpu		ARM64
+ident		MEDIATEK
+
+include		"std.arm64"
+include		"std.dev"
+include		"std.mediatek"
diff --git a/sys/arm64/conf/NOTES b/sys/arm64/conf/NOTES
index c0dac0a746f1..ca923e2ba7cf 100644
--- a/sys/arm64/conf/NOTES
+++ b/sys/arm64/conf/NOTES
@@ -43,6 +43,8 @@ options 	SOC_FREESCALE_IMX8
 options 	SOC_HISI_HI6220
 options 	SOC_INTEL_STRATIX10
 options 	SOC_MARVELL_8K
+options 	SOC_MEDIATEK
+options 	SOC_MEDIATEK_MT7986
 options 	SOC_NVIDIA_TEGRA210
 options 	SOC_NXP_LS
 options 	SOC_ROCKCHIP
diff --git a/sys/arm64/conf/std.mediatek b/sys/arm64/conf/std.mediatek
new file mode 100644
index 000000000000..a0f45bab3c24
--- /dev/null
+++ b/sys/arm64/conf/std.mediatek
@@ -0,0 +1,12 @@
+#
+# MediaTek SoC support
+#
+
+# SoC support
+options 	SOC_MEDIATEK
+options 	SOC_MEDIATEK_MT7986
+
+options 	FDT
+
+# DTBs
+makeoptions	MODULES_EXTRA+="dtb/mediatek"
diff --git a/sys/conf/options.arm64 b/sys/conf/options.arm64
index 1428edba2fbe..fb7cb32c950e 100644
--- a/sys/conf/options.arm64
+++ b/sys/conf/options.arm64
@@ -39,6 +39,8 @@ SOC_FREESCALE_IMX8		opt_soc.h
 SOC_HISI_HI6220			opt_soc.h
 SOC_INTEL_STRATIX10		opt_soc.h
 SOC_MARVELL_8K			opt_soc.h
+SOC_MEDIATEK			opt_soc.h
+SOC_MEDIATEK_MT7986		opt_soc.h	# Depends on SOC_MEDIATEK
 SOC_NVIDIA_TEGRA210		opt_soc.h
 SOC_NXP_LS			opt_soc.h
 SOC_ROCKCHIP			opt_soc.h
diff --git a/sys/modules/dtb/mediatek/Makefile b/sys/modules/dtb/mediatek/Makefile
new file mode 100644
index 000000000000..7071a800d24e
--- /dev/null
+++ b/sys/modules/dtb/mediatek/Makefile
@@ -0,0 +1,5 @@
+# All the dts files for MediaTek systems we support.
+DTS=	\
+	mediatek/mt7986a-bananapi-bpi-r3.dts
+
+.include <bsd.dtb.mk>