diff options
author | Zhang Jiejing <jiejing.zhang@freescale.com> | 2011-04-22 17:37:48 +0800 |
---|---|---|
committer | Zhang Jiejing <jiejing.zhang@freescale.com> | 2011-04-22 17:49:24 +0800 |
commit | c72f6c9bb9b62facd99dabd333415c65812136cd (patch) | |
tree | 2a90cc8146a735ee426d4ce3b13313a3e4e5df41 | |
parent | 2b7f1cffc6aff0e438c1d5d0eb438bc72b576fc3 (diff) | |
download | u-boot-imx-c72f6c9bb9b62facd99dabd333415c65812136cd.zip u-boot-imx-c72f6c9bb9b62facd99dabd333415c65812136cd.tar.gz u-boot-imx-c72f6c9bb9b62facd99dabd333415c65812136cd.tar.bz2 |
ENGR00142497 Android: MX53_SMD: check eMMC and SD recovery file.
Check eMMC and SD cards recovery file, if it exist, enter recovery mode.
original code only check SD card, since we already change main storage
to eMMC, so we check it both, since most of customer still test it under
SD card, check them to avoid support effert.
Signed-off-by: Zhang Jiejing <jiejing.zhang@freescale.com>
-rw-r--r-- | board/freescale/mx53_smd/mx53_smd.c | 80 |
1 files changed, 42 insertions, 38 deletions
diff --git a/board/freescale/mx53_smd/mx53_smd.c b/board/freescale/mx53_smd/mx53_smd.c index 70a0b94..fb42bbd 100644 --- a/board/freescale/mx53_smd/mx53_smd.c +++ b/board/freescale/mx53_smd/mx53_smd.c @@ -866,8 +866,9 @@ int check_recovery_cmd_file(void) { disk_partition_t info; ulong part_length; - int filelen; + int filelen = 0; char *env; + int i; /* For test only */ /* When detecting android_recovery_switch, @@ -883,46 +884,49 @@ int check_recovery_cmd_file(void) case MMC_BOOT: case SD_BOOT: { - block_dev_desc_t *dev_desc = NULL; - struct mmc *mmc = find_mmc_device(0); - - dev_desc = get_dev("mmc", 0); - - if (NULL == dev_desc) { - puts("** Block device MMC 0 not supported\n"); - return 0; - } - - mmc_init(mmc); - - if (get_partition_info(dev_desc, - CONFIG_ANDROID_CACHE_PARTITION_MMC, - &info)) { - printf("** Bad partition %d **\n", - CONFIG_ANDROID_CACHE_PARTITION_MMC); - return 0; - } - - part_length = ext2fs_set_blk_dev(dev_desc, - CONFIG_ANDROID_CACHE_PARTITION_MMC); - if (part_length == 0) { - printf("** Bad partition - mmc 0:%d **\n", - CONFIG_ANDROID_CACHE_PARTITION_MMC); - ext2fs_close(); - return 0; - } + for (i = 0; i < 2; i++) { + block_dev_desc_t *dev_desc = NULL; + struct mmc *mmc = find_mmc_device(i); + + dev_desc = get_dev("mmc", i); + + if (NULL == dev_desc) { + printf("** Block device MMC %d not supported\n", i); + continue; + } + + mmc_init(mmc); + + if (get_partition_info(dev_desc, + CONFIG_ANDROID_CACHE_PARTITION_MMC, + &info)) { + printf("** Bad partition %d **\n", + CONFIG_ANDROID_CACHE_PARTITION_MMC); + continue; + } + + part_length = ext2fs_set_blk_dev(dev_desc, + CONFIG_ANDROID_CACHE_PARTITION_MMC); + if (part_length == 0) { + printf("** Bad partition - mmc %d:%d **\n", i, + CONFIG_ANDROID_CACHE_PARTITION_MMC); + ext2fs_close(); + continue; + } + + if (!ext2fs_mount(part_length)) { + printf("** Bad ext2 partition or " + "disk - mmc i:%d **\n", + i, CONFIG_ANDROID_CACHE_PARTITION_MMC); + ext2fs_close(); + continue; + } + + filelen = ext2fs_open(CONFIG_ANDROID_RECOVERY_CMD_FILE); - if (!ext2fs_mount(part_length)) { - printf("** Bad ext2 partition or " - "disk - mmc 0:%d **\n", - CONFIG_ANDROID_CACHE_PARTITION_MMC); ext2fs_close(); - return 0; + break; } - - filelen = ext2fs_open(CONFIG_ANDROID_RECOVERY_CMD_FILE); - - ext2fs_close(); } break; case NAND_BOOT: |