kernel,bcm2711: Add RPi4 memory map

Signed-off-by: Hannu Lyytinen <hannu.lyytinen@unikie.com>

kernel,bcm2711: Fix RPI4 address mapping

Fix build error and warnings by removing GPIO mapping
from overlay. Also as a note, don't add 'serial1' or 'ethernet'
here, because 'serial1' is already mapped to sel4 kernel by
'chosen' block in 'overlay-rpi4.dts', and the translation for
the 'ethernet' is done with 'ranges' property.

Signed-off-by: Joonas Onatsu <joonasx@ssrc.tii.ae>

kernel,bcm2711: Fix memory area overlay DTS

First fix is to change the memory area reserved for
the VideoCore from 64 -> 76 MB, as this is the default
value on RPi4. Using other values would require configuration
of the first stage bootloader with 'config.txt' file.

Second fix is separating the disjunct memory areas
to separate nodes, as the generator Python scripts
in 'kernel/tools/' etc discarded the first area below
1GB limit if all areas were defined in the same node.
The effect of different variations can be observed
during kernel build in the generated
'kernel/gen_headers/plat/machine/devices_gen.h' header.

Third fix is adding the reserved memory area for the
VideoCore memory to avoid any collisions.

Signed-off-by: Joonas Onatsu <joonasx@ssrc.tii.ae>
This commit is contained in:
Hannu Lyytinen
2021-04-09 14:51:32 +03:00
committed by Gerwin Klein
parent ae332c0e5d
commit 1a9b776e4f
3 changed files with 64 additions and 7 deletions

View File

@@ -1,5 +1,6 @@
/*
* Copyright (C) 2021, Hensoldt Cyber GmbH
* Copyright 2022, Technology Innovation Institute
*
* SPDX-License-Identifier: GPL-2.0-only
*/
@@ -17,9 +18,6 @@
* addresses in this overlay file.
*/
soc {
gpio@7e200000 {
reg = <0xfe200000 0xb4>;
};
serial@7e201400 {
reg = <0xfe201400 0x200>;

View File

@@ -18,15 +18,60 @@
&{/timer};
};
/*
* See BCM2711 TRM section 1.2 and
* https://github.com/raspberrypi/firmware/issues/1374 for
* reference.
*
* RPi4B seems to be in "low peripheral" mode by default.
* These values were observed from running
* Raspbian instance from /proc/iomem and /sys/firmware/devicetree/base
*
* By default, the RPi 4B has 76MB reserved for the VideoCore/GPU.
* So, we have following memory ranges available:
*
* VC GPU RAM 76MB -> 0x40000000-0x04C00000 = 0x3b400000
*
* 0x00 0x00000000 0x3b400000 948MB
* 0x00 0x40000000 0xbc000000 3008MB
* 0x01 0x00000000 0x80000000 2048MB
* 0x01 0x80000000 0x80000000 2048MB
*
* Disjunct memory areas seem to work only
* when declared in different memory DT nodes.
*
* If all of the declarations below are in the
* same node, the kernel build system seems
* to only understand the second 3008MB area
* and ignores the rest.
*/
/delete-node/ memory;
memory@0 {
/* This is configurable in the Pi's config.txt, but we use 128MiB of RAM by default. */
reg = <0x00 0x00000000 0x08000000>;
device_type = "memory";
reg = < 0x00000000 0x00000000 0x3b400000 >;
};
memory@40000000 {
device_type = "memory";
reg = < 0x00000000 0x40000000 0xbc000000 >;
};
memory@100000000 {
device_type = "memory";
reg = < 0x00000001 0x00000000 0x80000000
0x00000001 0x80000000 0x80000000 >;
};
/* TODO: add DMA dedicated ranges
* here also?
*/
reserved-memory {
#address-cells = <0x01>;
#address-cells = <0x02>;
#size-cells = <0x01>;
ranges;
/* Keep the first page of physical memory is reserved for the initial
* bootloader (e.g. armstub). It has parked the secondary cores there,
* they spin until they get released. When SMP is enabled, the kernel
@@ -39,7 +84,16 @@
* See also https://leiradel.github.io/2019/01/20/Raspberry-Pi-Stubs.html#armstub8s
*/
reserved-memory@0{
reg = <0x0 0x1000>;
reg = < 0x00000000 0x00000000 0x00001000 >;
no-map;
};
/* Enforce that nothing tries to
* use the VideoCore memory area
* by declaring it as reserved memory.
*/
reserved-memory@3b400000 {
reg = < 0x00000000 0x3b400000 0x04C00000 >;
no-map;
};
};

View File

@@ -42,6 +42,11 @@
linux,cma-default;
alloc-ranges = <0x00 0x00 0x40000000>;
};
vc_mem {
size = <0xc0000000>;
alloc-ranges = <0x00 0x3ec00000 0xc0000000>;
};
};
thermal-zones {