From patchwork Thu Aug 16 07:54:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 10567135 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 32125109C for ; Thu, 16 Aug 2018 07:56:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 203AF2A9BD for ; Thu, 16 Aug 2018 07:56:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12A3E2A9DA; Thu, 16 Aug 2018 07:56:14 +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 B38BE2A9BD for ; Thu, 16 Aug 2018 07:56:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389621AbeHPKwY (ORCPT ); Thu, 16 Aug 2018 06:52:24 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:42218 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389605AbeHPKwY (ORCPT ); Thu, 16 Aug 2018 06:52:24 -0400 Received: by mail-pl0-f65.google.com with SMTP id g6-v6so1693370plq.9 for ; Thu, 16 Aug 2018 00:55:43 -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=NP825gJ8JNuiSBQ93C487DDun4LcomGeoIeRKjPEd4E=; b=iDGPLbmIJ0zPSpBy4lvB8EsQDHX7bRIdNAnDQFxtLduf3kOyfVH3f5adiNBSpZKDBF xc9JfZ8EY3ZitZ6p8O7WEMmc+zDD3UHkLp1TQehl7w+U3SRwy50JXNAeh2P7vY43BRSr gZ10x2M0XlKL5jaMHAvZ4vh37FymuwrLdcOuA= 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=NP825gJ8JNuiSBQ93C487DDun4LcomGeoIeRKjPEd4E=; b=WkE3neMAq2SpvgFs9d8fPH7XeeYymsQYqbpbB9mc++uezSR7DXAj2emtvsoidZ9Hvn PV8YvfKbsCn0rnxzFGyjgVk/Iek1VhP85DO/lm/+8mU9zvo7M1XrZke+0RzYCYnIBy/A T0zX0FPJf+NR4pukEE0zHXi5gPsQozs69vSrZ5fgzFviCfH9Qa6AxVLvAi7RWm/c5McW /cuV1XQYAIBBrRmrxFJEkagfwX+++wofsil302ROG9zkreklok4oPLTflAro7el6+wPb QFBD2ubkfLGaCOfgPzyd7QKnZgmzOvhvHfOsSw/CiJ9PkMG2Xr5mD/zNzVign11L5hXm skyg== X-Gm-Message-State: AOUpUlECpvM9uUal0JE/SRNL0uDmWE3ucNeNtkq3U7luayVltJrKV348 4Qv2Haw/YBZ4YhIfUywu17+PdQ== X-Google-Smtp-Source: AA+uWPx4HeTA6+2pB6luZJ4BqcVERBCFyrad8p+nJ8BxdjzecRBrzkWLG1ZeiND+cazDSEZGoJhS0g== X-Received: by 2002:a17:902:7d94:: with SMTP id a20-v6mr21648113plm.19.1534406142962; Thu, 16 Aug 2018 00:55:42 -0700 (PDT) Received: from ubt.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id i25-v6sm50838137pfi.150.2018.08.16.00.55.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Aug 2018 00:55:42 -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 15:54:20 +0800 Message-Id: <1534406064-10065-7-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534406064-10065-1-git-send-email-zhang.chunyan@linaro.org> References: <1534406064-10065-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 For version 4.10 and aboves, SDHCI_ARGUMENT2 is also uses to indicate 32-bit number of blocks, 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 | 9 +++++++++ drivers/mmc/host/sdhci.h | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index b3328ee..a72ad0d 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1729,6 +1729,15 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) } } + /* + * For version 4.10 and above, ARGUMENT2 register is also used as 32-bit + * block count register which don'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