diff --git a/arch/arm/include/asm/arch-rockchip/boot_mode.h b/arch/arm/include/asm/arch-rockchip/boot_mode.h index 6b2a610cf4..e38627e4c1 100644 --- a/arch/arm/include/asm/arch-rockchip/boot_mode.h +++ b/arch/arm/include/asm/arch-rockchip/boot_mode.h @@ -20,6 +20,7 @@ #ifndef __ASSEMBLY__ int setup_boot_mode(void); +void devtype_num_envset(void); #endif #endif diff --git a/arch/arm/mach-rockchip/boot_mode.c b/arch/arm/mach-rockchip/boot_mode.c index b50b17329c..f88a14b3d0 100644 --- a/arch/arm/mach-rockchip/boot_mode.c +++ b/arch/arm/mach-rockchip/boot_mode.c @@ -64,14 +64,20 @@ __weak int rockchip_dnl_key_pressed(void) return false; } -static void devtype_num_envset(void) +void devtype_num_envset(void) { + static int done = 0; + + if (done) + return; + const char *devtype_num_set = "if mmc dev 0; then setenv devtype mmc; setenv devnum 0;" "else if rknand dev 0; then setenv devtype rknand; setenv devnum 0; fi;" "fi;"; run_command_list(devtype_num_set, -1, 0); + done = 1; } void rockchip_dnl_mode_check(void) diff --git a/common/boot_rkimg.c b/common/boot_rkimg.c index 582255d436..8e07264999 100644 --- a/common/boot_rkimg.c +++ b/common/boot_rkimg.c @@ -148,30 +148,28 @@ err: int get_bootdev_type(void) { int type = 0; - char *boot_media = NULL; + char *boot_media = NULL, *devtype = NULL; char boot_options[128] = {0}; static int appended; - #ifdef CONFIG_EMMC_BOOT + devtype_num_envset(); + devtype = env_get("devtype"); + + if (!strcmp(devtype, "mmc")) { type = IF_TYPE_MMC; boot_media = "emmc"; - #endif /* CONFIG_EMMC_BOOT */ - #ifdef CONFIG_QSPI_BOOT - type = IF_TYPE_SPI_NAND; - boot_media = "nand"; - #endif /* CONFIG_QSPI_BOOT */ - #ifdef CONFIG_NAND_BOOT + } else if (!strcmp(devtype, "rknand")) { type = IF_TYPE_RKNAND; boot_media = "nand"; - #endif /* CONFIG_NAND_BOOT */ - #ifdef CONFIG_NOR_BOOT - type = IF_TYPE_SPI_NOR; - #endif /* CONFIG_NOR_BOOT */ + } else { + /* Add new to support */ + } /* For current use(Only EMMC support!) */ if (!type) { type = IF_TYPE_MMC; boot_media = "emmc"; + printf("Use emmc as default boot media\n"); } if (!appended && boot_media) {