Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp233226imm; Thu, 14 Jun 2018 19:06:20 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLM9/mzf91kr3S/h/2ka+voWvklL5w44LYipOxwxpLrg6dkqap86sOHqP/oDjGoVugJKdJD X-Received: by 2002:a62:484d:: with SMTP id v74-v6mr12073680pfa.256.1529028380676; Thu, 14 Jun 2018 19:06:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529028380; cv=none; d=google.com; s=arc-20160816; b=IPsvEKc0Cdv8xL9HYfDjuRbuZbUEhotbJM0pSLQENhPaCPM6PfksMq0BtEQ0Mlc/nG VL+aQSWTbXCA6MFxrr5bQjAyRz06FTnOtTXQfxl0Z5/mEXBC0h+CF1QyU6ENd1PpxIuH BDILDKEbhUaw+DbNHILdB/TOc0cw6EelcMRLFcKsUDcUzV1j/ygqGMgcT0jRMQK2qjrd QnE3GUFXc5DrJVhY0hvu3NlMhcmJ9CaksXlV5cYmUZcZYegI8cIM0mUWZpOEI1P6NkzH Ffgcbcg1W6b02vAKE3ZyjIFW0JZZUNwuW7UW3IlXOMGWSxglMuUFNMG5qleh2gLHWjdu D2vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=Y2y/xY2dusr5GMTlLcs29f19Nju3/wuuxjplM+exAbo=; b=x99mEil9/m0f5C0F7e8j3qExil3KwnSF++2DphWwce0AxcaBhjJK/z4J8ULs5W02Ix Tsn/jaTOGKcK/3lm3NnFLu+tbg1C3SLMKRbIZWhTD/uxlSlx/9OaQcJLs8XtRBQ2797z ejW7Fpj6OsnJjZJRuAJWC9ciKEvC8QmAlKntYCZR5iMejMBTQtmMgg087ACdXRaBYBYp 71HfR8Gr+8YgIeM9LJQn+1Q+cxnnl53rMRH9CHBNDBOcUSZnln81vi3wgKizWk/nzLqT 0LHgOiSsvmC/lt72wlmErl0pgWRqjVnQvWAZl9r/jrUk4s415hqavXpLCiy21YrF2ULU dR9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L48YsjaH; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 199-v6si5789550pgd.74.2018.06.14.19.06.06; Thu, 14 Jun 2018 19:06:20 -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=@linaro.org header.s=google header.b=L48YsjaH; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965502AbeFOCFS (ORCPT + 99 others); Thu, 14 Jun 2018 22:05:18 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:44886 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965475AbeFOCFO (ORCPT ); Thu, 14 Jun 2018 22:05:14 -0400 Received: by mail-pf0-f193.google.com with SMTP id h12-v6so4118805pfk.11 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=t8jxxFOXZ/IL6Qukwcfc5L2e1crCBQ2BWJ9Tjl7j6R1w9uBP9wy3XPZrYlknybO2aM 6DdprWcwjq7v+XHGezUL3KFa5waOzl7UjifZH8g9MIqcSxOCyFaDDgYXW0fUqZ+X86pg 5qMRUFcJ2eeXkL9ickn5Aecbeb898Au+1NzG7rFDlcY+zjxO6RsypyPCnpqk6benjd4V EwD1xeKhN9JdJpN5Z7l15EyJkeR//3MTmOuAZhi/+116MAtxTbC6rvRJcA9VL5l7H6Uq NHkfsuhesosdKcXapXDKivkQVVZsZPE64rG7oTsPP57aSgfnZ+QHBPzHjH+8XrDjbgjp 3N8w== X-Gm-Message-State: APt69E0xPtv94tH5dcR9i/OYMaFz7RweQZX68umpJAlycmjJCauYF9fH U/WLvOQaCcN3+ca4uSY0fiVeKw== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.7.4