diff mbox series

[5/6] arm: highbank: Do DRAM init from DT

Message ID 20210412000455.12996-6-andre.przywara@arm.com
State Accepted
Commit 1238d0143ab8e8c75e6de97b4c5475077c1abbbf
Delegated to: Tom Rini
Headers show
Series highbank: Update to driver model | expand

Commit Message

Andre Przywara April 12, 2021, 12:04 a.m. UTC
So far U-Boot was hard coding a (surely sufficient) memory size of 512
MB, even though all machines out there have at least 4GB of DRAM.
Since U-Boot uses its memory knowledge to populate the EFI memory map,
we are missing out here, at best losing everything beyond 4GB on Midway
boxes (which typically come with 8GB of DRAM).

Since the management processor populated the DT memory node already with
the detected DRAM size and configuration, we use that to populate
U-Boot's memory bank information, which is the base for the UEFI memory
map.
This finally allows us to get rid of the NR_DRAM_BANKS=0 hack, that we
had in place to avoid U-Boot messing up the DT memory node before
loading the kernel.

Also, to cover the whole of memory, we need to enable PHYS_64BIT.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 arch/arm/Kconfig           | 1 +
 board/highbank/highbank.c  | 9 +++++++--
 configs/highbank_defconfig | 2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)

Comments

Tom Rini April 20, 2021, 2:21 p.m. UTC | #1
On Mon, Apr 12, 2021 at 01:04:54AM +0100, Andre Przywara wrote:

> So far U-Boot was hard coding a (surely sufficient) memory size of 512
> MB, even though all machines out there have at least 4GB of DRAM.
> Since U-Boot uses its memory knowledge to populate the EFI memory map,
> we are missing out here, at best losing everything beyond 4GB on Midway
> boxes (which typically come with 8GB of DRAM).
> 
> Since the management processor populated the DT memory node already with
> the detected DRAM size and configuration, we use that to populate
> U-Boot's memory bank information, which is the base for the UEFI memory
> map.
> This finally allows us to get rid of the NR_DRAM_BANKS=0 hack, that we
> had in place to avoid U-Boot messing up the DT memory node before
> loading the kernel.
> 
> Also, to cover the whole of memory, we need to enable PHYS_64BIT.
> 
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0082d06182a..6b5479b60be 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -757,6 +757,7 @@  config ARCH_HIGHBANK
 	select CLK_CCF
 	select AHCI
 	select DM_ETH
+	select PHYS_64BIT
 
 config ARCH_INTEGRATOR
 	bool "ARM Ltd. Integrator family"
diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c
index 0667a48965c..ffb6fd922da 100644
--- a/board/highbank/highbank.c
+++ b/board/highbank/highbank.c
@@ -8,6 +8,7 @@ 
 #include <cpu_func.h>
 #include <env.h>
 #include <fdt_support.h>
+#include <fdtdec.h>
 #include <init.h>
 #include <net.h>
 #include <scsi.h>
@@ -84,8 +85,12 @@  int misc_init_r(void)
 
 int dram_init(void)
 {
-	gd->ram_size = SZ_512M;
-	return 0;
+	return fdtdec_setup_mem_size_base();
+}
+
+int dram_init_banksize(void)
+{
+	return fdtdec_setup_memory_banksize();
 }
 
 #if defined(CONFIG_OF_BOARD_SETUP)
diff --git a/configs/highbank_defconfig b/configs/highbank_defconfig
index c3352b827d7..5d65049c5c0 100644
--- a/configs/highbank_defconfig
+++ b/configs/highbank_defconfig
@@ -3,7 +3,7 @@  CONFIG_SYS_DCACHE_OFF=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_HIGHBANK=y
 CONFIG_SYS_TEXT_BASE=0x00008000
-CONFIG_NR_DRAM_BANKS=0
+CONFIG_NR_DRAM_BANKS=2
 CONFIG_ENV_SIZE=0x2000
 CONFIG_SYS_BOOTCOUNT_ADDR=0xfff3cf0c
 CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y