|
@@ -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,9 +219,32 @@ 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;
|
|
|
}
|
|
|
|
|
|
+ /*
|
|
|
+ * LD20 uses the last 64 byte for each channel for dynamic
|
|
|
+ * DDR PHY training
|
|
|
+ */
|
|
|
+ if (uniphier_get_soc_id() == UNIPHIER_LD20_ID)
|
|
|
+ gd->ram_size -= 64;
|
|
|
+
|
|
|
return 0;
|
|
|
}
|
|
|
|