Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3363125imm; Tue, 17 Jul 2018 03:38:56 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe2CYyZFLMyoo2aWH8eWGEzggIHxtcRZ20es9DqgnSyAaj8CivtDE6W7/V3q0Ipi3q1AFEp X-Received: by 2002:a17:902:654b:: with SMTP id d11-v6mr1106886pln.8.1531823936140; Tue, 17 Jul 2018 03:38:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531823936; cv=none; d=google.com; s=arc-20160816; b=dsbc2u7euI3xkumnsmtJCfNuc9Dn8Dl/2BNskQefZzxTv1ren7Ff1yEoFMAaYE2vjP +fzIX+WOzVMYYmISzIbB48wtn3n+p1IcuptRQuZGw6oVn68nm2aAiSNk4ViI9GAdKp5M cP/Z4ktid/Q1jymGpu2UAAqxyNJQ3Ut1t32p65aYwIqz1rYnwifQbg9pWK4fIwjLjVFi CJkO/FgWVl3qjPnwFkKJ5KzhKt8wVskiBfLTbsSbinss79x7Om9D5VVcEtWfOf9JDcUm bgUh2LHhCkCYpl8DBp1x4TukieCEmf6Z2VcD1DgW32qiY6OQoP6oiZCN9BHMBxxrG+0a QHyg== 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=H9UV801C9yUOEsFjKLHU+XJTTGlMMXb5pwyvQI3NkMQ=; b=M9PBbu5VW5fCSV4b8UMi+IjEoovvf7Uua1nSeWu/L1AY1xYP41asgBTvKom8Bx1lxn Ui+RLlp3Ni5Wlsvu/u5Ve2XjNuNVC6p3+z4p0GVSmKL2d83wSn8/J9fXJ2bC/CZRi09p mfEmi/ZoU6UrI4BarMRZy+m2Wxp+5RJhvQZqrLSRnjeAeKrVfAEqXeBXb1PyyQVjXRvy rVHX+RqsLp2RqYheD4eYevw2C7/V3uAADY3kPnvtkKmml73P8SPxAAG+YDFxk/9icYaa zHP3vfCLmj2B3nERsZ2L3ZEg2KWsZtPGBYn4fBVgFXVrpg5oIdEMsDPFlzDygQmJ3VOY vv6w== 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 q24-v6si526108pls.46.2018.07.17.03.38.40; Tue, 17 Jul 2018 03:38:56 -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 S1730503AbeGQLJq (ORCPT + 99 others); Tue, 17 Jul 2018 07:09:46 -0400 Received: from mga05.intel.com ([192.55.52.43]:52068 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730039AbeGQLJq (ORCPT ); Tue, 17 Jul 2018 07:09:46 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jul 2018 03:37:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,365,1526367600"; d="scan'208";a="73017279" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.168]) ([10.237.72.168]) by fmsmga001.fm.intel.com with ESMTP; 17 Jul 2018 03:37:45 -0700 Subject: Re: [PATCH V3 4/7] mmc: sdhci: add 32-bit block count support for 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 References: <1531106398-14062-1-git-send-email-zhang.chunyan@linaro.org> <1531106398-14062-5-git-send-email-zhang.chunyan@linaro.org> <892181d5-61f2-55da-2a79-1d2cbfc00f8f@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: Date: Tue, 17 Jul 2018 13:36:10 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.0 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 17/07/18 12:14, Chunyan Zhang wrote: > Hi, > > On 17 July 2018 at 16:29, Adrian Hunter wrote: >> On 09/07/18 06:19, Chunyan Zhang wrote: >>> When Host Version 4 is enabled, SDMA System Address register is >>> re-defined as 32-bit Block Count, and SDMA uses ADMA System >>> Address register (05Fh-058h) instead. >>> >>> Signed-off-by: Chunyan Zhang >>> --- >>> drivers/mmc/host/sdhci.c | 4 +++- >>> drivers/mmc/host/sdhci.h | 1 + >>> 2 files changed, 4 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c >>> index 7871ae2..f64e766 100644 >>> --- a/drivers/mmc/host/sdhci.c >>> +++ b/drivers/mmc/host/sdhci.c >>> @@ -889,6 +889,7 @@ static void sdhci_set_timeout(struct sdhci_host *host, struct mmc_command *cmd) >>> static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_command *cmd) >>> { >>> u8 ctrl; >>> + u32 reg; >>> struct mmc_data *data = cmd->data; >>> >>> host->data_timeout = 0; >>> @@ -1021,7 +1022,8 @@ 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); >>> + reg = host->v4_mode ? SDHCI_32BIT_BLK_CNT : SDHCI_BLOCK_COUNT; >>> + sdhci_writew(host, data->blocks, reg); >> >> The specification says to set 16-bit block count register to zero when using >> 32-bit block count. It also says it is valid for V4.1 onwards and also for >> V4 with SDMA and auto-CMD23. >> >> So maybe we should continue to use the 16-bit block count register with V4.0 > > Ok. > > Where can I get a V4.0 specification? I only have V4.10 on hands. I do not have a copy I can share, but the 4.1 specification already indicates what is V4.1 (onwards) and what only requires Host Version 4 Enable. > >> >>> } >>> >>> 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 24fa58a..889e48b 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)) >>> >> >