linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: core: Remove timeout when enabling cache
@ 2018-11-06 13:30 Sjoerd Simons
  2018-11-06 14:04 ` Faiz Abbas
  0 siblings, 1 reply; 15+ messages in thread
From: Sjoerd Simons @ 2018-11-06 13:30 UTC (permalink / raw)
  To: linux-mmc
  Cc: kernel, linux-kernel, Hongjie Fang, Bastian Stender,
	Kyle Roeschley, Wolfram Sang, Shawn Lin, Ulf Hansson,
	Harish Jenny K N, Simon Horman

On some of our boards containing Micron eMMC chips compatible with
the eMMC 5.0 specification we starting seeing boot failures due to
timeouts:
  mmc1: error -110 whilst initialising MMC card

It turns out that switching the cache on after a power loss event can
take quite long. In some simple testing thusfar we've seen values up to
700ms, which is far longer then the GENERIC_CMD6_TIME of the chip
(250ms).

Looking at both the eMMC 4.51 and 5.0 specification there doesn't seem
to be a defined upper bound for the CACHE_CTRL ON command. For both
CACHE_CTRL OFF and FLUSH_CACHE it is documented that they can take
essentially unbounded time, but CACHE_CTRL ON i get the impression that
it's assumed to be "fast". Unfortunately this is not true in reality.

To resolve this, simply drop the timeout from CACHE_CTRL ON and assume
it might take an unbounded time similar to the FLUSH_CACHE command.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>

---

 drivers/mmc/core/mmc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index bc1bd2c25613..ac70b508a939 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1794,8 +1794,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 	if (!mmc_card_broken_hpi(card) &&
 	    card->ext_csd.cache_size > 0) {
 		err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
-				EXT_CSD_CACHE_CTRL, 1,
-				card->ext_csd.generic_cmd6_time);
+				EXT_CSD_CACHE_CTRL, 1, 0);
 		if (err && err != -EBADMSG)
 			goto free_card;
 
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2018-11-20 22:27 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-06 13:30 [PATCH] mmc: core: Remove timeout when enabling cache Sjoerd Simons
2018-11-06 14:04 ` Faiz Abbas
2018-11-06 15:01   ` Sjoerd Simons
2018-11-07  8:47     ` Wolfram Sang
2018-11-20  9:24       ` Ulf Hansson
2018-11-20 10:09         ` Faiz Abbas
2018-11-20 10:23         ` Wolfram Sang
2018-11-20 10:39           ` Faiz Abbas
2018-11-20 10:58             ` Wolfram Sang
2018-11-20 11:38           ` Sjoerd Simons
2018-11-20 13:08             ` Ulf Hansson
2018-11-20 14:00               ` Sjoerd Simons
2018-11-20 14:24                 ` Ulf Hansson
2018-11-20 14:55                   ` Sjoerd Simons
2018-11-20 22:26                     ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).