Commit a5075eb9 authored by Saugata Das's avatar Saugata Das Committed by Chris Ball

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: default avatarSaugata Das <saugata.das@linaro.org>
Reviewed-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
Reviewed-by: default avatarNamjae Jeon <linkinjeon@gmail.com>
Reviewed-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent 6801c41a
...@@ -1284,7 +1284,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) ...@@ -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; int ret = 1, disable_multi = 0, retry = 0, type;
enum mmc_blk_status status; enum mmc_blk_status status;
struct mmc_queue_req *mq_rq; struct mmc_queue_req *mq_rq;
struct request *req; struct request *req = rqc;
struct mmc_async_req *areq; struct mmc_async_req *areq;
if (!rqc && !mq->mqrq_prev->req) 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,6 +1292,16 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
do { do {
if (rqc) { 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); mmc_blk_rw_rq_prep(mq->mqrq_cur, card, 0, mq);
areq = &mq->mqrq_cur->mmc_active; areq = &mq->mqrq_cur->mmc_active;
} else } else
...@@ -1539,7 +1549,12 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, ...@@ -1539,7 +1549,12 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
snprintf(md->disk->disk_name, sizeof(md->disk->disk_name), snprintf(md->disk->disk_name, sizeof(md->disk->disk_name),
"mmcblk%d%s", md->name_idx, subname ? subname : ""); "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); set_capacity(md->disk, size);
if (mmc_host_cmd23(card->host)) { if (mmc_host_cmd23(card->host)) {
......
...@@ -516,6 +516,8 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) ...@@ -516,6 +516,8 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
} else { } else {
card->ext_csd.data_tag_unit_size = 0; card->ext_csd.data_tag_unit_size = 0;
} }
} else {
card->ext_csd.data_sector_size = 512;
} }
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment