From patchwork Thu Aug 16 08:19:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 144336 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1781748ljj; Thu, 16 Aug 2018 01:20:11 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxnLMCeK7BOukEDmlkS87H1fRcNHdMm+34nalr/qzFUoc/QFbInoRxNIPIoYVUsqd9Tojw+ X-Received: by 2002:a17:902:70cc:: with SMTP id l12-v6mr27967564plt.132.1534407611774; Thu, 16 Aug 2018 01:20:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534407611; cv=none; d=google.com; s=arc-20160816; b=WylR+JoPHQE2RCRTWduSpcb4UkxzxJK6jmHiPnEQC3D7UlatEQrCRxkLm15kNDA+aD XuGp8/mGBVLSgotljytflWoUZMUTLBUJh+zaERXdyPYVtwLTiBmVStnm6hfUQbYv78PQ 9QsJsnzm2l/0CPpQ/PiFUSYMzQ8NPSCBaANgeTACBtaeus6qLwhcDaYkRZlD4Sg8PnWh xBwNwZn0l/0JVBHTGGHeC2J5nU2UPP7Z7nhLJG6wxXsRCGyPophBBFLWPmL0PoEEqTpL ruqTWx7tDJMkW3DdpkYgCCIsFnd88syfIwx90n3nXGMxLSrhjoqOkzdkC/yZQzUOmQuR 8lBA== 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=V0eY6+fmzUQEUNfRvyKK9lRfPheki8Rb1IGP5PMneFw=; b=SIyjtigmsw30GTRz7BAXtxipjz/QhWjGRxYXUtEhsTcISIO7x1MuyoIWQbXY05qxJb UHP2RMT0oTAp1bckxt8XyzyVX6G5APntvs8eWb7e9In2kYl0Ijwt5KKu4ewr3xkt32Hd LdcB/P0xBxFxX0SztN4HpW9QRjYMO0Ll7MAJbG4LXadzK6XZmJQ6/A3anaSZ1iAxRK1j kOpM6+ZkTGlXcNxwGUBrAX7WrvjzAZQNPtjt30aW2K9T9GoZbiEXb6oR6AmKxRx39fAe xcDB612dQfmDktsizh6q8//l/wDOroLeCvr92y3pJ392lyEgqhXZ9RBvwq+kZUOaW4AJ dvGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="bLj/nD3r"; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-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 x37-v6si24237828pgl.544.2018.08.16.01.20.11; Thu, 16 Aug 2018 01:20:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-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="bLj/nD3r"; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-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 S2389579AbeHPLQ7 (ORCPT + 5 others); Thu, 16 Aug 2018 07:16:59 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:34168 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731354AbeHPLQ7 (ORCPT ); Thu, 16 Aug 2018 07:16:59 -0400 Received: by mail-pf1-f194.google.com with SMTP id k19-v6so1690178pfi.1 for ; Thu, 16 Aug 2018 01:20:10 -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=V0eY6+fmzUQEUNfRvyKK9lRfPheki8Rb1IGP5PMneFw=; b=bLj/nD3rp1RfeE5UYgimzR2WHJE4fpT+zsTYAZzvev6SFAh5luFtsamINuMnkG3bzt F1hs2F+zI5h9xxtTWtFyRJUUKdI6ni5zwKAwG7tZ8d7QawZHHkFE9EsZgK1uYZEi4jAG fERG9oaC+Df0T77lhlZ239cqWPGgCZ9ao1z7M= 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=V0eY6+fmzUQEUNfRvyKK9lRfPheki8Rb1IGP5PMneFw=; b=nLh6FtomacZfXztG8yeuEZjQl103kIe0+IewdsPt1WNV0e1EYVClat+lQoHJ0fEC5e 7lqGm5wh5uZFs0R4cXZVXx/2vjFsL78VEkcdt0BtM1bjcs/Q2Jxv0Mn4xdrZCAg8+1dD 43QmjAH4U+cCEzCjzDliD0Z6vG1wCJUCn4do0AGMY9IMlvVZboL5fhN4zoTCwSV0RIpq f6NzMq7cAkahkY+CBUEPxju9Qxh0nwc/zZc/iW+90mdKQGZ7Q9hYHMd6wyI/zEv44cKA wDZRGAl+zIvR9bEUOfzLykja3EAIbbxnxAW5/q3z32+55WcxrLw0X7ea0XTph8APz6nD bOmA== X-Gm-Message-State: AOUpUlF/MKsmHJ8rJiV1CB5EtmpG7D2Qp6ggzL/nTswDtPbGhyrCnxoW +VzC8y4PlyTGGKarsmy0XKCR9w== X-Received: by 2002:a63:b504:: with SMTP id y4-v6mr28595656pge.247.1534407609928; Thu, 16 Aug 2018 01:20:09 -0700 (PDT) Received: from ubt.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id s66-v6sm24406279pgc.67.2018.08.16.01.20.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Aug 2018 01:20:08 -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 , Jason Wu , Chunyan Zhang Subject: [PATCH V5 06/10] mmc: sdhci: Disable auto-CMD23 if stuff bits is set in CMD23 argument Date: Thu, 16 Aug 2018 16:19:56 +0800 Message-Id: <1534407596-29696-1-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534406064-10065-7-git-send-email-zhang.chunyan@linaro.org> References: <1534406064-10065-7-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 For version 4.10 and aboves, SDHCI_ARGUMENT2 is also used to indicate 32-bit number of blocks, so it doesn't support stuff bits in argument of CMD23, but only block count for the following command (CMD18/25). Signed-off-by: Chunyan Zhang --- drivers/mmc/host/sdhci.c | 10 ++++++++++ drivers/mmc/host/sdhci.h | 1 + 2 files changed, 11 insertions(+) -- 2.7.4 diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index b3328ee..04e0904 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1729,6 +1729,16 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) } } + /* + * From version 4.10 onward, ARGUMENT2 register is also used as 32-bit + * block count register which doesn't support stuff bits of + * CMD23 argument. + */ + if (host->version >= SDHCI_SPEC_410 && + mrq->sbc && (mrq->sbc->arg & SDHCI_ARG2_STUFF) && + (host->flags & SDHCI_AUTO_CMD23)) + host->flags &= ~SDHCI_AUTO_CMD23; + if (!present || host->flags & SDHCI_DEVICE_DEAD) { mrq->cmd->error = -ENOMEDIUM; sdhci_finish_mrq(host, mrq); diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index d34971ac..daf8c1e 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_ARG2_STUFF GENMASK(31, 16) #define SDHCI_32BIT_BLK_CNT SDHCI_DMA_ADDRESS #define SDHCI_BLOCK_SIZE 0x04