Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5497839imm; Mon, 23 Jul 2018 00:13:26 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcu9hgaw1gBCyQJph049vhrzGjxqz3VS06NxkCuB2wMJs3oSc7EFdwwNkUW2H9PHayl1n21 X-Received: by 2002:a62:98d6:: with SMTP id d83-v6mr12158669pfk.186.1532330006059; Mon, 23 Jul 2018 00:13:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532330006; cv=none; d=google.com; s=arc-20160816; b=vAN865e3WYejxL6k2p4UnfhJGuE5fzsrtEAN/knKdlwyFyqzOFGttff0gkLVLHFwnl w8QXqbJ1spok3zWTi3i7j6dZc4agJjPgqxtLf+EHE6kV8QRnhwGwM8o9Gz1Q/PPnwgx+ 1bu9LLCogV/xJcqK9jdDMeuArwEeFrOONx+56MifiaRDxsxdV585tvnoOWB1djNU1Q3Y BEpG9P7KEFdG+aN0/EdGXGuoHg19F0rk7WPmjagdyw5TwOqgbG/Oe9HyGjjpVIzAQwPo +hWet3SueZQCk6g2usDZdNhye5rY5IlyUJKx4L9S353KieqW0LqkNQZAltIHYzlYxulI xpNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=+r1iMyc+42ftRkTTq9YRJROctWLQaEII4JimFrcDxsw=; b=i3QW9QgApNhvuLyVPiGEdOz5kQreqgZyA4cGHLwHa0h2DsCbgkxD3LpxDERsQ1xeV9 oASQhOQVaOp/UtxZkpbQLAXWjB4g77wfNsjB36iV9wZM2iWvE3iOfWhaWWQJNYMLo1G/ 0GxJh3EpUnoQV4gFH7DHAQgk6fY08Ah9zhMT7Wgs7X0/WFZjQ2p4JqHz5qhZBze3gn6K TCWK3I6BXegimx9NhDKEV5VW6arE31l7ZT50dZ885i0VXNfZiVjdi8suDMBnIEpMf9eq LJLhySmSpRlBeoPTBbvU8lcKG15yP69ijaxGQE/VitTysk/nZFzbe5jeyWAO2ipdcrHi WvsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="R/ZrYFA2"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c126-v6si8600263pfa.130.2018.07.23.00.13.11; Mon, 23 Jul 2018 00:13:26 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="R/ZrYFA2"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387964AbeGWIMC (ORCPT + 99 others); Mon, 23 Jul 2018 04:12:02 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:45781 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387915AbeGWIMC (ORCPT ); Mon, 23 Jul 2018 04:12:02 -0400 Received: by mail-lj1-f193.google.com with SMTP id q5-v6so15937462ljh.12; Mon, 23 Jul 2018 00:12:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=+r1iMyc+42ftRkTTq9YRJROctWLQaEII4JimFrcDxsw=; b=R/ZrYFA2C6gxgl9igD7y0iqdwUaCoBnyY2aOP9f223YKq4dVoQbkj2NTE8J8cH+aX0 /6Ej5ulxKSTXwY47nPWAYYM8l8GNuuFsSN4KZcTMlvuE3IAsXd6rGm6GTVOCKvogKtqQ XolInVjamrQdb0BYz+98r8tmFFR0DDqbOtzV9Gutlmix12xpHmBPe+oqhh6OjdVtj8ig 9XuA+pwzHketAGIvoCO+LKS2f7A8jwCfHTfoK2t/m4+uMZDqQicYac/ZdKBeVduPluza aG7adRqVghbvLwIuiRsbHO36JXnQP0QJrn97Wfwj+sxRQ3mG9IPXlNVwzYBeJ9JYbdkO aXNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=+r1iMyc+42ftRkTTq9YRJROctWLQaEII4JimFrcDxsw=; b=JNJ/n9m8eFS/eiA30KwP5nyEPeiuYLsQTGx88O8rxNpuzW5MIrMG4vEhyW4Wz9AFma YFX/8daAocJEeJx1EAbJbXuEQs7H64AC83fdUz9cdgaAoier+Emg6FcWl/u9isTSbSst 0DyEj6Q0+bLxLQf+CBUkbtk3Tt5Eu7rJYhjK7BL973vzrA1Me81WVhu4ikxWZYBbW7Ul rkEGAPLXZ37eSs8oy2rMSqSTRZjPAmJx6vQafW0qny89ljEuHDRftf2/aG/yUSbIQHtf 0pHCx6oKFrHpTt7yaA1XGm9lqQi7AEE9JrzoPr7g0+oLBkZZLayB40Etrgdvip5yi9XQ 7WVA== X-Gm-Message-State: AOUpUlFeJY5aXz5JhS6OE2I12f/zFQGD2QAociF27CFbulNzK2ZRDveq 59oPofZ8U0YRI8D0L+GyQ67n+DXu1/V1ONURYsQ= X-Received: by 2002:a2e:9f4d:: with SMTP id v13-v6mr4426951ljk.42.1532329934551; Mon, 23 Jul 2018 00:12:14 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab3:631a:0:0:0:0:0 with HTTP; Mon, 23 Jul 2018 00:11:34 -0700 (PDT) In-Reply-To: <892181d5-61f2-55da-2a79-1d2cbfc00f8f@intel.com> 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: Chunyan Zhang Date: Mon, 23 Jul 2018 15:11:34 +0800 Message-ID: Subject: Re: [PATCH V3 4/7] mmc: sdhci: add 32-bit block count support for v4 mode To: Adrian Hunter Cc: Chunyan Zhang , Ulf Hansson , linux-mmc@vger.kernel.org, Linux Kernel Mailing List , Orson Zhai , Baolin Wang , Billows Wu Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 I found that the 16-bit block count register is zero without being wrriten by driver, and the weird thing on my board is that the initialization would be interrupted by SDHCI_INT_ADMA_ERROR if setting "16-bit block count register" to zero manually. So I will add a check of whether it is zero already before writing it. > 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)) >> >