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: 10567149 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 27E695A4 for ; Thu, 16 Aug 2018 08:20:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 121D32958E for ; Thu, 16 Aug 2018 08:20:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 055E42AACA; Thu, 16 Aug 2018 08:20:18 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 AA09E2A9F4 for ; Thu, 16 Aug 2018 08:20:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389579AbeHPLQ7 (ORCPT ); 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-Google-Smtp-Source: AA+uWPwQ1ZE1VFgpIoXQnLQtOmMZJXkR/CnoEHly2rXLDIeAI6qaR0XYRnGr3ViCSg8Yci3eaA7ArQ== 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 X-Virus-Scanned: ClamAV using ClamSMTP 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(+) 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