From patchwork Wed Apr 27 02:10:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Warkentin X-Patchwork-Id: 735191 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3R2B6tc000523 for ; Wed, 27 Apr 2011 02:11:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756510Ab1D0CLN (ORCPT ); Tue, 26 Apr 2011 22:11:13 -0400 Received: from exprod5og114.obsmtp.com ([64.18.0.28]:60886 "EHLO exprod5og114.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756656Ab1D0CLN (ORCPT ); Tue, 26 Apr 2011 22:11:13 -0400 Received: from DE01MGRG01.AM.MOT-MOBILITY.COM ([192.54.82.14]) (using TLSv1) by exprod5ob114.postini.com ([64.18.4.12]) with SMTP ID DSNKTbd7QGb10DvrtKyMuLhmpke1W6TTDMRh@postini.com; Tue, 26 Apr 2011 19:11:13 PDT Received: from DE01MGRG01.AM.MOT-MOBILITY.COM ([10.22.94.168]) by DE01MGRG01.AM.MOT-MOBILITY.COM (8.14.3/8.14.3) with ESMTP id p3R2BcXI000192 for ; Tue, 26 Apr 2011 22:11:38 -0400 (EDT) Received: from mail-yx0-f170.google.com (mail-yx0-f170.google.com [209.85.213.170]) by DE01MGRG01.AM.MOT-MOBILITY.COM (8.14.3/8.14.3) with ESMTP id p3R29QVu029219 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Tue, 26 Apr 2011 22:11:38 -0400 (EDT) Received: by mail-yx0-f170.google.com with SMTP id 11so392301yxi.15 for ; Tue, 26 Apr 2011 19:11:11 -0700 (PDT) Received: by 10.236.116.130 with SMTP id g2mr1953507yhh.34.1303870270896; Tue, 26 Apr 2011 19:11:10 -0700 (PDT) Received: from localhost.localdomain (dyngate-ca119-13.motorola.com [144.189.96.13]) by mx.google.com with ESMTPS id h28sm181781yhm.97.2011.04.26.19.11.08 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 26 Apr 2011 19:11:10 -0700 (PDT) From: Andrei Warkentin To: linux-mmc@vger.kernel.org Cc: Andrei Warkentin , arindam.nath@amd.com, cjb@laptop.org, arnd@arndb.de Subject: [[v4] 4/5] MMC: Block CMD23 support for UHS104/SDXC cards. Date: Tue, 26 Apr 2011 21:10:34 -0500 Message-Id: <1303870235-29041-5-git-send-email-andreiw@motorola.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1303870235-29041-4-git-send-email-andreiw@motorola.com> References: <1302950458-1969-1-git-send-email-andreiw@motorola.com> <1303870235-29041-1-git-send-email-andreiw@motorola.com> <1303870235-29041-2-git-send-email-andreiw@motorola.com> <1303870235-29041-3-git-send-email-andreiw@motorola.com> <1303870235-29041-4-git-send-email-andreiw@motorola.com> X-CFilter-Loop: Reflected Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 27 Apr 2011 02:11:29 +0000 (UTC) SD cards operating at UHS104 or better support SET_BLOCK_COUNT. Cc: arindam.nath@amd.com Cc: cjb@laptop.org Cc: arnd@arndb.de Signed-off-by: Andrei Warkentin --- drivers/mmc/card/block.c | 9 ++++++--- drivers/mmc/core/sd.c | 7 +++++++ include/linux/mmc/card.h | 4 ++++ include/linux/mmc/sd.h | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index b91bec2..96250cf 100755 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -863,9 +863,12 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, blk_queue_logical_block_size(md->queue.queue, 512); set_capacity(md->disk, size); - if (mmc_host_cmd23(card->host) && - mmc_card_mmc(card)) - md->flags |= MMC_BLK_CMD23; + if (mmc_host_cmd23(card->host)) { + if (mmc_card_mmc(card) || + (mmc_card_sd(card) && + card->scr.cmds & SD_SCR_CMD23_SUPPORT)) + md->flags |= MMC_BLK_CMD23; + } if (mmc_card_mmc(card) && md->flags & MMC_BLK_CMD23 && diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 6dac89f..a3d771a 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -195,6 +195,13 @@ static int mmc_decode_scr(struct mmc_card *card) else card->erased_byte = 0x0; + if (scr->sda_vsn == SCR_SPEC_VER_2) { + + /* Check if Physical Layer Spec v3.0X is supported. */ + scr->sda_spec3 = UNSTUFF_BITS(resp, 47, 1); + if (scr->sda_spec3) + scr->cmds = UNSTUFF_BITS(resp, 32, 2); + } return 0; } diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index c758181..e6b2e6f 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -67,9 +67,13 @@ struct mmc_ext_csd { struct sd_scr { unsigned char sda_vsn; + unsigned char sda_spec3; unsigned char bus_widths; #define SD_SCR_BUS_WIDTH_1 (1<<0) #define SD_SCR_BUS_WIDTH_4 (1<<2) + unsigned char cmds; +#define SD_SCR_CMD20_SUPPORT (1<<0) +#define SD_SCR_CMD23_SUPPORT (1<<1) }; struct sd_ssr { diff --git a/include/linux/mmc/sd.h b/include/linux/mmc/sd.h index 3fd85e0..9fe0689 100644 --- a/include/linux/mmc/sd.h +++ b/include/linux/mmc/sd.h @@ -59,7 +59,7 @@ #define SCR_SPEC_VER_0 0 /* Implements system specification 1.0 - 1.01 */ #define SCR_SPEC_VER_1 1 /* Implements system specification 1.10 */ -#define SCR_SPEC_VER_2 2 /* Implements system specification 2.00 */ +#define SCR_SPEC_VER_2 2 /* Implements system specification 2.00-3.0X */ /* * SD bus widths