diff --git a/arch/arm/mach-mvebu/arm64-common.c b/arch/arm/mach-mvebu/arm64-common.c index 5357aa554d..238edbe6ba 100644 --- a/arch/arm/mach-mvebu/arm64-common.c +++ b/arch/arm/mach-mvebu/arm64-common.c @@ -28,14 +28,13 @@ DECLARE_GLOBAL_DATA_PTR; * Currently only 2GiB are mapped for system memory. This is what * we pass to the U-Boot subsystem here. */ -#define USABLE_RAM_SIZE 0x80000000 +#define USABLE_RAM_SIZE 0x80000000ULL ulong board_get_usable_ram_top(ulong total_size) { - if (gd->ram_size > USABLE_RAM_SIZE) - return USABLE_RAM_SIZE; + unsigned long top = CONFIG_SYS_SDRAM_BASE + min(gd->ram_size, USABLE_RAM_SIZE); - return gd->ram_size; + return (gd->ram_top > top) ? top : gd->ram_top; } /*