diff mbox series

[05/27] sunxi: suniv: add boot sequence for SPL to try

Message ID 20210725231636.879913-6-me@yifangu.com
State Superseded
Delegated to: Andre Przywara
Headers show
Series Add F1C100s based PocketGo handheld support | expand

Commit Message

Yifan Gu July 25, 2021, 11:16 p.m. UTC
From: Icenowy Zheng <icenowy@aosc.io>

The BROM of suniv do not pass the info of boot media to SPL.

Add boot sequence for SPL to try again for the available boot media.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Signed-off-by: Yifan Gu <me@yifangu.com>
---
 arch/arm/mach-sunxi/board.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
diff mbox series

Patch

diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
index 3b1a79eb5e..e84687973a 100644
--- a/arch/arm/mach-sunxi/board.c
+++ b/arch/arm/mach-sunxi/board.c
@@ -334,10 +334,32 @@  unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc,
 	return sector;
 }
 
+
+#ifndef CONFIG_MACH_SUNIV
 u32 spl_boot_device(void)
 {
 	return sunxi_get_boot_device();
 }
+#else
+/*
+ * suniv BROM do not pass the boot media type to SPL, so we try with the
+ * boot sequence in BROM: mmc0->spinor->fail.
+ */
+void board_boot_order(u32 *spl_boot_list)
+{
+	/*
+	 * See the comments above in sunxi_get_boot_device() for infomation
+	 * about FEL boot.
+	 */
+	if (!is_boot0_magic(SPL_ADDR + 4)) {
+		spl_boot_list[0] = BOOT_DEVICE_BOARD;
+		return;
+	}
+
+	spl_boot_list[0] = BOOT_DEVICE_MMC1;
+	spl_boot_list[1] = BOOT_DEVICE_SPI;
+}
+#endif
 
 void board_init_f(ulong dummy)
 {