diff mbox series

[RFC] ARM: dts: bcm2711: Fix DMA constrains for newer BCM2711 boards

Message ID 20220413162739.6717-1-stefan.wahren@i2se.com
State New
Headers show
Series [RFC] ARM: dts: bcm2711: Fix DMA constrains for newer BCM2711 boards | expand

Commit Message

Stefan Wahren April 13, 2022, 4:27 p.m. UTC
The commit 3d2cbb644836 ("ARM: dts: bcm2711: Move emmc2 into its own bus")
assumed that all bootloader pass the FDT modified by the firmware to the
kernel. But this is not always the case (e.g. Fedora) and cause boot
issues for boards with a BCM2711 C0 SoC (RPi 400, CM4, newer RPi 4 B)
which does have different DMA constraints.

Since we are not able to detect the SoC revision, let's assume a BCM2711
C0 SoC for bcm2711.dtsi and move the restricted DMA constrains to a
separate RPi 4 B board file just for the old SoC revision.

Fixes: 3d2cbb644836 ("ARM: dts: bcm2711: Move emmc2 into its own bus")
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
 arch/arm/boot/dts/Makefile               |  1 +
 arch/arm/boot/dts/bcm2711-rpi-4-b-b0.dts | 22 ++++++++++++++++++++++
 arch/arm/boot/dts/bcm2711.dtsi           | 11 +++--------
 3 files changed, 26 insertions(+), 8 deletions(-)
 create mode 100644 arch/arm/boot/dts/bcm2711-rpi-4-b-b0.dts

Comments

Florian Fainelli May 18, 2022, 8:18 p.m. UTC | #1
On 5/4/2022 2:43 PM, Stefan Wahren wrote:
> Hi,
> 
> Am 13.04.22 um 18:27 schrieb Stefan Wahren:
>> The commit 3d2cbb644836 ("ARM: dts: bcm2711: Move emmc2 into its own 
>> bus")
>> assumed that all bootloader pass the FDT modified by the firmware to the
>> kernel. But this is not always the case (e.g. Fedora) and cause boot
>> issues for boards with a BCM2711 C0 SoC (RPi 400, CM4, newer RPi 4 B)
>> which does have different DMA constraints.
>>
>> Since we are not able to detect the SoC revision, let's assume a BCM2711
>> C0 SoC for bcm2711.dtsi and move the restricted DMA constrains to a
>> separate RPi 4 B board file just for the old SoC revision.
>>
>> Fixes: 3d2cbb644836 ("ARM: dts: bcm2711: Move emmc2 into its own bus")
>> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
> since there wasn't any feedback yet, i want to ping ...

Could not we just rely on the VPU patching the Device Tree instead of 
having to differentiate the 2711 revision and having to use different 
DTS/DTBs?

Also, can we consider that the older B0 are less predominant in the wild 
than the C0 nowadays, especially with the shortages going on is that 
even remotely the case?
Stefan Wahren May 19, 2022, 6:48 p.m. UTC | #2
Am 18.05.22 um 22:18 schrieb Florian Fainelli:
>
>
> On 5/4/2022 2:43 PM, Stefan Wahren wrote:
>> Hi,
>>
>> Am 13.04.22 um 18:27 schrieb Stefan Wahren:
>>> The commit 3d2cbb644836 ("ARM: dts: bcm2711: Move emmc2 into its own 
>>> bus")
>>> assumed that all bootloader pass the FDT modified by the firmware to 
>>> the
>>> kernel. But this is not always the case (e.g. Fedora) and cause boot
>>> issues for boards with a BCM2711 C0 SoC (RPi 400, CM4, newer RPi 4 B)
>>> which does have different DMA constraints.
>>>
>>> Since we are not able to detect the SoC revision, let's assume a 
>>> BCM2711
>>> C0 SoC for bcm2711.dtsi and move the restricted DMA constrains to a
>>> separate RPi 4 B board file just for the old SoC revision.
>>>
>>> Fixes: 3d2cbb644836 ("ARM: dts: bcm2711: Move emmc2 into its own bus")
>>> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
>> since there wasn't any feedback yet, i want to ping ...
>
> Could not we just rely on the VPU patching the Device Tree instead of 
> having to differentiate the 2711 revision and having to use different 
> DTS/DTBs?
As long as every bootloader in the boot chain take care everything is 
fine. The problem is the VPU firmware is closed source, so only a few 
people knows about the hardware differences. So the idea was to make it 
more transparent and yes i'm also not happy with this patch.
>
> Also, can we consider that the older B0 are less predominant in the 
> wild than the C0 nowadays, especially with the shortages going on is 
> that even remotely the case?
So your idea is to make C0 the default and let the firmware patch the B0 
part? I must confess that i never tested this.
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 7c16f8a2b738..560d36ba1041 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -96,6 +96,7 @@  dtb-$(CONFIG_ARCH_BCM2835) += \
 	bcm2837-rpi-zero-2-w.dtb \
 	bcm2711-rpi-400.dtb \
 	bcm2711-rpi-4-b.dtb \
+	bcm2711-rpi-4-b-b0.dtb \
 	bcm2711-rpi-cm4-io.dtb \
 	bcm2835-rpi-zero.dtb \
 	bcm2835-rpi-zero-w.dtb
diff --git a/arch/arm/boot/dts/bcm2711-rpi-4-b-b0.dts b/arch/arm/boot/dts/bcm2711-rpi-4-b-b0.dts
new file mode 100644
index 000000000000..c53ed510392f
--- /dev/null
+++ b/arch/arm/boot/dts/bcm2711-rpi-4-b-b0.dts
@@ -0,0 +1,22 @@ 
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+#include "bcm2711-rpi-4-b.dts"
+
+&emmc2bus {
+	/*
+	 * emmc2 on initial SoC revision (only assembled on RPi 4 B)
+	 * has different DMA constraints.
+	 */
+	dma-ranges = <0x0 0xc0000000  0x0 0x00000000  0x40000000>;
+};
+
+&pcie0 {
+	/*
+	 * The wrapper around the PCIe block has a bug
+	 * preventing it from accessing beyond the first 3GB of
+	 * memory.
+	 */
+	dma-ranges = <0x02000000 0x0 0x00000000 0x0 0x00000000
+				      0x0 0xc0000000>;
+};
+
diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi
index 89af57482bc8..c307c45385a0 100644
--- a/arch/arm/boot/dts/bcm2711.dtsi
+++ b/arch/arm/boot/dts/bcm2711.dtsi
@@ -420,7 +420,7 @@  emmc2bus: emmc2bus {
 		#size-cells = <1>;
 
 		ranges = <0x0 0x7e000000  0x0 0xfe000000  0x01800000>;
-		dma-ranges = <0x0 0xc0000000  0x0 0x00000000  0x40000000>;
+		dma-ranges = <0x0 0x00000000  0x0 0x00000000  0xfc000000>;
 
 		emmc2: mmc@7e340000 {
 			compatible = "brcm,bcm2711-emmc2";
@@ -574,13 +574,8 @@  IRQ_TYPE_LEVEL_HIGH>,
 
 			ranges = <0x02000000 0x0 0xf8000000 0x6 0x00000000
 				  0x0 0x04000000>;
-			/*
-			 * The wrapper around the PCIe block has a bug
-			 * preventing it from accessing beyond the first 3GB of
-			 * memory.
-			 */
-			dma-ranges = <0x02000000 0x0 0x00000000 0x0 0x00000000
-				      0x0 0xc0000000>;
+			dma-ranges = <0x02000000 0x4 0x00000000 0x0 0x00000000
+				      0x1 0x00000000>;
 			brcm,enable-ssc;
 		};