Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp380932imm; Thu, 30 Aug 2018 00:55:24 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdakmq29wqnywuWUpBIAaVFACkKFMMiZ33+Fvlup5kqFMDc/b4Dz8L29NmHDPDiYXsyiKTkh X-Received: by 2002:a65:65c6:: with SMTP id y6-v6mr8817784pgv.436.1535615724827; Thu, 30 Aug 2018 00:55:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535615724; cv=none; d=google.com; s=arc-20160816; b=zqpwd7q2pYamYKUSIwIcffhTkKT0gHs9E8qiKApc4Jnhpazn/vdwHlmc41IHv7v2vT eDKjSVYIgdE+shHz5MjaSu33AGs1vWj4wgNJnlOtkkdUqkb/tjKZ8Bj4e4sOuFkHN3cD W+Fqn+uZs4gwq8U3i8PiI8v4Co8hVix/qjRZ/BNt0h6sPPsdpkFxruOsShUQdpOlmFHU D8ficN6G+D3M8YpPTFJkb7j6GeidjgwnQK1flLxHDEmoa1hsv+1u/7kNU4UVmV/wzhaK fWv2Q40Yt3cUXSy7lPfc1LIAuf7+SroOCUjwiu1wThER0IglCO67ahJq+ttBSVGmb9FJ MXSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :arc-authentication-results; bh=Rfjr57XnJFO5sgBaiWNnRRmY9ljsD+lsQgsC6Slftck=; b=qXD9pY2TXHEQodvObXtGALMFZia5UP23k8ZyydWFgs1OC0o4JPdfgcWFVCRltvGwHJ aTPAoqfs1lfa0wbv0boS6p4s4q9EBranQQ98wgQV5tYJe2XDwLKRcRdN9eofa+DzTWG+ gaov3jW4DeKl4WYT2fCJv9IfRP9HpQpqiXjLw8Oqm6B+7ooa/WkCvjzNfWqkIxUCsqNs v9gA1cgR2ClWATnsBDEOJwpQX7yOEoo7xCLSKysbeifzt1ZN4owrIxkxskw6huTY3j+1 oVZp1xEOMSV5OTaatwBAQAnKtrTyS6Ci+FaGycu1CY6p9x78kux09yOsHsgxVrcqGKb9 x17g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id l63-v6si5895926plb.106.2018.08.30.00.55.10; Thu, 30 Aug 2018 00:55:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727837AbeH3LyG (ORCPT + 99 others); Thu, 30 Aug 2018 07:54:06 -0400 Received: from mga18.intel.com ([134.134.136.126]:40444 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727203AbeH3LyG (ORCPT ); Thu, 30 Aug 2018 07:54:06 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Aug 2018 00:53:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,306,1531810800"; d="scan'208";a="253100829" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.98]) ([10.237.72.98]) by orsmga005.jf.intel.com with ESMTP; 30 Aug 2018 00:53:08 -0700 Subject: Re: [PATCH V7 7/9] mmc: sdhci: SDMA may use Auto-CMD23 in v4 mode To: Chunyan Zhang Cc: Chunyan Zhang , Ulf Hansson , linux-mmc@vger.kernel.org, Linux Kernel Mailing List , Orson Zhai , Baolin Wang , Billows Wu , Jason Wu , Chunyan Zhang References: <1535526184-32718-1-git-send-email-zhang.chunyan@linaro.org> <1535526184-32718-8-git-send-email-zhang.chunyan@linaro.org> <48e8ec2c-c3e3-ad08-2c1e-a0feb9ba0820@intel.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <145ef368-3aae-c6ae-14c9-6e8f50503dcf@intel.com> Date: Thu, 30 Aug 2018 10:51:27 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30/08/18 10:04, Chunyan Zhang wrote: > On 30 August 2018 at 13:59, Adrian Hunter wrote: >> On 29/08/18 14:39, Chunyan Zhang wrote: >>> On 29 August 2018 at 18:59, Adrian Hunter wrote: >>>> On 29/08/18 10:03, Chunyan Zhang wrote: >>>>> When Host Version 4 Enable is set to 1, SDMA uses ADMA System Address >>>>> register (05Fh-058h) instead of using register (000h-004h) to indicate >>>>> its system address of data location. The register (000h-004h) is >>>>> re-assigned to 32-bit Block Count and Auto CMD23 argument, so then SDMA >>>>> may use Auto CMD23. >>>>> >>>>> Signed-off-by: Chunyan Zhang >>>>> --- >>>>> drivers/mmc/host/sdhci.c | 8 ++++++-- >>>>> 1 file changed, 6 insertions(+), 2 deletions(-) >>>>> >>>>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c >>>>> index 62d843ac90..ac92e0f 100644 >>>>> --- a/drivers/mmc/host/sdhci.c >>>>> +++ b/drivers/mmc/host/sdhci.c >>>>> @@ -3834,10 +3834,14 @@ int sdhci_setup_host(struct sdhci_host *host) >>>>> if (host->quirks & SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12) >>>>> host->flags |= SDHCI_AUTO_CMD12; >>>>> >>>>> - /* Auto-CMD23 stuff only works in ADMA or PIO. */ >>>>> + /* >>>>> + * For v3 mode, Auto-CMD23 stuff only works in ADMA or PIO; >>>> >>>> ; -> . >>>> >>>>> + * For v4 mode, SDMA may use Auto-CMD23 as well. >>>>> + */ >>>>> if ((host->version >= SDHCI_SPEC_300) && >>>>> ((host->flags & SDHCI_USE_ADMA) || >>>>> - !(host->flags & SDHCI_USE_SDMA)) && >>>>> + (!host->v4_mode && !(host->flags & SDHCI_USE_SDMA)) || >>>>> + (host->v4_mode && (host->flags & SDHCI_USE_SDMA))) && >>>>> !(host->quirks2 & SDHCI_QUIRK2_ACMD23_BROKEN)) { >>>> >>>> This is over complicated. We can use auto-CMD23 if not using SDMA or if in >>>> v4_mode i.e. >>>> >>>> if (host->version >= SDHCI_SPEC_300 && >>>> (!(host->flags & SDHCI_USE_SDMA) || host->v4_mode) && >>>> !(host->quirks2 & SDHCI_QUIRK2_ACMD23_BROKEN)) { >>>> >>> >>> So no matter whether SDHCI_USE_ADMA is selected, right? >> >> Yes > > I think you mean like this: > > if ((host->version >= SDHCI_SPEC_300) && > ((host->flags & SDHCI_USE_ADMA) || > !(host->flags & SDHCI_USE_SDMA) || host->v4_mode) && > !(host->quirks2 & SDHCI_QUIRK2_ACMD23_BROKEN)) > > Otherwise, without checking (host->flags & SDHCI_USE_ADMA), if using > ADMA and SDMA on v3 mode, auto-CMD23 would not be selected. Yeah you are right - I was thinking SDHCI_USE_SDMA and SDHCI_USE_ADMA were mutually exclusive. Thanks! > >> >>> >>>>> host->flags |= SDHCI_AUTO_CMD23; >>>>> DBG("Auto-CMD23 available\n"); >>>>> >>>> >>> >> >