This operation may fail. Retry it a few times before giving up and report
a failure.
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
int mmc_switch_part(struct mmc *mmc, unsigned int part_num)
{
int ret;
int mmc_switch_part(struct mmc *mmc, unsigned int part_num)
{
int ret;
- ret = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_PART_CONF,
- (mmc->part_config & ~PART_ACCESS_MASK)
- | (part_num & PART_ACCESS_MASK));
+ do {
+ ret = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL,
+ EXT_CSD_PART_CONF,
+ (mmc->part_config & ~PART_ACCESS_MASK)
+ | (part_num & PART_ACCESS_MASK));
+ } while (ret && retry--);
/*
* Set the capacity if the switch succeeded or was intended
/*
* Set the capacity if the switch succeeded or was intended