Skip to contentSkip to conversation

arm64: mediatek: Add initial MT6895 and Xiaomi Poco X4 GT support

PATCH Superseded Alexander Letuchiy 6 participants 14 messages Nov 5 – Nov 9

Subsystems (4)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover arm64: mediatek: Add initial MT6895 and Xiaomi Poco X4 GT support

This series adds initial support for the MediaTek MT6895 (Dimensity 8100) SoC and the Xiaomi xaga board, sold as Xiaomi Poco X4 GT, Redmi Note 11T Pro/Pro+ and Redmi K50i. It is enough to boot to an initramfs with a serial console.

Bootloader dependency
---------------------
This was tested with a modified LK bootloader that is not public. The stock LK cannot boot this DT, as its Android fixups expect nodes that are not present here.

The DT relies on the bootloader to:

- update the /memory node
- add all firmware carveouts to /reserved-memory
- pass the command line from the boot image

The carveout addresses are therefore not listed in the DT, as the bootloader allocates some of them dynamically. I can describe the fixed ones in the DT if that is preferred.

Testing
-------
Tested on a Poco X4 GT with 8 GiB of RAM, using a minimal config and a script in the initramfs. The results were:

- All 8 CPUs come up and match the DT (A55 on 0-3, A78 on 4-7), and CPUs 1-7 can be taken offline and brought back through PSCI.
- The redistributor is found for each CPU, and timer interrupts reach every CPU.
- UART0 output works at 921600 baud, and its TX interrupt fires on the expected line.
- About 7 GiB of RAM was written and verified with no errors, with the carveouts added by the bootloader.
- The ramoops driver probes, and the console log survives a watchdog reset. The last 30 lines were clean in the final run.

UART1 is disabled and was not tested. Only a minimal config was tested on the device, not defconfig.

dt_binding_check, dtbs_check report no issues. checkpatch reports only the "does MAINTAINERS need updating?" warning for the new files, which are already covered by the existing F: pattern.

Tool use
--------
The commit messages, this cover letter and the test script were drafted with Claude Code (Claude Opus 5.5). I reviewed them and tested the result on the device.

Based on next-20261102.

Alexander Letuchiy (5):
dt-bindings: arm: mediatek: Add MT6895 and Xiaomi Poco X4 GT
dt-bindings: serial: mediatek,uart: Add compatible for MT6895
dt-bindings: watchdog: mediatek,mtk-wdt: Add compatible for MT6895
arm64: dts: mediatek: Add MT6895 SoC
arm64: dts: mediatek: Add Xiaomi Poco X4 GT

 .../devicetree/bindings/arm/mediatek.yaml     |   4 +
 .../bindings/serial/mediatek,uart.yaml        |   1 +
 .../bindings/watchdog/mediatek,mtk-wdt.yaml   |   1 +
 arch/arm64/boot/dts/mediatek/Makefile         |   1 +
 .../boot/dts/mediatek/mt6895-xiaomi-xaga.dts  |  46 +++++
 arch/arm64/boot/dts/mediatek/mt6895.dtsi      | 166 ++++++++++++++++++
 6 files changed, 219 insertions(+)
 create mode 100644 arch/arm64/boot/dts/mediatek/mt6895-xiaomi-xaga.dts
 create mode 100644 arch/arm64/boot/dts/mediatek/mt6895.dtsi
Signature · 1 line
2.56.0
#1 lore raw

PATCH 1/5 dt-bindings: arm: mediatek: Add MT6895 and Xiaomi Poco X4 GT

Add the compatible for the MediaTek MT6895 (Dimensity 8100) SoC, along with the Xiaomi xaga board based on it, which is sold as Xiaomi Poco X4 GT, Redmi Note 11T Pro/Pro+ and Redmi K50i.

---
 Documentation/devicetree/bindings/arm/mediatek.yaml | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/arm/mediatek.yaml +4 -0
index 180e6e4948e7..28180ed0e815 100644
@@ -72,6 +72,10 @@ properties:
               - archermind,mt6797-x20-dev
               - mediatek,mt6797-evb
           - const: mediatek,mt6797
+      - items:
+          - enum:
+              - xiaomi,xaga
+          - const: mediatek,mt6895
       - items:
           - enum:
               - bananapi,bpi-r64
Signature · 1 line
2.56.0
Acked-by on v1 1/5
#2 lore raw

Re: [PATCH 1/5] dt-bindings: arm: mediatek: Add MT6895 and Xiaomi Poco X4 GT

Quoted 8 lines · Alexander Letuchiy

