From f6d6731d8e896ab029466547dfa66d91a9a6b73a Mon Sep 17 00:00:00 2001
From: Hristo Venev <hristo@venev.name>
Date: Wed, 22 Apr 2020 16:34:59 +0300
Subject: [PATCH] dts: bcm2711: add "High Peripheral" mode overlay

The following addresses change:

 - 0xfc00_0000 -> 0x4_7c00_0000
 - 0xff80_0000 -> 0x4_c000_0000

The range 0xfc00_0000-0xffff_ffff becomes available as system RAM on
devices with >= 4 GiB of RAM. Firmware should initialize the memory node
appropriately.

Signed-off-by: Hristo Venev <hristo@venev.name>
---
 arch/arm/boot/dts/bcm2711-rpi.dtsi            |  2 +-
 arch/arm/boot/dts/overlays/Makefile           |  1 +
 arch/arm/boot/dts/overlays/README             |  6 ++
 .../boot/dts/overlays/highperi-overlay.dts    | 64 +++++++++++++++++++
 arch/arm/boot/dts/overlays/overlay_map.dts    |  4 ++
 5 files changed, 76 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/overlays/highperi-overlay.dts

--- a/arch/arm/boot/dts/bcm2711-rpi.dtsi
+++ b/arch/arm/boot/dts/bcm2711-rpi.dtsi
@@ -16,7 +16,7 @@
 		compatible = "arm,cortex-a72-pmu", "arm,cortex-a15-pmu";
 	};
 
-	v3dbus {
+	v3dbus: v3dbus {
 		compatible = "simple-bus";
 		#address-cells = <1>;
 		#size-cells = <2>;
--- a/arch/arm/boot/dts/overlays/Makefile
+++ b/arch/arm/boot/dts/overlays/Makefile
@@ -64,6 +64,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
 	hifiberry-dacplushd.dtbo \
 	hifiberry-digi.dtbo \
 	hifiberry-digi-pro.dtbo \
+	highperi.dtbo \
 	hy28a.dtbo \
 	hy28b.dtbo \
 	hy28b-2017.dtbo \
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -1019,6 +1019,12 @@ Load:   dtoverlay=hifiberry-digi-pro
 Params: <None>
 
 
+Name:   highperi
+Info:   Enables "High Peripheral" mode
+Load:   dtoverlay=highperi
+Params: <None>
+
+
 Name:   hy28a
 Info:   HY28A - 2.8" TFT LCD Display Module by HAOYU Electronics
         Default values match Texy's display shield
--- /dev/null
+++ b/arch/arm/boot/dts/overlays/highperi-overlay.dts
@@ -0,0 +1,64 @@
+/*
+ * highperi.dts
+ */
+
+/dts-v1/;
+/plugin/;
+
+/ {
+	compatible = "brcm,bcm2711";
+
+	fragment@0 {
+		target = <&soc>;
+		#address-cells = <2>;
+		#size-cells = <1>;
+
+		__overlay__ {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0x7c000000  0x4 0x7c000000  0x04000000>,
+				 <0x40000000  0x4 0xc0000000  0x00800000>;
+		};
+	};
+
+	fragment@1 {
+		target = <&scb>;
+		#address-cells = <2>;
+		#size-cells = <1>;
+
+		__overlay__ {
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges = <0x0 0x7c000000  0x4 0x7c000000  0x0 0x04000000>,
+				 <0x0 0x40000000  0x4 0xc0000000  0x0 0x00800000>,
+				 <0x6 0x00000000  0x6 0x00000000  0x0 0x40000000>,
+				 <0x0 0x00000000  0x0 0x00000000  0x1 0x00000000>;
+			dma-ranges = <0x0 0x00000000  0x0 0x00000000  0x2 0x00000000>;
+		};
+	};
+
+	fragment@2 {
+		target = <&v3dbus>;
+		#address-cells = <2>;
+		#size-cells = <1>;
+
+		__overlay__ {
+			#address-cells = <1>;
+			#size-cells = <2>;
+			ranges = <0x7c500000  0x4 0x7c500000  0x0 0x03300000>,
+				 <0x40000000  0x4 0xc0000000  0x0 0x00800000>;
+		};
+	};
+
+	fragment@3 {
+		target = <&emmc2bus>;
+		#address-cells = <2>;
+		#size-cells = <1>;
+
+		__overlay__ {
+			#address-cells = <2>;
+			#size-cells = <1>;
+			ranges = <0x0 0x7e000000  0x4 0x7e000000  0x01800000>;
+		};
+	};
+};
--- a/arch/arm/boot/dts/overlays/overlay_map.dts
+++ b/arch/arm/boot/dts/overlays/overlay_map.dts
@@ -5,6 +5,10 @@
 		deprecated = "use i2c-sensor,bmp085";
 	};
 
+	highperi {
+		bcm2711;
+	};
+
 	i2c0-bcm2708 {
 		deprecated = "use i2c0";
 	};
