mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 01:49:46 +00:00
mmc: block: disable CQ on SD cards when doing non-Discard erase
Only CMD38 with Arg=0x1 (Discard) is supported when in CQ mode, so turn it off before issuing a non-discard erase op. Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
This commit is contained in:
committed by
Dom Cobley
parent
c434924841
commit
41a38e1d78
@@ -1202,12 +1202,26 @@ static void mmc_blk_issue_erase_rq(struct mmc_queue *mq, struct request *req,
|
|||||||
sector_t from;
|
sector_t from;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
blk_status_t status = BLK_STS_OK;
|
blk_status_t status = BLK_STS_OK;
|
||||||
|
bool restart_cmdq = false;
|
||||||
|
|
||||||
if (!mmc_card_can_erase(card)) {
|
if (!mmc_card_can_erase(card)) {
|
||||||
status = BLK_STS_NOTSUPP;
|
status = BLK_STS_NOTSUPP;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Only Discard ops are supported with SD cards in CQ mode
|
||||||
|
* (SD Physical Spec v9.00 4.19.2)
|
||||||
|
*/
|
||||||
|
if (mmc_card_sd(card) && card->ext_csd.cmdq_en && erase_arg != SD_DISCARD_ARG) {
|
||||||
|
restart_cmdq = true;
|
||||||
|
err = mmc_sd_cmdq_disable(card);
|
||||||
|
if (err) {
|
||||||
|
status = BLK_STS_IOERR;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
from = blk_rq_pos(req);
|
from = blk_rq_pos(req);
|
||||||
nr = blk_rq_sectors(req);
|
nr = blk_rq_sectors(req);
|
||||||
|
|
||||||
@@ -1228,6 +1242,11 @@ static void mmc_blk_issue_erase_rq(struct mmc_queue *mq, struct request *req,
|
|||||||
status = BLK_STS_IOERR;
|
status = BLK_STS_IOERR;
|
||||||
else
|
else
|
||||||
mmc_blk_reset_success(md, type);
|
mmc_blk_reset_success(md, type);
|
||||||
|
|
||||||
|
if (restart_cmdq)
|
||||||
|
err = mmc_sd_cmdq_enable(card);
|
||||||
|
if (err)
|
||||||
|
status = BLK_STS_IOERR;
|
||||||
fail:
|
fail:
|
||||||
blk_mq_end_request(req, status);
|
blk_mq_end_request(req, status);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user