From 4ecc1452c707369da8582a118b31bc6d7453c8ea Mon Sep 17 00:00:00 2001
From: Christian Hewitt <christianshewitt@gmail.com>
Date: Mon, 1 Jan 2024 07:40:15 +0000
Subject: [PATCH 60/64] WIP: arm64: dts: meson: add p261/p271 support

Add device-trees for Amlogic P261/P271 (S905L) reference design boards. Similar to the
P281 (S905W) the boards are derived from P212 (S905X) but with silicon differences:

- P271 omits VP9 support and uses Mali 450-MP3
- P261 omits VP9 support and uses Mali 450-MP2

P271 boards have an S905L SoC with "B-3" or "3" marking. P261 boards have an S905L SoC
with "B-2" or "2" marking. The B is believed to denote a chip with DTS license and the
number is believed to reference the Mali 450 core(s) spec. The MP2 variant is referred
to as "S905C" in some Amlogic marketing presos and vendor code, and "S905L2" on chip
distributor stock lists.

Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
 arch/arm64/boot/dts/amlogic/Makefile          |  2 +
 .../boot/dts/amlogic/meson-gxl-s905l-p261.dts | 47 +++++++++++++++++++
 .../boot/dts/amlogic/meson-gxl-s905l-p271.dts | 31 ++++++++++++
 3 files changed, 80 insertions(+)
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-gxl-s905l-p261.dts
 create mode 100644 arch/arm64/boot/dts/amlogic/meson-gxl-s905l-p271.dts

diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile
index 33a8430a33b8..b2f07ba0b342 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -86,3 +86,5 @@ dtb-$(CONFIG_ARCH_MESON) += meson-sm1-x96-air.dtb
 
 # place experimental dtb/dtbo below here:
 dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-odroidc2-hifishield.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905l-p261.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905l-p271.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905l-p261.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905l-p261.dts
new file mode 100644
index 000000000000..b10a10277e0b
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905l-p261.dts
@@ -0,0 +1,47 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2024 Christian Hewitt <christianshewitt@gmail.com>
+ */
+
+/dts-v1/;
+
+#include "meson-gxl-s905x.dtsi"
+#include "meson-gx-p23x-q20x.dtsi"
+
+/ {
+	compatible = "amlogic,p261", "amlogic,s905l", "amlogic,meson-gxl";
+	model = "Amlogic Meson GXLX (S905L) P261 Development Board";
+
+	memory@0 {
+		device_type = "memory";
+		reg = <0x0 0x0 0x0 0x40000000>;
+	};
+
+	sound {
+		model = "P261";
+	};
+};
+
+&apb {
+	mali: gpu@c0000 {
+		/* Mali 450-MP2 */
+		interrupts = <GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>,
+			<GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>,
+			<GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>,
+			<GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>,
+			<GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>,
+			<GIC_SPI 165 IRQ_TYPE_LEVEL_HIGH>,
+			<GIC_SPI 166 IRQ_TYPE_LEVEL_HIGH>,
+			<GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>;
+		interrupt-names = "gp", "gpmmu", "pp", "pmu",
+			"pp0", "ppmmu0", "pp1", "ppmmu1";
+	};
+};
+
+&saradc {
+	compatible = "amlogic,meson-gxlx-saradc", "amlogic,meson-saradc";
+};
+
+&usb {
+	dr_mode = "host";
+};
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905l-p271.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905l-p271.dts
new file mode 100644
index 000000000000..91dac8fc0951
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905l-p271.dts
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2024 Christian Hewitt <christianshewitt@gmail.com>
+ */
+
+/dts-v1/;
+
+#include "meson-gxl-s905x.dtsi"
+#include "meson-gx-p23x-q20x.dtsi"
+
+/ {
+	compatible = "amlogic,p271", "amlogic,s905l", "amlogic,meson-gxl";
+	model = "Amlogic Meson GXLX (S905L) P271 Development Board";
+
+	memory@0 {
+		device_type = "memory";
+		reg = <0x0 0x0 0x0 0x40000000>;
+	};
+
+	sound {
+		model = "P271";
+	};
+};
+
+&saradc {
+	compatible = "amlogic,meson-gxlx-saradc", "amlogic,meson-saradc";
+};
+
+&usb {
+	dr_mode = "host";
+};
-- 
2.34.1