Add the compatible for the MediaTek MT6895 (Dimensity 8100) SoC, along with the Xiaomi xaga board based on it, which is sold as Xiaomi Poco X4 GT, Redmi Note 11T Pro/Pro+ and Redmi K50i.

---
 Documentation/devicetree/bindings/arm/mediatek.yaml | 4 ++++
 1 file changed, 4 insertions(+)

Best regards,
Krzysztof

#3 lore raw

PATCH 2/5 dt-bindings: serial: mediatek,uart: Add compatible for MT6895

In reply to Alexander Letuchiy

Add a compatible string for the UART of the MediaTek MT6895 (Dimensity 8100) SoC. It works with the existing driver through the mediatek,mt6577-uart fallback.

---
 Documentation/devicetree/bindings/serial/mediatek,uart.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/serial/mediatek,uart.yaml +1 -0
index 5bd8a8853ae0..a3969cfdea7e 100644
@@ -35,6 +35,7 @@ properties:
               - mediatek,mt6795-uart
               - mediatek,mt6797-uart
               - mediatek,mt6893-uart
+              - mediatek,mt6895-uart
               - mediatek,mt7622-uart
               - mediatek,mt7623-uart
               - mediatek,mt7629-uart
Signature · 1 line
2.56.0
#4 lore raw

Re: [PATCH 2/5] dt-bindings: serial: mediatek,uart: Add compatible for MT6895

Sashiko has reviewed this patch and found no issues.
Quoted 5 lines

Add a compatible string for the UART of the MediaTek MT6895 (Dimensity 8100) SoC. It works with the existing driver through the mediatek,mt6577-uart fallback.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#6 lore raw

PATCH 3/5 dt-bindings: watchdog: mediatek,mtk-wdt: Add compatible for MT6895

In reply to Alexander Letuchiy

Add a compatible string for the watchdog of the MediaTek MT6895 (Dimensity 8100) SoC, which uses mediatek,mt6589-wdt as its fallback.

---
 Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml +1 -0
index f9b725592c27..cac7d9ae98dd 100644
@@ -38,6 +38,7 @@ properties:
               - mediatek,mt6572-wdt
               - mediatek,mt6582-wdt
               - mediatek,mt6797-wdt
+              - mediatek,mt6895-wdt
               - mediatek,mt7622-wdt
               - mediatek,mt7623-wdt
               - mediatek,mt7629-wdt
Signature · 1 line
2.56.0
#7 lore raw

Re: [PATCH 3/5] dt-bindings: watchdog: mediatek,mtk-wdt: Add compatible for MT6895

Hi,

Quoted 4 lines · Alexander Letuchiy

Add a compatible string for the watchdog of the MediaTek MT6895 (Dimensity 8100) SoC, which uses mediatek,mt6589-wdt as its fallback.

Does mt6895 actually share the same reset layout as mt6589? Given the generation leap between these, the former is very unlikely to use the same resets.

Best regards,
Roman

Quoted 21 lines
---
 Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml +1 -1
index f9b725592c27..cac7d9ae98dd 100644
@@ -38,6 +38,7 @@ properties:
               - mediatek,mt6572-wdt
               - mediatek,mt6582-wdt
               - mediatek,mt6797-wdt
+              - mediatek,mt6895-wdt
               - mediatek,mt7622-wdt
               - mediatek,mt7623-wdt
               - mediatek,mt7629-wdt
--

2.56.0

#8 lore raw

Re: [PATCH 3/5] dt-bindings: watchdog: mediatek,mtk-wdt: Add compatible for MT6895

Hi Roman,

Thanks for looking.

Quoted 3 lines · Roman Vivchar

Does mt6895 actually share the same reset layout as mt6589? Given the generation leap between these, the former is very unlikely to use the same resets.

The vendor kernel for this SoC binds the watchdog with the same compatible list ("mediatek,mt6895-wdt", "mediatek,mt6589-wdt") at the same address, and its register definitions are identical to mtk_wdt.c.

The TOPRGU reset layout is the one thing I can't confirm, as I found no reset table for MT6895 there. This series does not use it: the DT has no #reset-cells and no consumers. If reset lines are needed later, I will add a dedicated mt6895_data to the driver.

I also tested the watchdog on the device: while userspace keeps kicking it, the system stays up, and once the kicks stop the watchdog resets the board after the timeout.

Best regards,
Alexander

#9 lore raw

Re: [PATCH 3/5] dt-bindings: watchdog: mediatek,mtk-wdt: Add compatible for MT6895

Hi Alexander,
(Resending with the Cc recipients I missed; sorry for the duplicate.)

Quoted 5 lines · Alexander Letuchiy
Quoted 3 lines · Roman Vivchar

Does mt6895 actually share the same reset layout as mt6589? Given the generation leap between these, the former is very unlikely to use the same resets.

Quoted 8 lines

The vendor kernel for this SoC binds the watchdog with the same compatible list ("mediatek,mt6895-wdt", "mediatek,mt6589-wdt") at the same address, and its register definitions are identical to mtk_wdt.c.

The TOPRGU reset layout is the one thing I can't confirm, as I found no reset table for MT6895 there. This series does not use it: the DT has no #reset-cells and no consumers. If reset lines are needed later, I will add a dedicated mt6895_data to the driver.

The MT6589 wdt driver now also registers a TOPRGU reset controller:
f12d5facded7 ("watchdog: mediatek: Add wdt/toprgu resets for mt6589")

The driver now registers a reset controller with 12 reset lines for the "mediatek,mt6589-wdt" compatible, regardless of whether the DT specifies #reset-cells or has any reset consumers. "mediatek,mt6589-wdt" used to be a watchdog-only fallback, since it did not register a TOPRGU reset controller.
That is no longer true.

Since the MT6895 reset layout is unconfirmed, it must not claim compatibility with the MT6589 TOPRGU reset controller by using "mediatek,mt6589-wdt" as a fallback.
The compatible list is part of the Device Tree ABI and cannot be changed later.

As I noted in [1], "mediatek,mt6589-wdt" is only a safe fallback where the reset layout is known to match. Many SoCs do not share MT6589's reset layout, and MT6895 gives no reason to be treated as an exception. We should not add yet another MT6589 fallback whose reset layout is not known to be correct.

Please give MT6895 its own "mediatek,mt6895-wdt" compatible without "mediatek,mt6589-wdt" fallback. Its TOPRGU reset support can be added once the actual reset layout has been confirmed.

[1] https://lore.kernel.org/linux-mediatek/xqnpukvhtezpqhwjnxbqeddiaqlro4m5yjukpplv5mjfxodlfp@ijaf2trst7p4/

Best regards,
Akari

#10 lore raw

Re: [PATCH 3/5] dt-bindings: watchdog: mediatek,mtk-wdt: Add compatible for MT6895

Hi Akari,
(Resending as plain text, the lists rejected my previous reply because it had an HTML part. Sorry for the duplicate.)

Quoted 3 lines · Akari Tsuyukusa

Please give MT6895 its own "mediatek,mt6895-wdt" compatible without "mediatek,mt6589-wdt" fallback. Its TOPRGU reset support can be added once the actual reset layout has been confirmed.

Thanks for the explanation, I missed that the mt6589 entry now registers a reset controller. I'll make mediatek,mt6895-wdt a standalone compatible in v2 and add a driver match entry for it without reset data.

I'll wait for comments on the rest of the series before sending v2.

Best regards,
Alexander

#12 lore raw

PATCH 4/5 arm64: dts: mediatek: Add MT6895 SoC

In reply to Alexander Letuchiy

Add initial support for the MediaTek MT6895 (Dimensity 8100) SoC, which has four Cortex-A55 and four Cortex-A78 cores.

Describe the CPUs, PSCI, the GICv3 interrupt controller, the architected timer, two UARTs and the watchdog. There is no clock controller driver for this SoC yet, so both UART clocks use a fixed 26 MHz clock.

---
 arch/arm64/boot/dts/mediatek/mt6895.dtsi | 166 +++++++++++++++++++++++
 1 file changed, 166 insertions(+)
 create mode 100644 arch/arm64/boot/dts/mediatek/mt6895.dtsi
