From patchwork Fri Jun 8 08:18:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 10453957 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DD93760467 for ; Fri, 8 Jun 2018 08:26:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CACE629298 for ; Fri, 8 Jun 2018 08:26:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF157292CB; Fri, 8 Jun 2018 08:26:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 654AD29298 for ; Fri, 8 Jun 2018 08:26:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932124AbeFHIZm (ORCPT ); Fri, 8 Jun 2018 04:25:42 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:39791 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752911AbeFHITS (ORCPT ); Fri, 8 Jun 2018 04:19:18 -0400 Received: by mail-pg0-f68.google.com with SMTP id w12-v6so6038185pgc.6 for ; Fri, 08 Jun 2018 01:19:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Y2y/xY2dusr5GMTlLcs29f19Nju3/wuuxjplM+exAbo=; b=FKieoiP+oTs39Jw8HxQ3lxOLeBs5f6t7CE83ff/85RIfHalbD8s+wfshp/M8iV4tbI I1r33vk+lPq7y6XD3ZVaO8Fh6nIg6wFXcDFUNOrKdsTKnDpXZsMJyl9eo8ZphQ+Z5LFb J6x6a2dFhQjM7Y1pZdermG1QvPPODua+nlxqs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Y2y/xY2dusr5GMTlLcs29f19Nju3/wuuxjplM+exAbo=; b=BUFdul/aKp3ATPnZAy1MZbdRzcTrorXQjd0maCToyz6MAhO56BsHaaX/u3puqHWlFK OuR19e5U0EO+9zGlJE+5cSmk2iiqH7QPGsORMGYzEUH0Xtxjpw00dV8kiDcHjpxGD8bE jOg+YAskYOqXnaZxa/W+YJ5KymUvjAYOsaP5bHlFhLk6fnspXCSj9rd5ZZgOilJH8Zpw dPfczqNHmW/AXCWmXxyxnBg4N/HtXlhUEJqrGzaajniYrEJalc2ox32GeOTHxEaUtTtj O3+09HG8ap8aKBZZ1OFD5CHn45/MEsXLhkvMke/YePXN6WzPE5CWZoYop3turYF+a/xZ SRgQ== X-Gm-Message-State: APt69E26jXdYh5WaGGFZjyH7rLJjGOwzn+bUOfWMFHKf4PDVOjO/Tzmi uROAHIqr9zYxH+8obfSc554J9Q== X-Google-Smtp-Source: ADUXVKLtVQTj9L/QmmEDUBBLNhSQFL/lAJhAPS+hMHV1N7gVjxJJHH0CCLtSt4hlw6Y0tiqRSTQsGQ== X-Received: by 2002:a62:e816:: with SMTP id c22-v6mr5006819pfi.124.1528445958137; Fri, 08 Jun 2018 01:19:18 -0700 (PDT) Received: from ubt.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id s4-v6sm72243947pgp.35.2018.06.08.01.19.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 Jun 2018 01:19:17 -0700 (PDT) From: Chunyan Zhang To: Ulf Hansson , Adrian Hunter Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Orson Zhai , Baolin Wang , Billows Wu , zhang.lyra@gmail.com Subject: [PATCH 5/6] mmc: sdhci: add CMD23 support for v4 mode Date: Fri, 8 Jun 2018 16:18:12 +0800 Message-Id: <1528445893-14530-6-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528445893-14530-1-git-send-email-zhang.chunyan@linaro.org> References: <1528445893-14530-1-git-send-email-zhang.chunyan@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Host Driver Version 4.10 adds a new bit in Host Control 2 Register for selecting Auto CMD23 or Auto CMD12 for ADMA3 data transfer. Signed-off-by: Chunyan Zhang --- drivers/mmc/host/sdhci.c | 16 +++++++++++++++- drivers/mmc/host/sdhci.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index b8ee124..3b2af7e 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -954,6 +954,20 @@ static inline bool sdhci_auto_cmd12(struct sdhci_host *host, !mrq->cap_cmd_during_tfr; } +static inline void sdhci_set_auto_cmd23(struct sdhci_host *host, + struct mmc_command *cmd) +{ + u16 ctrl2; + + if (host->v4_mode) { + ctrl2 = sdhci_readw(host, SDHCI_HOST_CONTROL2); + ctrl2 |= SDHCI_CMD23_ENABLE; + sdhci_writew(host, ctrl2, SDHCI_HOST_CONTROL2); + } else { + sdhci_writel(host, cmd->mrq->sbc->arg, SDHCI_ARGUMENT2); + } +} + static void sdhci_set_transfer_mode(struct sdhci_host *host, struct mmc_command *cmd) { @@ -989,7 +1003,7 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host, mode |= SDHCI_TRNS_AUTO_CMD12; else if (cmd->mrq->sbc && (host->flags & SDHCI_AUTO_CMD23)) { mode |= SDHCI_TRNS_AUTO_CMD23; - sdhci_writel(host, cmd->mrq->sbc->arg, SDHCI_ARGUMENT2); + sdhci_set_auto_cmd23(host, cmd); } } diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 1e84539..d5e1c10 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -185,6 +185,7 @@ #define SDHCI_CTRL_DRV_TYPE_D 0x0030 #define SDHCI_CTRL_EXEC_TUNING 0x0040 #define SDHCI_CTRL_TUNED_CLK 0x0080 +#define SDHCI_CMD23_ENABLE 0x0800 #define SDHCI_CTRL_V4_MODE 0x1000 #define SDHCI_CTRL_64BIT_ADDR 0x2000 #define SDHCI_CTRL_PRESET_VAL_ENABLE 0x8000