diff mbox series

[U-Boot,RFC] SPL: allow fall-back to SDP boot

Message ID 1516459133-10105-1-git-send-email-eric@nelint.com
State Not Applicable
Delegated to: Stefano Babic
Headers show
Series [U-Boot,RFC] SPL: allow fall-back to SDP boot | expand

Commit Message

Eric Nelson Jan. 20, 2018, 2:38 p.m. UTC
When SDP is enabled, allow it to be invoked as a fall-back
to allow re-programming a board with a full U-Boot loaded
over USB.

Signed-off-by: Eric Nelson <eric@nelint.com>
---
Since SDP loading is triggered through BOOT_DEVICE_BOARD, I'm not sure
if this should be specific to SDP.

 common/spl/spl.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 76c1963..5bbd4ed 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -373,6 +373,9 @@  static int boot_from_devices(struct spl_image_info *spl_image,
 
 void board_init_r(gd_t *dummy1, ulong dummy2)
 {
+#ifdef CONFIG_SPL_USB_SDP_SUPPORT
+	int i;
+#endif
 	u32 spl_boot_list[] = {
 		BOOT_DEVICE_NONE,
 		BOOT_DEVICE_NONE,
@@ -417,6 +420,15 @@  void board_init_r(gd_t *dummy1, ulong dummy2)
 #endif
 	board_boot_order(spl_boot_list);
 
+#ifdef CONFIG_SPL_USB_SDP_SUPPORT
+	for (i = 0; i < ARRAY_SIZE(spl_boot_list); i++) {
+		if (spl_boot_list[i] == BOOT_DEVICE_NONE) {
+			spl_boot_list[i] = BOOT_DEVICE_BOARD;
+			break;
+		}
+	}
+#endif
+
 	if (boot_from_devices(&spl_image, spl_boot_list,
 			      ARRAY_SIZE(spl_boot_list))) {
 		puts("SPL: failed to boot from all boot devices\n");