Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3258605imm; Tue, 17 Jul 2018 01:32:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc+kSKNYM5j1FsQT/7UXBTN91IF6IpxMmAhiEMbgRVAPvcbxVDkToP8u+2d353HvKNBEn7Z X-Received: by 2002:a65:53cb:: with SMTP id z11-v6mr686238pgr.218.1531816338473; Tue, 17 Jul 2018 01:32:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531816338; cv=none; d=google.com; s=arc-20160816; b=jrmc77EWlTCrKf/qdZZzWdFTVvL5a9l6c7L02OqlPIHlbv/4MyFL3AgSd8oJFlJn40 j6Q/6Mlwxql/NewXvcLOxTZxOajZL2aaD1tP/SR5srXn5jVXx+nRtIHD1jAkWo8TGjVK FPyTw8OBlGpsedr2nEggVeXa+WHl/g51p8aV9AvVQqPs2B0MQHxJRMnC8ZGQ/64HaQ/q o32RrcxRieG0d3j13qr9fFjAvht2nnLhRvvyqPzviTXUy+J5jXXBqXeA6P1l7hXHP6Au lKWKiEkS8FJLvDLrSqOjRJ7BTJ8kBmF+r+nDsXFzLA+5+0zGd6EGOL/eXzB/cakwANit xJCw== 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=1D0EnEZmmwBWoW9LPeHBggBDu+F0aAp0GeCM/G88mDc=; b=ZVJb3sC8oFOyFbk/izFkml8OPcYGhoZzPYhvCZeWs0qS5xi8iP1tMNfDl2CZt8WYKQ Y5xCZ96PgC4zLAlh9AblMoMgcLttLj5iAhagTTH30lNQ9zdme7G1Wr+pMfpHPOLyb6mK e5aQ1jXeIpWv5Mco1aVHfHdkE5TJJ3bzVKRgNm+eeWfJfO1G0fC8uaru3EGW6fZuyCgG nRdoPXZMi9V92VypgGWMHwStHCaeEOySthmxpIjx+4av7knOlw8ejHYF/QAnBxVmXuOJ BCZKXhkBWB8kYyMMGEFlSvFZ0+vOW5OnHFOfAkXiU36vOk1Qwn8QV5QRIwogBBq+BFCP WQ3A== 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 n6-v6si380494pgt.268.2018.07.17.01.32.03; Tue, 17 Jul 2018 01:32:18 -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 S1729631AbeGQJCZ (ORCPT + 99 others); Tue, 17 Jul 2018 05:02:25 -0400 Received: from mga04.intel.com ([192.55.52.120]:32054 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728024AbeGQJCZ (ORCPT ); Tue, 17 Jul 2018 05:02:25 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jul 2018 01:30:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,365,1526367600"; d="scan'208";a="73414031" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.168]) ([10.237.72.168]) by orsmga001.jf.intel.com with ESMTP; 17 Jul 2018 01:30:54 -0700 Subject: Re: [PATCH V3 4/7] 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 , zhang.lyra@gmail.com References: <1531106398-14062-1-git-send-email-zhang.chunyan@linaro.org> <1531106398-14062-5-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: <892181d5-61f2-55da-2a79-1d2cbfc00f8f@intel.com> Date: Tue, 17 Jul 2018 11:29:20 +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: <1531106398-14062-5-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 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 > } > > 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)) >