arm: spear: Return to BootROM if failing to boot from the main device
authorMiquel Raynal <miquel.raynal@bootlin.com>
Tue, 7 May 2019 12:18:54 +0000 (14:18 +0200)
committerTom Rini <trini@konsulko.com>
Thu, 11 Jul 2019 14:05:15 +0000 (10:05 -0400)
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>
arch/arm/cpu/arm926ejs/spear/spl.c

index b2cacf2d3ef52b97e4538b935898ffeebc7d7174..fc332fb62691b7bb49af3db900259b14010acaae 100644 (file)
@@ -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;