On 29 June 2012 15:42, Seungwon Jeon <tgih.jun@xxxxxxxxxxx> wrote: > Hi Saugata, > > Could you check the comment below? > > Friday, June 29, 2012, Saugata Das <saugata.das@xxxxxxxxxx> wrote: >> From: Saugata Das <saugata.das@xxxxxxxxxx> >> >> In 512B disable emulation patch, a check is done to ensure that size >> of the data is multiple of 4KB. However, the check is done with >> brq->data.blocks, which is not initialized at the point of check. >> This is now changed to blk_rq_sectors. >> >> Signed-off-by: Saugata Das <saugata.das@xxxxxxxxxx> >> --- >> drivers/mmc/card/block.c | 2 +- >> 1 files changed, 1 insertions(+), 1 deletions(-) >> >> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c >> index d628c5d..ee8b3d6 100644 >> --- a/drivers/mmc/card/block.c >> +++ b/drivers/mmc/card/block.c >> @@ -1296,7 +1296,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) >> * When 4KB native sector is enabled, only 8 blocks >> * multiple read or write is allowed >> */ >> - if ((brq->data.blocks & 0x07) && >> + if ((blk_rq_sectors(req) & 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); > > In current error handling, multiple block read can be retried using single block read > with disable_multi. Then 4KB alignment will be broken. True. I shall change to something like, if (disable_multi) - brq->data.blocks = 1; + brq->data.blocks = + (card->ext_csd.data_sector_size == 4096) ? + 8 : 1; > Also, there is some conditions to modify the number of blocks in mmc_blk_rw_rq_prep. > That means the alignment of blocks can be changed after mmc_blk_rw_rq_prep. > It needs to be considered. I think you are referring to possibilities where host is not able to transfer in multiple of 4KB (MMC_CAP2_NO_MULTI_READ is enabled or host->max_blk_count is not multiple of 8). I shall add a check in mmc_read_ext_csd. - if (ext_csd[EXT_CSD_DATA_SECTOR_SIZE] == 1) + if (ext_csd[EXT_CSD_DATA_SECTOR_SIZE] == 1) { + if ((card->host->caps2 & MMC_CAP2_NO_MULTI_READ) || + (card->host->max_blk_count & 0x07)) { + err = -EINVAL; + goto out; + } > > And I have a question. > Spec mentioned that arguments for read commands (CMD17/18) shall always be aligned to 8(4KB) > in Native 4KB sector. In current implementation CMD17/18 is only used when data.blocks is 1. > If data.blocks is 8 in Native 4KB sector, then CMD17/18 should be taken instead of CMD24/25? In native sector mode, only CMD18 and CMD25 will be used for read and write. > > Thanks, > Seungwon Jeon >> -- >> 1.7.4.3 >> >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in >> the body of a message to majordomo@xxxxxxxxxxxxxxx >> More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html