arm64: mvebu: a37xx: improve code determining memory info structures
authorMarek Behún <marek.behun@nic.cz>
Wed, 8 Apr 2020 17:25:19 +0000 (19:25 +0200)
committerStefan Roese <sr@denx.de>
Tue, 14 Apr 2020 11:16:42 +0000 (13:16 +0200)
commita129f64fb0f817178955e234c0a4f8b415b38759
tree71636073ffd059f206dc2d2c6a13a6364dc74976
parentf075b425a72c095a1e11ff855c3ba8b060feec20
arm64: mvebu: a37xx: improve code determining memory info structures

Currently on Armada-37xx the mem_map structure is statically defined to
map first 2 GB of memory as RAM region, and system registers and PCIe
region device region.

This is insufficient for when there is more RAM or when for example the
PCIe windows is mapped to another address by the CPU Address Decoder.
In the case when the board has 4 GB RAM, on some boards the ARM Trusted
Firmware can move the PCIe window to another address, in order to
maximize possible usable RAM.

Also the dram_init and dram_init_banksize looks for information in
device-tree, and therefore different device trees are needed for boards
with different RAM sizes.

Therefore we add code that looks at how the ARM Trusted Firmware has
configured the CPU Address Decoder windows, and then we update the
mem_map structure and compute gd->ram_size and gd->bd->bi_dram bank
base addresses and sizes accordingly.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
arch/arm/mach-mvebu/arm64-common.c
arch/arm/mach-mvebu/armada3700/cpu.c
arch/arm/mach-mvebu/include/mach/cpu.h