aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-5.10/950-0508-overlays-Add-pcie-32bit-dma-overlay.patch
blob: 0186a0b81ba24ea0babf5455ea73918ccbd5868f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
From ce2860020c57a59c543139ad7b260624cd930dff Mon Sep 17 00:00:00 2001
From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Date: Mon, 15 Mar 2021 17:25:02 +0100
Subject: [PATCH] overlays: Add pcie-32bit-dma overlay

In order to accommodate full PCI DMA access to memory on newer BCM2711
revisions, we're forced to map PCIe's view of physical memory with an
offset. This offset makes DMA addressing dependent on having 64bit
support on the PCI device's side. Which isn't always the case.

In order to mitigate this, introduce the pcie-32bit-dma overlay which
will forbid firmware from updating the default inbound memory window.
The default setting, albeit limited to accessing the lower 3GB of
memory, will allow for 32bit DMA addresses at the expense of having to
bounce buffers.

Link: https://github.com/raspberrypi/linux/issues/4197
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
 arch/arm/boot/dts/overlays/Makefile            |  1 +
 arch/arm/boot/dts/overlays/README              |  7 +++++++
 arch/arm/boot/dts/overlays/overlay_map.dts     |  4 ++++
 .../dts/overlays/pcie-32bit-dma-overlay.dts    | 18 ++++++++++++++++++
 4 files changed, 30 insertions(+)
 create mode 100644 arch/arm/boot/dts/overlays/pcie-32bit-dma-overlay.dts

--- a/arch/arm/boot/dts/overlays/Makefile
+++ b/arch/arm/boot/dts/overlays/Makefile
@@ -128,6 +128,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
 	ov9281.dtbo \
 	papirus.dtbo \
 	pca953x.dtbo \
+	pcie-32bit-dma.dtbo \
 	pibell.dtbo \
 	pifacedigital.dtbo \
 	pifi-40.dtbo \
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -2135,6 +2135,13 @@ Params: addr                    I2C addr
         xra1202                 Select the Exar XRA1202 (8 bit)
 
 
+Name:   pcie-32bit-dma
+Info:   Force PCIe config to support 32bit DMA addresses at the expense of
+        having to bounce buffers.
+Load:   dtoverlay=pcie-32bit-dma
+Params: <None>
+
+
 [ The pcf2127-rtc overlay has been deleted. See i2c-rtc. ]
 
 
--- a/arch/arm/boot/dts/overlays/overlay_map.dts
+++ b/arch/arm/boot/dts/overlays/overlay_map.dts
@@ -37,6 +37,10 @@
 		deprecated = "use gpio-ir";
 	};
 
+	pcie-32bit-dma {
+		bcm2711;
+	};
+
 	pi3-act-led {
 		renamed = "act-led";
 	};
--- /dev/null
+++ b/arch/arm/boot/dts/overlays/pcie-32bit-dma-overlay.dts
@@ -0,0 +1,18 @@
+/*
+ * pcie-32bit-dma-overlay.dts
+ */
+
+/dts-v1/;
+/plugin/;
+
+/ {
+	compatible = "brcm,bcm2711";
+
+	fragment@0 {
+		target-path = "/aliases";
+		__overlay__ {
+			pcie0 = "";
+		};
+	};
+
+};