arch/arm64/boot/dts/mediatek/mt6895.dtsi new file +166 -0
new file mode 100644
index 000000000000..c80f30da7bf9
@@ -0,0 +1,166 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+	compatible = "mediatek,mt6895";
+	interrupt-parent = <&gic>;
+	#address-cells = <2>;
+	#size-cells = <2>;
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu-map {
+			cluster0 {
+				core0 {
+					cpu = <&cpu0>;
+				};
+
+				core1 {
+					cpu = <&cpu1>;
+				};
+
+				core2 {
+					cpu = <&cpu2>;
+				};
+
+				core3 {
+					cpu = <&cpu3>;
+				};
+
+				core4 {
+					cpu = <&cpu4>;
+				};
+
+				core5 {
+					cpu = <&cpu5>;
+				};
+
+				core6 {
+					cpu = <&cpu6>;
+				};
+
+				core7 {
+					cpu = <&cpu7>;
+				};
+			};
+		};
+
+		cpu0: cpu@0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a55";
+			reg = <0x0>;
+			enable-method = "psci";
+		};
+
+		cpu1: cpu@100 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a55";
+			reg = <0x100>;
+			enable-method = "psci";
+		};
+
+		cpu2: cpu@200 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a55";
+			reg = <0x200>;
+			enable-method = "psci";
+		};
+
+		cpu3: cpu@300 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a55";
+			reg = <0x300>;
+			enable-method = "psci";
+		};
+
+		cpu4: cpu@400 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a78";
+			reg = <0x400>;
+			enable-method = "psci";
+		};
+
+		cpu5: cpu@500 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a78";
+			reg = <0x500>;
+			enable-method = "psci";
+		};
+
+		cpu6: cpu@600 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a78";
+			reg = <0x600>;
+			enable-method = "psci";
+		};
+
+		cpu7: cpu@700 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a78";
+			reg = <0x700>;
+			enable-method = "psci";
+		};
+	};
+
+	clk26m: clock-26m {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <26000000>;
+		clock-output-names = "clk26m";
+	};
+
+	psci {
+		compatible = "arm,psci-1.0";
+		method = "smc";
+	};
+
+	timer {
+		compatible = "arm,armv8-timer";
+		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW 0>,
+			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW 0>,
+			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW 0>,
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW 0>;
+	};
+
+	soc {
+		compatible = "simple-bus";
+		ranges;
+		#address-cells = <2>;
+		#size-cells = <2>;
+
+		gic: interrupt-controller@c000000 {
+			compatible = "arm,gic-v3";
+			reg = <0 0x0c000000 0 0x40000>,
+			      <0 0x0c040000 0 0x200000>;
+			#interrupt-cells = <4>;
+			interrupt-controller;
+			interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH 0>;
+		};
+
+		uart0: serial@11001000 {
+			compatible = "mediatek,mt6895-uart", "mediatek,mt6577-uart";
+			reg = <0 0x11001000 0 0x1000>;
+			interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH 0>;
+			clocks = <&clk26m>, <&clk26m>;
+			clock-names = "baud", "bus";
+			status = "disabled";
+		};
+
+		uart1: serial@11002000 {
+			compatible = "mediatek,mt6895-uart", "mediatek,mt6577-uart";
+			reg = <0 0x11002000 0 0x1000>;
+			interrupts = <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH 0>;
+			clocks = <&clk26m>, <&clk26m>;
+			clock-names = "baud", "bus";
+			status = "disabled";
+		};
+
+		watchdog: watchdog@1c007000 {
+			compatible = "mediatek,mt6895-wdt", "mediatek,mt6589-wdt";
+			reg = <0 0x1c007000 0 0x100>;
+		};
+	};
+};
Signature · 1 line
2.56.0
#13 lore raw

PATCH 5/5 arm64: dts: mediatek: Add Xiaomi Poco X4 GT

In reply to Alexander Letuchiy

Add a device tree for the Xiaomi xaga board, which is sold as Xiaomi Poco X4 GT, Redmi Note 11T Pro/Pro+ and Redmi K50i. It enables a serial console on UART0.

The DT only describes the memory that Linux itself uses, which is the ramoops region. The bootloader updates the /memory node and adds the firmware carveouts to /reserved-memory, so their addresses are not hardcoded here. This DT must not be booted with a bootloader that does not do this, as Linux would then use memory owned by the firmware.

The ramoops zone sizes place the console zone at the offset where the bootloader expects to find it.

---
 arch/arm64/boot/dts/mediatek/Makefile         |  1 +
 .../boot/dts/mediatek/mt6895-xiaomi-xaga.dts  | 46 +++++++++++++++++++
 2 files changed, 47 insertions(+)
 create mode 100644 arch/arm64/boot/dts/mediatek/mt6895-xiaomi-xaga.dts
arch/arm64/boot/dts/mediatek/Makefile +1 -0
index a86fb313b1a9..d73489149ab5 100644
@@ -6,6 +6,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += mt6795-evb.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt6795-sony-xperia-m5.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt6797-evb.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt6797-x20-dev.dtb
+dtb-$(CONFIG_ARCH_MEDIATEK) += mt6895-xiaomi-xaga.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7622-rfb1.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7622-bananapi-bpi-r64.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7981b-cudy-wr3000-v1.dtb
arch/arm64/boot/dts/mediatek/mt6895-xiaomi-xaga.dts new file +46 -0

46 lines not on this page · raw message

Signature · 1 line
2.56.0