diff options
author | Saugata Das <saugata.das@linaro.org> | 2012-05-17 07:02:21 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2012-05-17 09:35:21 -0400 |
commit | a5075eb94837edde6833fd5e0277fc2370cf8b39 (patch) | |
tree | e37957d108c9a01fc78dc9bdc4d914b382905a34 /drivers/mmc | |
parent | 6801c41a77123712accfde898820972a1f6fc117 (diff) |
mmc: block: Allow disabling 512B sector size emulation
This patch adds 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 <saugata.das@linaro.org>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Reviewed-by: Namjae Jeon <linkinjeon@gmail.com>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/card/block.c | 19 | ||||
-rw-r--r-- | drivers/mmc/core/mmc.c | 2 |
2 files changed, 19 insertions, 2 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 91cda7551a60..dd2d374dcc7a 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) | |||
1284 | int ret = 1, disable_multi = 0, retry = 0, type; | 1284 | int ret = 1, disable_multi = 0, retry = 0, type; |
1285 | enum mmc_blk_status status; | 1285 | enum mmc_blk_status status; |
1286 | struct mmc_queue_req *mq_rq; | 1286 | struct mmc_queue_req *mq_rq; |
1287 | struct request *req; | 1287 | struct request *req = rqc; |
1288 | struct mmc_async_req *areq; | 1288 | struct mmc_async_req *areq; |
1289 | 1289 | ||
1290 | if (!rqc && !mq->mqrq_prev->req) | 1290 | if (!rqc && !mq->mqrq_prev->req) |
@@ -1292,6 +1292,16 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) | |||
1292 | 1292 | ||
1293 | do { | 1293 | do { |
1294 | if (rqc) { | 1294 | if (rqc) { |
1295 | /* | ||
1296 | * When 4KB native sector is enabled, only 8 blocks | ||
1297 | * multiple read or write is allowed | ||
1298 | */ | ||
1299 | if ((brq->data.blocks & 0x07) && | ||
1300 | (card->ext_csd.data_sector_size == 4096)) { | ||
1301 | pr_err("%s: Transfer size is not 4KB sector size aligned\n", | ||
1302 | req->rq_disk->disk_name); | ||
1303 | goto cmd_abort; | ||
1304 | } | ||
1295 | mmc_blk_rw_rq_prep(mq->mqrq_cur, card, 0, mq); | 1305 | mmc_blk_rw_rq_prep(mq->mqrq_cur, card, 0, mq); |
1296 | areq = &mq->mqrq_cur->mmc_active; | 1306 | areq = &mq->mqrq_cur->mmc_active; |
1297 | } else | 1307 | } else |
@@ -1539,7 +1549,12 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, | |||
1539 | snprintf(md->disk->disk_name, sizeof(md->disk->disk_name), | 1549 | snprintf(md->disk->disk_name, sizeof(md->disk->disk_name), |
1540 | "mmcblk%d%s", md->name_idx, subname ? subname : ""); | 1550 | "mmcblk%d%s", md->name_idx, subname ? subname : ""); |
1541 | 1551 | ||
1542 | blk_queue_logical_block_size(md->queue.queue, 512); | 1552 | if (mmc_card_mmc(card)) |
1553 | blk_queue_logical_block_size(md->queue.queue, | ||
1554 | card->ext_csd.data_sector_size); | ||
1555 | else | ||
1556 | blk_queue_logical_block_size(md->queue.queue, 512); | ||
1557 | |||
1543 | set_capacity(md->disk, size); | 1558 | set_capacity(md->disk, size); |
1544 | 1559 | ||
1545 | if (mmc_host_cmd23(card->host)) { | 1560 | if (mmc_host_cmd23(card->host)) { |
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 2f0e11c9fd67..2d4a4b746750 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) | |||
516 | } else { | 516 | } else { |
517 | card->ext_csd.data_tag_unit_size = 0; | 517 | card->ext_csd.data_tag_unit_size = 0; |
518 | } | 518 | } |
519 | } else { | ||
520 | card->ext_csd.data_sector_size = 512; | ||
519 | } | 521 | } |
520 | 522 | ||
521 | out: | 523 | out: |