From patchwork Tue Nov 6 13:30:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sjoerd Simons X-Patchwork-Id: 10670407 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9208A175A for ; Tue, 6 Nov 2018 13:30:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77EFC2A3B2 for ; Tue, 6 Nov 2018 13:30:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B4F42A3CA; Tue, 6 Nov 2018 13:30:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7F5D2A3B2 for ; Tue, 6 Nov 2018 13:30:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730470AbeKFWzZ (ORCPT ); Tue, 6 Nov 2018 17:55:25 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:53740 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730421AbeKFWzZ (ORCPT ); Tue, 6 Nov 2018 17:55:25 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sjoerd) with ESMTPSA id 68D8F27DDD7 Received: by beast.luon.net (Postfix, from userid 1000) id EA1283E238B; Tue, 6 Nov 2018 14:30:07 +0100 (CET) From: Sjoerd Simons To: linux-mmc@vger.kernel.org Cc: kernel@collabora.com, linux-kernel@vger.kernel.org, Hongjie Fang , Bastian Stender , Kyle Roeschley , Wolfram Sang , Shawn Lin , Ulf Hansson , Harish Jenny K N , Simon Horman Subject: [PATCH] mmc: core: Remove timeout when enabling cache Date: Tue, 6 Nov 2018 14:30:07 +0100 Message-Id: <20181106133007.12318-1-sjoerd.simons@collabora.co.uk> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reported-by: Andreas Dannenberg Signed-off-by: Faiz Abbas Signed-off-by: Sekhar Nori --- 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;