From: Sergey Temerkhanov Date: Fri, 25 Sep 2015 19:17:19 +0300 Subject: [U-Boot] [PATCH v6 9/9] armv8: cavium: Get DRAM size from ATF In-Reply-To: <1443197844-23280-1-git-send-email-s.temerkhanov@gmail.com> References: <1443197844-23280-1-git-send-email-s.temerkhanov@gmail.com> Message-ID: <1443197844-23280-10-git-send-email-s.temerkhanov@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Change the dram_init() function on ThunderX to query ATF services for the real installed DRAM size Signed-off-by: Sergey Temerkhanov Signed-off-by: Radha Mohan Chintakuntla --- Changes in v6: None Changes in v5: - Moved dram_init() from a separate file to thunderx.c Changes in v4: None Changes in v3: None Changes in v2: None board/cavium/thunderx/thunderx.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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 #include +#include + #if !CONFIG_IS_ENABLED(OF_CONTROL) #include #include @@ -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. */ -- 2.2.0