From patchwork Thu May 17 11:02:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saugata Das X-Patchwork-Id: 8717 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id DB96523E63 for ; Thu, 17 May 2012 11:04:16 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 53800A1865C for ; Thu, 17 May 2012 11:04:16 +0000 (UTC) Received: by yenq6 with SMTP id q6so1963409yen.11 for ; Thu, 17 May 2012 04:04:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=AKpwzyndpgFcRmoa4S/zV2ZcLCNWQjnkDR+ebgXRcRg=; b=AV1dT8lZPS1OvVd9C+P3YM9YdesV6pJncAWosja2KboqzUKeRKQ8DH3N2DqYTx6xUs 4swE6pEYbeAG/7M+FegX8/GgsOIgoI1wFJ7udG5Pd7CqqOe23aYrdunEOXT4R/MAPUL2 H8SYPXjLdrQL8KesrW7tvxCID0gKq708MZueAbE3q2G19xeQJgqdm4vr/QkmhZMu9XMD cLCFXhVXgWkQjWRzhfSAgZb2g9XzwQCH+365L6l7Enqfu5vyzkRyaFF/jGSv6MVrO4wa DcH7eLPW3z4xkmy8JTTGSoI1PUb4c5UVsKRTuBtuBoiFlcHbxQooJb3BAh8su73F7fbg IOug== Received: by 10.42.88.135 with SMTP id c7mr3966207icm.57.1337252655563; Thu, 17 May 2012 04:04:15 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.35.72 with SMTP id o8csp20108ibd; Thu, 17 May 2012 04:04:14 -0700 (PDT) Received: by 10.213.27.3 with SMTP id g3mr2187252ebc.6.1337252654238; Thu, 17 May 2012 04:04:14 -0700 (PDT) Received: from eu1sys200aog117.obsmtp.com (eu1sys200aog117.obsmtp.com. [207.126.144.143]) by mx.google.com with SMTP id n3si1704625eeh.119.2012.05.17.04.04.07 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 17 May 2012 04:04:14 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.143 is neither permitted nor denied by best guess record for domain of saugata.das@stericsson.com) client-ip=207.126.144.143; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.143 is neither permitted nor denied by best guess record for domain of saugata.das@stericsson.com) smtp.mail=saugata.das@stericsson.com Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob117.postini.com ([207.126.147.11]) with SMTP ID DSNKT7TbI758OGzCKFQqOboyrTK8KBfTRIMa@postini.com; Thu, 17 May 2012 11:04:13 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id A64B8B0; Thu, 17 May 2012 10:55:38 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id D2E945FF; Thu, 17 May 2012 11:03:59 +0000 (GMT) Received: from exdcvycastm022.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm022", Issuer "exdcvycastm022" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id 147DB24C2E5; Thu, 17 May 2012 13:03:53 +0200 (CEST) Received: from localhost (10.201.54.119) by exdcvycastm022.EQ1STM.local (10.230.100.30) with Microsoft SMTP Server (TLS) id 8.3.83.0; Thu, 17 May 2012 13:04:04 +0200 From: Saugata Das To: Cc: , , , , , , Subject: [PATCH v2 1/2] [MMC-4.5] Disable emulation Date: Thu, 17 May 2012 16:32:21 +0530 Message-ID: <1337252542-25795-1-git-send-email-saugata.das@stericsson.com> X-Mailer: git-send-email 1.7.4.3 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQnqaMNxR3zMLJnVl6M59UYSP9WA7R5YYvtwOtIn/pMShiDeEZYpeBhqeKkhVEicO/ngogA6 From: Saugata Das This patch adds the support for large sector size of 4KB by disabling emulation. This patch passes eMMC DATA_SECTOR_SIZE as the logical block size during mmc_blk_alloc_req. In order to use this patch for 4KB sector size, ensure that USE_NATIVE_SECTOR is enabled, partition table is 4KB sector size aligned and file system block and sector size are 4KB multiples. Signed-off-by: Saugata Das changes in v2: Updated description, added pr_err based on review feedback Reviewed-by: Namjae Jeon Reviewed-by: Subhash Jadavani --- drivers/mmc/card/block.c | 18 ++++++++++++++++-- drivers/mmc/core/mmc.c | 2 ++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 91cda75..d628c5d 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -1284,7 +1284,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) int ret = 1, disable_multi = 0, retry = 0, type; enum mmc_blk_status status; struct mmc_queue_req *mq_rq; - struct request *req; + struct request *req = rqc; struct mmc_async_req *areq; if (!rqc && !mq->mqrq_prev->req) @@ -1292,6 +1292,16 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) do { if (rqc) { + /* + * When 4KB native sector is enabled, only 8 blocks + * multiple read or write is allowed + */ + if ((brq->data.blocks & 0x07) && + (card->ext_csd.data_sector_size == 4096)) { + pr_err("%s: Transfer size is not 4KB sector size aligned\n", + req->rq_disk->disk_name); + goto cmd_abort; + } mmc_blk_rw_rq_prep(mq->mqrq_cur, card, 0, mq); areq = &mq->mqrq_cur->mmc_active; } else @@ -1539,7 +1549,11 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, snprintf(md->disk->disk_name, sizeof(md->disk->disk_name), "mmcblk%d%s", md->name_idx, subname ? subname : ""); - blk_queue_logical_block_size(md->queue.queue, 512); + if (mmc_card_mmc(card)) + blk_queue_logical_block_size(md->queue.queue, + card->ext_csd.data_sector_size); + else + blk_queue_logical_block_size(md->queue.queue, 512); set_capacity(md->disk, size); if (mmc_host_cmd23(card->host)) { diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 7268c26..11444c6 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -516,6 +516,8 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) } else { card->ext_csd.data_tag_unit_size = 0; } + } else { + card->ext_csd.data_sector_size = 512; } out: