From patchwork Fri Jul 8 10:22:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 9220415 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9093A6089D for ; Fri, 8 Jul 2016 10:28:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FCD628684 for ; Fri, 8 Jul 2016 10:28:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 746FD2868A; Fri, 8 Jul 2016 10:28:34 +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=-6.9 required=2.0 tests=BAYES_00,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 EDC2028687 for ; Fri, 8 Jul 2016 10:28:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754475AbcGHK2a (ORCPT ); Fri, 8 Jul 2016 06:28:30 -0400 Received: from mga03.intel.com ([134.134.136.65]:45373 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754438AbcGHK23 (ORCPT ); Fri, 8 Jul 2016 06:28:29 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 08 Jul 2016 03:28:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,329,1464678000"; d="scan'208";a="1003105028" Received: from ahunter-desktop.fi.intel.com ([10.237.72.168]) by fmsmga001.fm.intel.com with ESMTP; 08 Jul 2016 03:28:25 -0700 From: Adrian Hunter To: Ulf Hansson Cc: linux-mmc , Alex Lemberg , Mateusz Nowak , Yuliy Izrailov , Jaehoon Chung , Dong Aisheng , Das Asutosh , Zhangfei Gao , Dorfman Konstantin , David Griego , Sahitya Tummala , Harjani Ritesh , Venu Byravarasu Subject: [PATCH V3 15/30] mmc: mmc: Add functions to enable / disable the Command Queue Date: Fri, 8 Jul 2016 13:22:56 +0300 Message-Id: <1467973391-29221-16-git-send-email-adrian.hunter@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1467973391-29221-1-git-send-email-adrian.hunter@intel.com> References: <1467973391-29221-1-git-send-email-adrian.hunter@intel.com> Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki 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 Add helper functions to enable or disable the Command Queue. Signed-off-by: Adrian Hunter --- drivers/mmc/core/mmc_ops.c | 27 +++++++++++++++++++++++++++ include/linux/mmc/core.h | 2 ++ 2 files changed, 29 insertions(+) diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index ad6e9798e949..7ec7d62922b0 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -797,3 +797,30 @@ int mmc_can_ext_csd(struct mmc_card *card) { return (card && card->csd.mmca_vsn > CSD_SPEC_VER_3); } + +int mmc_cmdq_switch(struct mmc_card *card, int enable) +{ + int err; + + if (!card->ext_csd.cmdq_support) + return -EOPNOTSUPP; + + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_CMDQ_MODE_EN, + enable, card->ext_csd.generic_cmd6_time); + if (!err) + card->ext_csd.cmdq_en = enable; + + return err; +} + +int mmc_cmdq_enable(struct mmc_card *card) +{ + return mmc_cmdq_switch(card, EXT_CSD_CMDQ_MODE_ENABLED); +} +EXPORT_SYMBOL_GPL(mmc_cmdq_enable); + +int mmc_cmdq_disable(struct mmc_card *card) +{ + return mmc_cmdq_switch(card, 0); +} +EXPORT_SYMBOL_GPL(mmc_cmdq_disable); diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index 368bed70aa9d..63dc01257852 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h @@ -161,6 +161,8 @@ extern void mmc_start_bkops(struct mmc_card *card, bool from_exception); extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int); extern int mmc_send_tuning(struct mmc_host *host, u32 opcode, int *cmd_error); extern int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd); +extern int mmc_cmdq_enable(struct mmc_card *card); +extern int mmc_cmdq_disable(struct mmc_card *card); #define MMC_ERASE_ARG 0x00000000 #define MMC_SECURE_ERASE_ARG 0x80000000