diff options
author | faqiang.zhu <faqiang.zhu@nxp.com> | 2018-09-26 16:24:36 +0800 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2018-09-29 00:35:27 -0700 |
commit | 4183caa916c3f7c3005837b896655745adf0c703 (patch) | |
tree | 205636e1ee18dfcaa4ab3632e2021d4a85b6a0a4 | |
parent | b54bfeeeed2c7239aeecfefe0ff3fcacadb8d25e (diff) |
MA-12283-4 remove the limitation of lock when use uuu
For imx8 chips, if boot from usb, lock status will be ignored for the
convenience of using uuu. For imx6 and imx7, the presistdata partition
is ignored, so unlock operation can alway succeed.
Change-Id: I842bab9fd2c04f8a864f4a134b63efc4436f71a4
Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
(cherry picked from commit bea54d4fbee5871187d80b67a5ace10577714f1e)
-rw-r--r-- | drivers/usb/gadget/f_fastboot.c | 31 | ||||
-rw-r--r-- | drivers/usb/gadget/fastboot_lock_unlock.c | 7 |
2 files changed, 24 insertions, 14 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index e1e027be1c..a9e92d4225 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -3426,21 +3426,24 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req) fb_response_str = response; #ifdef CONFIG_FASTBOOT_LOCK - int status; - status = fastboot_get_lock_stat(); - - if (status == FASTBOOT_LOCK) { - pr_err("device is LOCKed!\n"); - strcpy(response, "FAIL device is locked."); - fastboot_tx_write_str(response); - return; + /* for imx8 boot from USB, lock status can be ignored for uuu.*/ + if (!(is_imx8() || is_imx8m()) || !(is_boot_from_usb())) { + int status; + status = fastboot_get_lock_stat(); + + if (status == FASTBOOT_LOCK) { + pr_err("device is LOCKed!\n"); + strcpy(response, "FAIL device is locked."); + fastboot_tx_write_str(response); + return; - } else if (status == FASTBOOT_LOCK_ERROR) { - pr_err("write lock status into device!\n"); - fastboot_set_lock_stat(FASTBOOT_LOCK); - strcpy(response, "FAILdevice is locked."); - fastboot_tx_write_str(response); - return; + } else if (status == FASTBOOT_LOCK_ERROR) { + pr_err("write lock status into device!\n"); + fastboot_set_lock_stat(FASTBOOT_LOCK); + strcpy(response, "FAILdevice is locked."); + fastboot_tx_write_str(response); + return; + } } #endif fastboot_fail("no flash device defined"); diff --git a/drivers/usb/gadget/fastboot_lock_unlock.c b/drivers/usb/gadget/fastboot_lock_unlock.c index 307d927cdd..b575a78eef 100644 --- a/drivers/usb/gadget/fastboot_lock_unlock.c +++ b/drivers/usb/gadget/fastboot_lock_unlock.c @@ -38,6 +38,7 @@ #include "fastboot_lock_unlock.h" #include <fsl_fastboot.h> #include <memalign.h> +#include <asm/mach-imx/sys_proto.h> #ifdef CONFIG_IMX_TRUSTY_OS #include <trusty/libtipc.h> #include <asm/mach-imx/hab.h> @@ -476,6 +477,12 @@ FbLockEnableResult fastboot_lock_enable() { int mmc_id; FbLockEnableResult ret; + /* for imx6 and imx7 platforms, ignore presistdata partition + * for the convenience of using uuu + */ + if (is_mx6() || is_mx7() || is_mx7ulp()) + return FASTBOOT_UL_ENABLE; + bdata = (unsigned char *)memalign(ALIGN_BYTES, SECTOR_SIZE); if (bdata == NULL) return FASTBOOT_UL_ERROR; |