Skip to contentSkip to conversation

Add support for MediaTek MT7987 SoC

PATCH In review Weijie Gao 2 participants 7 messages Jan 23, 2025 – Jan 30, 2025

Subsystems (9)
lore
Share & tools
lore

Weijie Gao

author
#0 lore raw

cover Add support for MediaTek MT7987 SoC

This patch series add support for MediaTek MT7987 SoC with its reference boards and related drivers.

This patch series add basic boot support on eMMC/SD/SPI-NOR/SPI-NAND for these boards. The clock, pinctrl drivers and the SoC initializaton code are also included.

Weijie Gao (5):
clk: mediatek: add clock driver support for MediaTek MT7987 SoC
pinctrl: mediatek: add pinctrl driver for MT7987 SoC
mmc: mediatek: add support for MediaTek MT7987 SoCs
arm: mediatek: add support for MediaTek MT7987 SoC
board: mediatek: add MT7987 reference boards

 arch/arm/dts/mt7987-emmc.dtsi                 |  50 ++
 arch/arm/dts/mt7987-netsys-u-boot.dtsi        |  51 ++
 arch/arm/dts/mt7987-pinctrl-u-boot.dtsi       | 146 +++
 arch/arm/dts/mt7987-pinctrl.dtsi              | 200 +++++
 arch/arm/dts/mt7987-sd.dtsi                   |  37 +
 arch/arm/dts/mt7987.dtsi                      | 808 +++++++++++++++++
 arch/arm/dts/mt7987a-emmc-rfb-u-boot.dtsi     |  61 ++
 arch/arm/dts/mt7987a-emmc-rfb.dts             |  37 +
 arch/arm/dts/mt7987a-rfb-u-boot.dtsi          |  71 ++
 arch/arm/dts/mt7987a-rfb.dts                  |  34 +
 arch/arm/dts/mt7987a-sd-rfb-u-boot.dtsi       |  59 ++
 arch/arm/dts/mt7987a-sd-rfb.dts               |  37 +
 arch/arm/dts/mt7987a-u-boot.dtsi              |  66 ++
 arch/arm/dts/mt7987a.dtsi                     |  96 ++
 arch/arm/mach-mediatek/Kconfig                |  19 +-
 arch/arm/mach-mediatek/Makefile               |   2 +
 arch/arm/mach-mediatek/mt7987/Makefile        |   4 +
 arch/arm/mach-mediatek/mt7987/init.c          |  62 ++
 arch/arm/mach-mediatek/mt7987/lowlevel_init.S |  30 +
 arch/arm/mach-mediatek/tzcfg.c                | 242 +++++
 board/mediatek/mt7987/MAINTAINERS             |   8 +
 board/mediatek/mt7987/Makefile                |   3 +
 board/mediatek/mt7987/mt7987_rfb.c            |  10 +
 configs/mt7987_emmc_rfb_defconfig             |  91 ++
 configs/mt7987_rfb_defconfig                  |  87 ++
 configs/mt7987_sd_rfb_defconfig               |  91 ++
 drivers/clk/mediatek/Makefile                 |   1 +
 drivers/clk/mediatek/clk-mt7987.c             | 848 ++++++++++++++++++
 drivers/mmc/mtk-sd.c                          |  21 +-
 drivers/pinctrl/mediatek/Kconfig              |   4 +
 drivers/pinctrl/mediatek/Makefile             |   1 +
 drivers/pinctrl/mediatek/pinctrl-mt7987.c     | 736 +++++++++++++++
 include/configs/mt7987.h                      |  14 +
 .../dt-bindings/clock/mediatek,mt7987-clk.h   | 206 +++++
 34 files changed, 4230 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/dts/mt7987-emmc.dtsi
 create mode 100644 arch/arm/dts/mt7987-netsys-u-boot.dtsi
 create mode 100644 arch/arm/dts/mt7987-pinctrl-u-boot.dtsi
 create mode 100644 arch/arm/dts/mt7987-pinctrl.dtsi
 create mode 100644 arch/arm/dts/mt7987-sd.dtsi
 create mode 100644 arch/arm/dts/mt7987.dtsi
 create mode 100644 arch/arm/dts/mt7987a-emmc-rfb-u-boot.dtsi
 create mode 100644 arch/arm/dts/mt7987a-emmc-rfb.dts
 create mode 100644 arch/arm/dts/mt7987a-rfb-u-boot.dtsi
 create mode 100644 arch/arm/dts/mt7987a-rfb.dts
 create mode 100644 arch/arm/dts/mt7987a-sd-rfb-u-boot.dtsi
 create mode 100644 arch/arm/dts/mt7987a-sd-rfb.dts
 create mode 100644 arch/arm/dts/mt7987a-u-boot.dtsi
 create mode 100644 arch/arm/dts/mt7987a.dtsi
 create mode 100644 arch/arm/mach-mediatek/mt7987/Makefile
 create mode 100644 arch/arm/mach-mediatek/mt7987/init.c
 create mode 100644 arch/arm/mach-mediatek/mt7987/lowlevel_init.S
 create mode 100644 arch/arm/mach-mediatek/tzcfg.c
 create mode 100644 board/mediatek/mt7987/MAINTAINERS
 create mode 100644 board/mediatek/mt7987/Makefile
 create mode 100644 board/mediatek/mt7987/mt7987_rfb.c
 create mode 100644 configs/mt7987_emmc_rfb_defconfig
 create mode 100644 configs/mt7987_rfb_defconfig
 create mode 100644 configs/mt7987_sd_rfb_defconfig
 create mode 100644 drivers/clk/mediatek/clk-mt7987.c
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt7987.c
 create mode 100644 include/configs/mt7987.h
 create mode 100644 include/dt-bindings/clock/mediatek,mt7987-clk.h
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 1/5 clk: mediatek: add clock driver support for MediaTek MT7987 SoC

