[3/4] spl: Try to get boot device from board_get_int

Message ID 20200512112040.4140-1-jagan@amarulasolutions.com
State New
Headers show
Series
  • Untitled series #181
Related show

Commit Message

Jagan Teki May 12, 2020, 11:20 a.m. UTC
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 common/spl/spl.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

Patch

diff --git a/common/spl/spl.c b/common/spl/spl.c
index b0f0e1557b..cdb4b0b4cb 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -9,6 +9,7 @@ 
 #include <common.h>
 #include <bloblist.h>
 #include <binman_sym.h>
+#include <board.h>
 #include <dm.h>
 #include <handoff.h>
 #include <hang.h>
@@ -483,9 +484,20 @@  int spl_init(void)
 #define BOOT_DEVICE_NONE 0xdeadbeef
 #endif
 
+__weak u32 spl_boot_device(void)
+{
+	return 0;
+}
+
 __weak void board_boot_order(u32 *spl_boot_list)
 {
-	spl_boot_list[0] = spl_boot_device();
+	struct udevice *board;
+
+	if (!board_get(&board))
+		board_get_int(board, BOARD_SPL_BOOT_DEVICE,
+			      (int *)&spl_boot_list[0]);
+	else
+		spl_boot_list[0] = spl_boot_device();
 }
 
 static struct spl_image_loader *spl_ll_find_loader(uint boot_device)