From patchwork Wed Apr 8 17:25:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 237441 List-Id: U-Boot discussion From: marek.behun at nic.cz (=?UTF-8?q?Marek=20Beh=C3=BAn?=) Date: Wed, 8 Apr 2020 19:25:17 +0200 Subject: [PATCH v1 u-boot-marvell 0/5] MVEBU ARM64 improvments + another Turris Mox patch Message-ID: <20200408172522.18941-1-marek.behun@nic.cz> Hi, sorry for not sending these patches together with the others for Turris Mox, but these make changes to generic arm64 mvebu code, so I thought it would be better. Currently U-Boot on Turris Mox discovers RAM size by calling get_ram_size on the first gigabyte of memory. This is insufficient for new prototypes with 2 GB and 4 GB RAM. For the 2 GB variant it would be sufficient to simply call get_ram_size on the first 2 GB of memory, but the 4 GB variant is more problematic, because in order to support maximum usable RAM possible, ARM Trusted Firmware can change the default address of PCIe regions and also the DRAM memory windows are not consecutive. This series adds code that looks at how ATF configured CPU Address Decoder windows and accordingly changes mem_map regions for U-Boot's virtual memory, and accordingly reports RAM size in dram_init and RAM banks information in dram_init_banksize functions. The first patch moves Armada-8k specific code into Armada-8k specific directory. The second patch adds that looks at the configuration of CPU Address Decoder windows and does the above mentioned things. The third patch removes dram_init and dram_init_banksize in Turris Mox code so that the generic one which now works is used. The fourth patch adds a function which fixes the PCIe ranges property in the device-tree binary so that the driver will work even if ATF changed the address of PCIe window. The fifth patch calls this function on Turris Mox. It would be nice if someone tested these on other A3700 boards, like EspressoBIN. Marek Marek Beh?n (5): arm64: mvebu: armada-8k: move dram init code arm64: mvebu: a37xx: improve code determining memory info structures arm: mvebu: turris_mox: support devices with RAM > 1 GB arm64: mvebu: a37xx: add device-tree fixer for PCIe regions arm: mvebu: turris_mox: fix PCIe ranges in device tree arch/arm/mach-mvebu/arm64-common.c | 51 +---- arch/arm/mach-mvebu/armada3700/cpu.c | 304 ++++++++++++++++++++++--- arch/arm/mach-mvebu/armada8k/Makefile | 3 +- arch/arm/mach-mvebu/armada8k/dram.c | 52 +++++ arch/arm/mach-mvebu/include/mach/cpu.h | 11 + board/CZ.NIC/turris_mox/turris_mox.c | 27 +-- configs/turris_mox_defconfig | 2 +- 7 files changed, 361 insertions(+), 89 deletions(-) create mode 100644 arch/arm/mach-mvebu/armada8k/dram.c