This patch adds clock driver support for MediaTek MT7987 SoC

---
 drivers/clk/mediatek/Makefile                 |   1 +
 drivers/clk/mediatek/clk-mt7987.c             | 848 ++++++++++++++++++
 .../dt-bindings/clock/mediatek,mt7987-clk.h   | 206 +++++
 3 files changed, 1055 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt7987.c
 create mode 100644 include/dt-bindings/clock/mediatek,mt7987-clk.h
drivers/clk/mediatek/Makefile +1 -0
index e631f79e4dd..e412c92cafc 100644
@@ -10,6 +10,7 @@ obj-$(CONFIG_TARGET_MT7629) += clk-mt7629.o
 obj-$(CONFIG_TARGET_MT7986) += clk-mt7986.o
 obj-$(CONFIG_TARGET_MT7981) += clk-mt7981.o
 obj-$(CONFIG_TARGET_MT7988) += clk-mt7988.o
+obj-$(CONFIG_TARGET_MT7987) += clk-mt7987.o
 obj-$(CONFIG_TARGET_MT8183) += clk-mt8183.o
 obj-$(CONFIG_TARGET_MT8365) += clk-mt8365.o
 obj-$(CONFIG_TARGET_MT8516) += clk-mt8516.o
drivers/clk/mediatek/clk-mt7987.c new file +848 -0

848 lines not on this page · raw message

include/dt-bindings/clock/mediatek,mt7987-clk.h new file +206 -0

206 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#2 lore raw

PATCH 2/5 pinctrl: mediatek: add pinctrl driver for MT7987 SoC

In reply to Weijie Gao

This patch adds pinctrl and gpio support for MT7987 SoC

---
 drivers/pinctrl/mediatek/Kconfig          |   4 +
 drivers/pinctrl/mediatek/Makefile         |   1 +
 drivers/pinctrl/mediatek/pinctrl-mt7987.c | 736 ++++++++++++++++++++++
 3 files changed, 741 insertions(+)
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt7987.c
drivers/pinctrl/mediatek/Kconfig +4 -0
index 34d23cece51..8b9180bd2aa 100644
@@ -24,6 +24,10 @@ config PINCTRL_MT7986
 	bool "MT7986 SoC pinctrl driver"
 	select PINCTRL_MTK
 
+config PINCTRL_MT7987
+	bool "MT7987 SoC pinctrl driver"
+	select PINCTRL_MTK
+
 config PINCTRL_MT7988
 	bool "MT7988 SoC pinctrl driver"
 	select PINCTRL_MTK
