summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorKever Yang <kever.yang@rock-chips.com>2017-04-19 08:01:14 (GMT)
committerSimon Glass <sjg@chromium.org>2017-05-10 19:37:21 (GMT)
commit76e1693b9bb423318d212d0170e142640f226d95 (patch)
treed8bb5ac0a7ee1590a479b6d92f0bfb7dea596924 /board
parent7474bbe85718954b7565ac72eaffb3fc2e0880d3 (diff)
downloadu-boot-76e1693b9bb423318d212d0170e142640f226d95.tar.xz
rockchip: rk3399: use actual dram size
Since our sdram driver is ready, we can use the actual size instead of hard code. Signed-off-by: Kever Yang <kever.yang@rock-chips.com> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/rockchip/evb_rk3399/evb-rk3399.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/board/rockchip/evb_rk3399/evb-rk3399.c b/board/rockchip/evb_rk3399/evb-rk3399.c
index 6561c4f..e83dedb 100644
--- a/board/rockchip/evb_rk3399/evb-rk3399.c
+++ b/board/rockchip/evb_rk3399/evb-rk3399.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
#include <dm.h>
+#include <ram.h>
#include <dm/pinctrl.h>
#include <dm/uclass-internal.h>
#include <asm/arch/periph.h>
@@ -62,7 +63,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;
}