summaryrefslogtreecommitdiff
path: root/arch/mips/mach-bmips/dram.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2017-05-10 15:50:21 -0400
committerTom Rini <trini@konsulko.com>2017-05-10 15:50:21 -0400
commit102d86552abc82818c22b39fdef4b3a280a60643 (patch)
tree781ad3640c611f036fbd4645aa1623bfc5ba9a0c /arch/mips/mach-bmips/dram.c
parent05b8dc5cd30a6d6cdfb29c9e718198692e12b4bf (diff)
parenta41481bfcba89d1d8dd8b51faa7775cd3ff1c15f (diff)
Merge branch 'master' of git://git.denx.de/u-boot-mips
Diffstat (limited to 'arch/mips/mach-bmips/dram.c')
-rw-r--r--arch/mips/mach-bmips/dram.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/arch/mips/mach-bmips/dram.c b/arch/mips/mach-bmips/dram.c
new file mode 100644
index 0000000000..b19b28a910
--- /dev/null
+++ b/arch/mips/mach-bmips/dram.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2016 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
+ * Copyright (C) 2017 Álvaro Fernández Rojas <noltari@gmail.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <ram.h>
+#include <dm.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+ struct ram_info ram;
+ struct udevice *dev;
+ int err;
+
+ err = uclass_get_device(UCLASS_RAM, 0, &dev);
+ if (err) {
+ debug("DRAM init failed: %d\n", err);
+ return 0;
+ }
+
+ err = ram_get_info(dev, &ram);
+ if (err) {
+ debug("Cannot get DRAM size: %d\n", err);
+ return 0;
+ }
+
+ debug("SDRAM base=%zx, size=%x\n", ram.base, ram.size);
+
+ gd->ram_size = ram.size;
+
+ return 0;
+}