rockchip: boot_mode: recognise devtype and devnum dynamicly for rockusb

devtype can be "emmc" or "rknand", devnum is usually 0.

Change-Id: Ie90169ab2c164e9d91f3365c3d9c99278bf9c8c4
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
Joseph Chen 2017-12-28 09:52:00 +08:00 committed by Kever Yang
parent 221b522060
commit b1fd4f58f3
1 changed files with 6 additions and 1 deletions

View File

@ -57,10 +57,15 @@ __weak int rockchip_dnl_key_pressed(void)
void rockchip_dnl_mode_check(void)
{
const char *rockusb_cmd =
"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; rockusb 0 ${devtype} ${devnum};";
if (rockchip_dnl_key_pressed()) {
printf("download key pressed, entering download mode...\n");
/* If failed, we fall back to bootrom download mode */
cli_simple_run_command("rockusb 0 mmc 0", 0);
run_command_list(rockusb_cmd, -1, 0);
set_back_to_bootrom_dnl_flag();
do_reset(NULL, 0, 0, NULL);
}