Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp223968pxb; Sat, 18 Sep 2021 00:39:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgeqcdNE9rjP5RRjvOWxiRE1mRozyQvHpHU12iLyQ3P7LmDOkUBXiaDAgQ+nKV4mjhg9y+ X-Received: by 2002:a17:906:718e:: with SMTP id h14mr15878221ejk.365.1631950744973; Sat, 18 Sep 2021 00:39:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631950744; cv=none; d=google.com; s=arc-20160816; b=U96oyy5lv0DjU0uLU/eDujWTv9+0cLmwX5RCBsAi/QmDDNhgisXTzOkWKTbjqLtIEZ tSgi2RiFcOCNqPkZxRmigOfeoLLqN6C1jjx5wOs2oHPXCZLKe/ugGhGr3W3udlXRq6a8 H0DeNkAUgCYu6sclRV2TPvQ0UgtZhpTpEP2GF1jM2hb/PPGQVEiV9A7yrnfJZCB2APWU tQP39cBja/sUAMDRj1vG7PW66m2BGeCwPZY91Ynb1idNWglLTZmKwkyc6qW3tnP1PKhI YklcccOhpiKvimMfvWW3r0h/edvcy6/yWZAvjHhK0bMnqPCHIite4rusj2g5X0zf/VrC rAxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ALoBWaWV7jtCqRbGUVPAv75PEetKCqXCAn6SGuf3CPQ=; b=b8uO+YB23i9lwPKCHS6Uo1819EspWsW7eZuKnvf545DjclXzmbF4hDBuN7PrwEev4t y0FQmY6iZf0Csr8phg9qPeURaai8xJFvs/8PxDiF1pWY+4R7b/M0W0rsJhHJnxKQH2BI WZRcpfBUes8/3HMf2s8nahS8zlNBQu2moODXaD2wTPZMNSsFNtN+9fzPdivuysUXidno I9ZPIDasslz3w+hE3bSfziGgWxVDTcIY4LCZihZbYjY7TUo3ZShUh1GFIue614KXtuHg DPSdePy3mXVEq03UTSLsGKw8CPDZGpkjZ8E2MUMq0Y95k+Nz3PXr89Dt6K12oC/iFAfS 3XtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hfmZa6o3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z44si8943567ede.483.2021.09.18.00.38.28; Sat, 18 Sep 2021 00:39:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hfmZa6o3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343970AbhIQR3F (ORCPT + 99 others); Fri, 17 Sep 2021 13:29:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343988AbhIQR3D (ORCPT ); Fri, 17 Sep 2021 13:29:03 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE759C061764; Fri, 17 Sep 2021 10:27:40 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id s24so7911791wmh.4; Fri, 17 Sep 2021 10:27:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ALoBWaWV7jtCqRbGUVPAv75PEetKCqXCAn6SGuf3CPQ=; b=hfmZa6o3msrRRDWRzDSGlKKb3/zofRhELYAB7KdW63iFI1KBlxsYXJ2RrSfCf1pA3i SwaolNQ+1oENric+GAhhKBHvS5ihJ90k04MLmhro9OqUDkhGXyjDwgvp728ZtGofTKvW TeppU87f++S0Fbfhbo8gCWnMcTecI8h5nv5cCTt2xu8330bZHKgF6xEnaVGlhANFVcRH jeqskdwMjYgb7Pc0bjc1jDe1iqF18e40jLmhU6Woxh6vxDQt8RFobF6z+EuVv+5HZSv2 V8judbdkMUP/OaQWZWndJjonLJJYooi7KIQhlzmV5GM2sfsb7NNqgImAhPLXX2iWmgWx 06jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ALoBWaWV7jtCqRbGUVPAv75PEetKCqXCAn6SGuf3CPQ=; b=JVGTk+UrkHtrA3uHy2c2D7WpHmYrUNcOt4hMdhfTje+U15vp2pSIEO6ZUpDdHdDezR p45Rz/c0vACO/PN14nZRrbrmSw+ck8QN9poxeTt9CkJ7Di2JO2gi8ZcfioWA3jfBf8MF 74CWs7i0MgOkmo0XfF7VWWEiz7+g8amUcmSZks1GUy3KJANek658tm4+Gtn1cfRJrnks temn0J8tiwjwjHTuNmWt8bKWedwX0zjjFDIfc4OohHFRmfF4Rt1Psv1Xln4rEut1dHcQ O/NI8/0tvkCoi6f9ATouH3nKxxOWmxh4ySk3k8qV3UWrD2ToeMnP09lKs+veiLs349BU vjKw== X-Gm-Message-State: AOAM530DDaTsQ1ZU+gKcLQSrrA7zfuWvegx9jm2pFV/e4VzWXm1viUHu zKMu+BtPV/8P5Vg90Z5qUv8= X-Received: by 2002:a7b:c213:: with SMTP id x19mr16177279wmi.148.1631899659530; Fri, 17 Sep 2021 10:27:39 -0700 (PDT) Received: from ubuntu-laptop.speedport.ip (p200300e94717cf050f860509a8ecdb17.dip0.t-ipconnect.de. [2003:e9:4717:cf05:f86:509:a8ec:db17]) by smtp.gmail.com with ESMTPSA id 135sm2901947wma.32.2021.09.17.10.27.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Sep 2021 10:27:39 -0700 (PDT) From: Bean Huo To: Adrian Hunter , Ulf Hansson Cc: Bean Huo , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 2/2] mmc: sdhci: Use the SW timer when the HW timer cannot meet the timeout value required by the device Date: Fri, 17 Sep 2021 19:27:27 +0200 Message-Id: <20210917172727.26834-3-huobean@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210917172727.26834-1-huobean@gmail.com> References: <20210917172727.26834-1-huobean@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bean Huo If the data transmission timeout value required by the device exceeds the maximum timeout value of the host HW timer, we still use the HW timer with the maximum timeout value of the HW timer. This setting is suitable for most R/W situations. But sometimes, the device will complete the R/W task within its required timeout value (greater than the HW timer). In this case, the HW timer for data transmission will time out. Currently, in this condition, we disable the HW timer and use the SW timer only when the SDHCI_QUIRK2_DISABLE_HW_TIMEOUT quirk is set by the host driver. The patch is to remove this if statement restriction and allow data transmission to use the SW timer when the hardware timer cannot meet the required timeout value. Signed-off-by: Bean Huo --- drivers/mmc/host/sdhci.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 357b365bf0ec..463517fd9886 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -969,9 +969,6 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd, count++; current_timeout <<= 1; if (count > host->max_timeout_count) { - if (!(host->quirks2 & SDHCI_QUIRK2_DISABLE_HW_TIMEOUT)) - DBG("Too large timeout 0x%x requested for CMD%d!\n", - count, cmd->opcode); count = host->max_timeout_count; *too_big = true; break; @@ -1016,8 +1013,7 @@ void __sdhci_set_timeout(struct sdhci_host *host, struct mmc_command *cmd) bool too_big = false; u8 count = sdhci_calc_timeout(host, cmd, &too_big); - if (too_big && - host->quirks2 & SDHCI_QUIRK2_DISABLE_HW_TIMEOUT) { + if (too_big) { sdhci_calc_sw_timeout(host, cmd); sdhci_set_data_timeout_irq(host, false); } else if (!(host->ier & SDHCI_INT_DATA_TIMEOUT)) { -- 2.25.1