summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>2017-04-28 15:31:44 (GMT)
committerSimon Glass <sjg@chromium.org>2017-05-10 19:37:21 (GMT)
commite92e58035062930fcbcb1861cc92f512bde4067b (patch)
tree3f2215de6744379a4eb900f3edd6b76cc0fed36d /board
parenta70feb462016d1a6a4e6254aa10ba68948b458f2 (diff)
downloadu-boot-e92e58035062930fcbcb1861cc92f512bde4067b.tar.xz
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> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/theobroma-systems/puma_rk3399/puma-rk3399.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
index fb4d31e..0a8861a 100644
--- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c
+++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
@@ -5,10 +5,18 @@
*/
#include <common.h>
#include <dm.h>
+#include <misc.h>
+#include <ram.h>
#include <dm/pinctrl.h>
#include <dm/uclass-internal.h>
#include <asm/arch/periph.h>
#include <power/regulator.h>
+#include <u-boot/sha256.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define RK3399_CPUID_OFF 0x7
+#define RK3399_CPUID_LEN 0x10
DECLARE_GLOBAL_DATA_PTR;
@@ -57,7 +65,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;
}