From 81c9431f562bbeb2b6b1efb0f99e023ed818dc5d Mon Sep 17 00:00:00 2001 From: zhang sanshan Date: Wed, 10 May 2017 10:14:27 +0800 Subject: MA-9375 [Android IMX] uboot: enable BCB and bootctrl * Add API to read\write MISC partition. * get the boot mode from BCB command when boot up. * get the boot up tactics from bootctrl. Change-Id: Icbba6340e10983dddc1b04804ecc012a3a3c57d0 Signed-off-by: zhang sanshan --- board/freescale/common/Makefile | 2 +- board/freescale/common/recovery.c | 78 ------------------- board/freescale/common/recovery_keypad.c | 60 +++++++++++++++ board/freescale/common/recovery_keypad.h | 13 ++++ board/freescale/mx6qsabreauto/mx6qsabreauto.c | 93 +---------------------- board/freescale/mx6sabresd/mx6sabresd.c | 89 +--------------------- board/freescale/mx6slevk/mx6slevk.c | 76 +----------------- board/freescale/mx6sxsabreauto/mx6sxsabreauto.c | 82 +------------------- board/freescale/mx6sxsabresd/mx6sxsabresd.c | 73 +----------------- board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c | 83 +------------------- board/freescale/mx7dsabresd/mx7dsabresd.c | 59 +------------- board/freescale/mx7ulp_evk/mx7ulp_evk.c | 8 +- 12 files changed, 100 insertions(+), 616 deletions(-) delete mode 100644 board/freescale/common/recovery.c create mode 100644 board/freescale/common/recovery_keypad.c create mode 100644 board/freescale/common/recovery_keypad.h (limited to 'board/freescale') diff --git a/board/freescale/common/Makefile b/board/freescale/common/Makefile index 66cdf0c..21830be 100644 --- a/board/freescale/common/Makefile +++ b/board/freescale/common/Makefile @@ -66,7 +66,7 @@ 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 +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.c deleted file mode 100644 index 396bc73..0000000 --- a/board/freescale/common/recovery.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2010-2016 Freescale Semiconductor, Inc. All Rights Reserved. - * - * SPDX-License-Identifier: GPL-2.0+ - */ -#include -#include -#include -#ifdef CONFIG_MXC_KPD -#include -#endif -#include - -#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"); - } -} diff --git a/board/freescale/common/recovery_keypad.c b/board/freescale/common/recovery_keypad.c new file mode 100644 index 0000000..f73f88b --- /dev/null +++ b/board/freescale/common/recovery_keypad.c @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2010-2016 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright 2017 NXP + * + * SPDX-License-Identifier: GPL-2.0+ + */ +#include +#include +#include +#ifdef CONFIG_MXC_KPD +#include +#endif +#include + +#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 is_recovery_keypad_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 is_recovery_keypad_pressing(void) +{ + return 0; +} +#endif diff --git a/board/freescale/common/recovery_keypad.h b/board/freescale/common/recovery_keypad.h new file mode 100644 index 0000000..d315cea --- /dev/null +++ b/board/freescale/common/recovery_keypad.h @@ -0,0 +1,13 @@ +/* + * Copyright (C) 2016 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright 2017 NXP + * + * 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 159d9f3..1ea4185 100644 --- a/board/freescale/mx6qsabreauto/mx6qsabreauto.c +++ b/board/freescale/mx6qsabreauto/mx6qsabreauto.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2012-2016 Freescale Semiconductor, Inc. + * Copyright 2017 NXP * * Author: Fabio Estevam * @@ -1136,51 +1137,6 @@ int checkboard(void) } #ifdef CONFIG_FSL_FASTBOOT -void board_fastboot_setup(void) -{ - switch (get_boot_device()) { -#if defined(CONFIG_FASTBOOT_STORAGE_SATA) - case SATA_BOOT: - if (!getenv("fastboot_dev")) - setenv("fastboot_dev", "sata"); - if (!getenv("bootcmd")) - setenv("bootcmd", "boota sata"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_SATA*/ -#if defined(CONFIG_FASTBOOT_STORAGE_MMC) - case SD1_BOOT: - case MMC1_BOOT: - if (!getenv("fastboot_dev")) - setenv("fastboot_dev", "mmc0"); - if (!getenv("bootcmd")) - setenv("bootcmd", "boota mmc0"); - break; - case SD3_BOOT: - case MMC3_BOOT: - if (!getenv("fastboot_dev")) - setenv("fastboot_dev", "mmc1"); - if (!getenv("bootcmd")) - setenv("bootcmd", "boota mmc1"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_MMC*/ -#if defined(CONFIG_FASTBOOT_STORAGE_NAND) - case NAND_BOOT: - if (!getenv("fastboot_dev")) - setenv("fastboot_dev", "nand"); - if (!getenv("fbparts")) - setenv("fbparts", ANDROID_FASTBOOT_NAND_PARTS); - if (!getenv("bootcmd")) - setenv("bootcmd", - "nand read ${loadaddr} ${boot_nand_offset} " - "${boot_nand_size};boota ${loadaddr}"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_NAND*/ - default: - printf("unsupported boot devices\n"); - break; - } -} - #ifdef CONFIG_ANDROID_RECOVERY #define GPIO_VOL_DN_KEY IMX_GPIO_NR(5, 14) @@ -1188,12 +1144,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, @@ -1207,49 +1160,9 @@ int check_recovery_cmd_file(void) printf("Recovery key pressed\n"); } - return recovery_mode || button_pressed; + return button_pressed; } -void board_recovery_setup(void) -{ - int bootdev = get_boot_device(); - - switch (bootdev) { -#if defined(CONFIG_FASTBOOT_STORAGE_SATA) - case SATA_BOOT: - if (!getenv("bootcmd_android_recovery")) - setenv("bootcmd_android_recovery", "boota sata recovery"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_SATA*/ -#if defined(CONFIG_FASTBOOT_STORAGE_MMC) - case SD1_BOOT: - case MMC1_BOOT: - if (!getenv("bootcmd_android_recovery")) - setenv("bootcmd_android_recovery", "boota mmc0 recovery"); - break; - case SD3_BOOT: - case MMC3_BOOT: - if (!getenv("bootcmd_android_recovery")) - setenv("bootcmd_android_recovery", "boota mmc1 recovery"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_MMC*/ -#if defined(CONFIG_FASTBOOT_STORAGE_NAND) - case NAND_BOOT: - if (!getenv("bootcmd_android_recovery")) - setenv("bootcmd_android_recovery", - "nand read ${loadaddr} ${recovery_nand_offset} " - "${recovery_nand_size};boota ${loadaddr}"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_NAND*/ - default: - printf("Unsupported bootup device for recovery: dev: %d\n", - bootdev); - return; - } - - printf("setup env for recovery..\n"); - setenv("bootcmd", "run bootcmd_android_recovery"); -} #endif /*CONFIG_ANDROID_RECOVERY*/ #endif /*CONFIG_FSL_FASTBOOT*/ diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c index b655347..2a09e2f 100644 --- a/board/freescale/mx6sabresd/mx6sabresd.c +++ b/board/freescale/mx6sabresd/mx6sabresd.c @@ -1353,47 +1353,6 @@ int checkboard(void) } #ifdef CONFIG_FSL_FASTBOOT - -void board_fastboot_setup(void) -{ - switch (get_boot_device()) { -#if defined(CONFIG_FASTBOOT_STORAGE_SATA) - case SATA_BOOT: - if (!getenv("fastboot_dev")) - setenv("fastboot_dev", "sata"); - if (!getenv("bootcmd")) - setenv("bootcmd", "boota sata"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_SATA*/ -#if defined(CONFIG_FASTBOOT_STORAGE_MMC) - case SD2_BOOT: - case MMC2_BOOT: - if (!getenv("fastboot_dev")) - setenv("fastboot_dev", "mmc0"); - if (!getenv("bootcmd")) - setenv("bootcmd", "boota mmc0"); - break; - case SD3_BOOT: - case MMC3_BOOT: - if (!getenv("fastboot_dev")) - setenv("fastboot_dev", "mmc1"); - if (!getenv("bootcmd")) - setenv("bootcmd", "boota mmc1"); - break; - case MMC4_BOOT: - if (!getenv("fastboot_dev")) - setenv("fastboot_dev", "mmc2"); - if (!getenv("bootcmd")) - setenv("bootcmd", "boota mmc2"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_MMC*/ - default: - printf("unsupported boot devices\n"); - break; - } - -} - #ifdef CONFIG_ANDROID_RECOVERY #define GPIO_VOL_DN_KEY IMX_GPIO_NR(1, 5) @@ -1401,12 +1360,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, @@ -1420,48 +1376,7 @@ int check_recovery_cmd_file(void) printf("Recovery key pressed\n"); } - return recovery_mode || button_pressed; -} - -void board_recovery_setup(void) -{ - int bootdev = get_boot_device(); - - switch (bootdev) { -#if defined(CONFIG_FASTBOOT_STORAGE_SATA) - case SATA_BOOT: - if (!getenv("bootcmd_android_recovery")) - setenv("bootcmd_android_recovery", - "boota sata recovery"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_SATA*/ -#if defined(CONFIG_FASTBOOT_STORAGE_MMC) - case SD2_BOOT: - case MMC2_BOOT: - if (!getenv("bootcmd_android_recovery")) - setenv("bootcmd_android_recovery", - "boota mmc0 recovery"); - break; - case SD3_BOOT: - case MMC3_BOOT: - if (!getenv("bootcmd_android_recovery")) - setenv("bootcmd_android_recovery", - "boota mmc1 recovery"); - break; - case MMC4_BOOT: - if (!getenv("bootcmd_android_recovery")) - setenv("bootcmd_android_recovery", - "boota mmc2 recovery"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_MMC*/ - default: - printf("Unsupported bootup device for recovery: dev: %d\n", - bootdev); - return; - } - - printf("setup env for recovery..\n"); - setenv("bootcmd", "run bootcmd_android_recovery"); + return button_pressed; } #endif /*CONFIG_ANDROID_RECOVERY*/ diff --git a/board/freescale/mx6slevk/mx6slevk.c b/board/freescale/mx6slevk/mx6slevk.c index 33e7ef6..7a11f13 100644 --- a/board/freescale/mx6slevk/mx6slevk.c +++ b/board/freescale/mx6slevk/mx6slevk.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 - 2016 Freescale Semiconductor, Inc. + * Copyright 2017 NXP * * Author: Fabio Estevam * @@ -37,6 +38,7 @@ #ifdef CONFIG_FSL_FASTBOOT #include #ifdef CONFIG_ANDROID_RECOVERY +#include "../common/recovery_keypad.h" #include #endif #endif /*CONFIG_FSL_FASTBOOT*/ @@ -915,83 +917,13 @@ int setup_mxc_kpd(void) #endif /*CONFIG_MXC_KPD*/ #ifdef CONFIG_FSL_FASTBOOT -void board_fastboot_setup(void) -{ - switch (get_boot_device()) { -#if defined(CONFIG_FASTBOOT_STORAGE_MMC) - case SD1_BOOT: - case MMC1_BOOT: - if (!getenv("fastboot_dev")) - setenv("fastboot_dev", "mmc0"); - if (!getenv("bootcmd")) - setenv("bootcmd", "boota mmc0"); - break; - case SD2_BOOT: - case MMC2_BOOT: - if (!getenv("fastboot_dev")) - setenv("fastboot_dev", "mmc1"); - if (!getenv("bootcmd")) - setenv("bootcmd", "boota mmc1"); - break; - case SD3_BOOT: - case MMC3_BOOT: - if (!getenv("fastboot_dev")) - setenv("fastboot_dev", "mmc2"); - if (!getenv("bootcmd")) - setenv("bootcmd", "boota mmc2"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_MMC*/ - default: - printf("unsupported boot devices\n"); - break; - } - -} - #ifdef CONFIG_ANDROID_RECOVERY -int check_recovery_cmd_file(void) +int is_recovery_key_pressing(void) { - return recovery_check_and_clean_flag(); -} - -void board_recovery_setup(void) -{ - int bootdev = get_boot_device(); - - /*current uboot BSP only supports USDHC2*/ - switch (bootdev) { -#if defined(CONFIG_FASTBOOT_STORAGE_MMC) - case SD1_BOOT: - case MMC1_BOOT: - if (!getenv("bootcmd_android_recovery")) - setenv("bootcmd_android_recovery", - "boota mmc0 recovery"); - break; - case SD2_BOOT: - case MMC2_BOOT: - if (!getenv("bootcmd_android_recovery")) - setenv("bootcmd_android_recovery", - "boota mmc1 recovery"); - break; - case SD3_BOOT: - case MMC3_BOOT: - if (!getenv("bootcmd_android_recovery")) - setenv("bootcmd_android_recovery", - "boota mmc2 recovery"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_MMC*/ - default: - printf("Unsupported bootup device for recovery: dev: %d\n", - bootdev); - return; - } - - printf("setup env for recovery..\n"); - setenv("bootcmd", "run bootcmd_android_recovery"); + return is_recovery_keypad_pressing(); } #endif /*CONFIG_ANDROID_RECOVERY*/ - #endif /*CONFIG_FSL_FASTBOOT*/ diff --git a/board/freescale/mx6sxsabreauto/mx6sxsabreauto.c b/board/freescale/mx6sxsabreauto/mx6sxsabreauto.c index 648dbf0..71c51eb 100644 --- a/board/freescale/mx6sxsabreauto/mx6sxsabreauto.c +++ b/board/freescale/mx6sxsabreauto/mx6sxsabreauto.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2014-2016 Freescale Semiconductor, Inc. + * Copyright 2017 nxp * * Author: Ye Li * @@ -32,6 +33,7 @@ #include #ifdef CONFIG_ANDROID_RECOVERY #include +#include "../common/recovery_keypad.h" #endif #endif /*CONFIG_FSL_FASTBOOT*/ @@ -557,88 +559,12 @@ int checkboard(void) } #ifdef CONFIG_FSL_FASTBOOT -void board_fastboot_setup(void) -{ - switch (get_boot_device()) { -#if defined(CONFIG_FASTBOOT_STORAGE_MMC) - case SD3_BOOT: - case MMC3_BOOT: - if (!getenv("fastboot_dev")) - setenv("fastboot_dev", "mmc0"); - if (!getenv("bootcmd")) - setenv("bootcmd", "boota mmc0"); - break; - case SD4_BOOT: - case MMC4_BOOT: - if (!getenv("fastboot_dev")) - setenv("fastboot_dev", "mmc1"); - if (!getenv("bootcmd")) - setenv("bootcmd", "boota mmc1"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_MMC*/ -#if defined(CONFIG_FASTBOOT_STORAGE_NAND) - case NAND_BOOT: - if (!getenv("fastboot_dev")) - setenv("fastboot_dev", "nand"); - if (!getenv("fbparts")) - setenv("fbparts", ANDROID_FASTBOOT_NAND_PARTS); - if (!getenv("bootcmd")) - setenv("bootcmd", - "nand read ${loadaddr} ${boot_nand_offset} " - "${boot_nand_size};boota ${loadaddr}"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_NAND*/ - - default: - printf("unsupported boot devices\n"); - break; - } -} - #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) -{ - int bootdev = get_boot_device(); - - switch (bootdev) { -#if defined(CONFIG_FASTBOOT_STORAGE_MMC) - case SD3_BOOT: - case MMC3_BOOT: - if (!getenv("bootcmd_android_recovery")) - setenv("bootcmd_android_recovery", "boota mmc0 recovery"); - break; - case SD4_BOOT: - case MMC4_BOOT: - if (!getenv("bootcmd_android_recovery")) - setenv("bootcmd_android_recovery", "boota mmc1 recovery"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_MMC*/ -#if defined(CONFIG_FASTBOOT_STORAGE_NAND) - case NAND_BOOT: - if (!getenv("bootcmd_android_recovery")) - setenv("bootcmd_android_recovery", - "nand read ${loadaddr} ${recovery_nand_offset} " - "${recovery_nand_size};boota ${loadaddr}"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_NAND*/ - default: - printf("Unsupported bootup device for recovery: dev: %d\n", - bootdev); - return; - } - - printf("setup env for recovery..\n"); - setenv("bootcmd", "run bootcmd_android_recovery"); -} #endif /*CONFIG_ANDROID_RECOVERY*/ #endif /*CONFIG_FSL_FASTBOOT*/ diff --git a/board/freescale/mx6sxsabresd/mx6sxsabresd.c b/board/freescale/mx6sxsabresd/mx6sxsabresd.c index f99048a..608bd1d 100644 --- a/board/freescale/mx6sxsabresd/mx6sxsabresd.c +++ b/board/freescale/mx6sxsabresd/mx6sxsabresd.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2014-2016 Freescale Semiconductor, Inc. + * Copyright 2017 NXP * * Author: Fabio Estevam * @@ -977,38 +978,6 @@ int checkboard(void) } #ifdef CONFIG_FSL_FASTBOOT -void board_fastboot_setup(void) -{ - switch (get_boot_device()) { -#if defined(CONFIG_FASTBOOT_STORAGE_MMC) - case SD2_BOOT: - case MMC2_BOOT: - if (!getenv("fastboot_dev")) - setenv("fastboot_dev", "mmc0"); - if (!getenv("bootcmd")) - setenv("bootcmd", "boota mmc0"); - break; - case SD3_BOOT: - case MMC3_BOOT: - if (!getenv("fastboot_dev")) - setenv("fastboot_dev", "mmc1"); - if (!getenv("bootcmd")) - setenv("bootcmd", "boota mmc1"); - break; - case SD4_BOOT: - case MMC4_BOOT: - if (!getenv("fastboot_dev")) - setenv("fastboot_dev", "mmc2"); - if (!getenv("bootcmd")) - setenv("bootcmd", "boota mmc2"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_MMC*/ - default: - printf("unsupported boot devices\n"); - break; - } -} - #ifdef CONFIG_ANDROID_RECOVERY #define GPIO_VOL_DN_KEY IMX_GPIO_NR(1, 19) @@ -1016,12 +985,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, @@ -1035,42 +1001,9 @@ int check_recovery_cmd_file(void) printf("Recovery key pressed\n"); } - return recovery_mode || button_pressed; -} - -void board_recovery_setup(void) -{ - int bootdev = get_boot_device(); - - switch (bootdev) { -#if defined(CONFIG_FASTBOOT_STORAGE_MMC) - case SD2_BOOT: - case MMC2_BOOT: - if (!getenv("bootcmd_android_recovery")) - setenv("bootcmd_android_recovery", "boota mmc0 recovery"); - break; - case SD3_BOOT: - case MMC3_BOOT: - if (!getenv("bootcmd_android_recovery")) - setenv("bootcmd_android_recovery", "boota mmc1 recovery"); - break; - case SD4_BOOT: - case MMC4_BOOT: - if (!getenv("bootcmd_android_recovery")) - setenv("bootcmd_android_recovery", "boota mmc2 recovery"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_MMC*/ - default: - printf("Unsupported bootup device for recovery: dev: %d\n", - bootdev); - return; - } - - printf("setup env for recovery..\n"); - setenv("bootcmd", "run bootcmd_android_recovery"); + return button_pressed; } #endif /*CONFIG_ANDROID_RECOVERY*/ - #endif /*CONFIG_FSL_FASTBOOT*/ #ifdef CONFIG_SPL_BUILD diff --git a/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c b/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c index 8b707b6..325b6df 100644 --- a/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c +++ b/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2015-2016 Freescale Semiconductor, Inc. + * Copyright 2017 NXP * * SPDX-License-Identifier: GPL-2.0+ */ @@ -928,89 +929,13 @@ int checkboard(void) } #ifdef CONFIG_FSL_FASTBOOT -void board_fastboot_setup(void) -{ - switch (get_boot_device()) { -#if defined(CONFIG_FASTBOOT_STORAGE_MMC) - case SD1_BOOT: - case MMC1_BOOT: - if (!getenv("fastboot_dev")) - setenv("fastboot_dev", "mmc0"); - if (!getenv("bootcmd")) - setenv("bootcmd", "boota mmc0"); - break; - case SD2_BOOT: - case MMC2_BOOT: - if (!getenv("fastboot_dev")) - setenv("fastboot_dev", "mmc1"); - if (!getenv("bootcmd")) - setenv("bootcmd", "boota mmc1"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_MMC*/ -#if defined(CONFIG_FASTBOOT_STORAGE_NAND) - case NAND_BOOT: - if (!getenv("fastboot_dev")) - setenv("fastboot_dev", "nand"); - if (!getenv("fbparts")) - setenv("fbparts", ANDROID_FASTBOOT_NAND_PARTS); - if (!getenv("bootcmd")) - setenv("bootcmd", - "nand read ${loadaddr} ${boot_nand_offset} " - "${boot_nand_size};boota ${loadaddr}"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_NAND*/ - - default: - printf("unsupported boot devices\n"); - break; - } -} - #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) -{ - int bootdev = get_boot_device(); - - switch (bootdev) { -#if defined(CONFIG_FASTBOOT_STORAGE_MMC) - case SD1_BOOT: - case MMC1_BOOT: - if (!getenv("bootcmd_android_recovery")) - setenv("bootcmd_android_recovery", "boota mmc0 recovery"); - break; - case SD2_BOOT: - case MMC2_BOOT: - if (!getenv("bootcmd_android_recovery")) - setenv("bootcmd_android_recovery", "boota mmc1 recovery"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_MMC*/ -#if defined(CONFIG_FASTBOOT_STORAGE_NAND) - case NAND_BOOT: - if (!getenv("bootcmd_android_recovery")) - setenv("bootcmd_android_recovery", - "nand read ${loadaddr} ${recovery_nand_offset} " - "${recovery_nand_size};boota ${loadaddr}"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_NAND*/ - - default: - printf("Unsupported bootup device for recovery: dev: %d\n", - bootdev); - return; - } - - printf("setup env for recovery..\n"); - setenv("bootcmd", "run bootcmd_android_recovery"); -} #endif /*CONFIG_ANDROID_RECOVERY*/ #endif /*CONFIG_FSL_FASTBOOT*/ diff --git a/board/freescale/mx7dsabresd/mx7dsabresd.c b/board/freescale/mx7dsabresd/mx7dsabresd.c index 216f5b3..b97de36 100644 --- a/board/freescale/mx7dsabresd/mx7dsabresd.c +++ b/board/freescale/mx7dsabresd/mx7dsabresd.c @@ -689,31 +689,6 @@ int checkboard(void) } #ifdef CONFIG_FSL_FASTBOOT -void board_fastboot_setup(void) -{ - switch (get_boot_device()) { -#if defined(CONFIG_FASTBOOT_STORAGE_MMC) - case SD1_BOOT: - case MMC1_BOOT: - if (!getenv("fastboot_dev")) - setenv("fastboot_dev", "mmc0"); - if (!getenv("bootcmd")) - setenv("bootcmd", "boota mmc0"); - break; - case SD3_BOOT: - case MMC3_BOOT: - if (!getenv("fastboot_dev")) - setenv("fastboot_dev", "mmc1"); - if (!getenv("bootcmd")) - setenv("bootcmd", "boota mmc1"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_MMC*/ - default: - printf("unsupported boot devices\n"); - break; - } -} - #ifdef CONFIG_ANDROID_RECOVERY /* Use S3 button for recovery key */ @@ -722,12 +697,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, @@ -741,35 +713,8 @@ int check_recovery_cmd_file(void) printf("Recovery key pressed\n"); } - return recovery_mode || button_pressed; + return button_pressed; } -void board_recovery_setup(void) -{ - int bootdev = get_boot_device(); - - switch (bootdev) { -#if defined(CONFIG_FASTBOOT_STORAGE_MMC) - case SD1_BOOT: - case MMC1_BOOT: - if (!getenv("bootcmd_android_recovery")) - setenv("bootcmd_android_recovery", "boota mmc0 recovery"); - break; - case SD3_BOOT: - case MMC3_BOOT: - if (!getenv("bootcmd_android_recovery")) - setenv("bootcmd_android_recovery", "boota mmc1 recovery"); - break; -#endif /*CONFIG_FASTBOOT_STORAGE_MMC*/ - default: - printf("Unsupported bootup device for recovery: dev: %d\n", - bootdev); - return; - } - - printf("setup env for recovery..\n"); - setenv("bootcmd", "run bootcmd_android_recovery"); -} #endif /*CONFIG_ANDROID_RECOVERY*/ - #endif /*CONFIG_FSL_FASTBOOT*/ diff --git a/board/freescale/mx7ulp_evk/mx7ulp_evk.c b/board/freescale/mx7ulp_evk/mx7ulp_evk.c index a7ceb91..a35f724 100644 --- a/board/freescale/mx7ulp_evk/mx7ulp_evk.c +++ b/board/freescale/mx7ulp_evk/mx7ulp_evk.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2016 Freescale Semiconductor, Inc. + * Copyright 2017 NXP * * SPDX-License-Identifier: GPL-2.0+ */ @@ -233,11 +234,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; + /* TODO: uboot can get the key event from M4 core*/ + return 0; } void board_recovery_setup(void) -- cgit v1.1