diff options
author | Sergey Temerkhanov <s.temerkhanov@gmail.com> | 2015-10-14 16:55:52 (GMT) |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-01-19 22:26:13 (GMT) |
commit | 3ed2ece5e162b104cd3ea3788cae841ecd24408f (patch) | |
tree | 75526210ee6666ad882ab88fd0d1cf5aa0c201aa | |
parent | 900f88f3b08b71becd5cecba0687e8eb24fc342b (diff) | |
download | u-boot-3ed2ece5e162b104cd3ea3788cae841ecd24408f.tar.xz |
armv8: cavium: Get DRAM size from ATF
Change the dram_init() function on ThunderX to query ATF services for
the real installed DRAM size
Signed-off-by: Sergey Temerkhanov <s.temerkhanov@gmail.com>
Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>
-rw-r--r-- | board/cavium/thunderx/thunderx.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/board/cavium/thunderx/thunderx.c b/board/cavium/thunderx/thunderx.c index 486374e..b926767 100644 --- a/board/cavium/thunderx/thunderx.c +++ b/board/cavium/thunderx/thunderx.c @@ -9,6 +9,8 @@ #include <errno.h> #include <linux/compiler.h> +#include <cavium/atf.h> + #if !CONFIG_IS_ENABLED(OF_CONTROL) #include <dm/platdata.h> #include <dm/platform_data/serial_pl01x.h> @@ -50,6 +52,31 @@ int timer_init(void) return 0; } +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; +} + /* * Board specific reset that is system reset. */ |