From patchwork Mon Jun 27 21:43:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Rae X-Patchwork-Id: 641242 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3rdjM720yDz9sDC for ; Tue, 28 Jun 2016 07:51:46 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7D73EA75F3; Mon, 27 Jun 2016 23:51:41 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Rk3LkOVrh8SA; Mon, 27 Jun 2016 23:51:41 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D0FA5A7548; Mon, 27 Jun 2016 23:51:40 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B319AA7548 for ; Mon, 27 Jun 2016 23:51:37 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VEIHIyjylRWE for ; Mon, 27 Jun 2016 23:51:37 +0200 (CEST) X-Greylist: delayed 454 seconds by postgrey-1.34 at theia; Mon, 27 Jun 2016 23:51:34 CEST X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from p3plsmtpa09-02.prod.phx3.secureserver.net (p3plsmtpa09-02.prod.phx3.secureserver.net [173.201.193.231]) by theia.denx.de (Postfix) with ESMTPS id 2856CA7527 for ; Mon, 27 Jun 2016 23:51:33 +0200 (CEST) Received: from VM-host64-64-A1.ric.broadcom.com ([216.31.219.19]) by p3plsmtpa09-02.prod.phx3.secureserver.net with id Bxjk1t00C0RiFTL01xju5Z; Mon, 27 Jun 2016 14:43:58 -0700 X-Sender: smtpout@raedomain.com From: Steve Rae To: u-boot@lists.denx.de, Tom Rini Date: Mon, 27 Jun 2016 14:43:41 -0700 Message-Id: <1467063821-15900-1-git-send-email-steve.rae@raedomain.com> X-Mailer: git-send-email 1.8.5 Cc: Stefan Roese , Pantelis Antoniou , Steve Rae Subject: [U-Boot] [PATCH] arm: mmc: increase MMC SDHCI read status timeout X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Otherwise, ocassionally see errors like this: Flashing sparse image at offset 2078720 Flashing Sparse Image sdhci_send_command: Timeout for status update! mmc fail to send stop cmd write_sparse_image: Write failed, block #2181088 [0] This does not affect the actual writing speed, which is controlled by the default value: CONFIG_SDHCI_CMD_DEFAULT_TIMEOUT It only increases the retries when reading: SDHCI_INT_STATUS to avoid the timeout error. Signed-off-by: Steve Rae Reviewed-by: Stefan Roese Tested-by: Masahiro Yamada --- as per the discussion in: http://lists.denx.de/pipermail/u-boot/2016-June/258966.html this supercedes: http://patchwork.ozlabs.org/patch/615994/ drivers/mmc/sdhci.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 5c71ab8..aa4cd4f 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -127,6 +127,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data, #define CONFIG_SDHCI_CMD_MAX_TIMEOUT 3200 #endif #define CONFIG_SDHCI_CMD_DEFAULT_TIMEOUT 100 +#define CONFIG_SDHCI_READ_STATUS_TIMEOUT 1000 static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) @@ -243,9 +244,9 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd, if (stat & SDHCI_INT_ERROR) break; } while (((stat & mask) != mask) && - (get_timer(start) < CONFIG_SDHCI_CMD_DEFAULT_TIMEOUT)); + (get_timer(start) < CONFIG_SDHCI_READ_STATUS_TIMEOUT)); - if (get_timer(start) >= CONFIG_SDHCI_CMD_DEFAULT_TIMEOUT) { + if (get_timer(start) >= CONFIG_SDHCI_READ_STATUS_TIMEOUT) { if (host->quirks & SDHCI_QUIRK_BROKEN_R1B) return 0; else {