mmc: use active boot slot for mmc_exit instead of fixed sdc2
This commit is contained in:
parent
409869f074
commit
31e59fb0f1
@ -4115,25 +4115,39 @@ int mmc_initialize(bd_t *bis)
|
||||
int mmc_exit(void)
|
||||
{
|
||||
int err;
|
||||
int sdc_no = 2;
|
||||
struct mmc *mmc = find_mmc_device(sdc_no);
|
||||
bool uhs_en = supports_uhs(mmc->cfg->host_caps);
|
||||
int sdc_no = board_mmc_get_num();
|
||||
int dev_num = sunxi_mmcno_to_devnum(sdc_no);
|
||||
struct mmc *mmc = NULL;
|
||||
bool uhs_en;
|
||||
|
||||
if (dev_num >= 0)
|
||||
mmc = find_mmc_device(dev_num);
|
||||
|
||||
if (mmc == NULL) {
|
||||
MMCINFO("mmc %d not find, so not exit\n", sdc_no);
|
||||
/* Legacy fallback for platforms that still expect eMMC on sdc2/sdc3 */
|
||||
int fallback_sdc_no[] = { 2, 3 };
|
||||
int i;
|
||||
|
||||
#ifdef CONFIG_MMC3_SUPPORT
|
||||
sdc_no = 3;
|
||||
mmc = find_mmc_device(sdc_no);
|
||||
if (mmc == NULL) {
|
||||
MMCINFO("mmc %d not find, so not exit\n", sdc_no);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
MMCINFO("mmc %d not find, try legacy fallback\n", sdc_no);
|
||||
for (i = 0; i < ARRAY_SIZE(fallback_sdc_no); i++) {
|
||||
sdc_no = fallback_sdc_no[i];
|
||||
dev_num = sunxi_mmcno_to_devnum(sdc_no);
|
||||
if (dev_num < 0)
|
||||
continue;
|
||||
|
||||
mmc = find_mmc_device(dev_num);
|
||||
if (mmc != NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
if (mmc == NULL) {
|
||||
MMCINFO("mmc device not ready, so not exit\n");
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
uhs_en = supports_uhs(mmc->cfg->host_caps);
|
||||
|
||||
MMCINFO("mmc exit start\n");
|
||||
|
||||
#if 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user