summaryrefslogtreecommitdiff
path: root/board/imgtec/boston/ddr.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2016-09-21 18:50:18 (GMT)
committerTom Rini <trini@konsulko.com>2016-09-21 18:50:18 (GMT)
commit423620b9d47a704124f9fd624b4de4ed56c600d6 (patch)
tree78fbffeb39460482565bd75fd32ad4ae1a9cd135 /board/imgtec/boston/ddr.c
parentf85fad024f208ceedb3ce0bb1819936e62a0983e (diff)
parent31d36f748c52b22833aa946f6c406cc8fb2f1908 (diff)
downloadu-boot-423620b9d47a704124f9fd624b4de4ed56c600d6.tar.xz
Merge branch 'master' of git://git.denx.de/u-boot-mips
Diffstat (limited to 'board/imgtec/boston/ddr.c')
-rw-r--r--board/imgtec/boston/ddr.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/board/imgtec/boston/ddr.c b/board/imgtec/boston/ddr.c
new file mode 100644
index 0000000..ceffef6
--- /dev/null
+++ b/board/imgtec/boston/ddr.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2016 Imagination Technologies
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+#include <common.h>
+
+#include <asm/io.h>
+
+#include "boston-regs.h"
+
+phys_size_t initdram(int board_type)
+{
+ u32 ddrconf0 = __raw_readl((uint32_t *)BOSTON_PLAT_DDRCONF0);
+
+ return (phys_size_t)(ddrconf0 & BOSTON_PLAT_DDRCONF0_SIZE) << 30;
+}
+
+ulong board_get_usable_ram_top(ulong total_size)
+{
+ DECLARE_GLOBAL_DATA_PTR;
+
+ if (gd->ram_top < CONFIG_SYS_SDRAM_BASE) {
+ /* 2GB wrapped around to 0 */
+ return CKSEG0ADDR(256 << 20);
+ }
+
+ return min_t(unsigned long, gd->ram_top, CKSEG0ADDR(256 << 20));
+}