[PATCH v2 21/32] spl: sandbox: initialise the ram banksize in spl

Sughosh Ganu sughosh.ganu at linaro.org
Wed Aug 14 12:59:58 CEST 2024


Initialise the ram bank information for sandbox in SPL. This is needed
for adding available memory to the LMB memory map, which is done as
part of the initialisation sequence.

Signed-off-by: Sughosh Ganu <sughosh.ganu at linaro.org>
---
Changes since V1:
* Update the commit message to explain why this change is being done.

 arch/sandbox/cpu/spl.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/arch/sandbox/cpu/spl.c b/arch/sandbox/cpu/spl.c
index bcb1ca10a5..1b9896bc68 100644
--- a/arch/sandbox/cpu/spl.c
+++ b/arch/sandbox/cpu/spl.c
@@ -127,6 +127,15 @@ static int load_from_image(struct spl_image_info *spl_image,
 }
 SPL_LOAD_IMAGE_METHOD("sandbox_image", 7, BOOT_DEVICE_BOARD, load_from_image);
 
+int dram_init_banksize(void)
+{
+	/* These are necessary so TFTP can use LMBs to check its load address */
+	gd->bd->bi_dram[0].start = gd->ram_base;
+	gd->bd->bi_dram[0].size = get_effective_memsize();
+
+	return 0;
+}
+
 void spl_board_init(void)
 {
 	struct sandbox_state *state = state_get_current();
@@ -134,10 +143,6 @@ void spl_board_init(void)
 	if (!CONFIG_IS_ENABLED(UNIT_TEST))
 		return;
 
-	/* These are necessary so TFTP can use LMBs to check its load address */
-	gd->bd->bi_dram[0].start = gd->ram_base;
-	gd->bd->bi_dram[0].size = get_effective_memsize();
-
 	if (state->run_unittests) {
 		struct unit_test *tests = UNIT_TEST_ALL_START();
 		const int count = UNIT_TEST_ALL_COUNT();
-- 
2.34.1



More information about the U-Boot mailing list