From: Chaotian Jing <chaotian.jing@mediatek.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: srv_heupstream@mediatek.com, Shawn Lin <shawn.lin@rock-chips.com>,
linux-mmc@vger.kernel.org,
Adrian Hunter <adrian.hunter@intel.com>,
linux-kernel@vger.kernel.org, Avri Altman <avri.altman@wdc.com>,
linux-mediatek@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
Hongjie Fang <hongjiefang@asrmicro.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Simon Horman <horms+renesas@verge.net.au>,
Kyle Roeschley <kyle.roeschley@ni.com>,
Chaotian Jing <chaotian.jing@mediatek.com>
Subject: [PATCH v2 2/2] mmc: mmc: Fix HS setting in mmc_hs400_to_hs200()
Date: Fri, 15 Feb 2019 13:59:35 +0800 [thread overview]
Message-ID: <1550210375-32270-3-git-send-email-chaotian.jing@mediatek.com> (raw)
In-Reply-To: <1550210375-32270-1-git-send-email-chaotian.jing@mediatek.com>
mmc_hs400_to_hs200() begins with the card and host in HS400 mode.
before send CMD6 to switch card's timing to HS mode, it reduce clock
frequency to 50Mhz firstly, the original intention of reduce clock
is to make "more stable" when doing HS switch. however,reduce clock
frequency to 50Mhz but without host timming change may cause CMD6
response CRC error. because host is still running at hs400 mode,
and it's hard to find a suitable setting for all eMMC cards when
clock frequency reduced to 50Mhz but card & host still in hs400 mode.
so that We consider that CMD6 response CRC error is not a fatal error,
if host gets CMD6 response CRC error, it means that card has already
received this command.
Signed-off-by: Chaotian Jing <chaotian.jing@mediatek.com>
Fixes: ef3d232245ab ("mmc: mmc: Relax checking for switch errors after HS200 switch")
---
drivers/mmc/core/mmc.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 09c688f..03d1c17 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1248,8 +1248,25 @@ int mmc_hs400_to_hs200(struct mmc_card *card)
err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_HS_TIMING,
val, card->ext_csd.generic_cmd6_time, 0,
true, false, true);
- if (err)
- goto out_err;
+ /*
+ * as we are on the way to do re-tune, so if the CMD6 got response CRC
+ * error, do not treat it as error.
+ */
+ if (err) {
+ if (err == -EILSEQ) {
+ /*
+ * card will busy after sending out response and host
+ * driver may not wait busy de-assert when get
+ * response CRC error. so just wait enough time to
+ * ensure card leave busy state.
+ */
+ mmc_delay(card->ext_csd.generic_cmd6_time);
+ pr_debug("%s: %s switch to HS got CRC error\n",
+ mmc_hostname(host), __func__);
+ } else {
+ goto out_err;
+ }
+ }
mmc_set_timing(host, MMC_TIMING_MMC_DDR52);
--
1.8.1.1.dirty
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-02-15 6:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-15 5:59 [PATCH v2] Fix HS setting in mmc_hs400_to_hs200() Chaotian Jing
2019-02-15 5:59 ` [PATCH v2 1/2] mmc: core: do not retry CMD6 in __mmc_switch() Chaotian Jing
2019-02-26 8:18 ` Ulf Hansson
2019-02-15 5:59 ` Chaotian Jing [this message]
2019-02-25 16:08 ` [PATCH v2 2/2] mmc: mmc: Fix HS setting in mmc_hs400_to_hs200() Ulf Hansson
2019-02-23 6:42 ` [PATCH v2] " Chaotian Jing
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1550210375-32270-3-git-send-email-chaotian.jing@mediatek.com \
--to=chaotian.jing@mediatek.com \
--cc=adrian.hunter@intel.com \
--cc=avri.altman@wdc.com \
--cc=hongjiefang@asrmicro.com \
--cc=horms+renesas@verge.net.au \
--cc=kyle.roeschley@ni.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-mmc@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=shawn.lin@rock-chips.com \
--cc=srv_heupstream@mediatek.com \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox