From patchwork Mon Nov 11 09:49:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arend van Spriel X-Patchwork-Id: 3166871 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3E140C045B for ; Mon, 11 Nov 2013 09:50:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E1F45202F8 for ; Mon, 11 Nov 2013 09:50:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 73985202F9 for ; Mon, 11 Nov 2013 09:50:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752837Ab3KKJuO (ORCPT ); Mon, 11 Nov 2013 04:50:14 -0500 Received: from mms1.broadcom.com ([216.31.210.17]:3408 "EHLO mms1.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752743Ab3KKJuN (ORCPT ); Mon, 11 Nov 2013 04:50:13 -0500 Received: from [10.9.208.57] by mms1.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.5)); Mon, 11 Nov 2013 01:49:52 -0800 X-Server-Uuid: 06151B78-6688-425E-9DE2-57CB27892261 Received: from IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) by IRVEXCHCAS08.corp.ad.broadcom.com (10.9.208.57) with Microsoft SMTP Server (TLS) id 14.1.438.0; Mon, 11 Nov 2013 01:50:05 -0800 Received: from mail-sj1-12.sj.broadcom.com (10.10.10.20) by IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) with Microsoft SMTP Server id 14.1.438.0; Mon, 11 Nov 2013 01:50:05 -0800 Received: from arend-ubuntu-1 (unknown [10.176.68.27]) by mail-sj1-12.sj.broadcom.com (Postfix) with ESMTP id 69270207CE; Mon, 11 Nov 2013 01:50:01 -0800 (PST) Received: from arend by arend-ubuntu-1 with local (Exim 4.80) ( envelope-from ) id 1Vfo87-00073T-8m; Mon, 11 Nov 2013 10:49:59 +0100 From: "Arend van Spriel" To: "Chris Ball" cc: linux-mmc@vger.kernel.org, "Arend van Spriel" Subject: [PATCH V2] sdhci: only reprogram retuning timer when flag is set Date: Mon, 11 Nov 2013 10:49:55 +0100 Message-ID: <1384163395-27038-1-git-send-email-arend@broadcom.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1383821960-2533-1-git-send-email-arend@broadcom.com> References: <1383821960-2533-1-git-send-email-arend@broadcom.com> MIME-Version: 1.0 X-WSS-ID: 7E9E77CA1506958446-01-01 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When the host->tuning_count is zero it means that the retuning is disabled. This is checked on the first run of sdhci_execute_tuning() by the if statement below: if (!(host->flags & SDHCI_NEEDS_RETUNING) && host->tuning_count && (host->tuning_mode == SDHCI_TUNING_MODE_1)) { So only when tuning_count is non-zero it will set the host flag SDHCI_USING_RETUNING_TIMER. The else statement is only for re-programming the timer, which means that flag must be set. Because that is not checked the else statement is executed in the first run when tuning_count is zero. This was seen on a host controller which indicated SDHCI_TUNING_MODE_1 (0) and tuning_count being zero. Suspect that (one of) these registers is not properly set. Signed-off-by: Arend van Spriel Reviewed-by: Aaron Lu --- This patch applies to the mmc-next branch. V2: - add more explanation to the commit message - check host flag SDHCI_USING_RETUNING_TIMER --- drivers/mmc/host/sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index bd8a098..5974599 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2014,7 +2014,7 @@ out: host->tuning_count * HZ); /* Tuning mode 1 limits the maximum data length to 4MB */ mmc->max_blk_count = (4 * 1024 * 1024) / mmc->max_blk_size; - } else { + } else if (host->flags & SDHCI_USING_RETUNING_TIMER) { host->flags &= ~SDHCI_NEEDS_RETUNING; /* Reload the new initial value for timer */ if (host->tuning_mode == SDHCI_TUNING_MODE_1)