aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-uniphier/dram_init.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/arm/mach-uniphier/dram_init.c b/arch/arm/mach-uniphier/dram_init.c
index e9672d2f1bc..cb35dabfece 100644
--- a/arch/arm/mach-uniphier/dram_init.c
+++ b/arch/arm/mach-uniphier/dram_init.c
@@ -205,6 +205,7 @@ int dram_init(void)
return ret;
for (i = 0; i < ARRAY_SIZE(dram_map); i++) {
+ unsigned long max_size;
if (!dram_map[i].size)
break;
@@ -218,6 +219,22 @@ int dram_init(void)
dram_map[i].base)
break;
+ /*
+ * Do not use memory that exceeds 32bit address range. U-Boot
+ * relocates itself to the end of the effectively available RAM.
+ * This could be a problem for DMA engines that do not support
+ * 64bit address (SDMA of SDHCI, UniPhier AV-ether, etc.)
+ */
+ if (dram_map[i].base >= 1ULL << 32)
+ break;
+
+ max_size = (1ULL << 32) - dram_map[i].base;
+
+ if (dram_map[i].size > max_size) {
+ gd->ram_size += max_size;
+ break;
+ }
+
gd->ram_size += dram_map[i].size;
}