diff options
author | Philipp Tomsich <philipp.tomsich@theobroma-systems.com> | 2017-04-26 11:51:45 +0200 |
---|---|---|
committer | Philipp Tomsich <philipp.tomsich@theobroma-systems.com> | 2017-05-16 00:15:57 +0200 |
commit | ca0a50d602477ec0513d261dd6b98fffd189c060 (patch) | |
tree | 8c888a34d160880d8c8f638a25ace29a8a401616 | |
parent | a3cd8833e27583911037c875a21fd111755b5eba (diff) |
rockchip: ARM64: puma-rk3399: get DRAM size from DMC init
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 <philipp.tomsich@theobroma-systems.com>
-rw-r--r-- | board/theobroma-systems/puma_rk3399/puma-rk3399.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c index 056c374c6e..6cde4f0d29 100644 --- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c +++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c @@ -9,6 +9,7 @@ #include <dm/uclass-internal.h> #include <asm/arch/periph.h> #include <power/regulator.h> +#include <ram.h> #include <usb.h> #include <dwc3-uboot.h> @@ -59,7 +60,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; } |