bcm27xx: update to latest patches from RPi foundation
[oweals/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0633-ARM-dts-bcm283x-Unify-CMA-configuration.patch
1 From a2e6d1c03908eccf76b9305c4a493230a36035c0 Mon Sep 17 00:00:00 2001
2 From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
3 Date: Fri, 10 Jan 2020 18:29:35 +0100
4 Subject: [PATCH] ARM: dts: bcm283x: Unify CMA configuration
5
6 commit c5a1e5375d19bd4001c59dc5d482ac5b1ba51cbf upstream.
7
8 With the introduction of the Raspberry Pi 4 we were forced to explicitly
9 configure CMA's location, since arm64 defaults it into the ZONE_DMA32
10 memory area, which is not good enough to perform DMA operations on that
11 device. To bypass this limitation a dedicated CMA DT node was created,
12 explicitly indicating the acceptable memory range and size.
13
14 That said, compatibility between boards is a must on the Raspberry Pi
15 ecosystem so this creates a common CMA DT node so as for DT overlays to
16 be able to update CMA's properties regardless of the board being used.
17
18 Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
19 Reviewed-by: Phil Elwell <phil@raspberrypi.org>
20 Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
21 ---
22  arch/arm/boot/dts/bcm2711.dtsi | 32 +++++++++++++-------------------
23  arch/arm/boot/dts/bcm283x.dtsi | 13 +++++++++++++
24  2 files changed, 26 insertions(+), 19 deletions(-)
25
26 --- a/arch/arm/boot/dts/bcm2711.dtsi
27 +++ b/arch/arm/boot/dts/bcm2711.dtsi
28 @@ -12,25 +12,6 @@
29  
30         interrupt-parent = <&gicv2>;
31  
32 -       reserved-memory {
33 -               #address-cells = <2>;
34 -               #size-cells = <1>;
35 -               ranges;
36 -
37 -               /*
38 -                * arm64 reserves the CMA by default somewhere in ZONE_DMA32,
39 -                * that's not good enough for the BCM2711 as some devices can
40 -                * only address the lower 1G of memory (ZONE_DMA).
41 -                */
42 -               linux,cma {
43 -                       compatible = "shared-dma-pool";
44 -                       size = <0x2000000>; /* 32MB */
45 -                       alloc-ranges = <0x0 0x00000000 0x40000000>;
46 -                       reusable;
47 -                       linux,cma-default;
48 -               };
49 -       };
50 -
51         vc4: gpu {
52                 compatible = "brcm,bcm2711-vc5";
53                 status = "disabled";
54 @@ -992,6 +973,19 @@
55         };
56  };
57  
58 +&rmem {
59 +       #address-cells = <2>;
60 +};
61 +
62 +&cma {
63 +       /*
64 +        * arm64 reserves the CMA by default somewhere in ZONE_DMA32,
65 +        * that's not good enough for the BCM2711 as some devices can
66 +        * only address the lower 1G of memory (ZONE_DMA).
67 +        */
68 +       alloc-ranges = <0x0 0x00000000 0x40000000>;
69 +};
70 +
71  &i2c0 {
72         compatible = "brcm,bcm2711-i2c", "brcm,bcm2835-i2c";
73         interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
74 --- a/arch/arm/boot/dts/bcm283x.dtsi
75 +++ b/arch/arm/boot/dts/bcm283x.dtsi
76 @@ -30,6 +30,19 @@
77                 stdout-path = "serial0:115200n8";
78         };
79  
80 +       rmem: reserved-memory {
81 +               #address-cells = <1>;
82 +               #size-cells = <1>;
83 +               ranges;
84 +
85 +               cma: linux,cma {
86 +                       compatible = "shared-dma-pool";
87 +                       size = <0x4000000>; /* 64MB */
88 +                       reusable;
89 +                       linux,cma-default;
90 +               };
91 +       };
92 +
93         thermal-zones {
94                 cpu_thermal: cpu-thermal {
95                         polling-delay-passive = <0>;