summaryrefslogtreecommitdiff
path: root/board/renesas/rcar-common/common.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2019-05-26 20:18:20 -0400
committerTom Rini <trini@konsulko.com>2019-05-26 20:18:20 -0400
commitc18b103657d9541305a45a1fb21f979c317fba49 (patch)
tree3d7e8425a499e3df0c90c34e3e5b60660cfca3d7 /board/renesas/rcar-common/common.c
parent696f02d99b41190786b17ad28316a0cd45792c2c (diff)
parentb5900a58caf0416355ccab4dc9da55c9a388a953 (diff)
Merge branch 'master' of git://git.denx.de/u-boot-sh
- Gen3 PCIe driver + enablement on Salvator-X platforms. - Gen3 recovery SPL used to reload ATF/OpTee/U-Boot instead of minimon. - SDHI HS400 fixes ported from latest BSP and datasheet.
Diffstat (limited to 'board/renesas/rcar-common/common.c')
-rw-r--r--board/renesas/rcar-common/common.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/board/renesas/rcar-common/common.c b/board/renesas/rcar-common/common.c
index 1ce6e2eac1..292867e496 100644
--- a/board/renesas/rcar-common/common.c
+++ b/board/renesas/rcar-common/common.c
@@ -9,3 +9,41 @@
#include <common.h>
#include <asm/arch/rmobile.h>
+
+#ifdef CONFIG_RCAR_GEN3
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* If the firmware passed a device tree use it for U-Boot DRAM setup. */
+extern u64 rcar_atf_boot_args[];
+
+int dram_init(void)
+{
+ const void *atf_fdt_blob = (const void *)(rcar_atf_boot_args[1]);
+ const void *blob;
+
+ /* Check if ATF passed us DTB. If not, fall back to builtin DTB. */
+ if (fdt_magic(atf_fdt_blob) == FDT_MAGIC)
+ blob = atf_fdt_blob;
+ else
+ blob = gd->fdt_blob;
+
+ return fdtdec_setup_mem_size_base_fdt(blob);
+}
+
+int dram_init_banksize(void)
+{
+ const void *atf_fdt_blob = (const void *)(rcar_atf_boot_args[1]);
+ const void *blob;
+
+ /* Check if ATF passed us DTB. If not, fall back to builtin DTB. */
+ if (fdt_magic(atf_fdt_blob) == FDT_MAGIC)
+ blob = atf_fdt_blob;
+ else
+ blob = gd->fdt_blob;
+
+ fdtdec_setup_memory_banksize_fdt(blob);
+
+ return 0;
+}
+#endif