summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJi Luo <ji.luo@nxp.com>2019-07-18 13:56:45 +0800
committerJi Luo <ji.luo@nxp.com>2019-07-19 13:14:15 +0800
commit2a43c3e702720fab67ae9af73634a958a1b62044 (patch)
tree0399901533ba4e194f3d89235496e04082da32cf /drivers
parent3f94cf98113af6c31e146afcf394f34ff4d2bc00 (diff)
MA-15158 Set spl recovery mode for dual bootloader
The A/B slot selection is moved to spl, it may lead to hang if no bootable slots found. The only way to recover the board is re-flash images with uuu tool, which is quite inconvenient for some customers who can't enter serial download mode. This patch will set "spl recovery mode" which will give us a chance to re-flash images with fastboot commands. Test: Enter spl recovery mode and flash images when no bootable slots found. Change-Id: I31278f5212bde7609fe2f49e77b3849e92c0c516 Signed-off-by: Ji Luo <ji.luo@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/f_fastboot.c2
-rw-r--r--drivers/usb/gadget/fastboot_lock_unlock.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index e8298a8dbc..df8b537cd2 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -1701,7 +1701,7 @@ void board_recovery_setup(void)
#endif /*CONFIG_FSL_FASTBOOT*/
#if defined(CONFIG_AVB_SUPPORT) && defined(CONFIG_MMC)
-static AvbABOps fsl_avb_ab_ops = {
+AvbABOps fsl_avb_ab_ops = {
.read_ab_metadata = fsl_read_ab_metadata,
.write_ab_metadata = fsl_write_ab_metadata,
.ops = NULL
diff --git a/drivers/usb/gadget/fastboot_lock_unlock.c b/drivers/usb/gadget/fastboot_lock_unlock.c
index 06d21e73b8..e3c070383e 100644
--- a/drivers/usb/gadget/fastboot_lock_unlock.c
+++ b/drivers/usb/gadget/fastboot_lock_unlock.c
@@ -43,6 +43,7 @@
#include <trusty/libtipc.h>
#include <asm/mach-imx/hab.h>
#endif
+#include <fsl_avb.h>
#ifdef FASTBOOT_ENCRYPT_LOCK
@@ -480,6 +481,12 @@ FbLockEnableResult fastboot_lock_enable() {
int mmc_id;
FbLockEnableResult ret;
+#ifdef CONFIG_DUAL_BOOTLOADER
+ /* Always allow unlock device in spl recovery mode. */
+ if (is_spl_recovery())
+ return FASTBOOT_UL_ENABLE;
+#endif
+
bdata = (unsigned char *)memalign(ALIGN_BYTES, SECTOR_SIZE);
if (bdata == NULL)
return FASTBOOT_UL_ERROR;