diff options
author | Chen Guoyin <guoyin.chen@nxp.com> | 2016-11-15 17:57:25 +0800 |
---|---|---|
committer | Chen Guoyin <guoyin.chen@nxp.com> | 2016-11-16 18:36:34 +0800 |
commit | a5a753d62da1c6352235845629470e5337f4f347 (patch) | |
tree | f50e64b95766bc861fe18bb2dfd584576fa2e76c | |
parent | 7f652587219cf14755c07c35e9271b45f150b518 (diff) | |
download | u-boot-imx-a5a753d62da1c6352235845629470e5337f4f347.zip u-boot-imx-a5a753d62da1c6352235845629470e5337f4f347.tar.gz u-boot-imx-a5a753d62da1c6352235845629470e5337f4f347.tar.bz2 |
MA-9012 Support boot commands from bcb info
* Remove recovery/bootloader mode checking based on snvs register
* Use the API fastboot_run_bootmode() as the entry to check different
boot mode
* Set boot mode based on commands stored in bcb structure to align
Android's bootloader_message_writer.cpp
bootonce-bootloader -- > Fastboot mode
boot-recovery -- > Recovery mode
* Rename the recovery.c as recovery_keypad.c as only handle keypad
Change-Id: If34bee0c78bdca252e33296d61443d01a8fc8e96
Signed-off-by: Chen Guoyin <guoyin.chen@nxp.com>
21 files changed, 143 insertions, 253 deletions
diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c index 4e1ea01..c05f267 100644 --- a/arch/arm/cpu/armv7/mx6/soc.c +++ b/arch/arm/cpu/armv7/mx6/soc.c @@ -1027,55 +1027,3 @@ void v7_outer_cache_disable(void) } #endif #endif /* !CONFIG_SYS_L2CACHE_OFF */ - -#ifdef CONFIG_FSL_FASTBOOT - -#ifdef CONFIG_ANDROID_RECOVERY -#define ANDROID_RECOVERY_BOOT (1 << 7) -/* check if the recovery bit is set by kernel, it can be set by kernel - * issue a command '# reboot recovery' */ -int recovery_check_and_clean_flag(void) -{ - int flag_set = 0; - u32 reg; - reg = readl(SNVS_BASE_ADDR + SNVS_LPGPR); - - flag_set = !!(reg & ANDROID_RECOVERY_BOOT); - printf("check_and_clean: reg %x, flag_set %d\n", reg, flag_set); - /* clean it in case looping infinite here.... */ - if (flag_set) { - reg &= ~ANDROID_RECOVERY_BOOT; - writel(reg, SNVS_BASE_ADDR + SNVS_LPGPR); - } - - return flag_set; -} -#endif /*CONFIG_ANDROID_RECOVERY*/ - -#define ANDROID_FASTBOOT_BOOT (1 << 8) -/* check if the recovery bit is set by kernel, it can be set by kernel - * issue a command '# reboot fastboot' */ -int fastboot_check_and_clean_flag(void) -{ - int flag_set = 0; - u32 reg; - - reg = readl(SNVS_BASE_ADDR + SNVS_LPGPR); - - flag_set = !!(reg & ANDROID_FASTBOOT_BOOT); - - /* clean it in case looping infinite here.... */ - if (flag_set) { - reg &= ~ANDROID_FASTBOOT_BOOT; - writel(reg, SNVS_BASE_ADDR + SNVS_LPGPR); - } - - return flag_set; -} - -void fastboot_enable_flag(void) -{ - setbits_le32(SNVS_BASE_ADDR + SNVS_LPGPR, - ANDROID_FASTBOOT_BOOT); -} -#endif /*CONFIG_FSL_FASTBOOT*/ diff --git a/arch/arm/cpu/armv7/mx7/soc.c b/arch/arm/cpu/armv7/mx7/soc.c index d718e67..bcb870a 100644 --- a/arch/arm/cpu/armv7/mx7/soc.c +++ b/arch/arm/cpu/armv7/mx7/soc.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014-2015 Freescale Semiconductor, Inc. + * Copyright (C) 2014-2016 Freescale Semiconductor, Inc. * * SPDX-License-Identifier: GPL-2.0+ */ @@ -464,59 +464,3 @@ void reset_misc(void) lcdif_power_down(); #endif } - -#ifdef CONFIG_FSL_FASTBOOT - -#ifdef CONFIG_ANDROID_RECOVERY -#define ANDROID_RECOVERY_BOOT (1 << 7) -/* - * check if the recovery bit is set by kernel, it can be set by kernel - * issue a command '# reboot recovery' - */ -int recovery_check_and_clean_flag(void) -{ - int flag_set = 0; - u32 reg; - reg = readl(SNVS_BASE_ADDR + SNVS_LPGPR); - - flag_set = !!(reg & ANDROID_RECOVERY_BOOT); - printf("check_and_clean: reg %x, flag_set %d\n", reg, flag_set); - /* clean it in case looping infinite here.... */ - if (flag_set) { - reg &= ~ANDROID_RECOVERY_BOOT; - writel(reg, SNVS_BASE_ADDR + SNVS_LPGPR); - } - - return flag_set; -} -#endif /*CONFIG_ANDROID_RECOVERY*/ - -#define ANDROID_FASTBOOT_BOOT (1 << 8) -/* - * check if the recovery bit is set by kernel, it can be set by kernel - * issue a command '# reboot fastboot' - */ -int fastboot_check_and_clean_flag(void) -{ - int flag_set = 0; - u32 reg; - - reg = readl(SNVS_BASE_ADDR + SNVS_LPGPR); - - flag_set = !!(reg & ANDROID_FASTBOOT_BOOT); - - /* clean it in case looping infinite here.... */ - if (flag_set) { - reg &= ~ANDROID_FASTBOOT_BOOT; - writel(reg, SNVS_BASE_ADDR + SNVS_LPGPR); - } - - return flag_set; -} - -void fastboot_enable_flag(void) -{ - setbits_le32(SNVS_BASE_ADDR + SNVS_LPGPR, - ANDROID_FASTBOOT_BOOT); -} -#endif /*CONFIG_FSL_FASTBOOT*/ diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index 1f2bab1..96e1804 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -687,7 +687,7 @@ void board_init_r(gd_t *id, ulong dest_addr) #endif #ifdef CONFIG_FSL_FASTBOOT - check_fastboot(); + fastboot_run_bootmode(); #endif /* main_loop() can return to retry autoboot, if so just run it again. */ diff --git a/board/freescale/common/Makefile b/board/freescale/common/Makefile index 0c7fa21..49421bb 100644 --- a/board/freescale/common/Makefile +++ b/board/freescale/common/Makefile @@ -63,7 +63,7 @@ obj-$(CONFIG_ZM7300) += zm7300.o obj-$(CONFIG_POWER_PFUZE100) += pfuze.o obj-$(CONFIG_MXC_EPDC) += epdc_setup.o ifdef CONFIG_FSL_FASTBOOT -obj-${CONFIG_ANDROID_RECOVERY} += recovery.o +obj-${CONFIG_ANDROID_RECOVERY} += recovery_keypad.o endif obj-$(CONFIG_LS102XA_STREAM_ID) += ls102xa_stream_id.o diff --git a/board/freescale/common/recovery.c b/board/freescale/common/recovery_keypad.c index 9fa31c4..37e13dc 100644 --- a/board/freescale/common/recovery.c +++ b/board/freescale/common/recovery_keypad.c @@ -21,7 +21,7 @@ inline int test_key(int value, struct kpp_key_info *ki) return (ki->val == value) && (ki->evt == KDepress); } -int check_key_pressing(void) +int is_recovery_keypad_pressing(void) { struct kpp_key_info *key_info = NULL; int state = 0, keys, i; @@ -52,32 +52,8 @@ int check_key_pressing(void) } #else /* If not using mxc keypad, currently we will detect power key on board */ -int check_key_pressing(void) +int is_recovery_keypad_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(); -#ifdef CONFIG_BCB_SUPPORT - } else if (recovery_check_and_clean_command()) { - puts("Fastboot: BCB command found\n"); - setup_recovery_env(); -#endif - } else { - puts("Fastboot: Normal\n"); - } -} diff --git a/board/freescale/common/recovery_keypad.h b/board/freescale/common/recovery_keypad.h new file mode 100644 index 0000000..e8b0276 --- /dev/null +++ b/board/freescale/common/recovery_keypad.h @@ -0,0 +1,12 @@ +/* + * Copyright (C) 2016 Freescale Semiconductor, Inc. All Rights Reserved. + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef __RECOVERY_KEYPAD_H_ +#define __RECOVERY_KEYPAD_H_ + +int is_recovery_keypad_pressing(void); + +#endif diff --git a/board/freescale/mx6qsabreauto/mx6qsabreauto.c b/board/freescale/mx6qsabreauto/mx6qsabreauto.c index 21362a4..5a3ee29 100644 --- a/board/freescale/mx6qsabreauto/mx6qsabreauto.c +++ b/board/freescale/mx6qsabreauto/mx6qsabreauto.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2015 Freescale Semiconductor, Inc. + * Copyright (C) 2012-2016 Freescale Semiconductor, Inc. * * Author: Fabio Estevam <fabio.estevam@freescale.com> * @@ -1027,12 +1027,9 @@ iomux_v3_cfg_t const recovery_key_pads[] = { (MX6_PAD_DISP0_DAT20__GPIO5_IO14 | MUX_PAD_CTRL(NO_PAD_CTRL)), }; -int check_recovery_cmd_file(void) +int is_recovery_key_pressing(void) { int button_pressed = 0; - int recovery_mode = 0; - - recovery_mode = recovery_check_and_clean_flag(); /* Check Recovery Combo Button press or not. */ imx_iomux_v3_setup_multiple_pads(recovery_key_pads, @@ -1045,7 +1042,7 @@ int check_recovery_cmd_file(void) printf("Recovery key pressed\n"); } - return recovery_mode || button_pressed; + return button_pressed; } void board_recovery_setup(void) diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c index 716e2d7..5070c65 100644 --- a/board/freescale/mx6sabresd/mx6sabresd.c +++ b/board/freescale/mx6sabresd/mx6sabresd.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2015 Freescale Semiconductor, Inc. + * Copyright (C) 2012-2016 Freescale Semiconductor, Inc. * * Author: Fabio Estevam <fabio.estevam@freescale.com> * @@ -1241,12 +1241,9 @@ iomux_v3_cfg_t const recovery_key_pads[] = { (MX6_PAD_GPIO_5__GPIO1_IO05 | MUX_PAD_CTRL(NO_PAD_CTRL)), }; -int check_recovery_cmd_file(void) +int is_recovery_key_pressing(void) { int button_pressed = 0; - int recovery_mode = 0; - - recovery_mode = recovery_check_and_clean_flag(); /* Check Recovery Combo Button press or not. */ imx_iomux_v3_setup_multiple_pads(recovery_key_pads, @@ -1259,7 +1256,7 @@ int check_recovery_cmd_file(void) printf("Recovery key pressed\n"); } - return recovery_mode || button_pressed; + return button_pressed; } void board_recovery_setup(void) diff --git a/board/freescale/mx6slevk/mx6slevk.c b/board/freescale/mx6slevk/mx6slevk.c index b94fdf0..d19709f 100644 --- a/board/freescale/mx6slevk/mx6slevk.c +++ b/board/freescale/mx6slevk/mx6slevk.c @@ -38,6 +38,7 @@ #include <fsl_fastboot.h> #ifdef CONFIG_ANDROID_RECOVERY #include <recovery.h> +#include "../common/recovery_keypad.h" #endif #endif /*CONFIG_FSL_FASTBOOT*/ @@ -874,9 +875,9 @@ void board_fastboot_setup(void) } #ifdef CONFIG_ANDROID_RECOVERY -int check_recovery_cmd_file(void) +int is_recovery_key_pressing(void) { - return recovery_check_and_clean_flag(); + return is_recovery_keypad_pressing(); } void board_recovery_setup(void) diff --git a/board/freescale/mx6sxsabreauto/mx6sxsabreauto.c b/board/freescale/mx6sxsabreauto/mx6sxsabreauto.c index 43a2e3f..4b65b2a 100644 --- a/board/freescale/mx6sxsabreauto/mx6sxsabreauto.c +++ b/board/freescale/mx6sxsabreauto/mx6sxsabreauto.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014-2015 Freescale Semiconductor, Inc. + * Copyright (C) 2014-2016 Freescale Semiconductor, Inc. * * SPDX-License-Identifier: GPL-2.0+ */ @@ -48,6 +48,7 @@ #include <fsl_fastboot.h> #ifdef CONFIG_ANDROID_RECOVERY #include <recovery.h> +#include "../common/recovery_keypad.h" #endif #endif /*CONFIG_FSL_FASTBOOT*/ @@ -883,13 +884,9 @@ void board_fastboot_setup(void) } #ifdef CONFIG_ANDROID_RECOVERY -int check_recovery_cmd_file(void) +int is_recovery_key_pressing(void) { - int recovery_mode = 0; - - recovery_mode = recovery_check_and_clean_flag(); - - return recovery_mode; + return is_recovery_keypad_pressing(); } void board_recovery_setup(void) diff --git a/board/freescale/mx6sxsabresd/mx6sxsabresd.c b/board/freescale/mx6sxsabresd/mx6sxsabresd.c index 3b238e7..2ce9138 100644 --- a/board/freescale/mx6sxsabresd/mx6sxsabresd.c +++ b/board/freescale/mx6sxsabresd/mx6sxsabresd.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014-2015 Freescale Semiconductor, Inc. + * Copyright (C) 2014-2016 Freescale Semiconductor, Inc. * * Author: Fabio Estevam <fabio.estevam@freescale.com> * @@ -965,12 +965,9 @@ iomux_v3_cfg_t const recovery_key_pads[] = { (MX6_PAD_CSI_DATA05__GPIO1_IO_19 | MUX_PAD_CTRL(BUTTON_PAD_CTRL)), }; -int check_recovery_cmd_file(void) +int is_recovery_key_pressing(void) { int button_pressed = 0; - int recovery_mode = 0; - - recovery_mode = recovery_check_and_clean_flag(); /* Check Recovery Combo Button press or not. */ imx_iomux_v3_setup_multiple_pads(recovery_key_pads, @@ -983,7 +980,7 @@ int check_recovery_cmd_file(void) printf("Recovery key pressed\n"); } - return recovery_mode || button_pressed; + return button_pressed; } void board_recovery_setup(void) diff --git a/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c b/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c index c09e2ae..9bed1da 100644 --- a/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c +++ b/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Freescale Semiconductor, Inc. + * Copyright (C) 2015-2016 Freescale Semiconductor, Inc. * * SPDX-License-Identifier: GPL-2.0+ */ @@ -1031,13 +1031,10 @@ void board_fastboot_setup(void) } #ifdef CONFIG_ANDROID_RECOVERY -int check_recovery_cmd_file(void) +int is_recovery_key_pressing(void) { - int recovery_mode = 0; - - recovery_mode = recovery_check_and_clean_flag(); - - return recovery_mode; + /* No key defined for this board */ + return 0; } void board_recovery_setup(void) diff --git a/board/freescale/mx6ul_nxpu_iopb/mx6ul_nxpu_iopb.c b/board/freescale/mx6ul_nxpu_iopb/mx6ul_nxpu_iopb.c index 4b681ba..9ebabca 100644 --- a/board/freescale/mx6ul_nxpu_iopb/mx6ul_nxpu_iopb.c +++ b/board/freescale/mx6ul_nxpu_iopb/mx6ul_nxpu_iopb.c @@ -618,13 +618,10 @@ void board_fastboot_setup(void) } #ifdef CONFIG_ANDROID_RECOVERY -int check_recovery_cmd_file(void) +int is_recovery_key_pressing(void) { - int recovery_mode = 0; - - recovery_mode = recovery_check_and_clean_flag(); - - return recovery_mode; + /* No key defined for this board */ + return 0; } void board_recovery_setup(void) diff --git a/board/freescale/mx7dsabresd/mx7dsabresd.c b/board/freescale/mx7dsabresd/mx7dsabresd.c index b6123b9..26babf7 100644 --- a/board/freescale/mx7dsabresd/mx7dsabresd.c +++ b/board/freescale/mx7dsabresd/mx7dsabresd.c @@ -1173,12 +1173,9 @@ iomux_v3_cfg_t const recovery_key_pads[] = { (MX7D_PAD_SD2_WP__GPIO5_IO10 | MUX_PAD_CTRL(BUTTON_PAD_CTRL)), }; -int check_recovery_cmd_file(void) +int is_recovery_key_pressing(void) { int button_pressed = 0; - int recovery_mode = 0; - - recovery_mode = recovery_check_and_clean_flag(); /* Check Recovery Combo Button press or not. */ imx_iomux_v3_setup_multiple_pads(recovery_key_pads, @@ -1191,7 +1188,7 @@ int check_recovery_cmd_file(void) printf("Recovery key pressed\n"); } - return recovery_mode || button_pressed; + return button_pressed; } void board_recovery_setup(void) diff --git a/board/technexion/picosom-imx6ul/picosom-imx6ul.c b/board/technexion/picosom-imx6ul/picosom-imx6ul.c index ddbbeec..f4a1b77 100644 --- a/board/technexion/picosom-imx6ul/picosom-imx6ul.c +++ b/board/technexion/picosom-imx6ul/picosom-imx6ul.c @@ -778,13 +778,10 @@ void board_fastboot_setup(void) } #ifdef CONFIG_ANDROID_RECOVERY -int check_recovery_cmd_file(void) +int is_recovery_key_pressing(void) { - int recovery_mode = 0; - - recovery_mode = recovery_check_and_clean_flag(); - - return recovery_mode; + /* No key defined for this board */ + return 0; } void board_recovery_setup(void) diff --git a/common/board_r.c b/common/board_r.c index b1ad605..e2dbf36 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -685,7 +685,7 @@ static int initr_fastboot_setup(void) static int initr_check_fastboot(void) { - check_fastboot(); + fastboot_run_bootmode(); return 0; } #endif diff --git a/drivers/usb/gadget/bcb.h b/drivers/usb/gadget/bcb.h index f0bd83b..705c572 100644 --- a/drivers/usb/gadget/bcb.h +++ b/drivers/usb/gadget/bcb.h @@ -9,6 +9,11 @@ #include <linux/types.h> #include <linux/stat.h> +#define FASTBOOT_BCB_CMD "bootonce-bootloader" +#ifdef CONFIG_ANDROID_RECOVERY +#define RECOVERY_BCB_CMD "boot-recovery" +#endif + /* keep same as bootable/recovery/bootloader.h */ struct bootloader_message { char command[32]; @@ -49,4 +54,8 @@ int rw_block(bool bread, char **ppblock, uint *pblksize, char *pblock_write, uint offset, uint size); void set_mmc_id(unsigned int id); + +int bcb_write_command(char *bcb_command); + +int bcb_read_command(char *command); #endif diff --git a/drivers/usb/gadget/command.c b/drivers/usb/gadget/command.c index 3af3fcf..686065a 100644 --- a/drivers/usb/gadget/command.c +++ b/drivers/usb/gadget/command.c @@ -9,8 +9,7 @@ #include "bcb.h" #ifndef CONFIG_FASTBOOT_STORAGE_NAND -static char command[32]; -static int read_command(char *command) +int bcb_read_command(char *command) { int ret = 0; char *p_block = NULL; @@ -31,7 +30,8 @@ static int read_command(char *command) return 0; } -static int write_command(char *bcb_command) + +int bcb_write_command(char *bcb_command) { int ret = 0; char *p_block = NULL; @@ -61,45 +61,4 @@ static int write_command(char *bcb_command) free(p_block); return 0; } - -int recovery_check_and_clean_command(void) -{ - int ret; - ret = read_command(command); - if (ret < 0) { - printf("read command failed\n"); - return 0; - } - if (!strcmp(command, "boot-recovery")) { - memset(command, 0, 32); - write_command(command); - return 1; - } - return 0; -} -int fastboot_check_and_clean_command(void) -{ - int ret; - ret = read_command(command); - if (ret < 0) { - printf("read command failed\n"); - return 0; - } - if (!strcmp(command, "boot-bootloader")) { - memset(command, 0, 32); - write_command(command); - return 1; - } - - return 0; -} -#else -int recovery_check_and_clean_command(void) -{ - return 0; -} -int fastboot_check_and_clean_command(void) -{ - return 0; -} #endif diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index 26af6b5..00b6c8e 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -1742,21 +1742,79 @@ void fastboot_setup(void) /*load partitions information for the fastboot dev*/ _fastboot_load_partitions(); - /*check if we need to setup recovery*/ + parameters_setup(); +} + +/* Write the bcb with fastboot bootloader commands */ +static void enable_fastboot_command(void) +{ + char fastboot_command[32]; + memcpy(fastboot_command, FASTBOOT_BCB_CMD, 32); + bcb_write_command(fastboot_command); +} + +/* Get the Boot mode from BCB cmd or Key pressed */ +static FbBootMode fastboot_get_bootmode(void) +{ + int ret = 0; + int boot_mode = BOOTMODE_NORMAL; + char command[32]; + #ifdef CONFIG_ANDROID_RECOVERY - check_recovery_mode(); + if(is_recovery_key_pressing()) { + boot_mode = BOOTMODE_RECOVERY_KEY_PRESSED; + return boot_mode; + } #endif - parameters_setup(); + ret = bcb_read_command(command); + if (ret < 0) { + printf("read command failed\n"); + return boot_mode; + } + if (!strcmp(command, FASTBOOT_BCB_CMD)) { + memset(command, 0, 32); + bcb_write_command(command); + boot_mode = BOOTMODE_FASTBOOT_BCB_CMD; + } +#ifdef CONFIG_ANDROID_RECOVERY + else if (!strcmp(command, RECOVERY_BCB_CMD)) { + memset(command, 0, 32); + bcb_write_command(command); + boot_mode = BOOTMODE_RECOVERY_BCB_CMD; + } +#endif + + return boot_mode; } /* export to lib_arm/board.c */ -void check_fastboot(void) +void fastboot_run_bootmode(void) { - if (fastboot_check_and_clean_flag()) + FbBootMode boot_mode = fastboot_get_bootmode(); + switch(boot_mode){ + case BOOTMODE_FASTBOOT_BCB_CMD: + /* Make the boot into fastboot mode*/ + puts("Fastboot: Got bootloader commands!\n"); run_command("fastboot", 0); + break; +#ifdef CONFIG_ANDROID_RECOVERY + case BOOTMODE_RECOVERY_BCB_CMD: + case BOOTMODE_RECOVERY_KEY_PRESSED: + /* Make the boot into recovery mode */ + puts("Fastboot: Got Recovery key pressing or recovery commands!\n"); + board_recovery_setup(); + break; +#endif + default: + /* skip special mode boot*/ + puts("Fastboot: Normal\n"); + break; + } } + + #ifdef CONFIG_CMD_BOOTA /* Section for Android bootimage format support * Refer: @@ -3093,7 +3151,7 @@ static void cb_reboot_bootloader(struct usb_ep *ep, struct usb_request *req) fastboot_tx_write_str("OKAY"); udelay(1000000); - fastboot_enable_flag(); + enable_fastboot_command(); do_reset(NULL, 0, 0, NULL); } #endif diff --git a/include/fsl_fastboot.h b/include/fsl_fastboot.h index 7dce98a..b702ff2 100644 --- a/include/fsl_fastboot.h +++ b/include/fsl_fastboot.h @@ -78,6 +78,19 @@ enum { DEV_NAND }; +typedef enum { +#ifdef CONFIG_ANDROID_RECOVERY + /* Revoery boot due to combo keys pressed */ + BOOTMODE_RECOVERY_KEY_PRESSED, + /* Recovery boot due to boot-recovery cmd in misc parition */ + BOOTMODE_RECOVERY_BCB_CMD, +#endif + /* Fastboot boot due to bootonce-bootloader cmd in misc parition */ + BOOTMODE_FASTBOOT_BCB_CMD, + /* Normal boot */ + BOOTMODE_NORMAL +}FbBootMode; + struct cmd_fastboot_interface { /* This function is called when a buffer has been recieved from the client app. @@ -183,20 +196,18 @@ struct fastboot_ptentry *fastboot_flash_get_ptn(unsigned n); unsigned int fastboot_flash_get_ptn_count(void); void fastboot_flash_dump_ptn(void); - -/* Check the board special boot mode reboot to fastboot mode. */ -int fastboot_check_and_clean_flag(void); -int fastboot_check_and_clean_command(void); - -/* Set the flag which reboot to fastboot mode*/ -void fastboot_enable_flag(void); - -/*check if fastboot mode is requested by user*/ -void check_fastboot(void); +/* Make board into special boot mode */ +void fastboot_run_bootmode(void); /*Setup board-relative fastboot environment */ void board_fastboot_setup(void); +/* Check whether the combo keys pressed + * Return 1 if combo keys pressed for recovery boot + * Return 0 if no combo keys pressed + */ +int is_recovery_key_pressing(void); + #ifdef CONFIG_FASTBOOT_STORAGE_NAND /*Save parameters for NAND storage partitions */ void save_parts_values(struct fastboot_ptentry *ptn, diff --git a/include/recovery.h b/include/recovery.h index bd3d010..d6fd7c0 100644 --- a/include/recovery.h +++ b/include/recovery.h @@ -12,10 +12,6 @@ struct reco_envs { char *args; }; -void check_recovery_mode(void); -int recovery_check_and_clean_flag(void); -int recovery_check_and_clean_command(void); -int check_recovery_cmd_file(void); void board_recovery_setup(void); #endif |