From mboxrd@z Thu Jan 1 00:00:00 1970 From: Philipp Tomsich Date: Fri, 28 Apr 2017 17:31:44 +0200 Subject: [U-Boot] [PATCH] rockchip: ARM64: puma-rk3399: get DRAM size from DMC init Message-ID: <1493393504-63301-1-git-send-email-philipp.tomsich@theobroma-systems.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de With the RK3399 DRAM controller (DMC) driver providing all the infrastructure, retrieve the DRAM size from the DMC init in the board-specific code (instead of hard-coding) for the RK3399-Q7 (Puma). Signed-off-by: Philipp Tomsich --- board/theobroma-systems/puma_rk3399/puma-rk3399.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c index fb4d31e..27386dd 100644 --- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c +++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c @@ -9,6 +9,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -57,7 +58,23 @@ out: int dram_init(void) { - gd->ram_size = 0x80000000; + struct ram_info ram; + struct udevice *dev; + int ret; + + ret = uclass_get_device(UCLASS_RAM, 0, &dev); + if (ret) { + debug("DRAM init failed: %d\n", ret); + return ret; + } + ret = ram_get_info(dev, &ram); + if (ret) { + debug("Cannot get DRAM size: %d\n", ret); + return ret; + } + debug("SDRAM base=%llx, size=%x\n", ram.base, (unsigned int)ram.size); + gd->ram_size = ram.size; + return 0; } -- 1.9.1