drivers/pinctrl/mediatek/Makefile +1 -0
index de39d1ea436..b25e74e4e00 100644
@@ -8,6 +8,7 @@ obj-$(CONFIG_PINCTRL_MT7623) += pinctrl-mt7623.o
 obj-$(CONFIG_PINCTRL_MT7629) += pinctrl-mt7629.o
 obj-$(CONFIG_PINCTRL_MT7981) += pinctrl-mt7981.o
 obj-$(CONFIG_PINCTRL_MT7986) += pinctrl-mt7986.o
+obj-$(CONFIG_PINCTRL_MT7987) += pinctrl-mt7987.o
 obj-$(CONFIG_PINCTRL_MT7988) += pinctrl-mt7988.o
 obj-$(CONFIG_PINCTRL_MT8512) += pinctrl-mt8512.o
 obj-$(CONFIG_PINCTRL_MT8516) += pinctrl-mt8516.o
drivers/pinctrl/mediatek/pinctrl-mt7987.c new file +736 -0

736 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#3 lore raw

PATCH 3/5 mmc: mediatek: add support for MediaTek MT7987 SoCs

In reply to Weijie Gao

This patch adds eMMC/SD support for MT7987 SoC

---
 drivers/mmc/mtk-sd.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/mmc/mtk-sd.c +19 -2
