From patchwork Wed Apr 29 01:23:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: micky_ching@realsil.com.cn X-Patchwork-Id: 6293171 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 13B89BEEE1 for ; Wed, 29 Apr 2015 01:34:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 01EAC20320 for ; Wed, 29 Apr 2015 01:34:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8F31720259 for ; Wed, 29 Apr 2015 01:34:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031357AbbD2BeW (ORCPT ); Tue, 28 Apr 2015 21:34:22 -0400 Received: from rtits2.realtek.com ([60.250.210.242]:48840 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031276AbbD2BeV (ORCPT ); Tue, 28 Apr 2015 21:34:21 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.52 with qID t3T1XnFv013167, This message is accepted by code: ctloc85258 Received: from rsex2.realsil.com.cn (doc.realsil.com.cn[172.29.17.3](maybeforged)) by rtits2.realtek.com.tw (8.14.9/2.40/5.64) with ESMTP id t3T1XnFv013167 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Wed, 29 Apr 2015 09:33:49 +0800 Received: from localhost (172.29.41.103) by RSEX2.realsil.com.cn (172.29.17.3) with Microsoft SMTP Server id 14.3.195.1; Wed, 29 Apr 2015 09:24:47 +0800 From: To: , , CC: , , , , , , , Micky Ching Subject: [PATCH 02/12] mmc: core: modify mmc_app_cmd interface for SD4.0 Date: Wed, 29 Apr 2015 09:23:34 +0800 Message-ID: X-Mailer: git-send-email 1.9.1 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [172.29.41.103] Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Micky Ching When card running in SD4.0 mode, ACMD is not need to send two command, we only need to mark a flag for the CMD which is to be send. Signed-off-by: Micky Ching Signed-off-by: Wei Wang --- drivers/mmc/card/block.c | 2 +- drivers/mmc/core/sd_ops.c | 17 ++++++++++++----- include/linux/mmc/core.h | 3 ++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 2fc4269..a2acf3c 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -532,7 +532,7 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev, goto cmd_rel_host; if (idata->ic.is_acmd) { - err = mmc_app_cmd(card->host, card); + err = mmc_app_cmd(card->host, card, &cmd); if (err) goto cmd_rel_host; } diff --git a/drivers/mmc/core/sd_ops.c b/drivers/mmc/core/sd_ops.c index 48d0c93..cd37971c 100644 --- a/drivers/mmc/core/sd_ops.c +++ b/drivers/mmc/core/sd_ops.c @@ -22,7 +22,8 @@ #include "core.h" #include "sd_ops.h" -int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card) +int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card, + struct mmc_command *next_cmd) { int err; struct mmc_command cmd = {0}; @@ -30,6 +31,11 @@ int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card) BUG_ON(!host); BUG_ON(card && (card->host != host)); + if (card && mmc_card_uhsii(card)) { + next_cmd->app_cmd = true; + return 0; + } + cmd.opcode = MMC_APP_CMD; if (card) { @@ -82,7 +88,7 @@ int mmc_wait_for_app_cmd(struct mmc_host *host, struct mmc_card *card, * we cannot use the retries field in mmc_command. */ for (i = 0;i <= retries;i++) { - err = mmc_app_cmd(host, card); + err = mmc_app_cmd(host, card, cmd); if (err) { /* no point in retrying; no APP commands allowed */ if (mmc_host_is_spi(host)) { @@ -162,7 +168,8 @@ int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R3 | MMC_CMD_BCR; for (i = 100; i; i--) { - err = mmc_wait_for_app_cmd(host, NULL, &cmd, MMC_CMD_RETRIES); + err = mmc_wait_for_app_cmd(host, host->card, + &cmd, MMC_CMD_RETRIES); if (err) break; @@ -260,7 +267,7 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr) /* NOTE: caller guarantees scr is heap-allocated */ - err = mmc_app_cmd(card->host, card); + err = mmc_app_cmd(card->host, card, &cmd); if (err) return err; @@ -363,7 +370,7 @@ int mmc_app_sd_status(struct mmc_card *card, void *ssr) /* NOTE: caller guarantees ssr is heap-allocated */ - err = mmc_app_cmd(card->host, card); + err = mmc_app_cmd(card->host, card, &cmd); if (err) return err; diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index 337c6b8..b9821f1 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h @@ -235,7 +235,8 @@ extern struct mmc_async_req *mmc_start_req(struct mmc_host *, extern int mmc_interrupt_hpi(struct mmc_card *); extern void mmc_wait_for_req(struct mmc_host *, struct mmc_request *); extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int); -extern int mmc_app_cmd(struct mmc_host *, struct mmc_card *); +extern int mmc_app_cmd(struct mmc_host *, struct mmc_card *, + struct mmc_command *); extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *, struct mmc_command *, int); extern void mmc_start_bkops(struct mmc_card *card, bool from_exception);