Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1825704imm; Thu, 23 Aug 2018 09:20:45 -0700 (PDT) X-Google-Smtp-Source: AA+uWPz0hsRxNYv5X3joh3h1LRP3bY2ie7PPXJRIeWK6RuQ7fphlhEBOzn5ULWNumSQMXtP79fjV X-Received: by 2002:a62:4255:: with SMTP id p82-v6mr63753855pfa.238.1535041245478; Thu, 23 Aug 2018 09:20:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535041245; cv=none; d=google.com; s=arc-20160816; b=IcFcO7N5e3sF2WlhCL6VfPWoIVfYOz77xUUSzjF9WfErHA4JMx1GkbE75xj9Ht4crV L9t4VKa5f+hx3MVZytm5ra2UXx02I2kQNK2mYv0qzeJ1sT4jGpbReynOIYw+4OEzNzBr LXMqEBPMyOfImdW750FjHyAAGURM9HwZLiAqUGvA3Bx+fZlGzcPL6KzpIGXjbQZg3MQ6 ExYfPOIgUdcPBnUTy2fcpB3ZeND1s/tX7fKYu42ld55vqDa4W+bHfHmCO5wNa1LLM/qD geGq0iCdSiXK+61Oa1qywOWMI5cNHngIH48JQE1uaZsmMEXMc0ae2FE3w1EhTQrFkATt lW2g== 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=wzh6ZZ1poblXSWA3ZseqgTQHlGb518e/Ovd2Zs/3Fp8=; b=JO9TtBthSKxBsEr5fwCHtHPbOArxGpG3LTQSXWRNXnxRGT1B4AlswsUrvk4FE2e8Ht Tit9ewJ9xqD86WM1AVtWd/vIWg8pRMj6ZDyzUzZmNpqrBBmeq0Czpok931KUjGs4ADyT 9cet1JQuUAEjo26tQjh7wqTwg0sEgbF2Pn1IaHbE3zK6RDFy8piQFhakDeXOTQZCH5Rf gVRHZhA8CkjNa54tMK8eEgIY/ct7pVMBnZ2nOcjvY1uopzDcqmIOZHICjhDqljIUkbJt doMJ53kQJXFNq20ETWQANui8Ku+HGDPYR0PxYaa10ZtZVQOGcd7FamrynPmmp8dB6dDg SNJQ== 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 i5-v6si4165017pgc.607.2018.08.23.09.20.30; Thu, 23 Aug 2018 09:20:45 -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 S1729745AbeHWQTf (ORCPT + 99 others); Thu, 23 Aug 2018 12:19:35 -0400 Received: from mga09.intel.com ([134.134.136.24]:47581 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727714AbeHWQTe (ORCPT ); Thu, 23 Aug 2018 12:19:34 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Aug 2018 05:50:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,278,1531810800"; d="scan'208";a="256621355" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.137]) ([10.237.72.137]) by fmsmga005.fm.intel.com with ESMTP; 23 Aug 2018 05:49:57 -0700 Subject: Re: [PATCH V5 05/10] mmc: sdhci: Add 32-bit block count support for v4 mode To: Chunyan Zhang , Ulf Hansson Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Orson Zhai , Baolin Wang , Billows Wu , Jason Wu , Chunyan Zhang References: <1534406064-10065-1-git-send-email-zhang.chunyan@linaro.org> <1534406064-10065-6-git-send-email-zhang.chunyan@linaro.org> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <22b4b7de-01a4-2f40-6e77-885473c409ac@intel.com> Date: Thu, 23 Aug 2018 15:48:16 +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: <1534406064-10065-6-git-send-email-zhang.chunyan@linaro.org> 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 16/08/18 10:54, Chunyan Zhang wrote: > Host Controller Version 4.10 re-defines SDMA System Address register > as 32-bit Block Count for v4 mode, and SDMA uses ADMA System > Address register (05Fh-058h) instead if v4 mode is enabled. Also > when using 32-bit block count, 16-bit block count register need > to be set to zero. > > Signed-off-by: Chunyan Zhang > --- > drivers/mmc/host/sdhci.c | 14 +++++++++++++- > drivers/mmc/host/sdhci.h | 1 + > 2 files changed, 14 insertions(+), 1 deletion(-) > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > index 1dea1c4..b3328ee 100644 > --- a/drivers/mmc/host/sdhci.c > +++ b/drivers/mmc/host/sdhci.c > @@ -1073,7 +1073,19 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_command *cmd) > /* Set the DMA boundary value and block size */ > sdhci_writew(host, SDHCI_MAKE_BLKSZ(host->sdma_boundary, data->blksz), > SDHCI_BLOCK_SIZE); > - sdhci_writew(host, data->blocks, SDHCI_BLOCK_COUNT); > + > + /* > + * For Version 4.10 onwards, if v4 mode is enabled, 16-bit Block Count > + * register need to be set to zero, 32-bit Block Count register would > + * be selected. > + */ > + if (host->version >= SDHCI_SPEC_410 && host->v4_mode) { > + if (sdhci_readw(host, SDHCI_BLOCK_COUNT)) > + sdhci_writew(host, 0, SDHCI_BLOCK_COUNT); > + sdhci_writew(host, data->blocks, SDHCI_32BIT_BLK_CNT); Since it causes problems for auto-cmd23, use of 32-bit block count needs to be optional. I suggest adding a quirk for this. > + } else { > + sdhci_writew(host, data->blocks, SDHCI_BLOCK_COUNT); > + } > } > > static inline bool sdhci_auto_cmd12(struct sdhci_host *host, > diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h > index f95eda2..d34971ac 100644 > --- a/drivers/mmc/host/sdhci.h > +++ b/drivers/mmc/host/sdhci.h > @@ -28,6 +28,7 @@ > > #define SDHCI_DMA_ADDRESS 0x00 > #define SDHCI_ARGUMENT2 SDHCI_DMA_ADDRESS > +#define SDHCI_32BIT_BLK_CNT SDHCI_DMA_ADDRESS > > #define SDHCI_BLOCK_SIZE 0x04 > #define SDHCI_MAKE_BLKSZ(dma, blksz) (((dma & 0x7) << 12) | (blksz & 0xFFF)) >