From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peng Fan Date: Thu, 11 Jul 2019 06:14:29 +0000 Subject: [U-Boot] [PATCH v1 11/11] mmc: retry a few times if a partition switch failed In-Reply-To: <20190627103140.16505-12-jjhiblot@ti.com> References: <20190627103140.16505-1-jjhiblot@ti.com> <20190627103140.16505-12-jjhiblot@ti.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de > Subject: [PATCH v1 11/11] mmc: retry a few times if a partition switch failed > > This operation may fail. Retry it a few times before giving up and report a > failure. > > Signed-off-by: Jean-Jacques Hiblot > > --- > > drivers/mmc/mmc.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index > 709733747a..cec39a9acf 100644 > --- a/drivers/mmc/mmc.c > +++ b/drivers/mmc/mmc.c > @@ -958,10 +958,14 @@ static int mmc_set_capacity(struct mmc *mmc, int > part_num) int mmc_switch_part(struct mmc *mmc, unsigned int part_num) > { > int ret; > + int retry = 3; > > - 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 > -- Patchset applied to mmc/master. Please raise, if any objections. Thanks, Peng. > 2.17.1