diff mbox series

[U-Boot,12/12] arm: spear: Return to BootROM if failing to boot from the main device

Message ID 20190507121854.18575-13-miquel.raynal@bootlin.com
State Accepted
Commit 2e8a7202467acc3b40db864468c862327716b0ae
Delegated to: Tom Rini
Headers show
Series Enable returning back to BootROM from spear SPL | expand

Commit Message

Miquel Raynal May 7, 2019, 12:18 p.m. UTC
Overload the weak function board_boot_order() so that besides choosing
the main boot device, we can fallback on USB boot by returning in the
BootROM, eg. if the NOR flash is empty while it was the primary boot
medium.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 arch/arm/cpu/arm926ejs/spear/spl.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Stefan Roese May 7, 2019, 12:45 p.m. UTC | #1
On 07.05.19 14:18, Miquel Raynal wrote:
> Overload the weak function board_boot_order() so that besides choosing
> the main boot device, we can fallback on USB boot by returning in the
> BootROM, eg. if the NOR flash is empty while it was the primary boot
> medium.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan
Tom Rini July 11, 2019, 10:05 p.m. UTC | #2
On Tue, May 07, 2019 at 02:18:54PM +0200, Miquel Raynal wrote:

> Overload the weak function board_boot_order() so that besides choosing
> the main boot device, we can fallback on USB boot by returning in the
> BootROM, eg. if the NOR flash is empty while it was the primary boot
> medium.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> Reviewed-by: Stefan Roese <sr@denx.de>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/arch/arm/cpu/arm926ejs/spear/spl.c b/arch/arm/cpu/arm926ejs/spear/spl.c
index b2cacf2d3e..fc332fb626 100644
--- a/arch/arm/cpu/arm926ejs/spear/spl.c
+++ b/arch/arm/cpu/arm926ejs/spear/spl.c
@@ -241,6 +241,18 @@  u32 spl_boot_device(void)
 	return mode;
 }
 
+void board_boot_order(u32 *spl_boot_list)
+{
+	spl_boot_list[0] = spl_boot_device();
+
+	/*
+	 * If the main boot device (eg. NOR) is empty, try to jump back into the
+	 * BootROM for USB boot process.
+	 */
+	if (USB_BOOT_SUPPORTED)
+		spl_boot_list[1] = BOOT_DEVICE_BOOTROM;
+}
+
 void board_init_f(ulong dummy)
 {
 	struct misc_regs *misc_p = (struct misc_regs *)CONFIG_SPEAR_MISCBASE;