index d676cf9e314..2bc700b0d05 100644
@@ -329,6 +329,7 @@ struct msdc_compatible {
 	u8 clk_div_bits;
 	bool pad_tune0;
 	bool async_fifo;
+	bool async_fifo_crcsts;
 	bool data_tune;
 	bool busy_check;
 	bool stop_clk_fix;
@@ -1553,8 +1554,12 @@ static void msdc_init_hw(struct msdc_host *host)
 		/* use async fifo to avoid tune internal delay */
 		clrbits_le32(&host->base->patch_bit2,
 			     MSDC_PB2_CFGRESP);
-		clrbits_le32(&host->base->patch_bit2,
-			     MSDC_PB2_CFGCRCSTS);
+		if (host->dev_comp->async_fifo_crcsts)
+			setbits_le32(&host->base->patch_bit2,
+				     MSDC_PB2_CFGCRCSTS);
+		else
+			clrbits_le32(&host->base->patch_bit2,
+				     MSDC_PB2_CFGCRCSTS);
 	}
 
 	if (host->dev_comp->data_tune) {
@@ -1844,6 +1849,17 @@ static const struct msdc_compatible mt7986_compat = {
 	.enhance_rx = true,
 };
 
+static const struct msdc_compatible mt7987_compat = {
+	.clk_div_bits = 12,
+	.pad_tune0 = true,
+	.async_fifo = true,
+	.async_fifo_crcsts = true,
+	.data_tune = true,
+	.busy_check = true,
+	.stop_clk_fix = true,
+	.enhance_rx = true,
+};
+
 static const struct msdc_compatible mt7981_compat = {
 	.clk_div_bits = 12,
 	.pad_tune0 = true,
@@ -1886,6 +1902,7 @@ static const struct udevice_id msdc_ids[] = {
 	{ .compatible = "mediatek,mt7622-mmc", .data = (ulong)&mt7622_compat },
 	{ .compatible = "mediatek,mt7623-mmc", .data = (ulong)&mt7623_compat },
 	{ .compatible = "mediatek,mt7986-mmc", .data = (ulong)&mt7986_compat },
+	{ .compatible = "mediatek,mt7987-mmc", .data = (ulong)&mt7987_compat },
 	{ .compatible = "mediatek,mt7981-mmc", .data = (ulong)&mt7981_compat },
 	{ .compatible = "mediatek,mt8512-mmc", .data = (ulong)&mt8512_compat },
 	{ .compatible = "mediatek,mt8516-mmc", .data = (ulong)&mt8516_compat },
Signature · 1 line
2.34.1
author
#4 lore raw

PATCH 4/5 arm: mediatek: add support for MediaTek MT7987 SoC

In reply to Weijie Gao

This patch adds basic support for MediaTek MT7987 SoC. This includes files that will initialize the SoC after boot and its device tree.

In order to maximize the continuous usable memory space, MT7987 has its ATF BL31 loaded at the top of RAM. Since u-boot will also locate itself to top of RAM, u-boot will read the actual memory region of BL31 and set correct gd->ram_top to avoid u-boot overlapping with BL31.

As now support for mt7987 hasn't been submitted to linux kernel, all dts filed will be put to arch/arm/dts. They'll be removed after successfully being merged by linux kernel, and OF_UPSTREAM will also be switched on.

---
 arch/arm/dts/mt7987-emmc.dtsi                 |  50 ++
 arch/arm/dts/mt7987-netsys-u-boot.dtsi        |  51 ++
 arch/arm/dts/mt7987-pinctrl-u-boot.dtsi       | 146 ++++
 arch/arm/dts/mt7987-pinctrl.dtsi              | 200 +++++
 arch/arm/dts/mt7987-sd.dtsi                   |  37 +
 arch/arm/dts/mt7987.dtsi                      | 808 ++++++++++++++++++
 arch/arm/dts/mt7987a-u-boot.dtsi              |  66 ++
 arch/arm/dts/mt7987a.dtsi                     |  96 +++
 arch/arm/mach-mediatek/Kconfig                |  19 +-
 arch/arm/mach-mediatek/Makefile               |   2 +
 arch/arm/mach-mediatek/mt7987/Makefile        |   4 +
 arch/arm/mach-mediatek/mt7987/init.c          |  62 ++
 arch/arm/mach-mediatek/mt7987/lowlevel_init.S |  30 +
 arch/arm/mach-mediatek/tzcfg.c                | 242 ++++++
 14 files changed, 1812 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/mt7987-emmc.dtsi
 create mode 100644 arch/arm/dts/mt7987-netsys-u-boot.dtsi
 create mode 100644 arch/arm/dts/mt7987-pinctrl-u-boot.dtsi
 create mode 100644 arch/arm/dts/mt7987-pinctrl.dtsi
 create mode 100644 arch/arm/dts/mt7987-sd.dtsi
 create mode 100644 arch/arm/dts/mt7987.dtsi
 create mode 100644 arch/arm/dts/mt7987a-u-boot.dtsi
 create mode 100644 arch/arm/dts/mt7987a.dtsi
 create mode 100644 arch/arm/mach-mediatek/mt7987/Makefile
 create mode 100644 arch/arm/mach-mediatek/mt7987/init.c
 create mode 100644 arch/arm/mach-mediatek/mt7987/lowlevel_init.S
 create mode 100644 arch/arm/mach-mediatek/tzcfg.c
arch/arm/dts/mt7987-emmc.dtsi new file +50 -0
new file mode 100644
index 00000000000..80ab04d9d20
@@ -0,0 +1,50 @@
+// SPDX-License-Identifier: (GPL-2.0-only OR MIT)
+
+#include "mt7987-pinctrl.dtsi"
+
+/ {
+	reg_1p8v: regulator-1p8v {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-1.8V";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
+
+	reg_3p3v: regulator-3p3v {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-3.3V";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
+};
+
+/* Disable spi0/spi1 node since MSDC shares pins with spi0 and spi1*/
+&spi0 {
+	status = "disabled";
+};
+
+&spi1 {
+	status = "disabled";
+};
+
+&mmc0 {
+	pinctrl-names = "default", "state_uhs";
+	pinctrl-0 = <&mmc_pins_default>;
+	pinctrl-1 = <&mmc_pins_uhs>;
+	bus-width = <8>;
+	max-frequency = <200000000>;
+	cap-mmc-highspeed;
+	mmc-hs200-1_8v;
+	mmc-hs400-1_8v;
+	hs400-ds-delay = <0x12814>;
+	vqmmc-supply = <&reg_1p8v>;
+	vmmc-supply = <&reg_3p3v>;
+	non-removable;
+	no-sd;
+	no-sdio;
+	status = "okay";
+};
arch/arm/dts/mt7987-netsys-u-boot.dtsi new file +51 -0

51 lines not on this page · raw message

arch/arm/dts/mt7987-pinctrl-u-boot.dtsi new file +146 -0

146 lines not on this page · raw message

arch/arm/dts/mt7987-pinctrl.dtsi new file +200 -0

200 lines not on this page · raw message

arch/arm/dts/mt7987-sd.dtsi new file +37 -0
new file mode 100644
index 00000000000..4c8ca48c293
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+
+#include "mt7987-pinctrl.dtsi"
+
+/ {
+	reg_3p3v: regulator-3p3v {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-3.3V";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
+};
+
+/* Disable spi0/spi1 node since MSDC shares pins with spi0 and spi1*/
+&spi0 {
+	status = "disabled";
+};
+
+&spi1 {
+	status = "disabled";
+};
+
+&mmc0 {
+	pinctrl-names = "default", "state_uhs";
+	pinctrl-0 = <&sd_pins_default>;
+	pinctrl-1 = <&sd_pins_uhs>;
+	bus-width = <4>;
+	max-frequency = <50000000>;
+	cap-sd-highspeed;
+	vmmc-supply = <&reg_3p3v>;
+	vqmmc-supply = <&reg_3p3v>;
+	no-mmc;
+	no-sdio;
+	status = "okay";
+};
arch/arm/dts/mt7987.dtsi new file +808 -0

808 lines not on this page · raw message

arch/arm/dts/mt7987a-u-boot.dtsi new file +66 -0

66 lines not on this page · raw message

arch/arm/dts/mt7987a.dtsi new file +96 -0

96 lines not on this page · raw message

arch/arm/mach-mediatek/Kconfig +18 -1
index ff1fdee5c8d..39eea055f70 100644
@@ -59,6 +59,16 @@ config TARGET_MT7986
 	  including UART, SPI, SPI flash, USB3.0, MMC, NAND, SNFI, PWM, PCIe,
 	  Gigabit Ethernet, I2C, built-in 4x4 Wi-Fi, and PCIe.
 
+config TARGET_MT7987
+	bool "MediaTek MT7987 SoC"
+	select ARM64
+	select CPU
+	select MTK_TZ_MOVABLE
+	help
+	  The MediaTek MT7987 is a ARM64-based SoC with a quad-core Cortex-A53.
+	  including UART, I2C, PWM, SPI controller which support SPI flash,
+	  USB3.0, MMC, PCIe, SGMII and built-in Ethernet PHY.
+
 config TARGET_MT7988
 	bool "MediaTek MT7988 SoC"
 	select ARM64
@@ -122,6 +132,7 @@ config SYS_BOARD
 	default "mt7629" if TARGET_MT7629
 	default "mt7981" if TARGET_MT7981
 	default "mt7986" if TARGET_MT7986
+	default "mt7987" if TARGET_MT7987
 	default "mt7988" if TARGET_MT7988
 	default "mt8183" if TARGET_MT8183
 	default "mt8512" if TARGET_MT8512
@@ -139,6 +150,7 @@ config SYS_CONFIG_NAME
 	default "mt7629" if TARGET_MT7629
 	default "mt7981" if TARGET_MT7981
 	default "mt7986" if TARGET_MT7986
+	default "mt7987" if TARGET_MT7987
 	default "mt7988" if TARGET_MT7988
 	default "mt8183" if TARGET_MT8183
 	default "mt8365" if TARGET_MT8365
@@ -150,7 +162,12 @@ config MTK_BROM_HEADER_INFO
 	string
 	default "media=nor" if TARGET_MT8518 || TARGET_MT8512 || TARGET_MT7629 || TARGET_MT7622
 	default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 || TARGET_MT8183
-	default "media=snand;nandinfo=2k+64" if TARGET_MT7981 || TARGET_MT7986 || TARGET_MT7988
+	default "media=snand;nandinfo=2k+64" if TARGET_MT7981 || TARGET_MT7986 || TARGET_MT7987 || TARGET_MT7988
 	default "lk=1" if TARGET_MT7623
 
+config MTK_TZ_MOVABLE
+	select ARCH_MISC_INIT
+	select OF_SYSTEM_SETUP
+	bool
+
 endif
arch/arm/mach-mediatek/Makefile +2 -0
index 3d9e4684fb4..344434c6029 100644
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier:	GPL-2.0
 
 obj-y	+= cpu.o
+obj-$(CONFIG_MTK_TZ_MOVABLE)	+= tzcfg.o
 obj-$(CONFIG_XPL_BUILD)	+= spl.o
 
 obj-$(CONFIG_MT8512) += mt8512/
@@ -9,6 +10,7 @@ obj-$(CONFIG_TARGET_MT7623) += mt7623/
 obj-$(CONFIG_TARGET_MT7629) += mt7629/
 obj-$(CONFIG_TARGET_MT7981) += mt7981/
 obj-$(CONFIG_TARGET_MT7986) += mt7986/
+obj-$(CONFIG_TARGET_MT7987) += mt7987/
 obj-$(CONFIG_TARGET_MT7988) += mt7988/
 obj-$(CONFIG_TARGET_MT8183) += mt8183/
 obj-$(CONFIG_TARGET_MT8365) += mt8365/
arch/arm/mach-mediatek/mt7987/Makefile new file +4 -0
new file mode 100644
index 00000000000..007eb4a3679
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y += init.o
+obj-y += lowlevel_init.o
arch/arm/mach-mediatek/mt7987/init.c new file +62 -0

62 lines not on this page · raw message

arch/arm/mach-mediatek/mt7987/lowlevel_init.S new file +30 -0
new file mode 100644
index 00000000000..2f972551277
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2023 MediaTek Inc.
+ * Author: Sam Shih <[email protected]>
+ */
+
+/*
+ * Switch from AArch64 EL2 to AArch32 EL2
+ * @param inputs:
+ * x0: argument, zero
+ * x1: machine nr
+ * x2: fdt address
+ * x3: input argument
+ * x4: kernel entry point
+ * @param outputs for secure firmware:
+ * x0: function id
+ * x1: kernel entry point
+ * x2: machine nr
+ * x3: fdt address
+*/
+
+.global armv8_el2_to_aarch32
+armv8_el2_to_aarch32:
+	mov     x3, x2
+	mov     x2, x1
+	mov     x1, x4
+	mov	x4, #0
+	ldr x0, =0x82000200
+	SMC #0
+	ret
arch/arm/mach-mediatek/tzcfg.c new file +242 -0

242 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#5 lore raw

PATCH 5/5 board: mediatek: add MT7987 reference boards

In reply to Weijie Gao

This patch adds general board files based on MT7987 SoC.

MT7987 uses one mmc controller for booting from both SD and eMMC, and the pins of mmc controller are also shared with one spi controller. So three configs are need for these boot types:

1. mt7987_rfb_defconfig - SPI-NOR (spi2) and SPI-NAND (spi0)
2. mt7987_emmc_rfb_defconfig - eMMC + SPI-NOR (spi2)
3. mt7987_sd_rfb_defconfig - SD + SPI-NOR (spi2)

Note: spi2 also supports booting from SPI-NAND, but not the default option.

---
 arch/arm/dts/mt7987a-emmc-rfb-u-boot.dtsi | 61 +++++++++++++++
 arch/arm/dts/mt7987a-emmc-rfb.dts         | 37 +++++++++
 arch/arm/dts/mt7987a-rfb-u-boot.dtsi      | 71 ++++++++++++++++++
 arch/arm/dts/mt7987a-rfb.dts              | 34 +++++++++
 arch/arm/dts/mt7987a-sd-rfb-u-boot.dtsi   | 59 +++++++++++++++
 arch/arm/dts/mt7987a-sd-rfb.dts           | 37 +++++++++
 board/mediatek/mt7987/MAINTAINERS         |  8 ++
 board/mediatek/mt7987/Makefile            |  3 +
 board/mediatek/mt7987/mt7987_rfb.c        | 10 +++
 configs/mt7987_emmc_rfb_defconfig         | 91 +++++++++++++++++++++++
 configs/mt7987_rfb_defconfig              | 87 ++++++++++++++++++++++
 configs/mt7987_sd_rfb_defconfig           | 91 +++++++++++++++++++++++
 include/configs/mt7987.h                  | 14 ++++
 13 files changed, 603 insertions(+)
 create mode 100644 arch/arm/dts/mt7987a-emmc-rfb-u-boot.dtsi
 create mode 100644 arch/arm/dts/mt7987a-emmc-rfb.dts
 create mode 100644 arch/arm/dts/mt7987a-rfb-u-boot.dtsi
 create mode 100644 arch/arm/dts/mt7987a-rfb.dts
 create mode 100644 arch/arm/dts/mt7987a-sd-rfb-u-boot.dtsi
 create mode 100644 arch/arm/dts/mt7987a-sd-rfb.dts
 create mode 100644 board/mediatek/mt7987/MAINTAINERS
 create mode 100644 board/mediatek/mt7987/Makefile
 create mode 100644 board/mediatek/mt7987/mt7987_rfb.c
 create mode 100644 configs/mt7987_emmc_rfb_defconfig
 create mode 100644 configs/mt7987_rfb_defconfig
 create mode 100644 configs/mt7987_sd_rfb_defconfig
 create mode 100644 include/configs/mt7987.h
arch/arm/dts/mt7987a-emmc-rfb-u-boot.dtsi new file +61 -0
new file mode 100644
index 00000000000..54cf72b3bf8
@@ -0,0 +1,61 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include "mt7987a-u-boot.dtsi"
+#include "mt7987-netsys-u-boot.dtsi"
+
+/ {
+	model = "mt7987";
+	compatible = "mediatek,mt7987", "mediatek,mt7987-emmc-rfb";
+};
+
+&eth0 {
+	status = "okay";
+	pinctrl-names = "default";
+	pinctrl-0 = <&mdio0_pins>;
+	phy-mode = "2500base-x";
+	mediatek,switch = "auto";
+	reset-gpios = <&pio 42 GPIO_ACTIVE_HIGH>;
+
+	fixed-link {
+		speed = <2500>;
+		full-duplex;
+		pause;
+	};
+};
+
+&mmc0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc_pins_default>;
+	max-frequency = <48000000>;
+	bus-width = <8>;
+	cap-mmc-highspeed;
+	cap-mmc-hw-reset;
+	vmmc-supply = <&reg_3p3v>;
+	vqmmc-supply = <&reg_3p3v>;
+	non-removable;
+	status = "okay";
+};
+
+&spi2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&spi2_flash_pins>;
+	#address-cells = <1>;
+	#size-cells = <0>;
+	status = "okay";
+	must_tx;
+	enhance_timing;
+	dma_ext;
+	ipm_design;
+	support_quad;
+	tick_dly = <2>;
+	sample_sel = <0>;
+
+	/delete-node/ spi_nor@0;
+	spi_nor@0 {
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <52000000>;
+		spi-rx-bus-width = <4>;
+		spi-tx-bus-width = <4>;
+	};
+};
arch/arm/dts/mt7987a-emmc-rfb.dts new file +37 -0
new file mode 100644
index 00000000000..f59e5bd97bf
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+
+/dts-v1/;
+#include "mt7987a.dtsi"
+#include "mt7987-emmc.dtsi"
+#include <dt-bindings/input/input.h>
+
+/ {
+	model = "MediaTek MT7987 EMMC RFB";
+	compatible = "mediatek,mt7987a-emmc",
+		     "mediatek,mt7987a", "mediatek,mt7987";
+
+	chosen {
+		bootargs = "console=ttyS0,115200n1 loglevel=8  \
+			    earlycon=uart8250,mmio32,0x11000000 \
+			    pci=pcie_bus_perf ubi.block=0,firmware \
+			    root=/dev/fit0 rootwait";
+	};
+
+	gpio-keys {
+		compatible = "gpio-keys";
+
+		reset {
+			label = "reset";
+			linux,code = <KEY_RESTART>;
+			gpios = <&pio 1 GPIO_ACTIVE_LOW>;
+			debounce-interval = <10>;
+		};
+
+		wps {
+			label = "wps";
+			linux,code = <KEY_WPS_BUTTON>;
+			gpios = <&pio 0 GPIO_ACTIVE_LOW>;
+			debounce-interval = <10>;
+		};
+	};
+};
arch/arm/dts/mt7987a-rfb-u-boot.dtsi new file +71 -0

71 lines not on this page · raw message

arch/arm/dts/mt7987a-rfb.dts new file +34 -0
new file mode 100644
index 00000000000..0ba6b8d9ad7
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+
+/dts-v1/;
+#include "mt7987a.dtsi"
+#include <dt-bindings/input/input.h>
+
+/ {
+	model = "MediaTek MT7987A RFB";
+	compatible = "mediatek,mt7987a", "mediatek,mt7987";
+
+	chosen {
+		bootargs = "console=ttyS0,115200n1 loglevel=8  \
+			    earlycon=uart8250,mmio32,0x11000000 \
+			    pci=pcie_bus_perf";
+	};
+
+	gpio-keys {
+		compatible = "gpio-keys";
+
+		reset {
+			label = "reset";
+			linux,code = <KEY_RESTART>;
+			gpios = <&pio 1 GPIO_ACTIVE_LOW>;
+			debounce-interval = <10>;
+		};
+
+		wps {
+			label = "wps";
+			linux,code = <KEY_WPS_BUTTON>;
+			gpios = <&pio 0 GPIO_ACTIVE_LOW>;
+			debounce-interval = <10>;
+		};
+	};
+};
arch/arm/dts/mt7987a-sd-rfb-u-boot.dtsi new file +59 -0

59 lines not on this page · raw message

arch/arm/dts/mt7987a-sd-rfb.dts new file +37 -0
new file mode 100644
index 00000000000..85de4990682
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+
+/dts-v1/;
+#include "mt7987a.dtsi"
+#include "mt7987-sd.dtsi"
+#include <dt-bindings/input/input.h>
+
+/ {
+	model = "MediaTek MT7987 SD RFB";
+	compatible = "mediatek,mt7987a-sd",
+		     "mediatek,mt7987a", "mediatek,mt7987";
+
+	chosen {
+		bootargs = "console=ttyS0,115200n1 loglevel=8  \
+			    earlycon=uart8250,mmio32,0x11000000 \
+			    pci=pcie_bus_perf ubi.block=0,firmware \
+			    root=/dev/fit0 rootwait";
+	};
+
+	gpio-keys {
+		compatible = "gpio-keys";
+
+		reset {
+			label = "reset";
+			linux,code = <KEY_RESTART>;
+			gpios = <&pio 1 GPIO_ACTIVE_LOW>;
+			debounce-interval = <10>;
+		};
+
+		wps {
+			label = "wps";
+			linux,code = <KEY_WPS_BUTTON>;
+			gpios = <&pio 0 GPIO_ACTIVE_LOW>;
+			debounce-interval = <10>;
+		};
+	};
+};
board/mediatek/mt7987/MAINTAINERS new file +8 -0
new file mode 100644
index 00000000000..c257d0b09df
@@ -0,0 +1,8 @@
+MT7987
+M:	Sam Shih <[email protected]>
+S:	Maintained
+F:	board/mediatek/mt7987
+F:	include/configs/mt7987.h
+F:	configs/mt7987_rfb_defconfig
+F:	configs/mt7987_emmc_rfb_defconfig
+F:	configs/mt7987_sd_rfb_defconfig
board/mediatek/mt7987/Makefile new file +3 -0
new file mode 100644
index 00000000000..9f3f493f3c9
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y	+= mt7987_rfb.o
board/mediatek/mt7987/mt7987_rfb.c new file +10 -0
new file mode 100644
index 00000000000..fcb844deed8
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2025 MediaTek Inc.
+ * Author: Sam Shih <[email protected]>
+ */
+
+int board_init(void)
+{
+	return 0;
+}
configs/mt7987_emmc_rfb_defconfig new file +91 -0

91 lines not on this page · raw message

configs/mt7987_rfb_defconfig new file +87 -0

87 lines not on this page · raw message

configs/mt7987_sd_rfb_defconfig new file +91 -0

91 lines not on this page · raw message

include/configs/mt7987.h new file +14 -0
new file mode 100644
index 00000000000..18ed3c7a55b
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Configuration for MediaTek MT7987 SoC
+ *
+ * Copyright (C) 2025 MediaTek Inc.
+ * Author: Sam Shih <[email protected]>
+ */
+
+#ifndef __MT7987_H
+#define __MT7987_H
+
+#define CFG_MAX_MEM_MAPPED		0xC0000000
+
+#endif
Signature · 1 line
2.34.1
#6 lore raw
In reply to Weijie Gao
Quoted 8 lines · Weijie Gao

This patch series add support for MediaTek MT7987 SoC with its reference boards and related drivers.

This patch series add basic boot support on eMMC/SD/SPI-NOR/SPI-NAND for these boards. The clock, pinctrl drivers and the SoC initializaton code are also included.

[...]

Applied to u-boot/master, thanks!

Signature · 1 line
Tom