From 869b42fc52e62ec1784a4141e11a4cc8a5949d12 Mon Sep 17 00:00:00 2001 From: Jaehoon Chung Date: Mon, 1 Oct 2018 13:00:43 +0900 Subject: [PATCH] board: samsung: exynos5-dt: modify the get_dfu_alt_system information If there is a partition7, set to dfu_alt_system_2. Otherwise, just use the dfu_alt_system. (It's relevant to thor download.) - change from getenv() to env_get(). Change-Id: I1ff7b5a6c97ad7eed2b6cd489260cfdc902c2a73 Signed-off-by: Jaehoon Chung --- board/samsung/common/exynos5-dt.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/board/samsung/common/exynos5-dt.c b/board/samsung/common/exynos5-dt.c index 2727211..213640b 100644 --- a/board/samsung/common/exynos5-dt.c +++ b/board/samsung/common/exynos5-dt.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -163,11 +164,44 @@ int board_usb_init(int index, enum usb_init_type init) char *get_dfu_alt_system(char *interface, char *devstr) { char *info = "Not supported!"; + struct mmc *mmc; + char *alt_system; + int dev_num; + int ret; + struct disk_partition partinfo; if (board_is_odroidxu4() || board_is_odroidhc1() || board_is_odroidhc2()) return info; - return env_get("dfu_alt_system"); + dev_num = simple_strtoul(devstr, NULL, 10); + + mmc = find_mmc_device(dev_num); + if (!mmc) + return NULL; + + if (mmc_init(mmc)) + return NULL; + + ret = blk_select_hwpart_devnum(IF_TYPE_MMC, 0, 0); + if (ret) + return NULL; + + if (env_get("ramdiskpart")) { + int part_num = (int)simple_strtoul(env_get("ramdiskpart"), NULL, 10); +#ifndef CONFIG_BLK + ret = part_get_info(&mmc->block_dev, part_num, &partinfo); +#else + ret = part_get_info(mmc_get_blk_desc(mmc), part_num, &partinfo); +#endif + if (ret) + alt_system = CONFIG_DFU_ALT_SYSTEM; + else + alt_system = CONFIG_DFU_ALT_SYSTEM_2; + } else { + alt_system = CONFIG_DFU_ALT_SYSTEM; + } + + return alt_system; } char *get_dfu_alt_boot(char *interface, char *devstr) -- 2.7.4