Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1219586pxb; Thu, 23 Sep 2021 22:35:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxrdF17altDk+Y/bygAvjvGSfyByHnby2bAaD6YF0gGBaIkw1CwT0qI/+ej04n/rWXkYWb X-Received: by 2002:a17:907:7803:: with SMTP id la3mr9415038ejc.235.1632461732704; Thu, 23 Sep 2021 22:35:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632461732; cv=none; d=google.com; s=arc-20160816; b=FAZXM10bjVDADisoA55g/R017jSo0CJGxOXyRUoF2O4Omy8sQFOxAH9sNsokV867AO EBL/09Q8er6B8lKicyrOqFsMZLvZfbx/7Cxdb042Xceag1o72xsHxs+ZqPiRlgGkA0f2 AetzfS7UmMXt+GGD1ChfPI8AE0Q7exUPkRMqLVpdSFm3RETMSvvZhVtuMV/Nz5W0cVxG 8IYo/eGcdFpPmzgf36U6ok4/6RmlJanO2ZQ89P8ZYnGHIwIGxYuLfjMtgvKhZBN8ys3W AWIi8mUmS0iSVjpKVWYz6VZugm6YGdmGWGkUFP72u3KDBaFmCQ1E+8A6iNgTlK0CKp9u SA6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject; bh=168HgfkroPX3BAG358X8nWrUcUZmqg9eHOAscuGOkYU=; b=IHUukGnq+uunUPd4ogv9+IpubcMg1acIlBHWxkLw/o0JwSK4Wc3rV2dY7SyTnnQyhE Os6+YGB0s+mXEZAtwAo+pp9t4bM5szB4pFQmuhLP6j/4Dr1gg0g+ovCC87fmTnLJoK0m Qv7PHnKMdbaV+r2C93csXv60/jYD0V6zFbRL/BJFEMyPRiRQ5yeDTa2FY1MSlrHXdmdI 6KwDaEbxBx0WV0rgn6l2EEvvAvjrjoD7Icknp8S7bMe180S5krjdHXywbMSyWx6YEWap 6vhXAbaa4LojnLvzdM8pvt3EhPf6UOyQvtCAeUE4tIa+B1Q/sebvyJQgd96U5kfrC0cu siqw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e3si9055212ejs.199.2021.09.23.22.34.57; Thu, 23 Sep 2021 22:35:32 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244103AbhIXFau (ORCPT + 99 others); Fri, 24 Sep 2021 01:30:50 -0400 Received: from mga04.intel.com ([192.55.52.120]:1448 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242549AbhIXFar (ORCPT ); Fri, 24 Sep 2021 01:30:47 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10116"; a="222117451" X-IronPort-AV: E=Sophos;i="5.85,319,1624345200"; d="scan'208";a="222117451" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2021 22:29:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,319,1624345200"; d="scan'208";a="558844083" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.84]) ([10.237.72.84]) by fmsmga002.fm.intel.com with ESMTP; 23 Sep 2021 22:29:11 -0700 Subject: Re: [PATCH v1 2/2] mmc: sdhci: Use the SW timer when the HW timer cannot meet the timeout value required by the device To: Bean Huo , Ulf Hansson Cc: Bean Huo , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210917172727.26834-1-huobean@gmail.com> <20210917172727.26834-3-huobean@gmail.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: Date: Fri, 24 Sep 2021 08:29:51 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20210917172727.26834-3-huobean@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17/09/21 8:27 pm, Bean Huo wrote: > 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. The reason it is a quirk is because it does not work for all hardware. For some controllers the timeout cannot really be disabled, only the interrupt is disabled, and then the controller never indicates completion if the timeout is exceeded. > > 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)) { >