summaryrefslogtreecommitdiff
path: root/common/init
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-11-15 18:44:09 -0700
committerTom Rini <trini@konsulko.com>2018-11-26 08:25:37 -0500
commitb0edea3c27af3bf7b959fa190a7fe9d7881153c5 (patch)
treee48319d91713218a49706b7526f147f2d56c7aee /common/init
parent27028f186d17a25507eb7d5c9b852d8555432679 (diff)
spl: Add support for passing handoff info to U-Boot proper
There is some basic informaton that SPL normally wants to pass through to U-Boot, such as the SDRAM size and bank information. Mkae use of the new bloblist structure for this. Add a new 'handoff' blob which is set up in SPL and passed to U-Boot proper. Also adda test for sandbox_spl that checks that this works correctly and a new 'sb' command to show the information passed from SPL. Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/init')
-rw-r--r--common/init/Makefile1
-rw-r--r--common/init/handoff.c47
2 files changed, 48 insertions, 0 deletions
diff --git a/common/init/Makefile b/common/init/Makefile
index 4902635f53..853b56d1e5 100644
--- a/common/init/Makefile
+++ b/common/init/Makefile
@@ -5,3 +5,4 @@
#
obj-y += board_init.o
+obj-$(CONFIG_$(SPL_TPL_)HANDOFF) += handoff.o
diff --git a/common/init/handoff.c b/common/init/handoff.c
new file mode 100644
index 0000000000..e00b43e6a7
--- /dev/null
+++ b/common/init/handoff.c
@@ -0,0 +1,47 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Passing basic information from SPL to U-Boot proper
+ *
+ * Copyright 2018 Google, Inc
+ */
+
+#include <common.h>
+#include <handoff.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void handoff_save_dram(struct spl_handoff *ho)
+{
+ ho->ram_size = gd->ram_size;
+#ifdef CONFIG_NR_DRAM_BANKS
+ {
+ struct bd_info *bd = gd->bd;
+ int i;
+
+ for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+ ho->ram_bank[i].start = bd->bi_dram[i].start;
+ ho->ram_bank[i].size = bd->bi_dram[i].size;
+ }
+ }
+#endif
+}
+
+void handoff_load_dram_size(struct spl_handoff *ho)
+{
+ gd->ram_size = ho->ram_size;
+}
+
+void handoff_load_dram_banks(struct spl_handoff *ho)
+{
+#ifdef CONFIG_NR_DRAM_BANKS
+ {
+ struct bd_info *bd = gd->bd;
+ int i;
+
+ for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+ bd->bi_dram[i].start = ho->ram_bank[i].start;
+ bd->bi_dram[i].size = ho->ram_bank[i].size;
+ }
+ }
+#endif
+}