rockchip: recoganize boot devtype dynamicly

currently support: emmc and rknand.

Change-Id: I8b0e2623256ed3357de2acbee0d2455162228ab5
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
Joseph Chen 2018-02-24 15:18:27 +08:00 committed by Kever Yang
parent d5bbff804f
commit 3c3675ddd7
3 changed files with 18 additions and 13 deletions

View File

@ -20,6 +20,7 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
int setup_boot_mode(void); int setup_boot_mode(void);
void devtype_num_envset(void);
#endif #endif
#endif #endif

View File

@ -64,14 +64,20 @@ __weak int rockchip_dnl_key_pressed(void)
return false; 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 = const char *devtype_num_set =
"if mmc dev 0; then setenv devtype mmc; setenv devnum 0;" "if mmc dev 0; then setenv devtype mmc; setenv devnum 0;"
"else if rknand dev 0; then setenv devtype rknand; setenv devnum 0; fi;" "else if rknand dev 0; then setenv devtype rknand; setenv devnum 0; fi;"
"fi;"; "fi;";
run_command_list(devtype_num_set, -1, 0); run_command_list(devtype_num_set, -1, 0);
done = 1;
} }
void rockchip_dnl_mode_check(void) void rockchip_dnl_mode_check(void)

View File

@ -148,30 +148,28 @@ err:
int get_bootdev_type(void) int get_bootdev_type(void)
{ {
int type = 0; int type = 0;
char *boot_media = NULL; char *boot_media = NULL, *devtype = NULL;
char boot_options[128] = {0}; char boot_options[128] = {0};
static int appended; static int appended;
#ifdef CONFIG_EMMC_BOOT devtype_num_envset();
devtype = env_get("devtype");
if (!strcmp(devtype, "mmc")) {
type = IF_TYPE_MMC; type = IF_TYPE_MMC;
boot_media = "emmc"; boot_media = "emmc";
#endif /* CONFIG_EMMC_BOOT */ } else if (!strcmp(devtype, "rknand")) {
#ifdef CONFIG_QSPI_BOOT
type = IF_TYPE_SPI_NAND;
boot_media = "nand";
#endif /* CONFIG_QSPI_BOOT */
#ifdef CONFIG_NAND_BOOT
type = IF_TYPE_RKNAND; type = IF_TYPE_RKNAND;
boot_media = "nand"; boot_media = "nand";
#endif /* CONFIG_NAND_BOOT */ } else {
#ifdef CONFIG_NOR_BOOT /* Add new to support */
type = IF_TYPE_SPI_NOR; }
#endif /* CONFIG_NOR_BOOT */
/* For current use(Only EMMC support!) */ /* For current use(Only EMMC support!) */
if (!type) { if (!type) {
type = IF_TYPE_MMC; type = IF_TYPE_MMC;
boot_media = "emmc"; boot_media = "emmc";
printf("Use emmc as default boot media\n");
} }
if (!appended && boot_media) { if (!appended && boot_media) {