summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorfaqiang.zhu <faqiang.zhu@nxp.com>2018-09-26 16:24:36 +0800
committerfaqiang.zhu <faqiang.zhu@nxp.com>2018-09-29 14:14:24 +0800
commitbea54d4fbee5871187d80b67a5ace10577714f1e (patch)
tree205636e1ee18dfcaa4ab3632e2021d4a85b6a0a4 /drivers
parent26766be89286cad4946655b3004ab0fc4ef63a65 (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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/f_fastboot.c31
-rw-r--r--drivers/usb/gadget/fastboot_lock_unlock.c7
2 files changed, 24 insertions, 14 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index e1e027be1c7..a9e92d42250 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 307d927cdd8..b575a78eef9 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;