Message ID | 7cc8b7905b6b69d6a9e5db49059fc39d44a1caf0.1478272627.git-series.maxime.ripard@free-electrons.com |
---|---|
State | Accepted |
Commit | a9003dc641cf881992897585392567811652de09 |
Delegated to: | Jaehoon Chung |
Headers | show |
Hi, On 04-11-16 16:18, Maxime Ripard wrote: > Some eMMC will fail at the first switch, but would succeed in a subsequent > one. > > Make sure we try several times to cover those cases. The number of retries > (and the behaviour) is currently what is being used in Linux. > > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> LGTM: Reviewed-by: Hans de Goede <hdegoede@redhat.com> Pantelis or Tom, can you pick this up please ? Regards, Hans > --- > drivers/mmc/mmc.c | 15 +++++++++++---- > 1 file changed, 11 insertions(+), 4 deletions(-) > > diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c > index 4380c7c195a6..d6b7e4f510c9 100644 > --- a/drivers/mmc/mmc.c > +++ b/drivers/mmc/mmc.c > @@ -494,6 +494,7 @@ int mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value) > { > struct mmc_cmd cmd; > int timeout = 1000; > + int retries = 3; > int ret; > > cmd.cmdidx = MMC_CMD_SWITCH; > @@ -502,11 +503,17 @@ int mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value) > (index << 16) | > (value << 8); > > - ret = mmc_send_cmd(mmc, &cmd, NULL); > + while (retries > 0) { > + ret = mmc_send_cmd(mmc, &cmd, NULL); > > - /* Waiting for the ready status */ > - if (!ret) > - ret = mmc_send_status(mmc, timeout); > + /* Waiting for the ready status */ > + if (!ret) { > + ret = mmc_send_status(mmc, timeout); > + return ret; > + } > + > + retries--; > + } > > return ret; > >
On Sun, Nov 13, 2016 at 07:50:53PM +0100, Hans de Goede wrote: > Hi, > > On 04-11-16 16:18, Maxime Ripard wrote: > >Some eMMC will fail at the first switch, but would succeed in a subsequent > >one. > > > >Make sure we try several times to cover those cases. The number of retries > >(and the behaviour) is currently what is being used in Linux. > > > >Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> > > LGTM: > > Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Tom Rini <trini@konsulko.com> > Pantelis or Tom, can you pick this up please ? Want to just pick it up with the rest of the series in the sunxi tree?
On 11/14/2016 07:50 AM, Tom Rini wrote: > On Sun, Nov 13, 2016 at 07:50:53PM +0100, Hans de Goede wrote: >> Hi, >> >> On 04-11-16 16:18, Maxime Ripard wrote: >>> Some eMMC will fail at the first switch, but would succeed in a subsequent >>> one. >>> >>> Make sure we try several times to cover those cases. The number of retries >>> (and the behaviour) is currently what is being used in Linux. >>> >>> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> >> >> LGTM: >> >> Reviewed-by: Hans de Goede <hdegoede@redhat.com> > > Reviewed-by: Tom Rini <trini@konsulko.com> > >> Pantelis or Tom, can you pick this up please ? > > Want to just pick it up with the rest of the series in the sunxi tree? Sorry for late..If you are ok, i will pick these on today. If you already picked this..let me know, plz. Best Regards, Jaehoon Chung >
Hi, On 14-11-16 01:34, Jaehoon Chung wrote: > On 11/14/2016 07:50 AM, Tom Rini wrote: >> On Sun, Nov 13, 2016 at 07:50:53PM +0100, Hans de Goede wrote: >>> Hi, >>> >>> On 04-11-16 16:18, Maxime Ripard wrote: >>>> Some eMMC will fail at the first switch, but would succeed in a subsequent >>>> one. >>>> >>>> Make sure we try several times to cover those cases. The number of retries >>>> (and the behaviour) is currently what is being used in Linux. >>>> >>>> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> >>> >>> LGTM: >>> >>> Reviewed-by: Hans de Goede <hdegoede@redhat.com> >> >> Reviewed-by: Tom Rini <trini@konsulko.com> >> >>> Pantelis or Tom, can you pick this up please ? >> >> Want to just pick it up with the rest of the series in the sunxi tree? > > Sorry for late..If you are ok, i will pick these on today. Go ahead and pick these up please. > If you already picked this..let me know, plz. Regards, Hans
On 11/14/2016 06:56 PM, Hans de Goede wrote: > Hi, > > On 14-11-16 01:34, Jaehoon Chung wrote: >> On 11/14/2016 07:50 AM, Tom Rini wrote: >>> On Sun, Nov 13, 2016 at 07:50:53PM +0100, Hans de Goede wrote: >>>> Hi, >>>> >>>> On 04-11-16 16:18, Maxime Ripard wrote: >>>>> Some eMMC will fail at the first switch, but would succeed in a subsequent >>>>> one. >>>>> >>>>> Make sure we try several times to cover those cases. The number of retries >>>>> (and the behaviour) is currently what is being used in Linux. >>>>> >>>>> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> >>>> >>>> LGTM: >>>> >>>> Reviewed-by: Hans de Goede <hdegoede@redhat.com> >>> >>> Reviewed-by: Tom Rini <trini@konsulko.com> >>> >>>> Pantelis or Tom, can you pick this up please ? >>> >>> Want to just pick it up with the rest of the series in the sunxi tree? >> >> Sorry for late..If you are ok, i will pick these on today. > > Go ahead and pick these up please. Ok. I will pick these series. Thanks! Best Regards, Jaehoon Chung > >> If you already picked this..let me know, plz. > > Regards, > > Hans > > >
On 11/14/2016 03:50 AM, Hans de Goede wrote: > Hi, > > On 04-11-16 16:18, Maxime Ripard wrote: >> Some eMMC will fail at the first switch, but would succeed in a subsequent >> one. >> >> Make sure we try several times to cover those cases. The number of retries >> (and the behaviour) is currently what is being used in Linux. >> >> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> > > LGTM: > > Reviewed-by: Hans de Goede <hdegoede@redhat.com> > > Pantelis or Tom, can you pick this up please ? Applied on u-boot-mmc. Thanks! Best Regards, Jaehoon Chung > > Regards, > > Hans > > >> --- >> drivers/mmc/mmc.c | 15 +++++++++++---- >> 1 file changed, 11 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c >> index 4380c7c195a6..d6b7e4f510c9 100644 >> --- a/drivers/mmc/mmc.c >> +++ b/drivers/mmc/mmc.c >> @@ -494,6 +494,7 @@ int mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value) >> { >> struct mmc_cmd cmd; >> int timeout = 1000; >> + int retries = 3; >> int ret; >> >> cmd.cmdidx = MMC_CMD_SWITCH; >> @@ -502,11 +503,17 @@ int mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value) >> (index << 16) | >> (value << 8); >> >> - ret = mmc_send_cmd(mmc, &cmd, NULL); >> + while (retries > 0) { >> + ret = mmc_send_cmd(mmc, &cmd, NULL); >> >> - /* Waiting for the ready status */ >> - if (!ret) >> - ret = mmc_send_status(mmc, timeout); >> + /* Waiting for the ready status */ >> + if (!ret) { >> + ret = mmc_send_status(mmc, timeout); >> + return ret; >> + } >> + >> + retries--; >> + } >> >> return ret; >> >> > > >
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 4380c7c195a6..d6b7e4f510c9 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -494,6 +494,7 @@ int mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value) { struct mmc_cmd cmd; int timeout = 1000; + int retries = 3; int ret; cmd.cmdidx = MMC_CMD_SWITCH; @@ -502,11 +503,17 @@ int mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value) (index << 16) | (value << 8); - ret = mmc_send_cmd(mmc, &cmd, NULL); + while (retries > 0) { + ret = mmc_send_cmd(mmc, &cmd, NULL); - /* Waiting for the ready status */ - if (!ret) - ret = mmc_send_status(mmc, timeout); + /* Waiting for the ready status */ + if (!ret) { + ret = mmc_send_status(mmc, timeout); + return ret; + } + + retries--; + } return ret;
Some eMMC will fail at the first switch, but would succeed in a subsequent one. Make sure we try several times to cover those cases. The number of retries (and the behaviour) is currently what is being used in Linux. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> --- drivers/mmc/mmc.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)