From patchwork Wed May 16 16:26:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saugata Das X-Patchwork-Id: 8696 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 7366F23E61 for ; Wed, 16 May 2012 16:27:38 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id 279BCA18A6C for ; Wed, 16 May 2012 16:27:38 +0000 (UTC) Received: by ggnf1 with SMTP id f1so1065519ggn.11 for ; Wed, 16 May 2012 09:27:37 -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=PnPCo2Qo5Bw/kKBj05ar4k8LjkrLSNs8Do6hqU5WepU=; b=FTeQdattqxu7PUj1tkMMQ5COba4MGZl1YGKCM7tmftcnup7ZxVIc643cA/0wxWCxO+ eW8uA2VOuyH7p9SsmsVkJlYAhsPLubxyrM+tn5QLVNUyv1NLYO7VMDXWbwauf4Lp87Nx 1qrpPN/jnq82lhWmQYYFx9xmtCfAaIQNiI0CM1S9oxTQ2sndahFxoI8fl6h8DlAoF3wj +gx6Q6YbZMjojq9ZV6IHEm4PCcIwaO3ANJRg8Xa1VolaASNR/98C9mTv3NC43zYEqPc0 ewz+wFCpkOQIxMjnyEr8TtrPMmLNYpEP0DT9Wx7vHdg20lAUrolepCWNtjMSHqiK61TB EZEQ== Received: by 10.50.87.227 with SMTP id bb3mr2725522igb.57.1337185657331; Wed, 16 May 2012 09:27:37 -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 o8csp505065ibd; Wed, 16 May 2012 09:27:36 -0700 (PDT) Received: by 10.14.53.70 with SMTP id f46mr805242eec.62.1337185654947; Wed, 16 May 2012 09:27:34 -0700 (PDT) Received: from eu1sys200aog106.obsmtp.com (eu1sys200aog106.obsmtp.com. [207.126.144.121]) by mx.google.com with SMTP id q8si964037eef.110.2012.05.16.09.27.26 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 16 May 2012 09:27:34 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.121 is neither permitted nor denied by best guess record for domain of saugata.das@stericsson.com) client-ip=207.126.144.121; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.121 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 eu1sys200aob106.postini.com ([207.126.147.11]) with SMTP ID DSNKT7PVbRDgK09+98poRIsq/PShvnk8ujoT@postini.com; Wed, 16 May 2012 16:27:32 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 02813BD; Wed, 16 May 2012 16:19:00 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 0161637C; Wed, 16 May 2012 16:27:21 +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 AB37824C080; Wed, 16 May 2012 18:27:12 +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; Wed, 16 May 2012 18:27:21 +0200 From: Saugata Das To: , Cc: , , , Subject: [PATCH 1/2] [MMC-4.5] Disable emulation Date: Wed, 16 May 2012 21:56:54 +0530 Message-ID: <1337185615-17202-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: ALoCoQkD67O4QiO2S7Uw1JjQVPJBTPcugeC3Y56bsAj9/DWAMtvqyZMPjC4QNlfSfZgb2YGyPiTg 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 size is 4KB. Signed-off-by: Saugata Das --- drivers/mmc/card/block.c | 16 ++++++++++++++-- drivers/mmc/core/mmc.c | 2 ++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 91cda75..b4d0eb1 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,14 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) do { if (rqc) { + + /* + * When 4KB native sector is enabled, single block + * read or write is not allowed + */ + if ((brq->data.blocks == 1) && + (card->ext_csd.data_sector_size == 4096)) + goto cmd_abort; mmc_blk_rw_rq_prep(mq->mqrq_cur, card, 0, mq); areq = &mq->mqrq_cur->mmc_active; } else @@ -1539,7 +1547,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: