ARM: imx: imx8m: Fix board_get_usable_ram_top()

The 4 GiB boundary is at 0xffffffff+1 , not at 0x80000000, fix this.

The PHYS_SDRAM of i.MX8M is at 0x40000000 , so to restrict ram_top
below 4 GiB, the ram_top has to be set to 0xffffffff as it is not
an offset from the start of PHYS_SDRAM, but rather a physical address
marking the topmost allowed DRAM address.

Fixes: e27bddff4b ("imx8m: Restrict usable memory to space below 4G boundary")
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Frieder Schrempf <frieder.schrempf@kontron.de>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
This commit is contained in:
Marek Vasut
2022-04-14 15:51:46 +02:00
committed by Stefano Babic
parent 2e26a76eb0
commit 74f88b7221

View File

@@ -331,7 +331,7 @@ phys_size_t get_effective_memsize(void)
ulong board_get_usable_ram_top(ulong total_size) ulong board_get_usable_ram_top(ulong total_size)
{ {
ulong top_addr = PHYS_SDRAM + gd->ram_size; ulong top_addr;
/* /*
* Some IPs have their accessible address space restricted by * Some IPs have their accessible address space restricted by
@@ -339,8 +339,7 @@ ulong board_get_usable_ram_top(ulong total_size)
* space below the 4G address boundary (which is 3GiB big), * space below the 4G address boundary (which is 3GiB big),
* even when the effective available memory is bigger. * even when the effective available memory is bigger.
*/ */
if (top_addr > 0x80000000) top_addr = clamp_val((u64)PHYS_SDRAM + gd->ram_size, 0, 0xffffffff);
top_addr = 0x80000000;
/* /*
* rom_pointer[0] stores the TEE memory start address. * rom_pointer[0] stores the TEE memory start address.