From patchwork Fri Jun 15 02:04:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 10465567 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 D1183600F4 for ; Fri, 15 Jun 2018 02:05:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C12D128C7F for ; Fri, 15 Jun 2018 02:05:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B59A328CD7; Fri, 15 Jun 2018 02:05:19 +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 60A6928C7F for ; Fri, 15 Jun 2018 02:05:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965488AbeFOCFQ (ORCPT ); Thu, 14 Jun 2018 22:05:16 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:37186 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965487AbeFOCFO (ORCPT ); Thu, 14 Jun 2018 22:05:14 -0400 Received: by mail-pf0-f194.google.com with SMTP id y5-v6so4125382pfn.4 for ; Thu, 14 Jun 2018 19:05:14 -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=L48YsjaHSCvYqD74kW04H+9/aYUtXBSXZLec/VHg9XfYHeAjirdoDVUlw3e/3FHRNM cO8yeY1/D1nhjSeYtJ/DBC1EEmqb45dbTuGXsY8WzdqRuQ0Gwu99jhOAAXSMcW3sQnuC WJclfoErmkMO6rPwelFZDEW8ykNJoLvuIIMo4= 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=A9l2ExvURqHSsEztikY+McdZznqoWxkHeP1a2oX9ZQmZK3xbCw5Gm8n0XGFrKbr3MR X5Uqt0t6RRxB5bp2Cl9piX2O/WfjNGaRdYgEtmW/+XYl5qaYhpWddCcmhudci2mxcuRb uawg83/+UL6jwUW5rmq8cPnL4fDsVGGgXFqL3ewMBRpaPLzAmT1wr2HXcdE7vW1gB7hI GEMXAK7fQmcfpME3ZBe4Ikxt9Fk8Kbhxc6XEqW/q40RGAd14gzwq1EZB7ngqqlJe4Te6 MyDOgrLnqVCZiKXnaCohUWNQR/s3Tdc/tYfWYg6gyrcrYqXHN0mO2Gy2w0I62iIqURc3 8olg== X-Gm-Message-State: APt69E15rtGzGMRUWDG5NoQBh6jlzZ8cPVrcsg6BB8xNfDLS6KuKY1Yg nXL/46M3od4Px+shPjpJcN/i3Q== X-Google-Smtp-Source: ADUXVKJlgz/IFYDx4RfxjdumBHLYS10xb2vsTHvoDz7IY93cgf46UPvR8ajPYwKYkJUcJNvMjFPCnQ== X-Received: by 2002:a63:b34e:: with SMTP id x14-v6mr4395991pgt.243.1529028314036; Thu, 14 Jun 2018 19:05:14 -0700 (PDT) Received: from ubt.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id k69-v6sm9504953pgc.39.2018.06.14.19.05.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Jun 2018 19:05:13 -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 V2 5/7] mmc: sdhci: add CMD23 support for v4 mode Date: Fri, 15 Jun 2018 10:04:13 +0800 Message-Id: <1529028255-6022-6-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529028255-6022-1-git-send-email-zhang.chunyan@linaro.org> References: <1529028255-6022-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