[U-Boot] [PATCH 5/5] sunxi: restrict the ram_size to the accessible range in SPL
Icenowy Zheng
icenowy at aosc.io
Wed Feb 7 19:35:26 UTC 2018
On newer Allwinner SoCs with the BROM start at 0x0 and the DRAM space at
<0x40000000 0xc0000000>, some parts of DRAM will be inaccessible when
4GiB module is used.
Restrict the ram_size written to global_data in SPL.
Signed-off-by: Icenowy Zheng <icenowy at aosc.io>
---
board/sunxi/board.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 5828d47294..a6620f260a 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -541,6 +541,7 @@ int board_mmc_init(bd_t *bis)
void sunxi_board_init(void)
{
int power_failed = 0;
+ unsigned long long dram_real_size;
#ifdef CONFIG_SY8106A_POWER
power_failed = sy8106a_set_vout1(CONFIG_SY8106A_VOUT1_VOLT);
@@ -601,8 +602,16 @@ void sunxi_board_init(void)
#endif
#endif
printf("DRAM:");
- gd->ram_size = (phys_size_t)sunxi_dram_init();
- printf(" %d MiB\n", (int)(gd->ram_size >> 20));
+ dram_real_size = sunxi_dram_init();
+ printf(" %d MiB", (int)(dram_real_size >> 20));
+ if (dram_real_size > CONFIG_SUNXI_DRAM_MAX_SIZE) {
+ gd->ram_size = CONFIG_SUNXI_DRAM_MAX_SIZE;
+ printf(", %d MiB usable\n", (int)(gd->ram_size >> 20));
+ } else {
+ gd->ram_size = (phys_size_t) dram_real_size;
+ printf("\n");
+ }
+
if (!gd->ram_size)
hang();
--
2.15.1
More information about the U-Boot
mailing list