From patchwork Tue Dec 2 11:56:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sujit Reddy Thumma X-Patchwork-Id: 5419381 Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D96DE9F1C5 for ; Tue, 2 Dec 2014 11:56:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E4C1020266 for ; Tue, 2 Dec 2014 11:56:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D98F82022A for ; Tue, 2 Dec 2014 11:56:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932128AbaLBL4h (ORCPT ); Tue, 2 Dec 2014 06:56:37 -0500 Received: from wolverine01.qualcomm.com ([199.106.114.254]:53069 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753796AbaLBL4g (ORCPT ); Tue, 2 Dec 2014 06:56:36 -0500 X-IronPort-AV: E=McAfee;i="5600,1067,7639"; a="90436372" Received: from ironmsg04-r.qualcomm.com ([172.30.46.18]) by wolverine01.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 02 Dec 2014 03:56:36 -0800 X-IronPort-AV: E=Sophos;i="5.07,500,1413270000"; d="scan'208";a="857688306" Received: from asutoshd-ics.in.qualcomm.com ([10.44.83.79]) by Ironmsg04-R.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 02 Dec 2014 03:56:34 -0800 Received: (from asutoshd@localhost) by asutoshd-ics.in.qualcomm.com (8.14.2/8.14.5/Submit) id sB2BuTw9027646; Tue, 2 Dec 2014 17:26:29 +0530 Date: Tue, 2 Dec 2014 17:26:29 +0530 From: Sujit Reddy Thumma To: linux-mmc@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org Subject: [PATCH 1/5] mmc: core: Add support to read command queue parameters Message-ID: <20141202115629.GA27638@asutoshd-ics.in.qualcomm.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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=unavailable 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 eMMC cards with EXT_CSD version >= 7, optionally support command queuing feature as defined by Jedec eMMC5.1. Add support for probing command queue feature for such type of cards. Signed-off-by: Sujit Reddy Thumma Signed-off-by: Asutosh Das --- drivers/mmc/core/mmc.c | 15 +++++++++++++++ include/linux/mmc/card.h | 7 +++++++ include/linux/mmc/mmc.h | 6 ++++++ 3 files changed, 28 insertions(+) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 1ab5f3a..0ef3af5 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -571,6 +571,21 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) card->ext_csd.data_sector_size = 512; } + if (card->ext_csd.rev >= 7) { + card->ext_csd.cmdq_support = ext_csd[EXT_CSD_CMDQ_SUPPORT]; + if (card->ext_csd.cmdq_support) + card->ext_csd.cmdq_depth = ext_csd[EXT_CSD_CMDQ_DEPTH]; + } + + if (card->ext_csd.rev >= 7) { + card->ext_csd.cmdq_support = ext_csd[EXT_CSD_CMDQ_SUPPORT]; + if (card->ext_csd.cmdq_support) + card->ext_csd.cmdq_depth = ext_csd[EXT_CSD_CMDQ_DEPTH]; + } else { + card->ext_csd.cmdq_support = 0; + card->ext_csd.cmdq_depth = 0; + } + out: return err; } diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index b730272..b87a27c 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -112,6 +112,9 @@ struct mmc_ext_csd { u8 raw_pwr_cl_ddr_52_360; /* 239 */ u8 raw_bkops_status; /* 246 */ u8 raw_sectors[4]; /* 212 - 4 bytes */ + u8 cmdq_mode_en; /* 15 */ + u8 cmdq_depth; /* 307 */ + u8 cmdq_support; /* 308 */ unsigned int feature_support; #define MMC_DISCARD_FEATURE BIT(0) /* CMD38 feature */ @@ -259,6 +262,7 @@ struct mmc_card { #define MMC_STATE_HIGHSPEED_200 (1<<8) /* card is in HS200 mode */ #define MMC_STATE_DOING_BKOPS (1<<10) /* card is doing BKOPS */ #define MMC_STATE_SUSPENDED (1<<11) /* card is suspended */ +#define MMC_STATE_CMDQ (1<<12) /* card is in cmd queue mode */ unsigned int quirks; /* card quirks */ #define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ #define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */ @@ -427,6 +431,7 @@ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data) #define mmc_card_removed(c) ((c) && ((c)->state & MMC_CARD_REMOVED)) #define mmc_card_doing_bkops(c) ((c)->state & MMC_STATE_DOING_BKOPS) #define mmc_card_suspended(c) ((c)->state & MMC_STATE_SUSPENDED) +#define mmc_card_cmdq(c) ((c)->state & MMC_STATE_CMDQ) #define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) #define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) @@ -441,6 +446,8 @@ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data) #define mmc_card_clr_doing_bkops(c) ((c)->state &= ~MMC_STATE_DOING_BKOPS) #define mmc_card_set_suspended(c) ((c)->state |= MMC_STATE_SUSPENDED) #define mmc_card_clr_suspended(c) ((c)->state &= ~MMC_STATE_SUSPENDED) +#define mmc_card_set_cmdq(c) ((c)->state |= MMC_STATE_CMDQ) +#define mmc_card_clr_cmdq(c) ((c)->state &= ~MMC_STATE_CMDQ) /* * Quirk add/remove for MMC products. diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h index 50bcde3..a893c84 100644 --- a/include/linux/mmc/mmc.h +++ b/include/linux/mmc/mmc.h @@ -84,6 +84,9 @@ #define MMC_APP_CMD 55 /* ac [31:16] RCA R1 */ #define MMC_GEN_CMD 56 /* adtc [0] RD/WR R1 */ +/* MMC 5.1 - class 11: Command Queueing */ +#define MMC_CMDQ_TASK_MGMT 48 /* ac [31:0] task ID R1b */ + static inline bool mmc_op_multi(u32 opcode) { return opcode == MMC_WRITE_MULTIPLE_BLOCK || @@ -272,6 +275,7 @@ struct _mmc_csd { * EXT_CSD fields */ +#define EXT_CSD_CMDQ_MODE 15 /* R/W */ #define EXT_CSD_FLUSH_CACHE 32 /* W */ #define EXT_CSD_CACHE_CTRL 33 /* R/W */ #define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */ @@ -325,6 +329,8 @@ struct _mmc_csd { #define EXT_CSD_POWER_OFF_LONG_TIME 247 /* RO */ #define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */ #define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */ +#define EXT_CSD_CMDQ_DEPTH 307 /* RO */ +#define EXT_CSD_CMDQ_SUPPORT 308 /* RO */ #define EXT_CSD_TAG_UNIT_SIZE 498 /* RO */ #define EXT_CSD_DATA_TAG_SUPPORT 499 /* RO */ #define EXT_CSD_MAX_PACKED_WRITES 500 /* RO */