@@ -5,4 +5,4 @@
# SPDX-License-Identifier: GPL-2.0+
#
-obj-y := thunderx.o atf.o
+obj-y := thunderx.o atf.o dram.o
new file mode 100644
@@ -0,0 +1,35 @@
+/**
+ * (C) Copyright 2014, Cavium Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+**/
+
+#include <common.h>
+#include <cavium/atf.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+ ssize_t node_count = atf_node_count();
+ ssize_t dram_size;
+ int node;
+
+ printf("Initializing\nNodes in system: %zd\n", node_count);
+
+ gd->ram_size = 0;
+
+ for (node = 0; node < node_count; node++) {
+ dram_size = atf_dram_size(node);
+ printf("Node %d: %zd MBytes of DRAM\n", node, dram_size >> 20);
+ gd->ram_size += dram_size;
+ }
+
+ gd->ram_size -= MEM_BASE;
+
+ *(unsigned long *)CPU_RELEASE_ADDR = 0;
+
+ puts("DRAM size:");
+
+ return 0;
+}
@@ -16,18 +16,6 @@ int board_init(void)
return 0;
}
-int dram_init(void)
-{
- /*
- * Clear spin table so that secondary processors
- * observe the correct value after waken up from wfe.
- */
- *(unsigned long *)CPU_RELEASE_ADDR = 0;
-
- gd->ram_size = PHYS_SDRAM_1_SIZE;
- return 0;
-}
-
int timer_init(void)
{
return 0;