From patchwork Fri Feb 21 19:59:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arend van Spriel X-Patchwork-Id: 3699841 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 42C0D9F72D for ; Fri, 21 Feb 2014 19:59:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6A2B52012E for ; Fri, 21 Feb 2014 19:59:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 744B42010C for ; Fri, 21 Feb 2014 19:59:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752466AbaBUT7r (ORCPT ); Fri, 21 Feb 2014 14:59:47 -0500 Received: from mail-gw2-out.broadcom.com ([216.31.210.63]:31468 "EHLO mail-gw2-out.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751308AbaBUT7r (ORCPT ); Fri, 21 Feb 2014 14:59:47 -0500 X-IronPort-AV: E=Sophos;i="4.97,520,1389772800"; d="scan'208";a="15943259" Received: from irvexchcas08.broadcom.com (HELO IRVEXCHCAS08.corp.ad.broadcom.com) ([10.9.208.57]) by mail-gw2-out.broadcom.com with ESMTP; 21 Feb 2014 12:15:21 -0800 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.3.174.1; Fri, 21 Feb 2014 11:59:46 -0800 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) with Microsoft SMTP Server id 14.3.174.1; Fri, 21 Feb 2014 11:59:46 -0800 Received: from xl-bun-02.broadcom.com (xl-bun-02.bun.broadcom.com [10.176.128.60]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 60264EEBB7; Fri, 21 Feb 2014 11:59:46 -0800 (PST) Received: by xl-bun-02.broadcom.com (Postfix, from userid 25152) id ADF9A18896C0; Fri, 21 Feb 2014 20:59:45 +0100 (CET) From: Arend van Spriel To: Chris Ball CC: , Arend van Spriel , "Dong Aisheng" , Aaron Lu Subject: RESEND:[PATCH V3] sdhci: only reprogram retuning timer when flag is set Date: Fri, 21 Feb 2014 20:59:42 +0100 Message-ID: <1393012782-23917-1-git-send-email-arend@broadcom.com> X-Mailer: git-send-email 1.8.1.3 MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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. Cc: Dong Aisheng Cc: Aaron Lu Signed-off-by: Arend van Spriel Acked-by: Ulf Hansson Reviewed-by: Aaron Lu --- Noticed this patch was still not applied so please reconsider taking it in and let me know. The patch has been rebased and applies to the mmc-next branch. Regards, Arend V3: - remote tuning mode check for retuning timer reload V2: - add more explanation to the commit message - check host flag SDHCI_USING_RETUNING_TIMER --- drivers/mmc/host/sdhci.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 9ddef47..d5b421d 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2026,12 +2026,11 @@ 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) - mod_timer(&host->tuning_timer, jiffies + - host->tuning_count * HZ); + mod_timer(&host->tuning_timer, jiffies + + host->tuning_count * HZ); } /*