diff options
author | Ye Li <ye.li@nxp.com> | 2016-03-10 10:48:24 +0800 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2017-04-05 19:47:58 +0800 |
commit | d0d678fd9bbe9b115e06107f392229104de9b233 (patch) | |
tree | 00fa17609ced1332e0ae12093dadd845f042275b /board | |
parent | e84160eaf5c057da45a227039c6f8a7911f43a82 (diff) | |
download | u-boot-imx-d0d678fd9bbe9b115e06107f392229104de9b233.zip u-boot-imx-d0d678fd9bbe9b115e06107f392229104de9b233.tar.gz u-boot-imx-d0d678fd9bbe9b115e06107f392229104de9b233.tar.bz2 |
MLK-12527-2 android: Add FSL android fastboot support
Integrate the FSL android fastboot features into community's fastboot.
1. Use USB gadget g_dnl driver
2. Integrate the FSL SD/SATA/NAND flash operations, since the GPT and
EFI partitions are not support by i.MX.
3. Add FDT support to community's android image.
4. Add a new boot command "boota" for android image boot. The boota
implements to load ramdisk and fdt to their loading addresses
specified in boot.img header, while bootm won't do it for android image.
5. Support the authentication of boot.img at the "load_addr" for
both SD and NAND.
6. We use new configuration CONFIG_FSL_FASTBOOT for Freescale's fastboot
with relevant header file "fsl_fastboot.h". While disabling the
configuration, the community fastboot is used.
7. Overwrite the cmdline in boot.img by using bootargs saved in local environment.
8. Add recovery and reboot-bootloader support.
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 23d63ff185929fff5e392efc853d69b606ba081a)
Diffstat (limited to 'board')
-rw-r--r-- | board/freescale/common/Makefile | 3 | ||||
-rw-r--r-- | board/freescale/common/recovery.c | 78 |
2 files changed, 81 insertions, 0 deletions
diff --git a/board/freescale/common/Makefile b/board/freescale/common/Makefile index d844831..66cdf0c 100644 --- a/board/freescale/common/Makefile +++ b/board/freescale/common/Makefile @@ -65,6 +65,9 @@ obj-$(CONFIG_POWER_MC34VR500) += mc34vr500.o obj-$(CONFIG_DM_PMIC_PFUZE100) += pfuze_dm.o obj-$(CONFIG_MXC_EPDC) += epdc_setup.o obj-y += mmc.o +ifdef CONFIG_FSL_FASTBOOT +obj-${CONFIG_ANDROID_RECOVERY} += recovery.o +endif obj-$(CONFIG_LS102XA_STREAM_ID) += ls102xa_stream_id.o diff --git a/board/freescale/common/recovery.c b/board/freescale/common/recovery.c new file mode 100644 index 0000000..396bc73 --- /dev/null +++ b/board/freescale/common/recovery.c @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2010-2016 Freescale Semiconductor, Inc. All Rights Reserved. + * + * SPDX-License-Identifier: GPL-2.0+ + */ +#include <common.h> +#include <malloc.h> +#include <recovery.h> +#ifdef CONFIG_MXC_KPD +#include <mxc_keyb.h> +#endif +#include <asm/imx-common/boot_mode.h> + +#ifdef CONFIG_MXC_KPD +#define PRESSED_VOL_DOWN 0x01 +#define PRESSED_POWER 0x02 +#define RECOVERY_KEY_MASK (PRESSED_VOL_DOWN | PRESSED_POWER) + +inline int test_key(int value, struct kpp_key_info *ki) +{ + return (ki->val == value) && (ki->evt == KDepress); +} + +int check_key_pressing(void) +{ + struct kpp_key_info *key_info = NULL; + int state = 0, keys, i; + + int ret = 0; + + mxc_kpp_init(); + /* due to glitch suppression circuit, + wait sometime to let all keys scanned. */ + udelay(1000); + keys = mxc_kpp_getc(&key_info); + + printf("Detecting VOL_DOWN+POWER key for recovery(%d:%d) ...\n", + keys, keys ? key_info->val : 0); + if (keys > 1) { + for (i = 0; i < keys; i++) { + if (test_key(CONFIG_POWER_KEY, &key_info[i])) + state |= PRESSED_POWER; + else if (test_key(CONFIG_VOL_DOWN_KEY, &key_info[i])) + state |= PRESSED_VOL_DOWN; + } + } + if ((state & RECOVERY_KEY_MASK) == RECOVERY_KEY_MASK) + ret = 1; + if (key_info) + free(key_info); + return ret; +} +#else +/* If not using mxc keypad, currently we will detect power key on board */ +int check_key_pressing(void) +{ + return 0; +} +#endif + +void setup_recovery_env(void) +{ + board_recovery_setup(); +} + +/* export to lib_arm/board.c */ +void check_recovery_mode(void) +{ + if (check_key_pressing()) { + puts("Fastboot: Recovery key pressing got!\n"); + setup_recovery_env(); + } else if (check_recovery_cmd_file()) { + puts("Fastboot: Recovery command file found!\n"); + setup_recovery_env(); + } else { + puts("Fastboot: Normal\n"); + } +} |